From nobody Tue Feb 10 05:46:12 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+70364+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70364+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610691274; cv=none; d=zohomail.com; s=zohoarc; b=ePl7LPOOu7JtcCcGPUEwTBk8pi1zwnlv3GEUyWI1/gL4JMbqExCZz1ZFRiBerxiKi5mXk4nnZV62U2KHpbQRxp8BnhEqJhsz38G1Zy/RNcZnahMZzyQRSQOn8Fl38E9Rvh7FqkP4bkWH97AeVjdhaaCLy/sC++wEKXWJQUuy7Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610691274; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=dMMSeJ7JKSuoVy94QXbIfAjtqSoee4JswGwfqSp7QUY=; b=K+w3ur2WzDa14NF/h2k+k19ZmY4tiGKb1b2LTqedBICrlEsSjk8f2siMwwfZDFAuUizap9YAhsneJvSbHYBpFsKMRJz862UJC1eQEcmE3BrcxMa96sP3XwG+nDVtf/UqITLzb39FhLSOQ6Ry5ypmBDrSvF6uKWU41eEI+tp7VVw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70364+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610691274643255.13487632225088; Thu, 14 Jan 2021 22:14:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id EKnfYY1788612xG3liAg86rF; Thu, 14 Jan 2021 22:14:34 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.536.1610691273713458488 for ; Thu, 14 Jan 2021 22:14:33 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 684ADED1; Thu, 14 Jan 2021 22:14:33 -0800 (PST) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 457133F70D; Thu, 14 Jan 2021 22:14:31 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Sughosh Ganu Subject: [edk2-devel] [PATCH v3 07/13] StandaloneMmPkg: Add option to use FF-A calls for getting SPM version Date: Fri, 15 Jan 2021 11:43:58 +0530 Message-Id: <20210115061404.13552-8-sughosh.ganu@linaro.org> In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sughosh.ganu@linaro.org X-Gm-Message-State: nR3do8sJ7idUX9DoyqPgV52Nx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610691274; bh=P3hsz04sCamvOo62iv4WHn12RNf34oQPcN89sHufmgI=; h=Cc:Date:From:Reply-To:Subject:To; b=K+tfKJDKsu8//ITf1b818gveKJ2z0ldtbXq1ApFY53nn5SWz/083ELfiUrl9ab/Ww5U lQeNPU49Cnq95dpk/d5FIYOmigBzCns8L3COoLvjWfBDX0LO8RxLFJTWscnFbJxg1lyEg kfrH7YvF0uBtIlE4q6trFkU722PBMJ/Twqo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With the introduction of Firmware Framework(FF-A), a Secure Partition can get the SPM version either using FF-A calls or through the existing svc calls. Use a runtime check to use either of the two methods based on the Pcd feature flag value. Signed-off-by: Sughosh Ganu Co-developed-by: Achin Gupta Reviewed-by: Sami Mujawar --- Changes since V2: None StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPo= int.inf | 3 ++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 37 ++++++++++++++------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 75a654b06d..073934a6f5 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -48,5 +48,8 @@ gEfiStandaloneMmNonSecureBufferGuid gEfiArmTfCpuDriverEpDescriptorGuid =20 +[Pcd] + gArmTokenSpaceGuid.PcdFfaEnable + [BuildOptions] GCC:*_*_*_CC_FLAGS =3D -fpie diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 3bd2516608..25ead004e6 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -23,6 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include #include @@ -31,6 +32,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define SPM_MAJOR_VER_MASK 0xFFFF0000 #define SPM_MINOR_VER_MASK 0x0000FFFF #define SPM_MAJOR_VER_SHIFT 16 +#define FFA_NOT_SUPPORTED -1 =20 STATIC CONST UINT32 mSpmMajorVer =3D SPM_MAJOR_VERSION; STATIC CONST UINT32 mSpmMinorVer =3D SPM_MINOR_VERSION; @@ -178,19 +180,34 @@ EFI_STATUS GetSpmVersion (VOID) { EFI_STATUS Status; - UINT16 SpmMajorVersion; - UINT16 SpmMinorVersion; + UINT16 CalleeSpmMajorVer; + UINT16 CallerSpmMajorVer; + UINT16 CalleeSpmMinorVer; + UINT16 CallerSpmMinorVer; UINT32 SpmVersion; ARM_SVC_ARGS SpmVersionArgs; =20 - SpmVersionArgs.Arg0 =3D ARM_SVC_ID_SPM_VERSION_AARCH32; + if (FeaturePcdGet (PcdFfaEnable)) { + SpmVersionArgs.Arg0 =3D ARM_SVC_ID_FFA_VERSION_AARCH32; + SpmVersionArgs.Arg1 =3D mSpmMajorVerFfa << SPM_MAJOR_VER_SHIFT; + SpmVersionArgs.Arg1 |=3D mSpmMinorVerFfa; + CallerSpmMajorVer =3D mSpmMajorVerFfa; + CallerSpmMinorVer =3D mSpmMinorVerFfa; + } else { + SpmVersionArgs.Arg0 =3D ARM_SVC_ID_SPM_VERSION_AARCH32; + CallerSpmMajorVer =3D mSpmMajorVer; + CallerSpmMinorVer =3D mSpmMinorVer; + } =20 ArmCallSvc (&SpmVersionArgs); =20 SpmVersion =3D SpmVersionArgs.Arg0; + if (SpmVersion =3D=3D FFA_NOT_SUPPORTED) { + return EFI_UNSUPPORTED; + } =20 - SpmMajorVersion =3D ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VER_= SHIFT); - SpmMinorVersion =3D ((SpmVersion & SPM_MINOR_VER_MASK) >> 0); + CalleeSpmMajorVer =3D ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VE= R_SHIFT); + CalleeSpmMinorVer =3D ((SpmVersion & SPM_MINOR_VER_MASK) >> 0); =20 // Different major revision values indicate possibly incompatible functi= ons. // For two revisions, A and B, for which the major revision values are @@ -199,17 +216,17 @@ GetSpmVersion (VOID) // revision A must work in a compatible way with revision B. // However, it is possible for revision B to have a higher // function count than revision A. - if ((SpmMajorVersion =3D=3D mSpmMajorVer) && - (SpmMinorVersion >=3D mSpmMinorVer)) + if ((CalleeSpmMajorVer =3D=3D CallerSpmMajorVer) && + (CalleeSpmMinorVer >=3D CallerSpmMinorVer)) { DEBUG ((DEBUG_INFO, "SPM Version: Major=3D0x%x, Minor=3D0x%x\n", - SpmMajorVersion, SpmMinorVersion)); + CalleeSpmMajorVer, CalleeSpmMinorVer)); Status =3D EFI_SUCCESS; } else { - DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Current Version: Maj= or=3D0x%x, Minor=3D0x%x.\n Expected: Major=3D0x%x, Minor>=3D0x%x.\n", - SpmMajorVersion, SpmMinorVersion, mSpmMajorVer, mSpmMinorVer)); + DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Callee Version: Majo= r=3D0x%x, Minor=3D0x%x.\n Caller: Major=3D0x%x, Minor>=3D0x%x.\n", + CalleeSpmMajorVer, CalleeSpmMinorVer, CallerSpmMajorVer, Calle= rSpmMinorVer)); Status =3D EFI_UNSUPPORTED; } =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70364): https://edk2.groups.io/g/devel/message/70364 Mute This Topic: https://groups.io/mt/79696444/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-