From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.1277.1689086250840632971 for ; Tue, 11 Jul 2023 07:37:30 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: nishant.sharma@arm.com) 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 B786D2F4; Tue, 11 Jul 2023 07:38:12 -0700 (PDT) Received: from usa.arm.com (iss-desktop02.cambridge.arm.com [10.1.196.79]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9A04B3F740; Tue, 11 Jul 2023 07:37:29 -0700 (PDT) From: "Nishant Sharma" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Thomas Abraham , Sayanta Pattanayak , Achin Gupta Subject: [edk2-platforms][PATCH V1 15/20] ArmPkg/MmCommunicationDxe: Add support for obtaining FF-A partition ID Date: Tue, 11 Jul 2023 15:36:53 +0100 Message-Id: <20230711143658.781597-16-nishant.sharma@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711143658.781597-1-nishant.sharma@arm.com> References: <20230711143658.781597-1-nishant.sharma@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Achin Gupta This patch invokes the FFA_ID_GET to obtain and stash the ID of the the FF-A partition that implements the DXE MM communication driver. This ID is used in subsequent patches for sending and receiving MM communication protocol requests and responses that are packaged as FF-A messages. Signed-off-by: Achin Gupta Signed-off-by: Nishant Sharma --- ArmPkg/Include/IndustryStandard/ArmFfaSvc.h | 1 + ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 22 +++++++++++++++= +++++ 2 files changed, 23 insertions(+) diff --git a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h b/ArmPkg/Include= /IndustryStandard/ArmFfaSvc.h index 4a51f9fb56af..20eeb822ea56 100644 --- a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h +++ b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h @@ -17,6 +17,7 @@ #define ARM_FFA_SVC_H_ =20 #define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063 +#define ARM_SVC_ID_FFA_ID_GET_AARCH32 0x84000069 #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32 0x8400006F #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32 0x84000070 #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg= /Drivers/MmCommunicationDxe/MmCommunication.c index a6fcd590a65b..f907ccf7349f 100644 --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c @@ -23,6 +23,11 @@ =20 #include "MmCommunicate.h" =20 +// +// Partition ID if FF-A support is enabled +// +STATIC UINT16 mFfaPartId; + // // Address, Length of the pre-allocated buffer for communication with th= e secure // world. @@ -288,6 +293,23 @@ GetMmCompatibility ( Status =3D EFI_UNSUPPORTED; } =20 + // If FF-A is supported then discover our ID. + if (FixedPcdGet32 (PcdFfaEnable) !=3D 0) { + + // Get our ID + ZeroMem(&SmcArgs, sizeof(SmcArgs)); + SmcArgs.Arg0 =3D ARM_SVC_ID_FFA_ID_GET_AARCH32; + ArmCallSmc (&SmcArgs); + if (SmcArgs.Arg0 =3D=3D ARM_SVC_ID_FFA_ERROR_AARCH32) { + DEBUG ((DEBUG_ERROR, "Unable to retrieve FF-A partition ID (%d).\n= ", SmcArgs.Arg2)); + return EFI_UNSUPPORTED; + } + DEBUG ((DEBUG_INFO, "FF-A partition ID =3D 0x%lx.\n", SmcArgs.Arg2))= ; + mFfaPartId =3D SmcArgs.Arg2; + + return EFI_SUCCESS; + } + return Status; } =20 --=20 2.34.1