From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id B5579D8026A for ; Thu, 14 Sep 2023 23:10:48 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9O1oRaVhVkuKDPgMtT5MZY8RKbjgvU08G8wAEQrUiKo=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1694733047; v=1; b=ECGgEOTpgWftNosrvOmLL1jZ8o/Q7sRAX5/50jwhvZGgeUzZO76lIHcCSE76J+wCrsJ9MYw9 qnCtIONkKOZ5P3P89K54JVIh9cHTCe72KeyGCAqfhOoAT8z98e8NDb46feMfh6XesA1rTV4r64W AekllzSpLhHM0+J4RUBfrrXY= X-Received: by 127.0.0.2 with SMTP id cenlYY7687511x4WryrnpG32; Thu, 14 Sep 2023 16:10:47 -0700 X-Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mx.groups.io with SMTP id smtpd.web10.9112.1694733046886226404 for ; Thu, 14 Sep 2023 16:10:46 -0700 X-Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-68fbb10dea4so1238807b3a.3 for ; Thu, 14 Sep 2023 16:10:46 -0700 (PDT) X-Gm-Message-State: uLFeNtqk65kSdmwVaavjCjDbx7686176AA= X-Google-Smtp-Source: AGHT+IH1p/0/SfdZFZAx2Od2IpkAr/nLrsSxzMSIbW4c5sFDng0WVUp7emgbLFuJ2+65mzRgmiyZ7w== X-Received: by 2002:a05:6a00:1ac6:b0:690:45cc:bd37 with SMTP id f6-20020a056a001ac600b0069045ccbd37mr68121pfv.18.1694733045904; Thu, 14 Sep 2023 16:10:45 -0700 (PDT) X-Received: from localhost.localdomain (c-98-210-194-104.hsd1.ca.comcast.net. [98.210.194.104]) by smtp.gmail.com with ESMTPSA id d24-20020aa78e58000000b0066a4e561beesm1865591pfr.173.2023.09.14.16.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 16:10:45 -0700 (PDT) From: "Tuan Phan" To: devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, sami.mujawar@arm.com, ray.ni@intel.com, huangming@linux.alibaba.com, sunilvl@ventanamicro.com, yong.li@intel.com, Tuan Phan Subject: [edk2-devel] [PATCH v2 2/2] StandaloneMmPkg: Arm: Update to use the new StandaloneMmCpu driver Date: Thu, 14 Sep 2023 16:10:37 -0700 Message-Id: <20230914231037.23950-3-tphan@ventanamicro.com> In-Reply-To: <20230914231037.23950-1-tphan@ventanamicro.com> References: <20230914231037.23950-1-tphan@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,tphan@ventanamicro.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ECGgEOTp; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none Update entry point library for Arm to use the new platform independent StandaloneMmCpu driver. Signed-off-by: Tuan Phan --- .../Library/Arm/StandaloneMmCoreEntryPoint.h | 17 ++------ .../Arm/CreateHobList.c | 43 ++++++++++--------- .../Arm/StandaloneMmCoreEntryPoint.c | 15 ++++++- .../StandaloneMmCoreEntryPoint.inf | 2 +- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint= .h b/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h index 41bf0f132b4f..dbb81610ff8e 100644 --- a/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h +++ b/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h @@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef __STANDALONEMMCORE_ENTRY_POINT_H__=0D #define __STANDALONEMMCORE_ENTRY_POINT_H__=0D =0D +#include =0D #include =0D #include =0D =0D @@ -47,18 +48,6 @@ typedef struct { EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;=0D } EFI_SECURE_PARTITION_BOOT_INFO;=0D =0D -typedef=0D -EFI_STATUS=0D -(*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT) (=0D - IN UINTN EventId,=0D - IN UINTN CpuNumber,=0D - IN UINTN NsCommBufferAddr=0D - );=0D -=0D -typedef struct {=0D - PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *ArmTfCpuDriverEpPtr;=0D -} ARM_TF_CPU_DRIVER_EP_DESCRIPTOR;=0D -=0D typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) (=0D IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D IN UINT64 Length=0D @@ -145,8 +134,8 @@ LocateStandaloneMmCorePeCoffData ( VOID *=0D EFIAPI=0D CreateHobListFromBootInfo (=0D - IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D - IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D + IN OUT PI_MM_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D + IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D );=0D =0D /**=0D diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateH= obList.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHob= List.c index 2ac2d354f06a..80ed532352af 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include =0D #include =0D =0D +#include =0D #include =0D #include =0D #include =0D @@ -39,7 +40,7 @@ extern EFI_GUID gEfiStandaloneMmNonSecureBufferGuid; // GUID to identify HOB where the entry point of the CPU driver will be=0D // populated to allow this entry point driver to invoke it upon receipt of= an=0D // event=0D -extern EFI_GUID gEfiArmTfCpuDriverEpDescriptorGuid;=0D +extern EFI_GUID gEfiMmCpuDriverEpDescriptorGuid;=0D =0D /**=0D Use the boot information passed by privileged firmware to populate a HOB= list=0D @@ -52,22 +53,22 @@ extern EFI_GUID gEfiArmTfCpuDriverEpDescriptorGuid; **/=0D VOID *=0D CreateHobListFromBootInfo (=0D - IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D - IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D + IN OUT PI_MM_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,=0D + IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo=0D )=0D {=0D - EFI_HOB_HANDOFF_INFO_TABLE *HobStart;=0D - EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;=0D - UINT32 Index;=0D - UINT32 BufferSize;=0D - UINT32 Flags;=0D - EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob;=0D - EFI_MMRAM_DESCRIPTOR *MmramRanges;=0D - EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;=0D - MP_INFORMATION_HOB_DATA *MpInformationHobData;=0D - EFI_PROCESSOR_INFORMATION *ProcInfoBuffer;=0D - EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;=0D - ARM_TF_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;=0D + EFI_HOB_HANDOFF_INFO_TABLE *HobStart;=0D + EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;=0D + UINT32 Index;=0D + UINT32 BufferSize;=0D + UINT32 Flags;=0D + EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob;=0D + EFI_MMRAM_DESCRIPTOR *MmramRanges;=0D + EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;=0D + MP_INFORMATION_HOB_DATA *MpInformationHobData;=0D + EFI_PROCESSOR_INFORMATION *ProcInfoBuffer;=0D + EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;=0D + MM_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;=0D =0D // Create a hoblist with a PHIT and EOH=0D HobStart =3D HobConstructor (=0D @@ -144,13 +145,13 @@ CreateHobListFromBootInfo ( =0D // Create a Guided HOB to enable the ARM TF CPU driver to share its entr= y=0D // point and populate it with the address of the shared buffer=0D - CpuDriverEntryPointDesc =3D (ARM_TF_CPU_DRIVER_EP_DESCRIPTOR *)BuildGuid= Hob (=0D - &gEfiArmT= fCpuDriverEpDescriptorGuid,=0D - sizeof (A= RM_TF_CPU_DRIVER_EP_DESCRIPTOR)=0D - );=0D + CpuDriverEntryPointDesc =3D (MM_CPU_DRIVER_EP_DESCRIPTOR *)BuildGuidHob = (=0D + &gEfiMmCpuDri= verEpDescriptorGuid,=0D + sizeof (MM_CP= U_DRIVER_EP_DESCRIPTOR)=0D + );=0D =0D - *CpuDriverEntryPoint =3D NULL;=0D - CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr =3D CpuDriverEntryPoint;=0D + *CpuDriverEntryPoint =3D NULL;=0D + CpuDriverEntryPointDesc->MmCpuDriverEpPtr =3D CpuDriverEntryPoint;=0D =0D // Find the size of the GUIDed HOB with SRAM ranges=0D BufferSize =3D sizeof (EFI_MMRAM_HOB_DESCRIPTOR_BLOCK);=0D diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/Standal= oneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/= Arm/StandaloneMmCoreEntryPoint.c index 96de10405af8..900e0252ef9f 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCo= reEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCo= reEntryPoint.c @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include =0D #include =0D =0D +#include =0D #include =0D #include =0D #include =0D @@ -41,7 +42,7 @@ STATIC CONST UINT32 mSpmMinorVerFfa =3D SPM_MINOR_VERSIO= N_FFA; =0D #define BOOT_PAYLOAD_VERSION 1=0D =0D -PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT CpuDriverEntryPoint =3D NULL;=0D +PI_MM_CPU_DRIVER_ENTRYPOINT CpuDriverEntryPoint =3D NULL;=0D =0D /**=0D Retrieve a pointer to and print the boot information passed by privilege= d=0D @@ -140,6 +141,18 @@ DelegatedEventLoop ( DEBUG ((DEBUG_INFO, "X6 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg6= ));=0D DEBUG ((DEBUG_INFO, "X7 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg7= ));=0D =0D + //=0D + // ARM TF passes SMC FID of the MM_COMMUNICATE interface as the Event = ID upon=0D + // receipt of a synchronous MM request. Use the Event ID to distinguis= h=0D + // between synchronous and asynchronous events.=0D + //=0D + if ((ARM_SMC_ID_MM_COMMUNICATE !=3D (UINT32)EventCompleteSvcArgs->Arg0= ) &&=0D + (ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ !=3D (UINT32)EventCompleteSvcA= rgs->Arg0))=0D + {=0D + DEBUG ((DEBUG_ERROR, "UnRecognized Event - 0x%x\n", (UINT32)EventCom= pleteSvcArgs->Arg0));=0D + continue;=0D + }=0D +=0D FfaEnabled =3D FeaturePcdGet (PcdFfaEnable);=0D if (FfaEnabled) {=0D Status =3D CpuDriverEntryPoint (=0D diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 75cfb98c0e75..d41d7630b614 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -49,7 +49,7 @@ gMpInformationHobGuid=0D gEfiMmPeiMmramMemoryReserveGuid=0D gEfiStandaloneMmNonSecureBufferGuid=0D - gEfiArmTfCpuDriverEpDescriptorGuid=0D + gEfiMmCpuDriverEpDescriptorGuid=0D =0D [FeaturePcd.ARM, FeaturePcd.AARCH64]=0D gArmTokenSpaceGuid.PcdFfaEnable=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108662): https://edk2.groups.io/g/devel/message/108662 Mute This Topic: https://groups.io/mt/101369647/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-