From nobody Mon Apr 29 12:11:53 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+71722+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+71722+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561257; cv=none; d=zohomail.com; s=zohoarc; b=GINOD0IBJd2rRbTxOH3KBNoxu6x7mqBHjzaw7IToJqykyJ3/hh80yqk/hiA4kwcjGAUjTdfhpDS+9EzEzBAfw7yFNMk0IyuGlkJqeFwOQYVz0XvFKGWvFY6UJjzquA+wSJePWd1Fzor/sqq/s+P8mP5cZceiDVlNuki6Lcp/tsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561257; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=Uiy35QxBwQi0V04A3J9lXCGMCF+QI8AJhXHtx0vSo1o=; b=mY6F52kl9ROiYaUZjWVHY/18EiwaD6uLbpMZdGnk8oEc8D+k13rrhYQuhJbdSUIRQM589Ym0f3jZmWFiWQHMdqwaxWVR5V3377bk0u7KO2eChW32cS+3wfLR6+ROYcJtOrdSoTQwH21PfDaLm7Ncr+QoStN1oHFSuU6zONHmej8= 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+71722+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 1613561256796885.9443185936235; Wed, 17 Feb 2021 03:27:36 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id OdjhYY1788612xswBLTvH37c; Wed, 17 Feb 2021 03:27:35 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.6145.1613561249953412161 for ; Wed, 17 Feb 2021 03:27:30 -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 64597106F; Wed, 17 Feb 2021 03:27:29 -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 AA46F3F73B; Wed, 17 Feb 2021 03:27:27 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v4 01/14] ArmPkg/IndustryStandard: Add barebones FF-A header Date: Wed, 17 Feb 2021 16:57:04 +0530 Message-Id: <20210217112717.6820-2-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: quqDBfWxq6UkCFNnaMv7UaNKx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561255; bh=sVgAd3nJpxv2JxOBXRH//jb6TpBp2rYnVI4pXqwaGTo=; h=Cc:Date:From:Reply-To:Subject:To; b=VteAYEnsoL7f8lelbEDmj9jE8Fiz0d1OjNqDwnrWCX/DuWkTsVZTsTOmj2XktOaUaoP hwemHviD1mc4gmGR57XqJLCOrdcEk2p00NEaImPmXyFK8zb4Sivf9a5eCbAiHCD4K1PW/ 7LP7dwlPSYErA4/8+JEkQefvwNapBWFUrNc= 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 V3: 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 (#71722): https://edk2.groups.io/g/devel/message/71722 Mute This Topic: https://groups.io/mt/80701004/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 Mon Apr 29 12:11:53 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+71723+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+71723+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561253; cv=none; d=zohomail.com; s=zohoarc; b=gasfy3wUnw1NWRAvCjkCdMwbEBGZpgyjVDNSi0bkvMtB6oSds22Jy/3oCSQTZRr/iQ82oiE6fVVOCX8cho3kWgoCLybQVVF4AGlXU/USkE3W2fq+eyJwag4oRZPPkcjD4JSpbZXsgpfAsTfx5vwoLu3SbeJd9JlYrmpBUnUaF6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561253; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=RviQGOBEQEr6HP1jpOHFz4X+TBylP2eMf3Arlp9sxX8=; b=no+cGkw1/TxlUgPxgKJxufDeyp8uT9JNtZnLIC/rgCsPVMfddGq3wEYsLfgV/gkJiUc90sKVUC/dgAS3ydNTiYXqLXv6ptz/65Zi/PuU2zQXjhZCalJd9MbZhb619mGdLPY5qaJtfk1w64xsSgFSxMrjdRhukmDttHuCdYGTARA= 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+71723+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 1613561253096481.5073638807653; Wed, 17 Feb 2021 03:27:33 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GFJjYY1788612xycaht329Jv; Wed, 17 Feb 2021 03:27:32 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.6279.1613561252267304123 for ; Wed, 17 Feb 2021 03:27:32 -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 8AE3E31B; Wed, 17 Feb 2021 03:27:31 -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 C9EEC3F73B; Wed, 17 Feb 2021 03:27:29 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v4 02/14] ArmPkg/ArmSvcLib: Return x4-x7 in output parameters Date: Wed, 17 Feb 2021 16:57:05 +0530 Message-Id: <20210217112717.6820-3-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: eZIy5R4OjS4xU42GAFHqSgJQx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561252; bh=ejVM89nlYRFmnEyOLQg0xjW0By/kW4gBaHGF1UTh068=; h=Cc:Date:From:Reply-To:Subject:To; b=BRDE2lrCqgY0NHB+T1ZEqI0jjCehvq3rSSXWXtId53OxuYWwUHjHF9XDp+7rMHEC9Cy REJ00fEwABHxLtkXJhPJfix99jZwEnrxPmczUv+GGAIec086j8+8hwQhGCTDDsKHnoeTp xdQtOA1Zod2pKuaIyxrqsgPj7HaQ4GCMTV0= 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 V3: 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 (#71723): https://edk2.groups.io/g/devel/message/71723 Mute This Topic: https://groups.io/mt/80701005/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 Mon Apr 29 12:11:53 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+71724+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+71724+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613561254828350.00646066482955; Wed, 17 Feb 2021 03:27:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id CNp7YY1788612x7YrmQCAZIS; Wed, 17 Feb 2021 03:27:34 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.6280.1613561253941590595 for ; Wed, 17 Feb 2021 03:27:34 -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 9916A106F; Wed, 17 Feb 2021 03:27: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 E974A3F73B; Wed, 17 Feb 2021 03:27:31 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v4 03/14] StandaloneMmPkg: Use FF-A header file in Standalone MM Core entry point Date: Wed, 17 Feb 2021 16:57:06 +0530 Message-Id: <20210217112717.6820-4-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: I7EJzDCO2Py1F4nUWp9sQ6iAx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561254; bh=SuztE+dgGrAqh0CCufNzurR5aF2F9wowHekBgbqllWQ=; h=Cc:Date:From:Reply-To:Subject:To; b=ENGvTJjvK0zQfwwxmxHGqOLPhKLccO0QCb0Rrd9Lx3v1lXJ+y/5Sx7S9SUgHtDF4P9q wp8N6F7HoLpsyiO1GdD+fayeArv5CDpT0ZeOzcWxV2YpU/0oH01iN6Xgk2eqtkyKESie/ F77vR5P0q+9/kMWQUb4bewpTfhUXhAA4qjo= 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 V3: 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 (#71724): https://edk2.groups.io/g/devel/message/71724 Mute This Topic: https://groups.io/mt/80701007/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 Mon Apr 29 12:11:53 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+71725+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+71725+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561256; cv=none; d=zohomail.com; s=zohoarc; b=HrotgBqdPrRESWgfAKPz8NldKAvu1t6g7J21XsesdG0nDZu4KP9+LIEWEa/XnhW0KQdO2fwpqvCxF5h44IbEsCpPfeRO9LVSmFOm38ip2zaBualq5EMwy1vPxkCsMvSCJfbUViwENjv8npnvohiJ89NstRyM4Ny5kgmb6s1a0Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561256; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=nHIuKScN+FRpYpyAsEjCPu/ntL1LQ0LSDCra4N5qCTg=; b=lqIMb5b3+PYHIAZXteMYjv7fecBiCcjroMI12FXJZf5BKKWUIqEeXN9kXF4hFrjYSVRxBWO/UEsLqzTxdPFVwofogjsns6I0L+28O3VCg2QO0ED9hakLtXtkOMJO96Ol2AOGGZFPISnL6/eLDXlgZ3EqUTcizzVRTj2x4+l2wqs= 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+71725+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 1613561256978226.63324926542077; Wed, 17 Feb 2021 03:27:36 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id XPN1YY1788612xpXt5hPndAG; Wed, 17 Feb 2021 03:27:36 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.6146.1613561256149257643 for ; Wed, 17 Feb 2021 03:27:36 -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 B8591106F; Wed, 17 Feb 2021 03:27:35 -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 14D043F73B; Wed, 17 Feb 2021 03:27:33 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v4 04/14] ArmPkg: Introduce support for PcdFfaEnable Date: Wed, 17 Feb 2021 16:57:07 +0530 Message-Id: <20210217112717.6820-5-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: vyTrazGnuYoSuvp5AOqrYXokx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561256; bh=A47+4AZru6eq3Dkd1Dp1Qd7f6+GAtZOSCt2oxEv59gA=; h=Cc:Date:From:Reply-To:Subject:To; b=RFaKZv6xBTZ2JcpNH156mOEAuo7PY4qJpgueuzyxv/MXquho+lQe7236MdIRRNFPOnD 9km94WIBOXDgulRXMsyft7vJgJE2nfbqhHtRT3ybGw3Slb+On2AdLe//PS2FFU6wHcU94 lEYb4uaJSluf0YC+IqI5wg44EaljD0uFKKs= 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 --- Changes since V3: * Put the PcdFfaEnable under the PcdsFeatureFlag.AARCH64 section to avoid build breakage for the X64 StandaloneMm builds. ArmPkg/ArmPkg.dec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index f0b136a57a..a8a22c649f 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -84,6 +84,13 @@ # hardware coherency (i.e., no virtualization or cache coherent DMA) gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride|FALSE|BOOLEAN|0x0= 0000043 =20 +[PcdsFeatureFlag.AARCH64] + ## Used to select method for requesting services from S-EL1.

