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 <sayanta.pattana...@arm.com> --- 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/SgiPlatform.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 + # 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 = { 0x6f606eb3, 0x9123, 0x4e15, { 0xa8, 0x9b, 0x0f, 0xac, 0x66, 0xef, 0xd0, 0x17 } } diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/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 +!if $(EDK2_ENABLE_REMOTE_CXL_MEM) == TRUE + gArmSgiTokenSpaceGuid.PcdRemoteCxlMemory|TRUE +!endif + !if $(LPI_EN) == 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/SgiPkg/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 + # 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 Platform diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Platform/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 + gArmSgiTokenSpaceGuid.PcdRemoteCxlMemory + gArmSgiTokenSpaceGuid.PcdRemoteMemoryBase + gArmSgiTokenSpaceGuid.PcdRemoteMemorySize + gArmSgiTokenSpaceGuid.PcdChipCount gArmTokenSpaceGuid.PcdGicDistributorBase diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/Platform/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; ResourceAttributes = EFI_RESOURCE_ATTRIBUTE_PRESENT | @@ -111,9 +112,15 @@ ArmPlatformGetVirtualMemoryMap ( ASSERT (VirtualMemoryMap != NULL); Index = 0; + TotalMemoryMapDescirptors = MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS; + +#if (FixedPcdGetBool (PcdRemoteCxlMemory)) + TotalMemoryMapDescirptors += 1; +#endif + VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages (EFI_SIZE_TO_PAGES (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * - MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); + TotalMemoryMapDescirptors)); if (VirtualMemoryTable == NULL) { return; } @@ -221,6 +228,14 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length = PcdGet64 (PcdDramBlock2Size); VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; +#if (FixedPcdGetBool (PcdRemoteCxlMemory)) + // Expanded Remote memory region + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdRemoteMemoryBase); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdRemoteMemoryBase); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdRemoteMemorySize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; +#endif + #if (FixedPcdGet32 (PcdChipCount) > 1) // Chip 1 DDR Block 1 - (2GB) VirtualMemoryTable[++Index].PhysicalBase = SYSTEM_MEMORY_BASE_REMOTE (1), @@ -283,6 +298,6 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length = 0; VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0; - ASSERT ((Index + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + ASSERT ((Index + 1) <= TotalMemoryMapDescirptors); *VirtualMemoryMap = VirtualMemoryTable; } -- 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/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-