From nobody Wed May 8 22:10:40 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+71814+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+71814+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716588; cv=none; d=zohomail.com; s=zohoarc; b=Or4zgFW16/9ECY5047B0sQsniU3UmEr5mu2uBZ3oAaYPSgUGajsPKQg4qO1cjhQlLpBkWv7LB3/uy4YKhfoAZcoa90pE8cOjN0TgkyB9ydlPBcWqSJ5Ru7D/D8Cd12Ate7u51Pi3RMgIVcpZBDcV4gEsHulZjCFCF7kSKUB3ZkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716588; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=zNU4KqxYASqVv3Bc3NahjhrHvFZqU6Z9v8Ef0D52lMY=; b=MoMy1WtyeJunbE+6WOHuTDRqlfsExkUXt2bAE7pkYEQFR32THNK9/wb6bdrRzHQy1FWgy+8FJiiRvgTLxfygeGb2b62yLS7TLuLUUF8kxEJchB993XaK3aQyofu12ZA/QAlHkKEaQneaKGLSloY06TNJucSEC7WL/D/B2d7BfRY= 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+71814+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 1613716588624525.0930891535322; Thu, 18 Feb 2021 22:36:28 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id xQFBYY1788612xIJq4ZUnI8h; Thu, 18 Feb 2021 22:36:27 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5182.1613716581762220709 for ; Thu, 18 Feb 2021 22:36:21 -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 6B99F1FB; Thu, 18 Feb 2021 22:36:21 -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 BBB1E3F73B; Thu, 18 Feb 2021 22:36:19 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v5 01/14] ArmPkg/IndustryStandard: Add barebones FF-A header Date: Fri, 19 Feb 2021 12:05:54 +0530 Message-Id: <20210219063607.27920-2-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: 7XbVqnhCx8muTG0cc4Gdguwrx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716587; bh=MsDkKm37sbCsUpJcklwGZYlp/jX8/eudKjassnlA1HY=; h=Cc:Date:From:Reply-To:Subject:To; b=hW6p71fzEB6mjVGjXVUEsiYCa3sQ8cQbAiBcbH9HELTrVwNl+kqLePLRpY+aOihkGfl mZZ1PJaunReIITqLadjCBp5sU6TZJC0Ys09MSOgw7wvb9p6Mh9s1+TYQpjvYjvRVgtn19 FQWeOeHa651EKmJBPmridWpSBshuXgLnEyM= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: 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 (#71814): https://edk2.groups.io/g/devel/message/71814 Mute This Topic: https://groups.io/mt/80750045/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 Wed May 8 22:10:40 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+71815+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+71815+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 161371658478541.41396601707447; Thu, 18 Feb 2021 22:36:24 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id gsM9YY1788612xknjdVNsb5R; Thu, 18 Feb 2021 22:36:24 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5252.1613716583920458543 for ; Thu, 18 Feb 2021 22:36:24 -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 8B35D1FB; Thu, 18 Feb 2021 22:36: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 DAC463F73B; Thu, 18 Feb 2021 22:36:21 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v5 02/14] ArmPkg/ArmSvcLib: Return x4-x7 in output parameters Date: Fri, 19 Feb 2021 12:05:55 +0530 Message-Id: <20210219063607.27920-3-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: bllVyXrz4ehWqz1mvtWJZ3KMx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716584; bh=qMfeU2T1dBuW4hAlUOXPWy7OW9If/y3EI/6wCWccBvc=; h=Cc:Date:From:Reply-To:Subject:To; b=O/ga3T9ycp14ZU4+qV1Qb0g11k37p7voURzkUD5F8//1pvOgrn5qZwQcXTWeIy/BE7C 9TPbvvPGeYPe0ezXIinYPzxinvuxicFImt9z3mIIJw8nKZ9KH6vXvHQd8VwUQupRy29lT h7TY4WGttu4YOd+m0bPYcuo51LDa0XlEHQw= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: 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 (#71815): https://edk2.groups.io/g/devel/message/71815 Mute This Topic: https://groups.io/mt/80750046/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 Wed May 8 22:10:40 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+71816+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+71816+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 1613716592315832.2290626283303; Thu, 18 Feb 2021 22:36:32 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id xJoGYY1788612xqczqUmyvcr; Thu, 18 Feb 2021 22:36:31 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.5137.1613716586025396115 for ; Thu, 18 Feb 2021 22:36: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 AD2DF113E; Thu, 18 Feb 2021 22:36: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 06DE43F73B; Thu, 18 Feb 2021 22:36:23 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v5 03/14] StandaloneMmPkg: Use FF-A header file in Standalone MM Core entry point Date: Fri, 19 Feb 2021 12:05:56 +0530 Message-Id: <20210219063607.27920-4-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: nErdTMDEGBCXBMhDMTvmVJlVx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716591; bh=Urxu/qECTlvKkeSWWkLxGxdAA48aSHdJdqTSszLXYaU=; h=Cc:Date:From:Reply-To:Subject:To; b=r7cwOE2+dymuh9HBHiaZQXNSEGzzAdMTnhWJoT6WQqBnRROUNKVrFSpLuHxozTw3vYe qFghRAGXhuuel734NnYS+MdtPqLG+xyh1oDFmAcNUN69C5hVqZHbBXO6epHpxO1KJsfd4 7jUoLwAnYn1f3fGgyQ5vPJ+DJUJ/ks3rqUI= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: 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 (#71816): https://edk2.groups.io/g/devel/message/71816 Mute This Topic: https://groups.io/mt/80750047/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 Wed May 8 22:10:40 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+71817+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+71817+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716594; cv=none; d=zohomail.com; s=zohoarc; b=YvD5qhyx/9TZyugaP+gWjfyi6VfxqpJy4JNqSlJvx9z/Vy/7r4ZlcypO1C/XBIAGQrv1DTmBFc6a7Q/avtBmoiZJQJulHENMIhK1m2k224pD5IxDtTzY1GiIIDumrmz2r+tVWOHFE5tbtNXmTHwJKWrCGrju0ZG2tYte5lHFzqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716594; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=UXZDXuXDddCo0p4lYG0szRoAguT5Nqw0IlO9jwVhdi0=; b=QhK/NhQUvHphEpBmq1Ws2dEeSPrAOzvG88huBRqgd0Bs10rxcwyEQCus85gSe6XdIWoiKBCY5NE/5Ak6uzzYdH1AanlCCJjbhr0+onMp2b62qAZp0O0q6R/eukQY+fEJUHVt49jfMusP/H/C5hp9efjPkKEoySb0xLPd4zbmvGE= 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+71817+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 1613716594046936.244083942729; Thu, 18 Feb 2021 22:36:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id XUjVYY1788612xM5Xg4QPlXh; Thu, 18 Feb 2021 22:36:33 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5253.1613716588235085824 for ; Thu, 18 Feb 2021 22:36: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 CDA631FB; Thu, 18 Feb 2021 22:36:27 -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 294863F73B; Thu, 18 Feb 2021 22:36:25 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v5 04/14] ArmPkg: Introduce support for PcdFfaEnable Date: Fri, 19 Feb 2021 12:05:57 +0530 Message-Id: <20210219063607.27920-5-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: E6SGto4LqyzCl88T4L9iz6T6x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716593; bh=XYm7+6/UVfJGLCCzbYR4oxW8gGUDFNK9FRO31oIMei4=; h=Cc:Date:From:Reply-To:Subject:To; b=C0a62FQHyliRHzNv95JAH+cns6jM86U/rf2Kd7/y5p2Mu/0jqwkwadllWPZWaMly5+C WBwvH4s0z6PTeeq/bLLyK20Kt/Dkm4JBTy0hNzEQR5Ex4iZRa7yE4aAwYiPR7VMJsExWF Ml/cG6dCpWDiafE+IM5opSKCm4DaQiCP7GU= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- Changes since V4: None 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 (#71817): https://edk2.groups.io/g/devel/message/71817 Mute This Topic: https://groups.io/mt/80750048/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 Wed May 8 22:10:40 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+71818+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+71818+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716596; cv=none; d=zohomail.com; s=zohoarc; b=iiRfLJqcNCL9RxioccPB2lN0okAUb0AzUUry2px7hVi0F5ixZT6WzvdPTrIAO54vzwibCeyJjfzEhbT2JGDwIv0FdOm/GLDxRCdXssu2bwwnYrB0Gbx1lxXvZ9QxLvYgEpgejIutswFhcJdUCB01HmHHdIrrxTGbxhM4TPlbCoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716596; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=EPPiMVXVOz+s7KwIBWlacX7PkpB0pmP8n29+cfrtvi8=; b=C8/5QrzaoDEA2QYNyrF7Qu4NmIvJjkl+YNebMcZxmHf4Xx/Obm3SAqQ7DF19qDP46I50EAYYCLdE6+r54rzwPSpiKsUu2fXjyBLazSWyhJP9PwCJQGPupLTgpLx+Dzhhim83rBRgjU+OZM0smS44xcZtN7fMq+MdPgrpaFMyomk= 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+71818+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 1613716596386553.310295633698; Thu, 18 Feb 2021 22:36:36 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id cuMKYY1788612xugg17OCtnD; Thu, 18 Feb 2021 22:36:36 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5254.1613716590340798524 for ; Thu, 18 Feb 2021 22:36: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 EE4131FB; Thu, 18 Feb 2021 22:36: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 4A02F3F73B; Thu, 18 Feb 2021 22:36:28 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v5 05/14] ArmPkg: Add macros for SPM version Date: Fri, 19 Feb 2021 12:05:58 +0530 Message-Id: <20210219063607.27920-6-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: CBHQ5YYii5QcKsta1mQUqzFpx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716596; bh=/PITRbBKD6hBJZ5jYGrtepQS7kbuDFscu8ksjhBmw/c=; h=Cc:Date:From:Reply-To:Subject:To; b=b2eSM5c7OW/Uah3G5iar97TOxzHP1k4bWOaakgfMxjaRDIWOpep3jB/8cRjXaApwOsB +HZys1QcC+3Ao4Ea0ZabE9nQHDE61AJLBO8VT/Gg2F9SM+jQoebEnxA6Ni5cjW/ivK8te yGIZMZV7jWBE9tXr0yDD2G4nSvA+VFtsIu0= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- Changes since V4: None 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 (#71818): https://edk2.groups.io/g/devel/message/71818 Mute This Topic: https://groups.io/mt/80750050/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 Wed May 8 22:10:40 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+71819+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+71819+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716593; cv=none; d=zohomail.com; s=zohoarc; b=cKpCqpIncAz3fQ6l17X5BDeFFwNLgyTTY2xwWrDxY8343O9GrUa7ikcgNYS65gO2WTZxZMgSzT8/n2eaQ1haKqGdAjXktpuEZ6W+JnmHijfAmp28txVhE0OxI+gMz4u7F0IuC7cy4FO3XmOpYQURYQECjeQ89pKTnpxXyzkJBNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716593; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=PbpSSfsE8zB09XQV1a/zPu5DVIdko19MQP2X73y84x0=; b=azGe0t1x5WXC4OQEO2uTCcLP9nhob0yVZZLzz2Dh6kTp4iWKIRYwOMxnx/mOjRupGjbx9PIjS9MzSUV4urmnsmTB9IGI6UwhYUH+5l+2iJONKEtjwyX95kMf6MjnRkpp2uTCkQ26tJeKch1iSW19EyvOXgQPbW5JCFK877YzZkM= 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+71819+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 1613716593327808.3307739799163; Thu, 18 Feb 2021 22:36:33 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id tcZnYY1788612xsM1ogcaMFB; Thu, 18 Feb 2021 22:36:32 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.5139.1613716592446692045 for ; Thu, 18 Feb 2021 22:36: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 1F0781FB; Thu, 18 Feb 2021 22:36:32 -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 6A1223F73B; Thu, 18 Feb 2021 22:36:30 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v5 06/14] StandaloneMmPkg: Use macros for SPM version check Date: Fri, 19 Feb 2021 12:05:59 +0530 Message-Id: <20210219063607.27920-7-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: ovjtNfT22PZXFk807yt7uLmkx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716592; bh=ZYE4rWjhUK1I4+o+rezZq2wr1VKhp+qTwai6VpE5Tfk=; h=Cc:Date:From:Reply-To:Subject:To; b=e5sO9krQQgXER1y0pBPq9xEq/VfDMb7QvYbhJT6qX4FPemPcBhmYSO8iJgfSL+RinT4 UtsnXSTu9DVRJC/sYiN4Joi8edA2/40XSDxYdrQK/pbwpsURTWQpBuBLFcBHmUhM1LjJD 2/UwV8DRyC/2M3OJXP/i36ddxUIYuto11+w= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- Changes since V4: None 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 (#71819): https://edk2.groups.io/g/devel/message/71819 Mute This Topic: https://groups.io/mt/80750051/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 Wed May 8 22:10:40 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+71820+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+71820+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 1613716600792500.52672750628903; Thu, 18 Feb 2021 22:36:40 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id KDdhYY1788612xwpSs6PspnN; Thu, 18 Feb 2021 22:36:40 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5255.1613716594521974482 for ; Thu, 18 Feb 2021 22:36: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 3ACEA1FB; Thu, 18 Feb 2021 22:36:34 -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 8A44D3F73B; Thu, 18 Feb 2021 22:36:32 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v5 07/14] ArmPkg: Add macros for SPM version with FF-A support enabled Date: Fri, 19 Feb 2021 12:06:00 +0530 Message-Id: <20210219063607.27920-8-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: qrDiYNMHEUF5PfZZK1gROY9Dx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716600; bh=4nEiRSMRamNedk4pksqaDA8zi34fHDtty5Dm5sFJIMM=; h=Cc:Date:From:Reply-To:Subject:To; b=iE3xMLAECnaoANjeB4flQ4fUdpieW64XXYPHG3QvT5OfyKmBotUsWUthwELzSici6G+ ocNgUqb9D35DdLU2SuCvyZLNP49KMqpZZO6VF/sZFjc40fZeQrUqWZzmkCU+Xi4BWqH5V K76uFOYfyKn68PiDCStH5V5XiXfejZlW0dI= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- Changes since V4: None 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 (#71820): https://edk2.groups.io/g/devel/message/71820 Mute This Topic: https://groups.io/mt/80750052/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 Wed May 8 22:10:40 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+71821+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+71821+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716603; cv=none; d=zohomail.com; s=zohoarc; b=koKuYYH6lFlkFzRiFhyIW2fkfRgzLEuo6r8Y50ep7SdD31bNJlw6+3KUYOnX//15BRjObNdBHym7w6NRt7GXkNWSmSO/kauzKPMJ57qP9mLyhVip7nITbMZ9aYqcBdN6gpo+vINIcr4IiOPbbbkDO4XW0uLaismE0RNLNzK280o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716603; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=GbiNVib+LQlVIYSk8hYDJ/3idRzul4s0r3/DOIE87zo=; b=Y6NqYoDVpogPy8WUr6p6STMNK9t6rGkeC6RGZ9ODuvDx0/mjdhAzHrHR9cAPfYB5YJ9RMOOQx1865Z1HnD46m+MDjUsxsajqOLza1nRkT4w7AKjABQPqkZHNyHAkB1aYA3G8U/sgvyyWP+1xZalPPBILrIA4HFoc+5JZ1aZ159g= 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+71821+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 1613716602605206.462361095485; Thu, 18 Feb 2021 22:36:42 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id lAyfYY1788612xKuw2RkST80; Thu, 18 Feb 2021 22:36:42 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5265.1613716596733264197 for ; Thu, 18 Feb 2021 22:36: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 5CAD11FB; Thu, 18 Feb 2021 22:36: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 AA8043F73B; Thu, 18 Feb 2021 22:36:34 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v5 08/14] StandaloneMmPkg: Add option to use FF-A calls for getting SPM version Date: Fri, 19 Feb 2021 12:06:01 +0530 Message-Id: <20210219063607.27920-9-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: 5W6wJr5DmTxPflqvOuFxLCgSx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716602; bh=8EEQ0ySMc64UV/yyAZE7UcJcdRIWA39oTrIUmbhf+Wc=; h=Cc:Date:From:Reply-To:Subject:To; b=IhwmRvEauCxa4e7tZKNF6TBjVjb/VfUX78TRc0jM6RiBCf2vNXpuJ3JPFmJgiMbsst5 368nPEwIZIOWumYi84LUqPpX2M4lNzE9Ep5ji8qx853KhIHc3ZIa5pyNzd1z7152TYAo3 t8RjU77PFRSOpm+7IGmjWo6lo4rBI+tIvfc= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- Changes since V4: None 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 (#71821): https://edk2.groups.io/g/devel/message/71821 Mute This Topic: https://groups.io/mt/80750053/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 Wed May 8 22:10:40 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+71822+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+71822+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 1613716604700554.9924231722588; Thu, 18 Feb 2021 22:36:44 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id LxCNYY1788612x1YSBcLVzpr; Thu, 18 Feb 2021 22:36:44 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.5140.1613716598821078296 for ; Thu, 18 Feb 2021 22:36: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 7AF161FB; Thu, 18 Feb 2021 22:36: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 CA6453F73B; Thu, 18 Feb 2021 22:36:36 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v5 09/14] StandaloneMmPkg: Add option to use FF-A calls for communication with SPM Date: Fri, 19 Feb 2021 12:06:02 +0530 Message-Id: <20210219063607.27920-10-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: mZUlchLWSJquHxEHVhMVVOUGx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716604; bh=4SLbkG6ER55B+YEyHHEXg0budAPu20Iy5YsaBwyaQ/k=; h=Cc:Date:From:Reply-To:Subject:To; b=Y38F5GqGEKKiGz5OsR7SK6KhQAaj79xXbApB3YLxFhmbdr7NogclO8Hat9tviTqb7cf K8s28z+5eLOBzvGItRDPxgndipViavIl5iUN/EhKwz+ZaDm+Ul+Eq31v5jHTke1Cgz/Y6 xIj9N660Mik1xf3yNZuJVsJGUnAj02l41Ro= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: 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 (#71822): https://edk2.groups.io/g/devel/message/71822 Mute This Topic: https://groups.io/mt/80750054/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 Wed May 8 22:10:40 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+71823+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+71823+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 1613716606877140.83413236187698; Thu, 18 Feb 2021 22:36:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id I4FgYY1788612xYNZpHzZxYG; Thu, 18 Feb 2021 22:36:46 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5183.1613716600954881503 for ; Thu, 18 Feb 2021 22:36: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 9AFAC113E; Thu, 18 Feb 2021 22:36: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 EAF673F73B; Thu, 18 Feb 2021 22:36:38 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v5 10/14] ArmPkg: Use FF-A header file in Standalone MM Arm MMU library Date: Fri, 19 Feb 2021 12:06:03 +0530 Message-Id: <20210219063607.27920-11-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: d8ZGZ2hhwCDZvYSNdiq2x0SMx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716606; bh=NwlcGiZcQ7PO7bCnwqePwi98klxtGU5vRp7Mo2N8/Zs=; h=Cc:Date:From:Reply-To:Subject:To; b=HjEq2bLsK0N3JqTyIXaPrs9U8uiecJBQN1IcMv4vPj/UdA7tT+jEui+dTaKplXlbY2t +y3GRN2EChdMK0TvIaW6fuRZgkdclZGu5p+wLluSRUqxL7BQEfN8gIvdOtMRsliCdsqa0 LiWAs38Fm+93l4rSRt+C59KSc9GThWQSIFw= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: 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 (#71823): https://edk2.groups.io/g/devel/message/71823 Mute This Topic: https://groups.io/mt/80750055/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 Wed May 8 22:10:40 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+71824+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+71824+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716608; cv=none; d=zohomail.com; s=zohoarc; b=oEmneGJ9PYjh9bjNLG9+Cz+AHlwbCc8MGqscxNYAuQWQWqq4F+GmVW2H6FVzVFS6rUcR/b3WIVSFoZxkTfvJSWDVB5UboPC3qTpAoLJAsMWkuP+81TlAjpd7OhC2AhBWX0bXWsyZhyYZP3h2YYXPBMqReOGsaHhV6EQqXgtPLpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716608; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=FGU/8PIBjrVMJuuZA5Fu09UDW14HfuLlUkECbXK9vCM=; b=mBim0K5J5Uxe6vY6zJRNoG75SnWD2+LMCrREB1z84j+wcp12xHyPgBccN9KHyEVBJmeQC7o5WUq0XL9vU6EMaq0KMiP+aKkRhOcu079YmCfLwneImH8TCMSFLo6TXwjiyhekk7u3cqA44zgTDIewcNqkW/WiWCiSBTF1H0pSE7c= 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+71824+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 1613716608909478.3721445374647; Thu, 18 Feb 2021 22:36:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id cdPpYY1788612xbZLOp5YDT0; Thu, 18 Feb 2021 22:36:48 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5184.1613716603130484659 for ; Thu, 18 Feb 2021 22:36:43 -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 BC34B1FB; Thu, 18 Feb 2021 22:36: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 16C363F73B; Thu, 18 Feb 2021 22:36:40 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v5 11/14] ArmPkg: Allow FF-A calls to get memory region's attributes Date: Fri, 19 Feb 2021 12:06:04 +0530 Message-Id: <20210219063607.27920-12-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: p7tWPpQpPj2kiJfzifv9vgWCx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716608; bh=EZtX6PpX8Wu++s4ABSnRpDVft+AP3ds8eyBeGCJRiHg=; h=Cc:Date:From:Reply-To:Subject:To; b=lQAG/ZC4i14e4Hpc3Qhum5p7Bh2nGuNgVSBatG5bb/W5mWJXTPe+EaKNGuGVE7CCTe6 ph9205EOxH9RnBGYv01ggIGDfGEOYHRns8BqUJKXzs5bVlpr260RNxl/AAhy5mgyHzobN 7tvJUyd7YYKEMD2jdbF0Z1/4jeUWTzetGIo= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- Changes since V4: None 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 (#71824): https://edk2.groups.io/g/devel/message/71824 Mute This Topic: https://groups.io/mt/80750056/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 Wed May 8 22:10:40 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+71825+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+71825+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716611; cv=none; d=zohomail.com; s=zohoarc; b=DQwWupuWPWtUzYuIkWPtj6k3wz+w+2fefdE4L6Wg9gZWlj6PMggeDhmpwLYlQHDVm8jzANzPRuAQuTGH4BATeqvN4Dtk2ZElJEDVC+upHyZB2dE0P48bxmShhOQGLxmB5D2u+IKoTpjZZiDj5tRfeykWmbrFD+K8rMrKcVmbbnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716611; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=ckkdkiZmYH7o2B9XxhNFukrN5baRNA+UXn+xe79FdOE=; b=UEXgrbbtV2G3iHSwvKq+K2vW7o23Ugyn/PqXAC1y4CXibU2eiWLX2G/1IZHKxhnzMasZgoDdliudh20O+F+rE4Xg9/in3O7nIlM5pqMu6mDs13PkiPENrtK7oerRoT/xe4O+0Jd8nIhdb3CCsmyPnLmbwdTNWeHTsHZkpEivwQA= 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+71825+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 1613716611189480.47175885987747; Thu, 18 Feb 2021 22:36:51 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id mUZuYY1788612xKNLb5lgkI6; Thu, 18 Feb 2021 22:36:50 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.5209.1613716605286922211 for ; Thu, 18 Feb 2021 22:36: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 DBA101FB; Thu, 18 Feb 2021 22:36: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 377F03F73B; Thu, 18 Feb 2021 22:36:42 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Achin Gupta Subject: [edk2-devel] [PATCH v5 12/14] ArmPkg: Allow FF-A calls to set memory region's attributes Date: Fri, 19 Feb 2021 12:06:05 +0530 Message-Id: <20210219063607.27920-13-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: odhDhfficXxr7btzelfkgPogx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716610; bh=B4X/DYbpSUg46HJL0irfe9nC/+OXU2erb1lp4sZz+14=; h=Cc:Date:From:Reply-To:Subject:To; b=O1yAb8MIaNiK91ueQs09yN8HfM0oQqGBKxvHtA2xhVKwVc4O/TMsDajprb7GDmF5X2Y WhgHu4C6N1zA1BZotiZNYmI7uos9v8fEt3Wh9+RLoKwBGZ4elO/APwBqxlxkm351BPHP+ 6KdeDGHrpNSk0P3qv5eoCk66sfox8onMSDs= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: None 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 (#71825): https://edk2.groups.io/g/devel/message/71825 Mute This Topic: https://groups.io/mt/80750057/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 Wed May 8 22:10:40 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+71826+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+71826+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716608; cv=none; d=zohomail.com; s=zohoarc; b=hMqar1EPyJAqUKu+WhF3jnXmLz877I6lU7p0ue3DkSh42sT4F7d1hHwe9qZITR/+tYgN451q3W49x8P9GaMpiQwcI45BO0rmGeIwNX0+A/rPv2igX7khq/5UuKfw4RvoHHKycUfIxMw5hYPKjXlpxW89mocGDVCbBXt9edvlXqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716608; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=G2mcmibobGDalMaLe5oiAsVT+7HXERtPCgpREkEJgl0=; b=HDQpWpVpwjNAhIm/BKfV+KxLSHDT+NJlwradOWQivoKwDEMjyR4OxnnyAFu1CssSb5WXq7dE8siFIZkEyRKttUuaOnWa4D91YRGZ9SDTDPK82LXP+LyBozbnyPzadNRXwYApXq+PbarRCOp0/jg3cl59sgE33/zuVPxUwfXgYYE= 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+71826+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 16137166079931000.1241932434045; Thu, 18 Feb 2021 22:36:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fqMfYY1788612xf0FXrng42u; Thu, 18 Feb 2021 22:36:47 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5257.1613716607114954821 for ; Thu, 18 Feb 2021 22:36:47 -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 C1EF11FB; Thu, 18 Feb 2021 22:36: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 5775C3F73B; Thu, 18 Feb 2021 22:36:45 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel Subject: [edk2-devel] [PATCH v5 13/14] MdeModulePkg/VariableStandaloneMm: Set PcdFlashNvStorageVariableBase to Pcd Date: Fri, 19 Feb 2021 12:06:06 +0530 Message-Id: <20210219063607.27920-14-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: NF1FsiGg2jn4cmBJmt7mHPkBx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716607; bh=bFtTji2HfwTubl8sRbaxdJ2JOsMtkxST7QIKCv/kX5s=; h=Cc:Date:From:Reply-To:Subject:To; b=cAPOecZ+FLSX4cd917CD+sYv45dibpjdZ5kiujkEKGtIcHSiZpvfwikxYvpE/aBvGYp bbKGyFPiIYr1Zl745PaXetHpCu2DTO7aOhCog80tVgrAgsB3KBEqkOxj+w0FQCOKvkfRy 8ljyluw8aybhywiY8bkx4f0j9WrVCG9GlC8= 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. While at it, move the rest of the variables under Pcd section, instead of FixedPcd -- this is in line with how the variables are defined in the other Variable modules. Signed-off-by: Ilias Apalodimas Reviewed-by: Sami Mujawar Reviewed-by: Liming Gao Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: * Define all variable Pcd's under the [Pcd] section instead of [FixedPcd], as suggested by Liming Gao MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf | 4 ++= -- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneM= m.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf index fada0bf3c5..d8c4f77e7f 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf @@ -119,10 +119,10 @@ ## 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 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 (#71826): https://edk2.groups.io/g/devel/message/71826 Mute This Topic: https://groups.io/mt/80750058/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 Wed May 8 22:10:40 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+71827+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+71827+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613716610; cv=none; d=zohomail.com; s=zohoarc; b=hAWAJ+PQmWWCc3/rx9A8WEYnX3OkKPqCvFuJq9zi7FWvzikgceQp6plA7wCYGTpAHwsATu4Rgz23mvf21SdB3DSEFu9b/pJygE5bIESm8WcSFwfW39SpBzkwvH1XmQAURXVYlaeQYMq6hZZ3J1kGW+7N/xa2m6Pjqj3za0E9w/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613716610; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=0OIZ4nsVWKCSn8JzoGIEqjvyZu2Eso3ln+oEA0vZOFs=; b=YiAbizXu5NSQpxh9fkgDS2RK1U+57ctYslDVvsQC2ZjT6UL0PV10z1N9TQx1e6AsR9dDf5K/d7knOJ3GlogwRkqewKf3qypHUP0z5PERjgfXwKXVudFXMnkhzuxJbqLW9mezdV7dkKUUNw8rVgmIqueKjYGIVlGwTsv9fEn521U= 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+71827+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 1613716610117250.24986197915462; Thu, 18 Feb 2021 22:36:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 1RBQYY1788612xm2n1hsJkw3; Thu, 18 Feb 2021 22:36:49 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5185.1613716609207037442 for ; Thu, 18 Feb 2021 22:36: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 E1F761FB; Thu, 18 Feb 2021 22:36: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 3DE473F73B; Thu, 18 Feb 2021 22:36:47 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ilias Apalodimas , Ard Biesheuvel , Sughosh Ganu Subject: [edk2-devel] [PATCH v5 14/14] StandaloneMmPkg: Allow sending FFA Direct Request message to StandaloneMm Date: Fri, 19 Feb 2021 12:06:07 +0530 Message-Id: <20210219063607.27920-15-sughosh.ganu@linaro.org> In-Reply-To: <20210219063607.27920-1-sughosh.ganu@linaro.org> References: <20210219063607.27920-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: k5Eff9cbbpMz99Dat5vFaT44x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613716609; bh=KJwfOp+RxdzML2AUjRdlasc7NsJ9TS/P8VHMPirJ7ig=; h=Cc:Date:From:Reply-To:Subject:To; b=bVZKYAnYrxnspGVhXGrMDybPU5BOzMc0FatKL+Yjg24IsLjXgWvwgv9jYeSS4rCk+83 uYoo1iE1T5pK+SsVQhlZ7E0OKFJakFOoM1fY6Qi0RzFqA6W3d37s0d6vtKgBZ8S9qiX57 j3j2NWJzW0I5xoPzBwAcelQ8Ra6ZHraPfq0= 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 Acked-by: Ard Biesheuvel > Acked-by: Ard Biesheuvel --- Changes since V4: 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 (#71827): https://edk2.groups.io/g/devel/message/71827 Mute This Topic: https://groups.io/mt/80750059/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-