From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70358+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70358+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691258; cv=none; d=zohomail.com; s=zohoarc; b=BKK1Qr53yM3ZDHVh3T0NXamQr8ydNI+xHIUGLa5q8owfS1ql9HCK98FCmbWEsfxgpoCLdWQkP9LadQsb3NwrG0qOY7wY3YKekzuEMoorSdxNdjGkn3mO7caAHztBxNrWuqO109CBvbR8IfQj0hSNpRlFHFBd9HT1OIy9iLasNPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691258; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=INx9PPKBFnxCweCa2pYvX5vUGjZJF5R9tj5fxajdnbg=; b=hlBkIyaZQfYerTaJwkzS0tzLL+d8bt21XEZu0HKAgu1hV5IKi3eidu69PlXA2ozgfoQ4rNEA0qUItiyoDpnGdEsPF+SKNQoPS0HdsVEPvsLl5CxpajZ94UnmEhp77T8SOoG8e3xXxtN/94xr8rcDA2vXPK9Bc2wUd1QbvnVOXNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70358+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691258887607.0223139442687; Thu, 14 Jan 2021 22:14:18 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id QmnAYY1788612xFNhzs8uwqu; Thu, 14 Jan 2021 22:14:18 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.511.1610691258052960423 for ; Thu, 14 Jan 2021 22:14:18 -0800 X-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 C4346ED1; Thu, 14 Jan 2021 22:14:17 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A26DC3F70D; Thu, 14 Jan 2021 22:14:15 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Achin Gupta Subject: [edk2-devel] [PATCH v3 01/13] ArmPkg/IndustryStandard: Add barebones FF-A header Date: Fri, 15 Jan 2021 11:43:52 +0530 Message-Id: <20210115061404.13552-2-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: HHrX9iashBtqFxgQTV6QlfdVx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691258; bh=+clmLMf/CiMRCZJSIBvIlqD6CoRQnLbOUSimm98Voe4=; h=Cc:Date:From:Reply-To:Subject:To; b=AwVeokH+vU9LY8GAGsCunfx92eQYtqD6Puhm+BH66NUaICzrsKa8VHDpgKNQLS5ItKl oymJITF2N6DS4b4jaqAZUIzSiDasP5IxEsb5Y3yxDroHY6YVEjBtBaYxCn9p9DKZ4WIXj M5aUfNHfqxsOY+mQD2PByTEDRgEr8QM3VSY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Achin Gupta This patch adds a rudimentary header file with defines for FF-A ABIs that will be used as the transport between S-EL0 and the SPM Signed-off-by: Achin Gupta Reviewed-by: Sami Mujawar Reviewed-by: Ard Biesheuvel --- Changes since V2: None ArmPkg/Include/IndustryStandard/ArmFfaSvc.h | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h b/ArmPkg/Include/I= ndustryStandard/ArmFfaSvc.h new file mode 100644 index 0000000000..1eadf48ab5 --- /dev/null +++ b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h @@ -0,0 +1,23 @@ +/** @file + Header file for FF-A ABI's that will be used for + communication between S-EL0 and the Secure Partition + Manager(SPM) + + Copyright (c) 2020, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + - FF-A Version 1.0 + + +**/ + +#ifndef ARM_FFA_SVC_H_ +#define ARM_FFA_SVC_H_ + +#define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063 +#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F +#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64 0xC4000070 + +#endif // ARM_FFA_SVC_H_ --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70358): https://edk2.groups.io/g/devel/message/70358 Mute This Topic: https://groups.io/mt/79696438/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70359+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70359+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691261; cv=none; d=zohomail.com; s=zohoarc; b=X78yQawiyXpEjMK32akXx/kT4j7mU050X2ERyrD+ukZVROP07yXkmIySdvA/p8BQnV+Xhh7JXk+jSy5E4XIDdRmRcFstyf+6m4kG6yLcsjp5qiSMKsRJuwc1Qwvn9Qdj0UCJ8E/cBU/Orbz0LAS/7121a+tfRk2ti+aeUwKa/98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691261; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=W8WirhpfK7B06bn/JSKifKUCIs0GcX48PvpRWOJTbUQ=; b=dVFZbF+xSYP6R9QTIiCqct8y8CAY1g/33kTBSzfqEmSPTi9lgQhoDndeJtKV5nuKItgYa/WtMMaWcaQJsNkAf+1pRFYBPWpsmYuULBP2nXDfyhKIt7ASslcOhEm/J9UP9GCIcc4xHUFQF/keqg0TIObpJHv7bRmXAoDZB1azKuA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70359+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691261549204.72285832129728; Thu, 14 Jan 2021 22:14:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id bbEIYY1788612xNRlpJHA01T; Thu, 14 Jan 2021 22:14:21 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.534.1610691260666066463 for ; Thu, 14 Jan 2021 22:14:20 -0800 X-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 642CDED1; Thu, 14 Jan 2021 22:14:20 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4274B3F70D; Thu, 14 Jan 2021 22:14:18 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Achin Gupta Subject: [edk2-devel] [PATCH v3 02/13] ArmPkg/ArmSvcLib: Return x4-x7 in output parameters Date: Fri, 15 Jan 2021 11:43:53 +0530 Message-Id: <20210115061404.13552-3-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: sFHmCxxAUz4ZYyCkRSttRS3Vx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691261; bh=wuIXiFhsQUbIPB1Jyz/8eN43vre3W+V7zWXiQDnkpIk=; h=Cc:Date:From:Reply-To:Subject:To; b=Fv9/hrkeJbnZOSpWWhADzxTRv1p63iTkBDYVQdddHaS9/gGMov5K3bRgHGLilCDc/a2 i0IHIhSplDwb+uYQdvxiY13Q13QzpNljcYxaxTf8faPGGPO/G0szyGExZKGRk4dLhgZx1 6oVEFm/Uppx6/tdO+PBeJyEwlOQIxn2g0Lk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Achin Gupta The Arm SMC calling convention standard v1.2 allows 8 input and output parameter registers. The FF-A specification relies on this communication. This patch extends the number of output registers returned by ArmCallSvc() to match this convention. Signed-off-by: Achin Gupta Reviewed-by: Sami Mujawar Reviewed-by: Ard Biesheuvel --- Changes since V2: None ArmPkg/Include/Library/ArmSvcLib.h | 10 ++++++++-- ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ArmPkg/Include/Library/ArmSvcLib.h b/ArmPkg/Include/Library/Ar= mSvcLib.h index a94ead1965..a4414270f3 100644 --- a/ArmPkg/Include/Library/ArmSvcLib.h +++ b/ArmPkg/Include/Library/ArmSvcLib.h @@ -27,10 +27,16 @@ typedef struct { /** Trigger an SVC call =20 - SVC calls can take up to 7 arguments and return up to 4 return values. - Therefore, the 4 first fields in the ARM_SVC_ARGS structure are used + SVC calls can take up to 8 arguments and return up to 8 return values. + Therefore, the 8 first fields in the ARM_SVC_ARGS structure are used for both input and output values. =20 + @param[in, out] Args Arguments to be passed as part of the SVC call + The return values of the SVC call are also placed + in the same structure + + @retval None + **/ VOID ArmCallSvc ( diff --git a/ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S b/ArmPkg/Library/Arm= SvcLib/AArch64/ArmSvc.S index ee265f94b9..1a7c10cb79 100644 --- a/ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S +++ b/ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S @@ -33,9 +33,11 @@ ASM_PFX(ArmCallSvc): ldr x9, [sp, #16] =20 // Store the SVC returned values into the ARM_SVC_ARGS structure. - // A SVC call can return up to 4 values - we do not need to store back x= 4-x7. + // A SVC call can return up to 8 values stp x0, x1, [x9, #0] stp x2, x3, [x9, #16] + stp x4, x5, [x9, #32] + stp x6, x7, [x9, #48] =20 mov x0, x9 =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70359): https://edk2.groups.io/g/devel/message/70359 Mute This Topic: https://groups.io/mt/79696439/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70360+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70360+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691270; cv=none; d=zohomail.com; s=zohoarc; b=fDTbA/Z/UTJ6FQaQynVYOLrfcQNjYAJGCNKNzpa9VR/VKboOlutu76CZnNEcY7SaXs95igbAbCjnHGRHCv7ClXesaeYGYuyqZa5Sb0PFhleTK8iI1uyNMbnZmhP/ID1gApaYAryxpAr2+b3iQ1a8YSDm3iuC4kz+1au0y2rIumA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691270; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=d1CkNhcGMKAyVsNEn/e9fOS17G0xP7c2LEYzos6/b9k=; b=A1KUXAQiBIkkVzOH2Cowm4aaykk/XSH8lLtSCU2ZMFgY9djPrUTbHqZDk2lME7oAH0pAqTxhukfVTLy+W1OajGDX5R/SUK+d16+4HumLyaMKqiKgFhCZTjr6qpIYEN4AykWBSAUfURogPJXj69VThhlvU7m1aXYDK8paN2JVObs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70360+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691270153475.51279801500004; Thu, 14 Jan 2021 22:14:30 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id TRuNYY1788612x79gIYnDBJO; Thu, 14 Jan 2021 22:14:28 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.464.1610691263376428613 for ; Thu, 14 Jan 2021 22:14:23 -0800 X-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 02D28ED1; Thu, 14 Jan 2021 22:14:23 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D56BD3F70D; Thu, 14 Jan 2021 22:14:20 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Achin Gupta Subject: [edk2-devel] [PATCH v3 03/13] StandaloneMmPkg: Use FF-A header file in Standalone MM Core entry point Date: Fri, 15 Jan 2021 11:43:54 +0530 Message-Id: <20210115061404.13552-4-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: 3YTSjWg9pC3d9OgHoSsuaY8Sx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691268; bh=9JMHduuaH2qRdHpiq1bFObCStB5F33VUCuIZpO7EDYw=; h=Cc:Date:From:Reply-To:Subject:To; b=jfnAIq7v3lfTiPeCMiFcvg+1ZpsXoTqXM4qNTsChLftDTPVc4rJXXMH8usjnuo92v8X 5GGjehP96gY4Hk0OP+sHF2S6G/ONJrI39ThKUJ6ADz4s7UsQCIx1hjE41SnbaZbsxavlE j447755h+z8/rLYliC0u6rZTmSXia9PO+14= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Achin Gupta Add the Firmware Framework(FF-A) header in the StandaloneMm entry point driver. Support for invoking the functions through FF-A will be added in a subsequent patch. Signed-off-by: Achin Gupta Reviewed-by: Sami Mujawar --- Changes since V2: None StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 1 + 1 file changed, 1 insertion(+) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index fa2005e7e9..3d78e8e9ae 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #include #include +#include =20 #define SPM_MAJOR_VER_MASK 0xFFFF0000 #define SPM_MINOR_VER_MASK 0x0000FFFF --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70360): https://edk2.groups.io/g/devel/message/70360 Mute This Topic: https://groups.io/mt/79696440/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70361+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70361+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691268; cv=none; d=zohomail.com; s=zohoarc; b=EKMT0VoR969FaxvsUb2v+NMw4XzjOPyK+LvIPfAADeGpXG3QtevdF6DInUGpjYSdePPQFDmVFBsxZPfmEtTBmCImbvU1B4adg0CqKtLMflhohQQTsIyBdnRxqNJUjgrSW3vXUP5hrrWHBaAPrlVFtYTz1p2O/xERXrbSalL8hes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691268; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=/HuY5anQFkZHAMTLmA+Vxv2z9RjFGRZf9r+UkCysuuA=; b=cV3SBSLIS1eEAMnd6DEP2WnxAWOMjnMh/Bpv7cjTZPU3YEs4BRHhorokvpsgW5oVS6bQdtpRWjAJO21GT0QYNRNoSQWjr0HTUauAJ8UwLFoBhVqBLdhKV8fsI0BY8pwa5Rls278p5QZuRdDpP9TRnKYIieY5hit7c8malQAY91k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70361+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691268780259.371474411893; Thu, 14 Jan 2021 22:14:28 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id vZr1YY1788612xe3OcjagPYc; Thu, 14 Jan 2021 22:14:26 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.513.1610691265906264201 for ; Thu, 14 Jan 2021 22:14:26 -0800 X-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 95EFBED1; Thu, 14 Jan 2021 22:14:25 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 744243F70D; Thu, 14 Jan 2021 22:14:23 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Sughosh Ganu Subject: [edk2-devel] [PATCH v3 04/13] ArmPkg: Introduce support for PcdFfaEnable Date: Fri, 15 Jan 2021 11:43:55 +0530 Message-Id: <20210115061404.13552-5-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: kn0yqvRzFbMVLnV5rjQcD46kx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691266; bh=EP4Yg5oHI8JuZE213CjUALY78nab61Z1oebXYTOrGGw=; h=Cc:Date:From:Reply-To:Subject:To; b=kNTXqykJuC6MtocCwfYEI6l7xUHwG9aoM8p6Wxho4ZemDt3EADfqztqoI6RwGshmDqR 8+Hfc746um3IM/e62EeQCkgWpHWMPTehthZB6Hp5RJpBqFE9OQ3GpgN4EfVQtNNohBai3 EyaM/KBe75HB9D+kWCwEylZYJZ9En7uL1DQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The Secure Partition(SP) can request services from the Secure Partition Manager Core(SPMC) either through FF-A calls or through the existing SVC calls. Add a feature flag Pcd for enabling the FF-A method -- when this is set to FALSE, the SP uses the existing SVC calls for making the requests. Signed-off-by: Sughosh Ganu Reviewed-by: Sami Mujawar Reviewed-by: Ard Biesheuvel --- Changes since V2: None ArmPkg/ArmPkg.dec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index eaf1072d9e..507e16844c 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -78,6 +78,12 @@ # Define if the GICv3 controller should use the GICv2 legacy gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE|BOOLEAN|0x00000042 =20 + ## Used to select method for requesting services from S-EL1.

