[edk2-devel] [edk2-platforms][PATCH v3 3/5] Platform/Sgi: define memory region for GHES error status block

Omkar Anand Kulkarni posted 5 patches 4 years, 5 months ago
[edk2-devel] [edk2-platforms][PATCH v3 3/5] Platform/Sgi: define memory region for GHES error status block
Posted by Omkar Anand Kulkarni 4 years, 5 months ago
Allow platforms to define the base address and size of the memory region
that is reserved for MM drivers to populate the GHES generic error
status block with information about the platform error.

Co-authored-by: Thomas Abraham <thomas.abraham@arm.com>
Signed-off-by: Omkar Anand Kulkarni <omkar.kulkarni@arm.com>
---
 Platform/ARM/SgiPkg/SgiPlatform.dec                      |  1 +
 Platform/ARM/SgiPkg/SgiPlatform.dsc.inc                  |  4 ++++
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf  |  6 ++++++
 Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c | 13 +++++++++++--
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 8cd818a9bf64..e46fa5d9a1d5 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -31,6 +31,7 @@
 [PcdsFeatureFlag.common]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000001
   gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x00000010
+  gArmSgiTokenSpaceGuid.PcdGhesMmSupported|FALSE|BOOLEAN|0x00000027
 
 [PcdsFixedAtBuild]
   gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
index bb32584de63d..5307280ef9a3 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
@@ -107,6 +107,10 @@
   gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE
 
