From nobody Tue Feb 10 03:38:32 2026 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+68773+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+68773+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1607957106; cv=none; d=zohomail.com; s=zohoarc; b=iohzIUPdC+06DyG1c5WIMBGT4MfpTaDkejLuZlkJBJogcDFpGI/0wSj1VnN2Jz6jNaM2hWvWLfzSfWtqNnKwnwc0MEA1OuHXsjjsP1Im3MloTOO2ylaHOtMr+woHzhSz+qxgJ/TmnbCVw1uh1T7nU9ONucjAyzKqG/SF0YqVm0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607957106; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=fOizgH8Ivb175cYKTjdsaEB8KYVKK19qRVpN8xdSGw4=; b=VmJbSbTpOinlTbM31DWPhmJVeEfGWFVd86EdgKiTxrrolRCkJ3cYjlc6AeGu+145qd6D0tDPkQK+zMe449+T7Y71h6LorZaB39v2rbL03CwfSKC1wa6lAtFlCYMLIEyt3dM+6Ct2ZHTeuDBgmeWTiglRRXC5bv13jMidvKVrY4M= 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+68773+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 1607957106840488.7442270935775; Mon, 14 Dec 2020 06:45:06 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Hkx0YY1788612xXoMNVFR1QZ; Mon, 14 Dec 2020 06:45:04 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.35678.1607956966222066859 for ; Mon, 14 Dec 2020 06:42: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 AF8B230E; Mon, 14 Dec 2020 06:42:45 -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 AF9A03F66E; Mon, 14 Dec 2020 06:42:43 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Sughosh Ganu Subject: [edk2-devel] [PATCH v2 07/13] StandaloneMmPkg: Add option to use FF-A calls for getting SPM version Date: Mon, 14 Dec 2020 20:12:10 +0530 Message-Id: <20201214144216.26328-8-sughosh.ganu@linaro.org> In-Reply-To: <20201214144216.26328-1-sughosh.ganu@linaro.org> References: <20201214144216.26328-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: 23VhbbvcK21l0U8lABtvVI9jx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1607957104; bh=E2PFqyoY8zQyjdZtYWS74FRoGksj0xDcrRIFQB5+jrw=; h=Cc:Date:From:Reply-To:Subject:To; b=O9bo9TVmvucZP8OlStL23cWI9uyFr+kYfVfkNIiGouSZqiqLXp5A1WAZ5UXWqj4Vd8J 9Lk+E5HQhIzPJyMEimF7rCLNVoMMrR9g3tKDuz3DL3sr0s+WfFx7+c8j9olQScFKLSJ6G HXRglHm06P3pwjGN/0utBC55dMXI41w76J8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With the introduction of Firmware Framework(FF-A), a Secure Partition can get the SPM version either using FF-A calls or through the existing svc calls. Use a runtime check to use either of the two methods based on the Pcd feature flag value. Signed-off-by: Sughosh Ganu Co-developed-by: Achin Gupta Reviewed-by: Sami Mujawar --- StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPo= int.inf | 3 ++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 37 ++++++++++++++------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 7d6ee4e08e..f8184f501b 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -49,5 +49,8 @@ gEfiStandaloneMmNonSecureBufferGuid gEfiArmTfCpuDriverEpDescriptorGuid =20 +[Pcd] + gArmTokenSpaceGuid.PcdFfaEnable + [BuildOptions] GCC:*_*_*_CC_FLAGS =3D -fpie diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 093a4a4285..b390ea8371 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -23,6 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include #include @@ -31,6 +32,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define SPM_MAJOR_VER_MASK 0xFFFF0000 #define SPM_MINOR_VER_MASK 0x0000FFFF #define SPM_MAJOR_VER_SHIFT 16 +#define FFA_NOT_SUPPORTED -1 =20 CONST UINT32 mSpmMajorVer =3D SPM_MAJOR_VERSION; CONST UINT32 mSpmMinorVer =3D SPM_MINOR_VERSION; @@ -165,19 +167,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 @@ -186,17 +203,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 (#68773): https://edk2.groups.io/g/devel/message/68773 Mute This Topic: https://groups.io/mt/78951503/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-