+ # FALSE - Selects SVC calls for communication between S-EL0 and SPMC.<= BR> + # @Prompt Enable FF-A support. + gArmTokenSpaceGuid.PcdFfaEnable|FALSE|BOOLEAN|0x0000005B + [PcdsFeatureFlag.ARM] # Whether to map normal memory as non-shareable. FALSE is the safe choic= e, but # TRUE may be appropriate to fix performance problems if you don't care = about --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70361): https://edk2.groups.io/g/devel/message/70361 Mute This Topic: https://groups.io/mt/79696441/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70362+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70362+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691269; cv=none; d=zohomail.com; s=zohoarc; b=iOn0gAG/yRGTRAfCteoTWNE5MD0LAECvNhZTjmLZJH5qvFh86Y3On7fVn4hW3r4Bo3ugXoG2RL2j20F4FH1FCYiFhtXgMkP/C8HYPxw+7btsKnlFIwo17I+FRkeKi3LgXyqhsSXVzCnfVmFpXzKp//uAvIGs0EdxRuOpH+ss6Fg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691269; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=XiTNiy4HXRXjmlfwZfO59oZugyiQjHvKgQGxkjIgkj0=; b=MWyOd2PTryHiP97hbTRJP3qz+P2obxDIkOFmG0efT0NqHMYv/2/3x3YVhmVhUnZsm/BCsPoK2nIY0Fqns51qd59AesEk/othTSLsJFg6nmiM+DDAu8Ds06aV9U/DPFSuLj8adexEexT66FqMkkj1L1pYtBB3DmfreEVyHEIzll8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70362+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691269778794.0758899962324; Thu, 14 Jan 2021 22:14:29 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id roBtYY1788612xcflBT1kSPx; Thu, 14 Jan 2021 22:14:29 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.515.1610691268503626672 for ; Thu, 14 Jan 2021 22:14:28 -0800 X-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 33B6CED1; Thu, 14 Jan 2021 22:14:28 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 121293F70D; Thu, 14 Jan 2021 22:14:25 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Sughosh Ganu Subject: [edk2-devel] [PATCH v3 05/13] StandaloneMmPkg: Add macros for SPM version Date: Fri, 15 Jan 2021 11:43:56 +0530 Message-Id: <20210115061404.13552-6-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: IdLJxicRLTfpznxfnuFaK5qZx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691269; bh=eV/4tKyTPqWEgctVeN47A6WvHTsk+saXmu60XhLklWg=; h=Cc:Date:From:Reply-To:Subject:To; b=mR3ooS1qXSOlYIWnVQR6PLNcAKEq/Y9OYAJZB3uMea5EbGS6dKIR22byyuNcvOUOhpZ McBRhFz0jvYHVCFo0x62OQc0i6rLiSWHz807VvxaIIJixowe8WmoDR4oCO6vX0rX6qWwm jKz6HakscGK9JV99WhvtUKUhXBI3FDbStfY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Declare module wide variables for SPM major and minor versions to be used in checking the SPM version compatibility. Declare the the values of SPM major and minor versions as macros. Signed-off-by: Sughosh Ganu Reviewed-by: Sami Mujawar --- Changes since V2: * Added a STATIC storage class specifier for mSpmMajorVer and mSpmMinorVer variables ArmPkg/Include/IndustryStandard/ArmMmSvc.h = | 3 +++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ArmPkg/Include/IndustryStandard/ArmMmSvc.h b/ArmPkg/Include/In= dustryStandard/ArmMmSvc.h index ee29c2fecc..71a5398558 100644 --- a/ArmPkg/Include/IndustryStandard/ArmMmSvc.h +++ b/ArmPkg/Include/IndustryStandard/ArmMmSvc.h @@ -41,4 +41,7 @@ #define ARM_SVC_SPM_RET_DENIED -3 #define ARM_SVC_SPM_RET_NO_MEMORY -5 =20 +#define SPM_MAJOR_VERSION 0 +#define SPM_MINOR_VERSION 1 + #endif diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 3d78e8e9ae..2643473e88 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -32,8 +32,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define SPM_MINOR_VER_MASK 0x0000FFFF #define SPM_MAJOR_VER_SHIFT 16 =20 -#define SPM_MAJOR_VER 0 -#define SPM_MINOR_VER 1 +STATIC CONST UINT32 mSpmMajorVer =3D SPM_MAJOR_VERSION; +STATIC CONST UINT32 mSpmMinorVer =3D SPM_MINOR_VERSION; =20 #define BOOT_PAYLOAD_VERSION 1 =20 @@ -196,8 +196,8 @@ GetSpmVersion (VOID) // revision A must work in a compatible way with revision B. // However, it is possible for revision B to have a higher // function count than revision A. - if ((SpmMajorVersion =3D=3D SPM_MAJOR_VER) && - (SpmMinorVersion >=3D SPM_MINOR_VER)) + if ((SpmMajorVersion =3D=3D mSpmMajorVer) && + (SpmMinorVersion >=3D mSpmMinorVer)) { DEBUG ((DEBUG_INFO, "SPM Version: Major=3D0x%x, Minor=3D0x%x\n", SpmMajorVersion, SpmMinorVersion)); @@ -206,7 +206,7 @@ GetSpmVersion (VOID) else { DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Current Version: Maj= or=3D0x%x, Minor=3D0x%x.\n Expected: Major=3D0x%x, Minor>=3D0x%x.\n", - SpmMajorVersion, SpmMinorVersion, SPM_MAJOR_VER, SPM_MINOR_VER= )); + SpmMajorVersion, SpmMinorVersion, mSpmMajorVer, mSpmMinorVer)); Status =3D EFI_UNSUPPORTED; } =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70362): https://edk2.groups.io/g/devel/message/70362 Mute This Topic: https://groups.io/mt/79696442/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70363+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70363+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691271; cv=none; d=zohomail.com; s=zohoarc; b=CyXWgImgg/1jeFQLg8bErHVzA6qy+jETlwR/61UlLGh7qCTxskQeN9PFEKYLftQ3U1M/Pds3dLMxp620EyrxV4BDsJPKuNKe/6gKIEHC4K5xBILAcJMuo/c8xH3jRvd2WClp6U+QaeZ1Rupp1AkMnajhwTJqurqq4PR29xIJEr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691271; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=DPgjeRlGhRIvHLAC6xqtx7gm54aOKswHOZwXBoNSZDA=; b=gYuem1Duyfhqq3EbWpvANEFnyZOl6m+Z969qR1cHGnVs0zq6iRvrb7G6BTB0i71uffxVUgk+6P3beE1tYFVbDLHI0qrWmPQHWshLlp8e2MCXyU62ZJerHn3BlxlI+anCZTriA2wwruwXSAQEu/EaBPc+dfxFua3wwYI/Z7WS0Nw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70363+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691271909568.7923471728787; Thu, 14 Jan 2021 22:14:31 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id eldwYY1788612xrRzi8FgxqR; Thu, 14 Jan 2021 22:14:31 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.516.1610691271066401221 for ; Thu, 14 Jan 2021 22:14:31 -0800 X-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 C7260ED1; Thu, 14 Jan 2021 22:14:30 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A5DFF3F70D; Thu, 14 Jan 2021 22:14:28 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Sughosh Ganu Subject: [edk2-devel] [PATCH v3 06/13] StandaloneMmPkg: Add the SPM version for FF-A Date: Fri, 15 Jan 2021 11:43:57 +0530 Message-Id: <20210115061404.13552-7-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: 336Zbe4zXooQxiet0Ne3dYTOx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691271; bh=xd/LXZeKHS2cSBhYfLPpd/hVgk19QTpsebOjVm+0avY=; h=Cc:Date:From:Reply-To:Subject:To; b=CPyk8nL4HQLGBgBncsHlZvGurki7rI4NNnzO9Krwxp8upbNGyBeL/iNDgLYhycCbsJR 2TUio5kNsMOLC+l6GjVoKhKftRqnta/xkKsMXteevRhWD+wsTig9rHxMeCE1brfSra0ag 0zHPicsWhsN1Sa0MUEJUE5Ae+7V1/8ONwn4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The Firmware Framework(FF-A) requires implementation of SPM version v1.0. Add new macros for the version that will be used for FF-A. Signed-off-by: Sughosh Ganu Reviewed-by: Sami Mujawar --- Changes since V2: * Added a STATIC storage class specifier for mSpmMajorVerFfa and mSpmMinorVerFfa variables ArmPkg/Include/IndustryStandard/ArmFfaSvc.h = | 3 +++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h b/ArmPkg/Include/I= ndustryStandard/ArmFfaSvc.h index 1eadf48ab5..bdf6ce4676 100644 --- a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h +++ b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h @@ -20,4 +20,7 @@ #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64 0xC4000070 =20 +#define SPM_MAJOR_VERSION_FFA 1 +#define SPM_MINOR_VERSION_FFA 0 + #endif // ARM_FFA_SVC_H_ diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 2643473e88..3bd2516608 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -35,6 +35,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent STATIC CONST UINT32 mSpmMajorVer =3D SPM_MAJOR_VERSION; STATIC CONST UINT32 mSpmMinorVer =3D SPM_MINOR_VERSION; =20 +STATIC CONST UINT32 mSpmMajorVerFfa =3D SPM_MAJOR_VERSION_FFA; +STATIC CONST UINT32 mSpmMinorVerFfa =3D SPM_MINOR_VERSION_FFA; + #define BOOT_PAYLOAD_VERSION 1 =20 PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT CpuDriverEntryPoint =3D NULL; --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70363): https://edk2.groups.io/g/devel/message/70363 Mute This Topic: https://groups.io/mt/79696443/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70364+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70364+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691274; cv=none; d=zohomail.com; s=zohoarc; b=ePl7LPOOu7JtcCcGPUEwTBk8pi1zwnlv3GEUyWI1/gL4JMbqExCZz1ZFRiBerxiKi5mXk4nnZV62U2KHpbQRxp8BnhEqJhsz38G1Zy/RNcZnahMZzyQRSQOn8Fl38E9Rvh7FqkP4bkWH97AeVjdhaaCLy/sC++wEKXWJQUuy7Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691274; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=dMMSeJ7JKSuoVy94QXbIfAjtqSoee4JswGwfqSp7QUY=; b=K+w3ur2WzDa14NF/h2k+k19ZmY4tiGKb1b2LTqedBICrlEsSjk8f2siMwwfZDFAuUizap9YAhsneJvSbHYBpFsKMRJz862UJC1eQEcmE3BrcxMa96sP3XwG+nDVtf/UqITLzb39FhLSOQ6Ry5ypmBDrSvF6uKWU41eEI+tp7VVw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70364+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691274643255.13487632225088; Thu, 14 Jan 2021 22:14:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id EKnfYY1788612xG3liAg86rF; Thu, 14 Jan 2021 22:14:34 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.536.1610691273713458488 for ; Thu, 14 Jan 2021 22:14:33 -0800 X-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 684ADED1; Thu, 14 Jan 2021 22:14:33 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 457133F70D; Thu, 14 Jan 2021 22:14:31 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Sughosh Ganu Subject: [edk2-devel] [PATCH v3 07/13] StandaloneMmPkg: Add option to use FF-A calls for getting SPM version Date: Fri, 15 Jan 2021 11:43:58 +0530 Message-Id: <20210115061404.13552-8-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: nR3do8sJ7idUX9DoyqPgV52Nx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691274; bh=P3hsz04sCamvOo62iv4WHn12RNf34oQPcN89sHufmgI=; h=Cc:Date:From:Reply-To:Subject:To; b=K+tfKJDKsu8//ITf1b818gveKJ2z0ldtbXq1ApFY53nn5SWz/083ELfiUrl9ab/Ww5U lQeNPU49Cnq95dpk/d5FIYOmigBzCns8L3COoLvjWfBDX0LO8RxLFJTWscnFbJxg1lyEg kfrH7YvF0uBtIlE4q6trFkU722PBMJ/Twqo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With the introduction of Firmware Framework(FF-A), a Secure Partition can get the SPM version either using FF-A calls or through the existing svc calls. Use a runtime check to use either of the two methods based on the Pcd feature flag value. Signed-off-by: Sughosh Ganu Co-developed-by: Achin Gupta Reviewed-by: Sami Mujawar --- Changes since V2: None StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPo= int.inf | 3 ++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 37 ++++++++++++++------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 75a654b06d..073934a6f5 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -48,5 +48,8 @@ gEfiStandaloneMmNonSecureBufferGuid gEfiArmTfCpuDriverEpDescriptorGuid =20 +[Pcd] + gArmTokenSpaceGuid.PcdFfaEnable + [BuildOptions] GCC:*_*_*_CC_FLAGS =3D -fpie diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 3bd2516608..25ead004e6 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -23,6 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include #include @@ -31,6 +32,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define SPM_MAJOR_VER_MASK 0xFFFF0000 #define SPM_MINOR_VER_MASK 0x0000FFFF #define SPM_MAJOR_VER_SHIFT 16 +#define FFA_NOT_SUPPORTED -1 =20 STATIC CONST UINT32 mSpmMajorVer =3D SPM_MAJOR_VERSION; STATIC CONST UINT32 mSpmMinorVer =3D SPM_MINOR_VERSION; @@ -178,19 +180,34 @@ EFI_STATUS GetSpmVersion (VOID) { EFI_STATUS Status; - UINT16 SpmMajorVersion; - UINT16 SpmMinorVersion; + UINT16 CalleeSpmMajorVer; + UINT16 CallerSpmMajorVer; + UINT16 CalleeSpmMinorVer; + UINT16 CallerSpmMinorVer; UINT32 SpmVersion; ARM_SVC_ARGS SpmVersionArgs; =20 - SpmVersionArgs.Arg0 =3D ARM_SVC_ID_SPM_VERSION_AARCH32; + if (FeaturePcdGet (PcdFfaEnable)) { + SpmVersionArgs.Arg0 =3D ARM_SVC_ID_FFA_VERSION_AARCH32; + SpmVersionArgs.Arg1 =3D mSpmMajorVerFfa << SPM_MAJOR_VER_SHIFT; + SpmVersionArgs.Arg1 |=3D mSpmMinorVerFfa; + CallerSpmMajorVer =3D mSpmMajorVerFfa; + CallerSpmMinorVer =3D mSpmMinorVerFfa; + } else { + SpmVersionArgs.Arg0 =3D ARM_SVC_ID_SPM_VERSION_AARCH32; + CallerSpmMajorVer =3D mSpmMajorVer; + CallerSpmMinorVer =3D mSpmMinorVer; + } =20 ArmCallSvc (&SpmVersionArgs); =20 SpmVersion =3D SpmVersionArgs.Arg0; + if (SpmVersion =3D=3D FFA_NOT_SUPPORTED) { + return EFI_UNSUPPORTED; + } =20 - SpmMajorVersion =3D ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VER_= SHIFT); - SpmMinorVersion =3D ((SpmVersion & SPM_MINOR_VER_MASK) >> 0); + CalleeSpmMajorVer =3D ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VE= R_SHIFT); + CalleeSpmMinorVer =3D ((SpmVersion & SPM_MINOR_VER_MASK) >> 0); =20 // Different major revision values indicate possibly incompatible functi= ons. // For two revisions, A and B, for which the major revision values are @@ -199,17 +216,17 @@ GetSpmVersion (VOID) // revision A must work in a compatible way with revision B. // However, it is possible for revision B to have a higher // function count than revision A. - if ((SpmMajorVersion =3D=3D mSpmMajorVer) && - (SpmMinorVersion >=3D mSpmMinorVer)) + if ((CalleeSpmMajorVer =3D=3D CallerSpmMajorVer) && + (CalleeSpmMinorVer >=3D CallerSpmMinorVer)) { DEBUG ((DEBUG_INFO, "SPM Version: Major=3D0x%x, Minor=3D0x%x\n", - SpmMajorVersion, SpmMinorVersion)); + CalleeSpmMajorVer, CalleeSpmMinorVer)); Status =3D EFI_SUCCESS; } else { - DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Current Version: Maj= or=3D0x%x, Minor=3D0x%x.\n Expected: Major=3D0x%x, Minor>=3D0x%x.\n", - SpmMajorVersion, SpmMinorVersion, mSpmMajorVer, mSpmMinorVer)); + DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Callee Version: Majo= r=3D0x%x, Minor=3D0x%x.\n Caller: Major=3D0x%x, Minor>=3D0x%x.\n", + CalleeSpmMajorVer, CalleeSpmMinorVer, CallerSpmMajorVer, Calle= rSpmMinorVer)); Status =3D EFI_UNSUPPORTED; } =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70364): https://edk2.groups.io/g/devel/message/70364 Mute This Topic: https://groups.io/mt/79696444/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70366+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70366+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691287; cv=none; d=zohomail.com; s=zohoarc; b=XR5WtKiVziZPGh/5Rh60ZtFNYRkuPr8QW33R+bZct/z+08k8VHmA/j8wxVveAGvDmGe0IA30qn+92FrPvxX5I9ebFb1banWcEFSmSGIXSbL8yKY28vhEa/bSvr8bruKGWjLpoYjjYCA25xEcricdN13n1b/17ZR/PAG+9J+qBfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691287; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=Fk3SbdpX+w5IaF//c52dcScJDOpq0toAd6+AbeAWLAo=; b=bFbF6KNpCTl5oVCdDRQGJ6JqHhiwJgmhT6o0LRyrF+L3DZBKCdbUk43SaQanCcYIaIPvHngnpzKxbMyMAW6702cN8nysU4+8w/STHmII/o2RkxNR+UQe2Fl+T9nfMnCyo++CbsyCb9FhU95e4XeCNTmMlKz3CBSlYsfvUNsygOc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70366+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691287252348.9904812816138; Thu, 14 Jan 2021 22:14:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8H8xYY1788612xbJ8CBhU5X5; Thu, 14 Jan 2021 22:14:46 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.489.1610691281327382929 for ; Thu, 14 Jan 2021 22:14:41 -0800 X-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 093F9ED1; Thu, 14 Jan 2021 22:14:36 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D99443F70D; Thu, 14 Jan 2021 22:14:33 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Achin Gupta Subject: [edk2-devel] [PATCH v3 08/13] StandaloneMmPkg: Add option to use FF-A calls for communication with SPM Date: Fri, 15 Jan 2021 11:43:59 +0530 Message-Id: <20210115061404.13552-9-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: yz5Ti5PwiI6H2wsejqPF0MyQx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691286; bh=s3hRioZjLuFRNKAAhXVaGgg70nHr13uQ9AuPKF5Z9SI=; h=Cc:Date:From:Reply-To:Subject:To; b=hr6g2cq9lNyqxL6ElJ/jHfUprp6uVk16rlNG4CyDoYVh5BngcO5+XmW3rAXQsTkQxtK /cR6BQm+4r3jQNBFZ3WtQUIIrlN4rLtx26t3zcL9b+Ce9ipXhnpaoTI3gFe5gtTAZPagx 9A7DVE/cj5escjhqa2vTEwrkshygVt/j/Z0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Achin Gupta Add support for reporting completion of a MM request using either the Firmware Framework(FF-A) ABI transport or through the earlier used SVC calls. Signed-off-by: Achin Gupta Co-developed-by: Sughosh Ganu Reviewed-by: Sami Mujawar --- Changes since V2: * Add braces for if/else statements * Add a check for EFI_NOT_FOUND as a possible return value from LocateStandaloneMmCorePeCoffData in _ModuleEntryPoint function StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 88 ++++++++++++++++---- 1 file changed, 74 insertions(+), 14 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 25ead004e6..6c50f470aa 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -120,6 +120,7 @@ DelegatedEventLoop ( IN ARM_SVC_ARGS *EventCompleteSvcArgs ) { + BOOLEAN FfaEnabled; EFI_STATUS Status; UINTN SvcStatus; =20 @@ -131,16 +132,32 @@ DelegatedEventLoop ( DEBUG ((DEBUG_INFO, "X1 : 0x%x\n", (UINT32) EventCompleteSvcArgs->Arg= 1)); DEBUG ((DEBUG_INFO, "X2 : 0x%x\n", (UINT32) EventCompleteSvcArgs->Arg= 2)); DEBUG ((DEBUG_INFO, "X3 : 0x%x\n", (UINT32) EventCompleteSvcArgs->Arg= 3)); - - Status =3D CpuDriverEntryPoint ( - EventCompleteSvcArgs->Arg0, - EventCompleteSvcArgs->Arg3, - EventCompleteSvcArgs->Arg1 - ); - - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Failed delegated event 0x%x, Status 0x%x\n", - EventCompleteSvcArgs->Arg0, Status)); + DEBUG ((DEBUG_INFO, "X4 : 0x%x\n", (UINT32) EventCompleteSvcArgs->Arg= 4)); + DEBUG ((DEBUG_INFO, "X5 : 0x%x\n", (UINT32) EventCompleteSvcArgs->Arg= 5)); + DEBUG ((DEBUG_INFO, "X6 : 0x%x\n", (UINT32) EventCompleteSvcArgs->Arg= 6)); + DEBUG ((DEBUG_INFO, "X7 : 0x%x\n", (UINT32) EventCompleteSvcArgs->Arg= 7)); + + FfaEnabled =3D FeaturePcdGet (PcdFfaEnable); + if (FfaEnabled) { + Status =3D CpuDriverEntryPoint ( + EventCompleteSvcArgs->Arg0, + EventCompleteSvcArgs->Arg6, + EventCompleteSvcArgs->Arg3 + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed delegated event 0x%x, Status 0x%x\n", + EventCompleteSvcArgs->Arg3, Status)); + } + } else { + Status =3D CpuDriverEntryPoint ( + EventCompleteSvcArgs->Arg0, + EventCompleteSvcArgs->Arg3, + EventCompleteSvcArgs->Arg1 + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed delegated event 0x%x, Status 0x%x\n", + EventCompleteSvcArgs->Arg0, Status)); + } } =20 switch (Status) { @@ -164,8 +181,16 @@ DelegatedEventLoop ( break; } =20 - EventCompleteSvcArgs->Arg0 =3D ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; - EventCompleteSvcArgs->Arg1 =3D SvcStatus; + if (FfaEnabled) { + EventCompleteSvcArgs->Arg0 =3D ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_A= ARCH64; + EventCompleteSvcArgs->Arg1 =3D 0; + EventCompleteSvcArgs->Arg2 =3D 0; + EventCompleteSvcArgs->Arg3 =3D ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; + EventCompleteSvcArgs->Arg4 =3D SvcStatus; + } else { + EventCompleteSvcArgs->Arg0 =3D ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; + EventCompleteSvcArgs->Arg1 =3D SvcStatus; + } } } =20 @@ -233,6 +258,32 @@ GetSpmVersion (VOID) return Status; } =20 +/** + Initialize parameters to be sent via SVC call. + + @param[out] InitMmFoundationSvcArgs Args structure + @param[out] Ret Return Code + +**/ +STATIC +VOID +InitArmSvcArgs ( + OUT ARM_SVC_ARGS *InitMmFoundationSvcArgs, + OUT INT32 *Ret + ) +{ + if (FeaturePcdGet (PcdFfaEnable)) { + InitMmFoundationSvcArgs->Arg0 =3D ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_= AARCH64; + InitMmFoundationSvcArgs->Arg1 =3D 0; + InitMmFoundationSvcArgs->Arg2 =3D 0; + InitMmFoundationSvcArgs->Arg3 =3D ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; + InitMmFoundationSvcArgs->Arg4 =3D *Ret; + } else { + InitMmFoundationSvcArgs->Arg0 =3D ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; + InitMmFoundationSvcArgs->Arg1 =3D *Ret; + } +} + /** The entry point of Standalone MM Foundation. =20 @@ -255,6 +306,7 @@ _ModuleEntryPoint ( EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo; ARM_SVC_ARGS InitMmFoundationSvcArgs; EFI_STATUS Status; + INT32 Ret; UINT32 SectionHeaderOffset; UINT16 NumberOfSections; VOID *HobStart; @@ -346,8 +398,16 @@ _ModuleEntryPoint ( DEBUG ((DEBUG_INFO, "Shared Cpu Driver EP 0x%lx\n", (UINT64) CpuDriverEn= tryPoint)); =20 finish: + if (Status =3D=3D RETURN_UNSUPPORTED) { + Ret =3D -1; + } else if (Status =3D=3D RETURN_INVALID_PARAMETER) { + Ret =3D -2; + } else if (Status =3D=3D EFI_NOT_FOUND) { + Ret =3D -7; + } else { + Ret =3D 0; + } ZeroMem (&InitMmFoundationSvcArgs, sizeof(InitMmFoundationSvcArgs)); - InitMmFoundationSvcArgs.Arg0 =3D ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64; - InitMmFoundationSvcArgs.Arg1 =3D Status; + InitArmSvcArgs (&InitMmFoundationSvcArgs, &Ret); DelegatedEventLoop (&InitMmFoundationSvcArgs); } --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70366): https://edk2.groups.io/g/devel/message/70366 Mute This Topic: https://groups.io/mt/79696446/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70365+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70365+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691284; cv=none; d=zohomail.com; s=zohoarc; b=BHdo3XVxQkHVTRFyBWdyxQhbwLlJ/HFHeA/Ply8oAMrkoSKYKZCxhSRNROoDnXdrm1+OkQU70C0hwpgwoqDvQaq0RR14Bc/pUd8GkArig3n4wzi4TO4ajtTpfCI/pUxWG5rpS6GgHC/KDheSoAyFuAnkFlfu1IX2md2h6M5IJTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691284; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=FsjR5xp3eOyv9iLlwwRaNFhHNPIfWErmUvGyQFJVzFg=; b=DGyLtEqyRcpT27g89oE4pwXHMJe6UdXWJ+KZex3axkjM5yClevqWyOdeW2ABh+aHQm3uQvFx72tGSbxlBgvJ8EjEJhmSso57/32ZUHWrAr7Yb9SSekB6YGro3QmZ3aS7FNKvrx5KOriTsuh4s8gao5h5jFJiwQB+x5aPK+fC2kQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70365+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691284721664.6712484533838; Thu, 14 Jan 2021 22:14:44 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id oBKAYY1788612xqpqhhdXi5N; Thu, 14 Jan 2021 22:14:44 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.467.1610691278954397463 for ; Thu, 14 Jan 2021 22:14:39 -0800 X-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 9AC3211B3; Thu, 14 Jan 2021 22:14:38 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 790863F70D; Thu, 14 Jan 2021 22:14:36 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Achin Gupta Subject: [edk2-devel] [PATCH v3 09/13] StandaloneMmPkg: Use FF-A header file in Standalone MM Arm MMU library Date: Fri, 15 Jan 2021 11:44:00 +0530 Message-Id: <20210115061404.13552-10-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: oBQn86fxi2xEJwjbtug0rc7Fx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691284; bh=oyHrlt2fJ6RQUblRJah3EMRaAdV175+LLZB4SRcaugM=; h=Cc:Date:From:Reply-To:Subject:To; b=jFvkTU3VS4Oeux3ywUdPOeZQ3qAjBA1vHn0YrtmhrflcUdzk4arXbohYYuxsg6crtCU 7UFCg6dOa7JmPOBVxFs9YpNycXfg42wr898QrOYjgsZVi4GLY7BYFKErbRdhVN4/FtY0m u4Mok0fLBTpLPiy2fkonsIGcW4got5f1Dls= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Achin Gupta Add the FF-A header for invoking the mmu functions using FF-A calls as the transport mechanism. Support for invoking the functions through FF-A will be added in a subsequent patch. Signed-off-by: Achin Gupta Reviewed-by: Sami Mujawar --- Changes since V2: None ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLi= b.c b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c index 5a316bc256..e2770636fb 100644 --- a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c +++ b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c @@ -9,6 +9,7 @@ =20 #include #include +#include =20 #include #include --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70365): https://edk2.groups.io/g/devel/message/70365 Mute This Topic: https://groups.io/mt/79696445/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70367+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70367+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691287; cv=none; d=zohomail.com; s=zohoarc; b=diItpLcaoH+xMFxaAoIeaxR+c0ygfSsxoijJA2a3yxhqJxF95OY70YSsJ8ETJImGr92phCgxyegKZWqwxgVbiD9EoNx+t6LXK4rM7xBd2AhcsadMZfpYqNsW2Yk+yM8YiXaWYygo7FcngVrn+Hmq9Zco/AZ9TQmZDqh2w6SC5bg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691287; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=j7qCXrBvS5nHfpiO2JJckgWQOEc/kAKA4OK33LpYrG0=; b=mL1jW8p2dO8U7O1HYIc/cQqQO9ZMJwGXebZUCkzXQhkx1Y393sArQV9AaUOl1/siTRerqwvEARe6qhdNWDresWy99dhWNPrM/98m+IRX5h4QWPYAJsAxRby2CTzMXC7hx/AeNGluJt33yCy73+SmJBvNPm+Ah8BcKKklyJRgwdk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70367+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691287707171.4517883333191; Thu, 14 Jan 2021 22:14:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id FLPiYY1788612xMtbijwRW0b; Thu, 14 Jan 2021 22:14:47 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.468.1610691281485952465 for ; Thu, 14 Jan 2021 22:14:41 -0800 X-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 39C3611B3; Thu, 14 Jan 2021 22:14:41 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 182343F70D; Thu, 14 Jan 2021 22:14:38 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Achin Gupta Subject: [edk2-devel] [PATCH v3 10/13] StandaloneMmMmuLib: Allow FF-A calls to get memory region's attributes Date: Fri, 15 Jan 2021 11:44:01 +0530 Message-Id: <20210115061404.13552-11-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: HPpD3RRa43Uj3S3pJNpRBNfEx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691287; bh=o2kl0dFOaAeo7tNG/coD5NxEwsPLXC6WMReWFbjwLcU=; h=Cc:Date:From:Reply-To:Subject:To; b=bM6BFj6Qba46vJfwiXngja7ja1Kw76KEaVUofF48SV1Q1Pka9oMmpN/0yfk6oO2Yqyl CZSYb7/yGpqAz4A2J0h/e0ODBY1AXFbJq/QDECn2nAbngAiKUcAgkntQCF4pkiUk02RrI zXdctgymG21CZodzx+5YpewM+s6zjeGtLJA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Achin Gupta Allow getting memory region's permissions using either of the Firmware Framework(FF-A) ABI transport or through the earlier used SVC calls. Signed-off-by: Achin Gupta Co-developed-by: Sughosh Ganu Reviewed-by: Sami Mujawar --- Changes since V2: * Check for the return value in Arg0 after the Direct Request call to handle errors returned * Put a comment to reflect the fact that FFA_INTERRUPT and FFA_SUCCESS response won't be expected in return to a Direct Request call to get the memory attributes ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf | 3 + ArmPkg/Include/IndustryStandard/ArmFfaSvc.h | 18 +++= ++ ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c | 78 +++= +++++++++++++++-- 3 files changed, 93 insertions(+), 6 deletions(-) diff --git a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf b/= ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf index 85973687f5..a29dd800b5 100644 --- a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf +++ b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf @@ -23,6 +23,9 @@ ArmPkg/ArmPkg.dec MdePkg/MdePkg.dec =20 +[Pcd] + gArmTokenSpaceGuid.PcdFfaEnable + [LibraryClasses] ArmLib CacheMaintenanceLib diff --git a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h b/ArmPkg/Include/I= ndustryStandard/ArmFfaSvc.h index bdf6ce4676..65b8343ade 100644 --- a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h +++ b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h @@ -23,4 +23,22 @@ #define SPM_MAJOR_VERSION_FFA 1 #define SPM_MINOR_VERSION_FFA 0 =20 +#define ARM_FFA_SPM_RET_SUCCESS 0 +#define ARM_FFA_SPM_RET_NOT_SUPPORTED -1 +#define ARM_FFA_SPM_RET_INVALID_PARAMETERS -2 +#define ARM_FFA_SPM_RET_NO_MEMORY -3 +#define ARM_FFA_SPM_RET_BUSY -4 +#define ARM_FFA_SPM_RET_INTERRUPTED -5 +#define ARM_FFA_SPM_RET_DENIED -6 +#define ARM_FFA_SPM_RET_RETRY -7 +#define ARM_FFA_SPM_RET_ABORTED -8 + +// For now, the destination id to be used in the FF-A calls +// is being hard-coded. Subsequently, support will be added +// to get the endpoint id's dynamically +// This is the endpoint id used by the optee os's implementation +// of the spmc. +// https://github.com/OP-TEE/optee_os/blob/master/core/arch/arm/kernel/stm= m_sp.c#L66 +#define ARM_FFA_DESTINATION_ENDPOINT_ID 3 + #endif // ARM_FFA_SVC_H_ diff --git a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLi= b.c b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c index e2770636fb..14fe781630 100644 --- a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c +++ b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c @@ -17,6 +17,7 @@ #include #include #include +#include =20 STATIC EFI_STATUS @@ -25,20 +26,85 @@ GetMemoryPermissions ( OUT UINT32 *MemoryAttributes ) { + INT32 Ret; ARM_SVC_ARGS GetMemoryPermissionsSvcArgs; + BOOLEAN FfaEnabled; =20 ZeroMem (&GetMemoryPermissionsSvcArgs, sizeof (ARM_SVC_ARGS)); =20 - GetMemoryPermissionsSvcArgs.Arg0 =3D ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AA= RCH64; - GetMemoryPermissionsSvcArgs.Arg1 =3D BaseAddress; + FfaEnabled =3D FeaturePcdGet (PcdFfaEnable); + if (FfaEnabled) { + GetMemoryPermissionsSvcArgs.Arg0 =3D ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RE= Q_AARCH64; + GetMemoryPermissionsSvcArgs.Arg1 =3D ARM_FFA_DESTINATION_ENDPOINT_ID; + GetMemoryPermissionsSvcArgs.Arg2 =3D 0; + GetMemoryPermissionsSvcArgs.Arg3 =3D ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_= AARCH64; + GetMemoryPermissionsSvcArgs.Arg4 =3D BaseAddress; + } else { + GetMemoryPermissionsSvcArgs.Arg0 =3D ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_= AARCH64; + GetMemoryPermissionsSvcArgs.Arg1 =3D BaseAddress; + GetMemoryPermissionsSvcArgs.Arg2 =3D 0; + GetMemoryPermissionsSvcArgs.Arg3 =3D 0; + } =20 + *MemoryAttributes =3D 0; ArmCallSvc (&GetMemoryPermissionsSvcArgs); - if (GetMemoryPermissionsSvcArgs.Arg0 =3D=3D ARM_SVC_SPM_RET_INVALID_PARA= MS) { - *MemoryAttributes =3D 0; - return EFI_INVALID_PARAMETER; + if (FfaEnabled) { + // Getting memory attributes is an atomic call, with + // StandaloneMm at S-EL0 being the caller and the SPM + // core being the callee. Thus there won't be a + // FFA_INTERRUPT or FFA_SUCCESS response to the Direct + // Request sent above. This will have to be considered + // for other Direct Request calls which are not atomic + // We therefore check only for Direct Response by the + // callee. + if (GetMemoryPermissionsSvcArgs.Arg0 !=3D + ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { + // If Arg0 is not a Direct Response, that means we + // have an FF-A error. We need to check Arg2 for the + // FF-A error code. + Ret =3D GetMemoryPermissionsSvcArgs.Arg2; + switch (Ret) { + case ARM_FFA_SPM_RET_INVALID_PARAMETERS: + + return EFI_INVALID_PARAMETER; + + case ARM_FFA_SPM_RET_DENIED: + return EFI_NOT_READY; + + case ARM_FFA_SPM_RET_NOT_SUPPORTED: + return EFI_UNSUPPORTED; + + case ARM_FFA_SPM_RET_BUSY: + return EFI_NOT_READY; + + case ARM_FFA_SPM_RET_ABORTED: + return EFI_ABORTED; + } + } else if (GetMemoryPermissionsSvcArgs.Arg0 =3D=3D + ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { + // A Direct Response means FF-A success + // Now check the payload for errors + // The callee sends back the return value + // in Arg3 + Ret =3D GetMemoryPermissionsSvcArgs.Arg3; + } + } else { + Ret =3D GetMemoryPermissionsSvcArgs.Arg0; + } + + if (Ret & BIT31) { + // Bit 31 set means there is an error retured + switch (Ret) { + case ARM_SVC_SPM_RET_INVALID_PARAMS: + return EFI_INVALID_PARAMETER; + + case ARM_SVC_SPM_RET_NOT_SUPPORTED: + return EFI_UNSUPPORTED; + } + } else { + *MemoryAttributes =3D Ret; } =20 - *MemoryAttributes =3D GetMemoryPermissionsSvcArgs.Arg0; return EFI_SUCCESS; } =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70367): https://edk2.groups.io/g/devel/message/70367 Mute This Topic: https://groups.io/mt/79696447/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70368+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70368+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691284; cv=none; d=zohomail.com; s=zohoarc; b=A3JbbJU02uJZyqFiUxrpncsVAoJESKe6QhP1fdpGufZVokFqRcRgTr182+BxADSezQ8tHcX9kluhH9mCaAtlsQPM406UsHJkq9qw4e4fEZ+rkj3ZzYgXaoZzsiykCQZifeKc36Fh520HKeL6NaCoRIFwNOdr81XHUiAuMnmCJyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691284; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=4mcA4/1JDow6ZtsgwPh4oiFKT8WpdmEwjFfXil/A7c4=; b=ZniI/oZ277WF0g+TyuRlYoF72bzVkXMDnpUJ3o3DHgthgzkV6t+Mg+WkxcH4DVEiN6WNvo+Y+1KjvcOHjPRzB77bqEcecs71ROoycWDAZoaabruYyHIlTjgZESWLFbdQHbyfHoVE31wps9Dtqv1diXAsDcdV+vg6NeLO308KWmc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70368+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691284983636.3109893580613; Thu, 14 Jan 2021 22:14:44 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0fEGYY1788612x2i1yfv82aG; Thu, 14 Jan 2021 22:14:44 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.518.1610691284091592372 for ; Thu, 14 Jan 2021 22:14:44 -0800 X-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 CCCC1ED1; Thu, 14 Jan 2021 22:14:43 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AB3BC3F70D; Thu, 14 Jan 2021 22:14:41 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Achin Gupta Subject: [edk2-devel] [PATCH v3 11/13] StandaloneMmMmuLib: Allow FF-A calls to set memory region's attributes Date: Fri, 15 Jan 2021 11:44:02 +0530 Message-Id: <20210115061404.13552-12-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: fbdHaQ0SA5yuDfqQVLTIHJmVx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691284; bh=apvfpVTGMCoeZognHunPnAQJxJN7abYzZoU4PwkryYY=; h=Cc:Date:From:Reply-To:Subject:To; b=Y+vhmZpn+7BM1u9pISrCMdGnISG4nKG2kzZJYoQCBDxJXGmIBuqcNvk/qrzbETD2fbM prTY1ek7SWD5lCI0SQZe8BiWFVTG7hYmVin55juK7OXAuTVXNXNdX6jANs3/IZHmEeP4K S9xPXthwnj0xvViezcLWbbLpDYaL/Qsw80U= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Achin Gupta Allow setting memory region's permissions using either of the Firmware Framework(FF-A) ABI transport or through the earlier used SVC calls. Signed-off-by: Achin Gupta Co-developed-by: Sughosh Ganu --- Changes since V2: * Check for the return value in Arg0 after the Direct Request call to handle errors returned * Put a comment to reflect the fact that FFA_INTERRUPT and FFA_SUCCESS response won't be expected in return to a Direct Request call to set the memory attributes ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c | 88 +++= ++++++++++++----- 1 file changed, 65 insertions(+), 23 deletions(-) diff --git a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLi= b.c b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c index 14fe781630..a30369af9c 100644 --- a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c +++ b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c @@ -116,47 +116,89 @@ RequestMemoryPermissionChange ( IN UINTN Permissions ) { - EFI_STATUS Status; + INT32 Ret; + BOOLEAN FfaEnabled; ARM_SVC_ARGS ChangeMemoryPermissionsSvcArgs; =20 ZeroMem (&ChangeMemoryPermissionsSvcArgs, sizeof (ARM_SVC_ARGS)); =20 - ChangeMemoryPermissionsSvcArgs.Arg0 =3D ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES= _AARCH64; - ChangeMemoryPermissionsSvcArgs.Arg1 =3D BaseAddress; - ChangeMemoryPermissionsSvcArgs.Arg2 =3D EFI_SIZE_TO_PAGES(Length); - ChangeMemoryPermissionsSvcArgs.Arg3 =3D Permissions; + FfaEnabled =3D FeaturePcdGet (PcdFfaEnable); + + if (FfaEnabled) { + ChangeMemoryPermissionsSvcArgs.Arg0 =3D ARM_SVC_ID_FFA_MSG_SEND_DIRECT= _REQ_AARCH64; + ChangeMemoryPermissionsSvcArgs.Arg1 =3D ARM_FFA_DESTINATION_ENDPOINT_I= D; + ChangeMemoryPermissionsSvcArgs.Arg2 =3D 0; + ChangeMemoryPermissionsSvcArgs.Arg3 =3D ARM_SVC_ID_SP_SET_MEM_ATTRIBUT= ES_AARCH64; + ChangeMemoryPermissionsSvcArgs.Arg4 =3D BaseAddress; + ChangeMemoryPermissionsSvcArgs.Arg5 =3D EFI_SIZE_TO_PAGES (Length); + ChangeMemoryPermissionsSvcArgs.Arg6 =3D Permissions; + } else { + ChangeMemoryPermissionsSvcArgs.Arg0 =3D ARM_SVC_ID_SP_SET_MEM_ATTRIBUT= ES_AARCH64; + ChangeMemoryPermissionsSvcArgs.Arg1 =3D BaseAddress; + ChangeMemoryPermissionsSvcArgs.Arg2 =3D EFI_SIZE_TO_PAGES (Length); + ChangeMemoryPermissionsSvcArgs.Arg3 =3D Permissions; + } =20 ArmCallSvc (&ChangeMemoryPermissionsSvcArgs); =20 - Status =3D ChangeMemoryPermissionsSvcArgs.Arg0; + if (FfaEnabled) { + // Setting memory attributes is an atomic call, with + // StandaloneMm at S-EL0 being the caller and the SPM + // core being the callee. Thus there won't be a + // FFA_INTERRUPT or FFA_SUCCESS response to the Direct + // Request sent above. This will have to be considered + // for other Direct Request calls which are not atomic + // We therefore check only for Direct Response by the + // callee. + if (ChangeMemoryPermissionsSvcArgs.Arg0 !=3D + ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { + // If Arg0 is not a Direct Response, that means we + // have an FF-A error. We need to check Arg2 for the + // FF-A error code. + Ret =3D ChangeMemoryPermissionsSvcArgs.Arg2; + switch (Ret) { + case ARM_FFA_SPM_RET_INVALID_PARAMETERS: + return EFI_INVALID_PARAMETER; =20 - switch (Status) { - case ARM_SVC_SPM_RET_SUCCESS: - Status =3D EFI_SUCCESS; - break; + case ARM_FFA_SPM_RET_DENIED: + return EFI_NOT_READY; + + case ARM_FFA_SPM_RET_NOT_SUPPORTED: + return EFI_UNSUPPORTED; + + case ARM_FFA_SPM_RET_BUSY: + return EFI_NOT_READY; + + case ARM_FFA_SPM_RET_ABORTED: + return EFI_ABORTED; + } + } else if (ChangeMemoryPermissionsSvcArgs.Arg0 =3D=3D + ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { + // A Direct Response means FF-A success + // Now check the payload for errors + // The callee sends back the return value + // in Arg3 + Ret =3D ChangeMemoryPermissionsSvcArgs.Arg3; + } + } else { + Ret =3D ChangeMemoryPermissionsSvcArgs.Arg0; + } =20 + switch (Ret) { case ARM_SVC_SPM_RET_NOT_SUPPORTED: - Status =3D EFI_UNSUPPORTED; - break; + return EFI_UNSUPPORTED; =20 case ARM_SVC_SPM_RET_INVALID_PARAMS: - Status =3D EFI_INVALID_PARAMETER; - break; + return EFI_INVALID_PARAMETER; =20 case ARM_SVC_SPM_RET_DENIED: - Status =3D EFI_ACCESS_DENIED; - break; + return EFI_ACCESS_DENIED; =20 case ARM_SVC_SPM_RET_NO_MEMORY: - Status =3D EFI_BAD_BUFFER_SIZE; - break; - - default: - Status =3D EFI_ACCESS_DENIED; - ASSERT (0); + return EFI_BAD_BUFFER_SIZE; } =20 - return Status; + return EFI_SUCCESS; } =20 EFI_STATUS --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70368): https://edk2.groups.io/g/devel/message/70368 Mute This Topic: https://groups.io/mt/79696448/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70369+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70369+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691288; cv=none; d=zohomail.com; s=zohoarc; b=Yxba2M7LNpA/UU2waRqKUlpH1+n8VwMghw3cmI/eTdpYNM6+WH5A42CEfyBeOl1inUU7vVZniQM5bkt+x0HFTkk0GhairQ/rTlhfehwUTwRt8fJTG8097yfyy68Ffc5oqMDjZZFxJq1qA28DoTtp11fSGedTaoqUO29btMxb7lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691288; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=jGuL+08B9BD2LUBzY0HoEVMQsnRUKk8/TuQZKttl2cM=; b=dPNEFBZFUdnJQQbTC1wHcVszYBfC9ZK+zLGUA6fqxDqzQ75q1obapQKXvQLlUTlFHqb4T3pZXD7SmdoNnsL8eR08KZ9vdRd2ecCgTErCPtr0F/nWR/IQbkjdE6M1Qgd9wp6I3aEalrMOsE0Z7LGMgSIDoUA+o2zJ56r5pbzOU1o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70369+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691288129804.2512728480905; Thu, 14 Jan 2021 22:14:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5bpDYY1788612xB3jxaGwwVr; Thu, 14 Jan 2021 22:14:47 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.503.1610691286499009001 for ; Thu, 14 Jan 2021 22:14:46 -0800 X-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 3223FED1; Thu, 14 Jan 2021 22:14:46 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A27A3F70D; Thu, 14 Jan 2021 22:14:44 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas Subject: [edk2-devel] [PATCH v3 12/13] MdeModulePkg/VariableStandaloneMm: Set PcdFlashNvStorageVariableBase to Pcd Date: Fri, 15 Jan 2021 11:44:03 +0530 Message-Id: <20210115061404.13552-13-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: PntabfW0GshWsnTw15XQksQsx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691287; bh=gUkMrebQxipwLydrObGbWB/4cN48b29udbWbBzN9azE=; h=Cc:Date:From:Reply-To:Subject:To; b=xTYWkqymzxbSoZ7NXvdnVu8Q5Tvbx7OhXII3GzIilrJLo3j8J0UOkkYktZYc9Zj/3w3 zIlgRK3AT1rRPysmZSg7xJoA1YID53VLdkIRYBSoH6PSWEOucewkSxd0dIOo0IHjrYUWd rpYtgaWEWS27xCKQvrwubK0v6lSX3/LU838= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ilias Apalodimas Instead of running StMM in SPM, OP-TEE creates a new secure partition, which emulates SPM and isolates StMM from the rest of the Trusted Applications (TAs). We can then compile StMM as an FD image and run it in OP-TEE. With the addition of a new RPMB driver, we can leverage OP-TEE and store variables to an RPMB device. Since EDK2 upper layers expect byte addressable code, for the RPMB to work, we need to allocate memory and sync it with the hardware on read/writes. Since DynamicPCDs are not supported in that context we can only use PatchablePCDs. So let's switch them to Pcd instead of FixedPcd and accomodate the new driver. Signed-off-by: Ilias Apalodimas Reviewed-by: Sami Mujawar --- Changes since V2: None MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf | 6 ++= ++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneM= m.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf index fada0bf3c5..2a25fbdada 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf @@ -119,10 +119,12 @@ ## SOMETIMES_PRODUCES ## Variable:L"VarErrorFlag" gEdkiiVarErrorFlagGuid =20 -[FixedPcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CO= NSUMES +[Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SO= METIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CO= NSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CO= NSUMES + +[FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CO= NSUMES --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70369): https://edk2.groups.io/g/devel/message/70369 Mute This Topic: https://groups.io/mt/79696449/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 07:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70370+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70370+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691289; cv=none; d=zohomail.com; s=zohoarc; b=a/U5AZ+sb3N82HR+arUoSk0TvhFnm3LNJmGx62KQuGu7xYnbLg4b41HrS3s2gJH/UkQWKHz/pkkfSkkkMY+CKd31Itv9738gULb94vpfaisnTPvy4GpZEG+LwNVD0IcBzbatwAg0OycF2ofGGh883/aXbrvOt6O6X6G2Skm7YtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691289; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=Pv4F3us611VEPdRjh9Yu5FNMRlKSpxFqmLrrDEvEDO4=; b=WqWt38hmEc+EzGJ7+4IrtRYTlSK3TMSk3aTJrrhmv+kXoxUcA5bArTFl4gfhYFdZ+xeWuhehxYq1gKdk73ADLm97bnAZH/DGrHQDbOA5dqMt90m1akmCvaQyzPng+soXrMt7SCvAq7wPQRwayUVUm/94E/aHpq54AXaMYB8qrNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70370+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691289952403.34338998915825; Thu, 14 Jan 2021 22:14:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UV67YY1788612x86aLUO9GLY; Thu, 14 Jan 2021 22:14:49 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.519.1610691289096116902 for ; Thu, 14 Jan 2021 22:14:49 -0800 X-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 C5396ED1; Thu, 14 Jan 2021 22:14:48 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A3AE03F70D; Thu, 14 Jan 2021 22:14:46 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Sughosh Ganu Subject: [edk2-devel] [PATCH v3 13/13] StandaloneMmPkg: Allow sending FFA Direct Request message to StandaloneMm Date: Fri, 15 Jan 2021 11:44:04 +0530 Message-Id: <20210115061404.13552-14-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: MXGrjrDc0jCTvq1NpurRFjR2x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691289; bh=bcepV+oZ3BIiBz9EEeItVKZFlj3rPshbEFpg6SxglZY=; h=Cc:Date:From:Reply-To:Subject:To; b=VbCD/h1tWUk6oQq2Atjb4JgrGxVQpuaTHL+CpDhwAY0Ax+gx84tsQf2E3wOKip2i2cO ZOjcDsFX1EUtTmDv/gPidk0sjR9rnus1h9XoUxpZRR/4q+i4wqurr+9thUwb6SL0Plcat FNR8VUWHnW4Ttqktj80vDsUGeWGGQNQlgIk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ilias Apalodimas Allow passing of a request to StandaloneMm Core through the Firmware Framework(FF-A) using FFA_MSG_SEND_DIRECT_REQ method. This method is used as a mechanism for requesting some service from StandaloneMm. Signed-off-by: Ilias Apalodimas Signed-off-by: Sughosh Ganu Reviewed-by: Sami Mujawar --- Changes since V2: None StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c = b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c index d86d21bb01..63fbe26642 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c @@ -22,6 +22,7 @@ #include #include =20 +#include #include =20 #include "StandaloneMmCpu.h" @@ -91,7 +92,8 @@ PiMmStandaloneArmTfCpuDriverEntry ( // receipt of a synchronous MM request. Use the Event ID to distinguish // between synchronous and asynchronous events. // - if (ARM_SMC_ID_MM_COMMUNICATE_AARCH64 !=3D EventId) { + if ((ARM_SMC_ID_MM_COMMUNICATE_AARCH64 !=3D EventId) && + (ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 !=3D EventId)) { DEBUG ((DEBUG_INFO, "UnRecognized Event - 0x%x\n", EventId)); return EFI_INVALID_PARAMETER; } --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70370): https://edk2.groups.io/g/devel/message/70370 Mute This Topic: https://groups.io/mt/79696450/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-