Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp340306ybg; Mon, 1 Jun 2020 02:47:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzwHw2FzqeCg8RVh+7VOWRFIH+wW0sCFR3tSJjoChG4MKl9764qCsDKNOQTSgJ4yFPbEOA X-Received: by 2002:a17:906:6410:: with SMTP id d16mr1406597ejm.376.1591004845931; Mon, 01 Jun 2020 02:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591004845; cv=none; d=google.com; s=arc-20160816; b=jxbO7DowuMRo9f2mBk1A/7eiHtTvDgPNpvPuOHhb1AfhczI3g4FhCLJuQpzGarMNxF mF5IJjoKumuy2WWbGsI8nfyrXyfMaPnhcabGmlyuT39nRmFPqG9BmEcjqoEfp88an1P3 fWxsn9TUxhfET+2zfq9Jw/pG3iilcHl2mx0H/eE6XjJ99E1fSnXFbVeFFAM9EP5njOnF yUEVh1o2ZC+Tzc56VE0ZNjvNruvszhDGZuamiGHgwV3DRxBlFpRoRbDcXBG+NlNV+FHw YWeD6XZm9LywZp7PGb3GWin7D0OJOdnU4S8aXPMrvLgPz2LpIBcZj+/iRIz+yVGj/cPg Ltfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=dwLm70utfuEGI5EzJKYaZcIrywbaqcq2c59JtQES3C0=; b=E7mek0dGjq5eyeqAgMmQfZpdCTzd1UgB2Aet52Ner6rgrOT8qxYv5xWT/RjvdsRYY/ O78l12eaTuErgEyYwN2lSpqA8IFGG8iPeyFMDoaJE7dhNjMcjlLl1NTWcYbRwm5Qwr20 QijM/I4RJ7orDLQQYXRAcG4L8ChfhlhTIEURFHD0m4CtJemNpWe99JCfcFT8jEhLsbCT 2cFexHBHzBah35z/EKN90MGQviV5dPPcK+UUFe9bwZivWjrpyd5BjNYdhaM855y1ddN5 Hrnwq5xWIqcUjN8FNqWPknh4CvjaJtg/Lx6DVX7aZawvbEUkex54SN3C1qNmwOzrJ10m zoMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si9474114ejx.725.2020.06.01.02.47.03; Mon, 01 Jun 2020 02:47:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726035AbgFAJpU (ORCPT + 99 others); Mon, 1 Jun 2020 05:45:20 -0400 Received: from foss.arm.com ([217.140.110.172]:35640 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbgFAJpT (ORCPT ); Mon, 1 Jun 2020 05:45:19 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 630231FB; Mon, 1 Jun 2020 02:45:19 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 65E7B3F305; Mon, 1 Jun 2020 02:45:18 -0700 (PDT) From: Sudeep Holla To: Will Deacon , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , linux-kernel@vger.kernel.org, Marc Zyngier Subject: [RFC PATCH 0/3] firmware: Add support for PSA FF-A interface Date: Mon, 1 Jun 2020 10:45:09 +0100 Message-Id: <20200601094512.50509-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, Sorry for posting in the middle of merge window and I must have done this last week itself. This is not the driver I had thought about posting last week. After I started cleaning up and looking at Will's KVM prototype[1] for PSA FF-A (previously known as SPCI), I got more doubts on alignment and dropped huge chunk of interface APIs in the driver in order to keep it simple, and get aligned more with that prototype and avoid scanning lots of code unnecessary. Here are few things to clarify: 1. DT bindings --------------- I was initially against adding bindings for Tx/Rx buffers for partitions. As per the spec, an endpoint could allocate the buffer pair and use the FFA_RXTX_MAP interface to map it with the Hypervisor(KVM here). However looking at the prototype and also I remember you mentioning that it is not possible to manage buffers in that way. Please confirm if you plan to add the buffer details fetcthing them through ioctls in KVM and adding them to VM DT nodes in KVM userspace. I will update the bindings accordingly. 2. Driver --------- a. Support for multiple partitions in a VM ------------------------------------------ I am not sure if there is need for supporting multiple partitions within a VM. It should be possible to do so as I expect to create device for each partition entry under arm-psa-ffa devicetree node. However, I don't want to assume something that will never be a usecase. However I don't think this will change must of the abstraction as we need to keep the interface API implementation separate to support different partitions on various platforms. b. SMCCC interface ------------------ This is something I messed up completely while trying to add support for SMCCC v1.2. It now supports x0-x17 as parameter registers(input) and return registers(output). I started simple with x0-x7 as both input and output as PSA FF-A needs that at most. But extending to x0-x17 then became with messy in my implementation. That's the reason I dropped it completely here and thought of checking it first. Do we need to extend the optimisations that were done to handle ARCH_WORKAROUND_{1,2}. Or should be just use a version with x0-x7 as both input and ouput. Hyper-V guys need full x0-x17 support. I need some guidance as what is the approach preferred ? 3. Partitions ------------- I am not sure if we have a full define partition that we plan to push upstream. Without one, we can have a sample/example partition to test all the interface APIs, but is that fine with respect to what we want upstream ? Any other thoughts that helps to test the driver ? Sorry for long email and too many questions, but I thought it is easier this way to begin with than throwing huge code implementing loads of APIs with no users(expect example partition) especially that I am posting this during merge window. Sudeep Holla (3): dt-bindings: Add ARM PSA FF binding for non-secure VM partitions firmware: Add support for PSA FF-A transport for VM partitions firmware: Add example PSA FF-A non-secure VM partition .../devicetree/bindings/arm/arm,psa-ffa.txt | 47 ++++ drivers/firmware/Kconfig | 1 + drivers/firmware/Makefile | 1 + drivers/firmware/arm_psa_ffa/Kconfig | 22 ++ drivers/firmware/arm_psa_ffa/Makefile | 3 + drivers/firmware/arm_psa_ffa/driver.c | 250 ++++++++++++++++++ drivers/firmware/arm_psa_ffa/partition.c | 71 +++++ include/linux/arm_psa_ffa.h | 42 +++ 8 files changed, 437 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/arm,psa-ffa.txt create mode 100644 drivers/firmware/arm_psa_ffa/Kconfig create mode 100644 drivers/firmware/arm_psa_ffa/Makefile create mode 100644 drivers/firmware/arm_psa_ffa/driver.c create mode 100644 drivers/firmware/arm_psa_ffa/partition.c create mode 100644 include/linux/arm_psa_ffa.h -- 2.17.1