+ # TRUE - Selects FF-A calls for communication between S-EL0 and SPMC.=
+ # FALSE - Selects SVC calls for communication between S-EL0 and SPMC.<= BR> + # @Prompt Enable FF-A support. + gArmTokenSpaceGuid.PcdFfaEnable|FALSE|BOOLEAN|0x0000005B + [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdTrustzoneSupport|FALSE|BOOLEAN|0x00000006 =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 (#71725): https://edk2.groups.io/g/devel/message/71725 Mute This Topic: https://groups.io/mt/80701008/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 Mon Apr 29 12:11:53 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+71726+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+71726+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613561259071361.63862895187265; Wed, 17 Feb 2021 03:27:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id v8EWYY1788612xmBQhYnCydU; Wed, 17 Feb 2021 03:27:38 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.6200.1613561258263172380 for ; Wed, 17 Feb 2021 03:27:38 -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 D6C7831B; Wed, 17 Feb 2021 03:27:37 -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 33CFB3F73B; Wed, 17 Feb 2021 03:27:35 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v4 05/14] ArmPkg: Add macros for SPM version Date: Wed, 17 Feb 2021 16:57:08 +0530 Message-Id: <20210217112717.6820-6-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: xp6BKCjICBPhkFCdkhlAC0yvx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561258; bh=XO7tbYTqCB8tZFz+sxTTEi4QQtqZ/8fdOELCzvfs2y8=; h=Cc:Date:From:Reply-To:Subject:To; b=hmMK+/vG0WZMRO9bWA0o1TPvqGoaQXDNMBocWKJheN3qTVIbwInGS9Mu/mbeTtqptxD JmwKtza9e+keLkoHksc1Uu/QMu9n6dnt259gWcb2Bj+OSTqSU67eXv4m0FuzDzgepSwQO bfT2smXDFx8ChGYTZ4qIDw83Bj7LGVPxD/c= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Declare the values of SPM major and minor versions as macros which can be used in the module for checking the SPM version compatibility. Signed-off-by: Sughosh Ganu --- Changes since V3: * Put the macro definitions for the SPM major and minor versions in a separate patch, as suggested by Sami. ArmPkg/Include/IndustryStandard/ArmMmSvc.h | 3 +++ 1 file changed, 3 insertions(+) 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 --=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 (#71726): https://edk2.groups.io/g/devel/message/71726 Mute This Topic: https://groups.io/mt/80701009/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 Mon Apr 29 12:11:53 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+71727+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+71727+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613561266662566.3290411007063; Wed, 17 Feb 2021 03:27:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id JQ2JYY1788612xDNiAxSCgP6; Wed, 17 Feb 2021 03:27:46 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.6162.1613561260289884546 for ; Wed, 17 Feb 2021 03:27:40 -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 02380106F; Wed, 17 Feb 2021 03:27:40 -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 52CA73F73B; Wed, 17 Feb 2021 03:27:38 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v4 06/14] StandaloneMmPkg: Use macros for SPM version check Date: Wed, 17 Feb 2021 16:57:09 +0530 Message-Id: <20210217112717.6820-7-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: pT5Pzu8Q2JKbQdKhMELAuoM8x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561266; bh=tenNO1yDcTZngOikjuAS9avi0BVmM4TVAoljREYpbgU=; h=Cc:Date:From:Reply-To:Subject:To; b=H/mrGXOvU+w7khDjtqqqDOikSooOLuvDt9yet5Bf4ab0z3dL2gvXZRbwFTzhBQTP7Wh HWxApqK7Ezu9qSFWEpbYjzhzoP6mDHJigc0cZt130OifVAhaaBPYotb/RZS/QIWjWu39q rKKyrJJAOLTLll2kbhySmghwUAAJbdUWVDE= 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. Use the SPM major and minor version macros declared in the previous patch for the version check. Signed-off-by: Sughosh Ganu --- Changes since V3: * Separate out the declaration of the SPM major and minor version macros in the earlier patch as was suggested by Sami. StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 (#71727): https://edk2.groups.io/g/devel/message/71727 Mute This Topic: https://groups.io/mt/80701010/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 Mon Apr 29 12:11:53 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+71728+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+71728+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561263; cv=none; d=zohomail.com; s=zohoarc; b=Ex7pJxR0c/ACMe5CE9bgeCa7+nxi6j/gX5q5BdMB9uvTBpZFPD/Jc3vieW587mU4f1FI04OI8A4MBmfHbKopwOb5dkd03Xj25afgmPxsb9Oqh63AG8jBDC/wmZAVlslBboFZAVkd7ixUs189aBmuwIFnzs3H+Kvr2PUmJPh7kSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561263; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=c8vlfFY446w6b8cm72F/FMBXSf+vMmyMSwVYy8onLyM=; b=kao+IG6D8YRfgmwJup//d2xxt2UnEZprVD+gYWth8fSJ6UyEXM1ZbcFcd8Rgq/egkBj/prMu9SytvipJvceR2Qa1hDlYisi2XUSsbOp0RePI7FW9XHZfqAIGWwhy1bPU8HRV4xmdnnGhOTX4Z9yeH2KackqBy3X3h28zzmBppXY= 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+71728+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 1613561263460303.8333960006337; Wed, 17 Feb 2021 03:27:43 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GcUmYY1788612xgn2ZlhKOoG; Wed, 17 Feb 2021 03:27:42 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.6147.1613561262454181952 for ; Wed, 17 Feb 2021 03:27:42 -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 20FB631B; Wed, 17 Feb 2021 03:27:42 -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 71CDD3F73B; Wed, 17 Feb 2021 03:27:40 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v4 07/14] ArmPkg: Add macros for SPM version with FF-A support enabled Date: Wed, 17 Feb 2021 16:57:10 +0530 Message-Id: <20210217112717.6820-8-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: aE0Gjt8uvoPGBuVAEPA2AdyQx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561262; bh=Ehk+kklmo17hGh4P6HWyoZ03HBS/+cWtzsaaLXAumKg=; h=Cc:Date:From:Reply-To:Subject:To; b=EH62Ok2rgzNz3ZGo2rcHNpHsadJ2Mo5dtWThreuaZnVd6avXy2ZTVlh3Z5q8eZNug+C PxkXb+Wx+bXMx9TqpoYZM5L6gV85qSU4zRq0JcnSDHXeP2T79+fdgW9mfHSbITwTFwTP/ hJJxdnXoIVs6esgQFI4JajQXhgl+VXMa8fQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Declare the values of SPM major and minor versions as macros with FF-A enabled, which can be used in the module for checking the SPM version compatibility. These SPM major and minor version numbers are mandated for having support for the Firmware Framework(FF-A) feature enabled. Signed-off-by: Sughosh Ganu --- Changes since V3: * Put the macro definitions for the SPM major and minor versions with FF-A support in a separate patch, as suggested by Sami. ArmPkg/Include/IndustryStandard/ArmFfaSvc.h | 3 +++ 1 file changed, 3 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_ --=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 (#71728): https://edk2.groups.io/g/devel/message/71728 Mute This Topic: https://groups.io/mt/80701013/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 Mon Apr 29 12:11:53 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+71729+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+71729+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613561265773808.7858781736097; Wed, 17 Feb 2021 03:27:45 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id hu5PYY1788612xB7LA3FXrWJ; Wed, 17 Feb 2021 03:27:45 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.6116.1613561264752067275 for ; Wed, 17 Feb 2021 03:27:45 -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 401DD31B; Wed, 17 Feb 2021 03:27:44 -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 90CD33F73B; Wed, 17 Feb 2021 03:27:42 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v4 08/14] StandaloneMmPkg: Add option to use FF-A calls for getting SPM version Date: Wed, 17 Feb 2021 16:57:11 +0530 Message-Id: <20210217112717.6820-9-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: bdPVHmNTedzuJE60IvXuWfgAx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561265; bh=Ga8K1grSQXcF/NA1lN8VtQdhsT4YT+be100oQnl77sU=; h=Cc:Date:From:Reply-To:Subject:To; b=N+w6D6YZzR6AoDSgEgQHopT7HtvbfuHa/bS5eyTnjxNoLiiq7s05gP84O0kg20W1Crk S0uzU/Fk+GItdZLfeo7JAJ9KwC3RBc8YKXVrpt3PnTbMYOozaikfsBVkKFTFwgLnvOpc5 YyLcxo0srx89DpA6yxzX6O66qIcZ4TsPfN0= 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 --- Changes since V3: * Declare the PcdFfaEnable Pcd Feature flag under FeaturePcd.AARCH64 to avoid build break for the X64 build of StandaloneMm. StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPo= int.inf | 3 ++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 40 +++++++++++++++----- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 313bc6f7bd..4fa426f58e 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -51,5 +51,8 @@ gEfiStandaloneMmNonSecureBufferGuid gEfiArmTfCpuDriverEpDescriptorGuid =20 +[FeaturePcd.AARCH64] + 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 2643473e88..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,10 +32,14 @@ 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; =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; @@ -175,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 @@ -196,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 (#71729): https://edk2.groups.io/g/devel/message/71729 Mute This Topic: https://groups.io/mt/80701014/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 Mon Apr 29 12:11:53 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+71730+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+71730+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561272; cv=none; d=zohomail.com; s=zohoarc; b=FD2PtWHEurkIjpPGCGYZ+nk5RHOkc8F83SJx2qn1BOXRpltLfX4i9+zVSw5d6E7O32phntZUW5wO2FaBsQ2Y8xNlJNTEiPtvcI8mO2nKNFINAT7ELST0v+kxmkqjmHeb4EjP6ocxGxtg2QmkU5nB9ym8l3WZStdt/OXzCvyu5tw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561272; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=Z7b174fuxxnbbLXojG5RKzq+XuxMEaC7MCFRalyOni8=; b=O492q1i8UCKaXRGqboavcU49vAKWj0JskSzfEPkghCa/sGxp2wicz1nqf0geFx++hElZPHJTbQdDN/74GaaZLJC948tHNHcewy3VG91lFCsM/RryktGxoj51sCtfqJra8n6oTW1GmD207kqrEJ88aYjyLsFC7a2f9sIdMpvCQLQ= 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+71730+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 1613561272535942.1156495769025; Wed, 17 Feb 2021 03:27:52 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id s9KoYY1788612xuRj5iWTqc5; Wed, 17 Feb 2021 03:27:52 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.6201.1613561266714450278 for ; Wed, 17 Feb 2021 03:27: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 5F8BB106F; Wed, 17 Feb 2021 03:27: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 B03793F73B; Wed, 17 Feb 2021 03:27:44 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v4 09/14] StandaloneMmPkg: Add option to use FF-A calls for communication with SPM Date: Wed, 17 Feb 2021 16:57:12 +0530 Message-Id: <20210217112717.6820-10-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: KkBiSdayOJpGtZdoSwym6tu6x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561272; bh=5OT/1jzCJrWmuhoQokne1jRH/ocMZwHHhdJ+jnTdlQk=; h=Cc:Date:From:Reply-To:Subject:To; b=xACoCqzbySDpHh+c4wlJtZSoIBqU1vqxh1sEXEPV7llR5+gnzU626CXjCir+MuWnzPa 8vhQ86cBRKoIAb8TJ8CYbWaEyqwmar1hsHsKoE9fgaj4RjKKFUFiPeQkPw3BFwTITek+c CFCzm00lkUpCn5zpGyW215Zkc1a6FYDPUbw= 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 V3: None 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 (#71730): https://edk2.groups.io/g/devel/message/71730 Mute This Topic: https://groups.io/mt/80701015/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 Mon Apr 29 12:11:53 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+71731+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+71731+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613561270063801.8721394380708; Wed, 17 Feb 2021 03:27:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id HdFjYY1788612xD2Qk34da6G; Wed, 17 Feb 2021 03:27:49 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.6281.1613561268928924430 for ; Wed, 17 Feb 2021 03:27: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 7E9D331B; Wed, 17 Feb 2021 03:27: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 CF4FA3F73B; Wed, 17 Feb 2021 03:27:46 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v4 10/14] ArmPkg: Use FF-A header file in Standalone MM Arm MMU library Date: Wed, 17 Feb 2021 16:57:13 +0530 Message-Id: <20210217112717.6820-11-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: q53SxvKd0iaz0XQNvOQeoMRPx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561269; bh=y/Yd1pWmQ9Rmt95vllEK9TconUe7+R3wtlKc5ncooT0=; h=Cc:Date:From:Reply-To:Subject:To; b=tnW2xpQrCnu4llSLX6YmUhhmKJ2H82F56N3uEzO4ttcG1n3KqYOjyTx99CswW1Pecbn 3jP5/07w5giKbBi5R9zpef3yhyOJfTuRtooPpXOrON/OVmsaEKu/Kzh+KLcgpnp4mu0ac sxxccXweBeYH3PjiHyPN2TUcnJkAuXj87RI= 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 V3: 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 (#71731): https://edk2.groups.io/g/devel/message/71731 Mute This Topic: https://groups.io/mt/80701017/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 Mon Apr 29 12:11:53 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+71732+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+71732+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561272; cv=none; d=zohomail.com; s=zohoarc; b=K14ymrQeePRgvunJPyWIVVPi0m+CF2Q84LUc84Y52AhsMz0ixblRL1NT11EkESIjyUkBWn9dEFYPLWSNOBu2SU3zqiTlulOjISHDhhsoWW1hxjnsm6cdCQRWS94lZ0wpoyIBOT/PDN0fdNDaK5gxfkf7wa9sEaJtKjZ2Soerf5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561272; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=JhYGCPds+i6yV7RSS7ra83zcAwRPhsMArSAnxRaPmos=; b=ZSkJr2dB84uj3qY3I5pnrmYRg+KMZpKP8Kwd6W83rmpt0lN/9ioKVTOPBZkviP7AwKC/5K2Y3RXkPHWQnYKgrp78wtxaxCaJxM9gRtl5yxgka/LRS527Bro8k0iNdQKy7gryNB5pUcUh4CFYC/NHD2A2BQYikE+FRNvMcF50iE0= 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+71732+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 1613561271973721.3814269912083; Wed, 17 Feb 2021 03:27:51 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id EiasYY1788612xHxC9Lg9H2z; Wed, 17 Feb 2021 03:27:51 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.6165.1613561271065429211 for ; Wed, 17 Feb 2021 03:27:51 -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 B03DD106F; Wed, 17 Feb 2021 03:27:50 -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 EEC913F73B; Wed, 17 Feb 2021 03:27:48 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v4 11/14] ArmPkg: Allow FF-A calls to get memory region's attributes Date: Wed, 17 Feb 2021 16:57:14 +0530 Message-Id: <20210217112717.6820-12-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: buvIgpNIOMvxFjnxawALHu1Gx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561271; bh=eK30RVEBmK5jrJqeCJknrn8fSCWBtwKKY00bO4y9acY=; h=Cc:Date:From:Reply-To:Subject:To; b=CWnUD4qxn5R0IcGrfcpys/82fQXtiFkBEfrM6BAI9u8000AfKygnE1zCl1lyE4CsWAO AHv1AgnhCI0bBtAdzsTlPC98dgxWU32dufAZGNh0CUItfIHjUQ1JKHbJDYEd3jY+DNvkq eHLOrwnDY2z9LJ1ZcNNFbwApejvuURrUjNs= 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 --- Changes since V3: * Change the patch header to have the ArmPkg prefix instead of StandaloneMmMmuLib as suggested by Sami. * Put the PcdFfaEnable flag under FeaturePcd.AARCH64 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..89dda509c5 100644 --- a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf +++ b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf @@ -23,6 +23,9 @@ ArmPkg/ArmPkg.dec MdePkg/MdePkg.dec =20 +[FeaturePcd.AARCH64] + 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 (#71732): https://edk2.groups.io/g/devel/message/71732 Mute This Topic: https://groups.io/mt/80701018/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 Mon Apr 29 12:11:53 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+71733+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+71733+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561274; cv=none; d=zohomail.com; s=zohoarc; b=NOsHzG5ZPKvE/gUGxz7KATPXzbc3g2AzfMce6JEQf0fa7LiJO5RaG9bAMkkegIlper7jV2/S3pyFBmPqw9mYgX3iklWDx8yqZzOYtjkSsztJMBSSLiNyL3CRElXtCtk/DMAmKqN7l77lNR3SfOpk+SnHf8xSzTmkzbiEfAg/u+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561274; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=pAvjfj/bxh5vVzWcu4/npVzwbebSsIluHk4VC4AuMow=; b=Ixp2hrNuNaiD0QFRrsjUbpBrpxpYkKI51l0AQnAvYdOmbO/tIDw+CIeo/lkjABv49+vnzTBmm5pMdJUPXNPJPUc0FOruHzLt7USzYJY0Rn7eNBGdypdQUfWwH8Z9CBNAxOE9abrQZjsnTq04vY4PJ7V/vWK38K+dJ29XN/GAqR4= 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+71733+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 1613561274077114.89521659959041; Wed, 17 Feb 2021 03:27:54 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id I7UjYY1788612xbTGxQK8vOj; Wed, 17 Feb 2021 03:27:53 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.6203.1613561273093135462 for ; Wed, 17 Feb 2021 03:27:53 -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 C38FD11D4; Wed, 17 Feb 2021 03:27:52 -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 19A963F73B; Wed, 17 Feb 2021 03:27:50 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v4 12/14] ArmPkg: Allow FF-A calls to set memory region's attributes Date: Wed, 17 Feb 2021 16:57:15 +0530 Message-Id: <20210217112717.6820-13-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: Td2G6ymxEy7iUP0INo0qaTMUx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561273; bh=pbOzsKIMqlVZUr7CRTIAUXXqv4xhm/CYVnGxNuxC/wA=; h=Cc:Date:From:Reply-To:Subject:To; b=T9ovRBa++APKa9qYpkGAYG4lyXZEIA1sUYJJtK80Eb6CvSP4rHbICIHhUeptWZ4j/Jy HuOg4orT+xCNq6dX1Ko1bIcBn8gpzAgGzQaOiSFabMLMDeEQ7lWhY29CFb6JYhrYitx+a Yw0e790ftv7o38L29LDjNdGhstobkLkyaXo= 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 Reviewed-by: Sami Mujawar --- Changes since V3: * Change the patch header to have the ArmPkg prefix instead of StandaloneMmMmuLib as suggested by Sami. 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 (#71733): https://edk2.groups.io/g/devel/message/71733 Mute This Topic: https://groups.io/mt/80701019/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 Mon Apr 29 12:11:53 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+71734+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+71734+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561282; cv=none; d=zohomail.com; s=zohoarc; b=R9G4pOyJoSB8F5tqXBvtl1tQCkUytgcIJe48sk5fwBCQt0U2UFKq47DBIsJs+MtLiyiazYvjCJ4JuiXpUw10BYnUL3EhIICA71BepJgMPLW8s/iVf8gn5mnIQBz7HO+4P6DEmR173bNKigJkGsRCoalzfw8BFLWgSLogZMIAbOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561282; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=wA/4b276cAbrWH77xDjc3ohFCMY4g1rMwQfItSZp+p4=; b=IO+j4UPJZ9YMy8zBuG1vGUGoeDhVq5MDPbdmISapC3ytLE4UJcpMSSE3Joq+cFqVaYullGGlFe17RekFQspxE9wpaV/2EchRMxJ69O8ubjBUYfsbw8l9bukOWH9RnrcbgJowLQF4wBILdEmMx6MGyiE9Y2MrkdcFPXMWP0prHGk= 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+71734+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 1613561281925226.0489433097249; Wed, 17 Feb 2021 03:28:01 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id AwuEYY1788612x3021acoglR; Wed, 17 Feb 2021 03:28:01 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.6204.1613561274949438084 for ; Wed, 17 Feb 2021 03:27:55 -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 A321131B; Wed, 17 Feb 2021 03:27:54 -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 3892A3F73B; Wed, 17 Feb 2021 03:27:52 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel Subject: [edk2-devel] [PATCH v4 13/14] MdeModulePkg/VariableStandaloneMm: Set PcdFlashNvStorageVariableBase to Pcd Date: Wed, 17 Feb 2021 16:57:16 +0530 Message-Id: <20210217112717.6820-14-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: VWn8unUas48ZKEhpowcSR5wsx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561281; bh=wanxXcUgKL/fjv/+6LgLTHKbjbCg6Q8DHPXy9CLSY2A=; h=Cc:Date:From:Reply-To:Subject:To; b=Xu1IzjPYH1gltXhPKrROlXk5RzOV9JUDwmb9tuT9QdcO9b3qHg6E/okjcInD76c5nIB pAcKIl+JB7vnElc4P0f00TLcCsUzmO6XK9+SLEV0zQ8SSojAB4jSG1XODrLNzX6iSVymP SsdzbZOHst+Kdshkpms+DJ69oGWPC7GN2eU= 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 V3: 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 (#71734): https://edk2.groups.io/g/devel/message/71734 Mute This Topic: https://groups.io/mt/80701021/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 Mon Apr 29 12:11:53 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+71735+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+71735+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613561284; cv=none; d=zohomail.com; s=zohoarc; b=i15X7FcE4+8wRPbCsCNdsGe+uyzm7PQ0Jg3IuGpRNowPPTZ9hgTrapQi74p1WMN+M1CbGHKgyFwC1zGhdO192/pHHEX60xlbBsm+xlGbV3oKdxb55x9tniKy2q0A8Y9HXc8E3YVwb56mu74cpDalRz6TJhjlGvU/G82GdpYcPvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613561284; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=npCRHlTS1t4N20i6AeUUEHGKzSJonaiW4MgYtGziNh8=; b=btlCaUpTDv+GFMI/QwRNmy4zrybZC/VOyPLvAjbijbUzTmCgzxxwJPgwdkJpR7wSltmW0YYiy30+w4ZILxh5k37+4e333FHiAmUz/FWMfTWLTKtP8JXcXe1VjJHYsbDmMBgFp3mRGhBRM94SBuiKtAyjq5JudW6dTytt6MfbCwI= 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+71735+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 1613561283660466.2505804213931; Wed, 17 Feb 2021 03:28:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fYyPYY1788612xRHBCQg5pXw; Wed, 17 Feb 2021 03:28:02 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.6122.1613561277078872434 for ; Wed, 17 Feb 2021 03:27:57 -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 C28CC31B; Wed, 17 Feb 2021 03:27:56 -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 1F8E93F73B; Wed, 17 Feb 2021 03:27:54 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v4 14/14] StandaloneMmPkg: Allow sending FFA Direct Request message to StandaloneMm Date: Wed, 17 Feb 2021 16:57:17 +0530 Message-Id: <20210217112717.6820-15-sughosh.ganu@linaro.org> In-Reply-To: <20210217112717.6820-1-sughosh.ganu@linaro.org> References: <20210217112717.6820-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: RSEHIZcsRtGipllam6YwZYHFx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613561282; bh=uIIDDfLLC2SFFynpyLSp1ttP3r/V2u/pph06KHJzo8M=; h=Cc:Date:From:Reply-To:Subject:To; b=YEb9MiEqYo64AlcO+9ctiOmLkkWDDPCyqlXdo1Jsa6QD9BEUWh2p6BGUW6oa3qk7elI Qhy/rccg1T5DBnzwllogm7lPKsCz0N23FeTDh8vjsOGDUm4UpHI0i61oqMDskpbDdGXEm 3/0qM8/P0I+s0h+AlFQOKofCuoenfFVIJGE= 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 V3: 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 (#71735): https://edk2.groups.io/g/devel/message/71735 Mute This Topic: https://groups.io/mt/80701022/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-