+!if $(ENABLE_GHES_MM) == TRUE
+  gArmSgiTokenSpaceGuid.PcdGhesMmSupported|TRUE
+!endif
+
 [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdVFPEnabled|1
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
index 22e247ea4fae..8cc362ea194f 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
@@ -79,10 +79,16 @@
   gArmSgiTokenSpaceGuid.PcdWdogBase
   gArmSgiTokenSpaceGuid.PcdWdogSize
 
+  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase
+  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize
+
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
 
+[FeaturePcd]
+  gArmSgiTokenSpaceGuid.PcdGhesMmSupported
+
 [Guids]
   gArmSgiPlatformIdDescriptorGuid
   gEfiHobListGuid          ## CONSUMES  ## SystemTable
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
index 8139b75d8ee4..fd4a90bbc0ef 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2018-2020, ARM Limited. All rights reserved.
+*  Copyright (c) 2018-2021, ARM Limited. All rights reserved.
 *
 *  SPDX-License-Identifier: BSD-2-Clause-Patent
 *
@@ -17,7 +17,8 @@
 
 // Total number of descriptors, including the final "end-of-table" descriptor.
 #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS                 \
-          (14 + (FixedPcdGet32 (PcdChipCount) * 2))
+          (14 + (FixedPcdGet32 (PcdChipCount) * 2)) +      \
+          (FeaturePcdGet (PcdGhesMmSupported))
 
 /**
   Returns the Virtual Memory Map of the platform.
@@ -239,6 +240,14 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Length          = PcdGet64 (PcdMmBufferSize);
   VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED;
 
+  if (FeaturePcdGet (PcdGhesMmSupported)) {
+    // GHESv2 Generic Error Memory Space
+    VirtualMemoryTable[++Index].PhysicalBase  = PcdGet64 (PcdGhesGenericErrorDataMmBufferBase);
+    VirtualMemoryTable[Index].VirtualBase     = PcdGet64 (PcdGhesGenericErrorDataMmBufferBase);
+    VirtualMemoryTable[Index].Length          = PcdGet64 (PcdGhesGenericErrorDataMmBufferSize);
+    VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+  }
+
   // End of Table
   VirtualMemoryTable[++Index].PhysicalBase  = 0;
   VirtualMemoryTable[Index].VirtualBase     = 0;
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79752): https://edk2.groups.io/g/devel/message/79752
Mute This Topic: https://groups.io/mt/85104849/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-platforms][PATCH v3 3/5] Platform/Sgi: define memory region for GHES error status block
Posted by Sami Mujawar 4 years, 4 months ago
Hi Omkar,

This patch looks good to me.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar


On 24/08/2021 07:00 AM, Omkar Anand Kulkarni wrote:
> Allow platforms to define the base address and size of the memory region
> that is reserved for MM drivers to populate the GHES generic error
> status block with information about the platform error.
>
> Co-authored-by: Thomas Abraham <thomas.abraham@arm.com>
> Signed-off-by: Omkar Anand Kulkarni <omkar.kulkarni@arm.com>
> ---
>   Platform/ARM/SgiPkg/SgiPlatform.dec                      |  1 +
>   Platform/ARM/SgiPkg/SgiPlatform.dsc.inc                  |  4 ++++
>   Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf  |  6 ++++++
>   Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c | 13 +++++++++++--
>   4 files changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
> index 8cd818a9bf64..e46fa5d9a1d5 100644
> --- a/Platform/ARM/SgiPkg/SgiPlatform.dec
> +++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
> @@ -31,6 +31,7 @@
>   [PcdsFeatureFlag.common]
>     gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000001
>     gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x00000010
> +  gArmSgiTokenSpaceGuid.PcdGhesMmSupported|FALSE|BOOLEAN|0x00000027
>   
>   [PcdsFixedAtBuild]
>     gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002
> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
> index bb32584de63d..5307280ef9a3 100644
> --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
> +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
> @@ -107,6 +107,10 @@
>     gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|TRUE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE
>   
> +!if $(ENABLE_GHES_MM) == TRUE
> +  gArmSgiTokenSpaceGuid.PcdGhesMmSupported|TRUE
> +!endif
> +
>   [PcdsFixedAtBuild.common]
>     gArmTokenSpaceGuid.PcdVFPEnabled|1
>     gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
> index 22e247ea4fae..8cc362ea194f 100644
> --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
> +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
> @@ -79,10 +79,16 @@
>     gArmSgiTokenSpaceGuid.PcdWdogBase
>     gArmSgiTokenSpaceGuid.PcdWdogSize
>   
> +  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase
> +  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize
> +
>     gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
>     gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
>     gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
>   
> +[FeaturePcd]
> +  gArmSgiTokenSpaceGuid.PcdGhesMmSupported
> +
>   [Guids]
>     gArmSgiPlatformIdDescriptorGuid
>     gEfiHobListGuid          ## CONSUMES  ## SystemTable
> diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
> index 8139b75d8ee4..fd4a90bbc0ef 100644
> --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
> +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
> @@ -1,6 +1,6 @@
>   /** @file
>   *
> -*  Copyright (c) 2018-2020, ARM Limited. All rights reserved.
> +*  Copyright (c) 2018-2021, ARM Limited. All rights reserved.
>   *
>   *  SPDX-License-Identifier: BSD-2-Clause-Patent
>   *
> @@ -17,7 +17,8 @@
>   
>   // Total number of descriptors, including the final "end-of-table" descriptor.
>   #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS                 \
> -          (14 + (FixedPcdGet32 (PcdChipCount) * 2))
> +          (14 + (FixedPcdGet32 (PcdChipCount) * 2)) +      \
> +          (FeaturePcdGet (PcdGhesMmSupported))
>   
>   /**
>     Returns the Virtual Memory Map of the platform.
> @@ -239,6 +240,14 @@ ArmPlatformGetVirtualMemoryMap (
>     VirtualMemoryTable[Index].Length          = PcdGet64 (PcdMmBufferSize);
>     VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED;
>   
> +  if (FeaturePcdGet (PcdGhesMmSupported)) {
> +    // GHESv2 Generic Error Memory Space
> +    VirtualMemoryTable[++Index].PhysicalBase  = PcdGet64 (PcdGhesGenericErrorDataMmBufferBase);
> +    VirtualMemoryTable[Index].VirtualBase     = PcdGet64 (PcdGhesGenericErrorDataMmBufferBase);
> +    VirtualMemoryTable[Index].Length          = PcdGet64 (PcdGhesGenericErrorDataMmBufferSize);
> +    VirtualMemoryTable[Index].Attributes      = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +  }
> +
>     // End of Table
>     VirtualMemoryTable[++Index].PhysicalBase  = 0;
>     VirtualMemoryTable[Index].VirtualBase     = 0;



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81461): https://edk2.groups.io/g/devel/message/81461
Mute This Topic: https://groups.io/mt/85104849/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-