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 351427803D8 for ; Tue, 10 Oct 2023 11:38:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=IHvxOmDFnJCc7Tsq9duMZnILlwMtu2TbtkixZGM1uuo=; 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=1696937918; v=1; b=KTZCwRnHw8Zf9PmJSbgFE9aYmOIjopvjZoVnR5p+YTNHaOpA/paTGIin9P1WJXXiL2SDQ7E7 xQayQp+TBLQrmHMC47uo3fTrRwifjM5o4XT9Z7DFeNPHJdSkXUNMaoXrbikn9aKDEN2mzFsFXdE hvjKkawy59Iln1FGda1NW0xo= X-Received: by 127.0.0.2 with SMTP id D9pCYY7687511xo5CCSosjyY; Tue, 10 Oct 2023 04:38:38 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.89195.1696937917959474463 for ; Tue, 10 Oct 2023 04:38:38 -0700 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 47106C15; Tue, 10 Oct 2023 04:39:18 -0700 (PDT) X-Received: from usa.arm.com (a077432.blr.arm.com [10.162.46.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4FFF73F7A6; Tue, 10 Oct 2023 04:38:36 -0700 (PDT) From: "Sayanta Pattanayak" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v1 1/4] Platform/Sgi: add remote memory descriptor Date: Tue, 10 Oct 2023 17:08:26 +0530 Message-Id: <20231010113829.647426-2-sayanta.pattanayak@arm.com> In-Reply-To: <20231010113829.647426-1-sayanta.pattanayak@arm.com> References: <20231010113829.647426-1-sayanta.pattanayak@arm.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,sayanta.pattanayak@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: QF2RfiK035xGXohMQrkFooExx7686176AA= 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=KTZCwRnH; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 8GB address region starting at 0x3FE00000000 is reserved for extended Remote Memory use. One of the use case, for extended remote memory region, is using it as CXL.Mem region. Remote memory region, with Normal memory attributes, is included into the Translation table entries based on the PcdRemoteCxlMemory flag status. Resource descriptor for Remote CXL device memory is not created in PlatformLibMem, it will be added at later execution phase after the discovery of CXL Mem device. This patch adds a Pcd, PcdRemoteCxlMemory for identifying a platform with CXL enabled configuration. Also marked Local memory block count, for creating SRAT tables in subsequent patch. Signed-off-by: Sayanta Pattanayak --- Platform/ARM/SgiPkg/SgiPlatform.dec | 8 ++++++++ Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 4 ++++ Platform/ARM/SgiPkg/RdN2Cfg1/RdN2Cfg1.dsc | 7 +++++++ Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf | 4 ++++ Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c | 19 ++++++++++= +++++++-- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/Sg= iPlatform.dec index 1613cc0198..a147e22f42 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dec +++ b/Platform/ARM/SgiPkg/SgiPlatform.dec @@ -102,5 +102,13 @@ gArmSgiTokenSpaceGuid.PcdIoVirtSocExpBlk0Base|0|UINT64|0x0000002B gArmSgiTokenSpaceGuid.PcdIoVirtSocExpBlkUartEnable|0|UINT32|0x0000002C =20 + # Number of Local Memory blocks + gArmSgiTokenSpaceGuid.PcdNumLocalMemBlock|1|UINT32|0x00001005 + + # Expanded Remote Memory Base and Size + gArmSgiTokenSpaceGuid.PcdRemoteCxlMemory|FALSE|BOOLEAN|0x00001006 + gArmSgiTokenSpaceGuid.PcdRemoteMemoryBase|0|UINT64|0x00001007 + gArmSgiTokenSpaceGuid.PcdRemoteMemorySize|0|UINT64|0x00001008 + [Ppis] gNtFwConfigDtInfoPpiGuid =3D { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8,= 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } } diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPk= g/SgiPlatform.dsc.inc index 26ecd9ed59..26b9a11a24 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -111,6 +111,10 @@ gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0x8080000000 gArmSgiTokenSpaceGuid.PcdDramBlock2Size|0x180000000 =20 +!if $(EDK2_ENABLE_REMOTE_CXL_MEM) =3D=3D TRUE + gArmSgiTokenSpaceGuid.PcdRemoteCxlMemory|TRUE +!endif + !if $(LPI_EN) =3D=3D TRUE # Allow use of LPI in the response to _OSC method call gArmSgiTokenSpaceGuid.PcdOscLpiEnable|1 diff --git a/Platform/ARM/SgiPkg/RdN2Cfg1/RdN2Cfg1.dsc b/Platform/ARM/Sgi= Pkg/RdN2Cfg1/RdN2Cfg1.dsc index c26f652cb9..37bae5c392 100644 --- a/Platform/ARM/SgiPkg/RdN2Cfg1/RdN2Cfg1.dsc +++ b/Platform/ARM/SgiPkg/RdN2Cfg1/RdN2Cfg1.dsc @@ -47,6 +47,13 @@ gArmPlatformTokenSpaceGuid.PcdCoreCount|1 gArmPlatformTokenSpaceGuid.PcdClusterCount|8 =20 + # Number of local memory blocks + gArmSgiTokenSpaceGuid.PcdNumLocalMemBlock|3 + + # Expanded Remote Memory Region, used as CXL Memory + gArmSgiTokenSpaceGuid.PcdRemoteMemoryBase|0x3FE00000000 + gArmSgiTokenSpaceGuid.PcdRemoteMemorySize|0x200000000 + ########################################################################= ######## # # Components Section - list of all EDK II Modules needed by this Platfor= m diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Pl= atform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf index 020bde0d1f..2cdf9377e9 100644 --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf @@ -51,6 +51,10 @@ gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize =20 + gArmSgiTokenSpaceGuid.PcdRemoteCxlMemory + gArmSgiTokenSpaceGuid.PcdRemoteMemoryBase + gArmSgiTokenSpaceGuid.PcdRemoteMemorySize + gArmSgiTokenSpaceGuid.PcdChipCount =20 gArmTokenSpaceGuid.PcdGicDistributorBase diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/P= latform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c index fa3cfbc730..13ba2a5960 100644 --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c @@ -50,6 +50,7 @@ ArmPlatformGetVirtualMemoryMap ( UINTN Index; ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; + UINTN TotalMemoryMapDescirptors; =20 ResourceAttributes =3D EFI_RESOURCE_ATTRIBUTE_PRESENT | @@ -111,9 +112,15 @@ ArmPlatformGetVirtualMemoryMap ( ASSERT (VirtualMemoryMap !=3D NULL); Index =3D 0; =20 + TotalMemoryMapDescirptors =3D MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS; + +#if (FixedPcdGetBool (PcdRemoteCxlMemory)) + TotalMemoryMapDescirptors +=3D 1; +#endif + VirtualMemoryTable =3D (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages (EFI_SIZE_TO_PAGES (sizeof (ARM_MEMORY_REGION_DES= CRIPTOR) * - MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); + TotalMemoryMapDescirptors)); if (VirtualMemoryTable =3D=3D NULL) { return; } @@ -221,6 +228,14 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length =3D PcdGet64 (PcdDramBlock2S= ize); VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_WRITE_BACK; =20 +#if (FixedPcdGetBool (PcdRemoteCxlMemory)) + // Expanded Remote memory region + VirtualMemoryTable[++Index].PhysicalBase =3D FixedPcdGet64 (PcdRemo= teMemoryBase); + VirtualMemoryTable[Index].VirtualBase =3D FixedPcdGet64 (PcdRemo= teMemoryBase); + VirtualMemoryTable[Index].Length =3D FixedPcdGet64 (PcdRemo= teMemorySize); + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTR= IBUTE_WRITE_BACK; +#endif + #if (FixedPcdGet32 (PcdChipCount) > 1) // Chip 1 DDR Block 1 - (2GB) VirtualMemoryTable[++Index].PhysicalBase =3D SYSTEM_MEMORY_BASE_REMOT= E (1), @@ -283,6 +298,6 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length =3D 0; VirtualMemoryTable[Index].Attributes =3D (ARM_MEMORY_REGION_ATTRI= BUTES)0; =20 - ASSERT ((Index + 1) <=3D MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + ASSERT ((Index + 1) <=3D TotalMemoryMapDescirptors); *VirtualMemoryMap =3D VirtualMemoryTable; } --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109489): https://edk2.groups.io/g/devel/message/109489 Mute This Topic: https://groups.io/mt/101872994/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-