public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v4 0/1] support multi memory nodes
@ 2024-03-27 14:01 Xiong Yining
  2024-03-27 14:01 ` [edk2-devel] [PATCH v4 1/1] SbsaQemu: add memory space for the high " Xiong Yining
  0 siblings, 1 reply; 3+ messages in thread
From: Xiong Yining @ 2024-03-27 14:01 UTC (permalink / raw)
  To: devel
  Cc: quic_llindhol, ardb+tianocore, graeme, marcin.juszkiewicz,
	chenbaozi, Xiong Yining

When SaSbQemu platform is configured with multi memory nodes, like 
numa architecture, os will ignore any memory node in the device tree 
except the first one. The kernel reads UEFI memory map for memory 
information when booting via UEFI. 

However UEFI only allocates the first memory node memory space for 
SbsaQemu platform, in this scenario we can refer to the implement 
of "OvmfPkg/Fdt/HighMemDxe" and use the GCD services to add memory 
spaces for high memory node.

Instead of using FdtClientDxe driver to get the informatin of memory, 
we get the hardware information of memory via SMC calls, which is proposed
on get rid of DeviceTree from SbsaQemu:
https://openfw.io/edk2-devel/20240131132400.3022662-1-xiongyining1480@phytium.com.cn/

Changes in v4:
- Rename SbsaQemuHardwareInfoLib to HardwareInfoLib and use newer function names.
- Link to v3: https://openfw.io/edk2-devel/20240220073332.3249289-1-xiongyining1480@phytium.com.cn/

Changes in v3:
- when the memory node is the first one, there is no need to add it.

Changes in v2:
- get the information of memory via SMC rather than FdtClientDxe.
- add a new driver rather than use HighMemDxe. 

Xiong Yining (1):
  SbsaQemu: add memory space for the high memory nodes

 Platform/Qemu/SbsaQemu/SbsaQemu.dsc           |   1 +
 Platform/Qemu/SbsaQemu/SbsaQemu.fdf           |   1 +
 .../SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf |  45 ++++++
 .../SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c   | 134 ++++++++++++++++++
 4 files changed, 181 insertions(+)
 create mode 100644 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
 create mode 100644 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c

-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117169): https://edk2.groups.io/g/devel/message/117169
Mute This Topic: https://groups.io/mt/105177587/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [edk2-devel] [PATCH v4 1/1] SbsaQemu: add memory space for the high memory nodes
  2024-03-27 14:01 [edk2-devel] [PATCH v4 0/1] support multi memory nodes Xiong Yining
@ 2024-03-27 14:01 ` Xiong Yining
  2024-03-28 13:18   ` Leif Lindholm
  0 siblings, 1 reply; 3+ messages in thread
From: Xiong Yining @ 2024-03-27 14:01 UTC (permalink / raw)
  To: devel
  Cc: quic_llindhol, ardb+tianocore, graeme, marcin.juszkiewicz,
	chenbaozi, Xiong Yining

To support more memory nodes, we refer to the implement of
"OvmfPkg/Fdt/HighMemDxe" to add memory space for the high memory nodes
except the first one.

Signed-off-by: Xiong Yining <xiongyining1480@phytium.com.cn>
Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc           |   1 +
 Platform/Qemu/SbsaQemu/SbsaQemu.fdf           |   1 +
 .../SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf |  45 ++++++
 .../SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c   | 134 ++++++++++++++++++
 4 files changed, 181 insertions(+)
 create mode 100644 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
 create mode 100644 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index 3b936f6e6386..22017792bad2 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -671,6 +671,7 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+  Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
 
   #
   # FAT filesystem + GPT/MBR partitioning
diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
index 6fcfd25faaeb..b35f42e11aa4 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
@@ -161,6 +161,7 @@ READ_LOCK_STATUS   = TRUE
 
   INF MdeModulePkg/Core/Dxe/DxeMain.inf
   INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+  INF Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
 
   #
   # PI DXE Drivers producing Architectural Protocols (EFI Services)
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
new file mode 100644
index 000000000000..304f47392298
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
@@ -0,0 +1,45 @@
+## @file
+#  High memory node enumeration DXE driver for SbsaQemu
+#
+#  Copyright (c) 2023, Linaro Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = SbsaQemuHighMemDxe
+  FILE_GUID                      = 9E749C5E-C282-32F8-7CC3-E5A3DDE15329
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+
+  ENTRY_POINT                    = InitializeHighMemDxe
+
+[Sources]
+  SbsaQemuHighMemDxe.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ArmPkg/ArmPkg.dec
+  Silicon/Qemu/SbsaQemu/SbsaQemu.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  DxeServicesTableLib
+  PcdLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  HardwareInfoLib
+
+[Protocols]
+  gEfiCpuArchProtocolGuid                 ## CONSUMES
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
+
+[Depex]
+  gEfiCpuArchProtocolGuid
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c
new file mode 100644
index 000000000000..004a8c0cf654
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c
@@ -0,0 +1,134 @@
+/** @file
+*  High memory node enumeration DXE driver for SbsaQemu
+*  Virtual Machines
+*
+*  Copyright (c) 2023, Linaro Ltd. All rights reserved.
+*
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DxeServicesTableLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/HardwareInfoLib.h>
+
+#include <Protocol/Cpu.h>
+
+EFI_STATUS
+EFIAPI
+InitializeHighMemDxe (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_CPU_ARCH_PROTOCOL            *Cpu;
+  EFI_STATUS                       Status;
+  UINT32                           NumMemNodes;
+  UINT32                           index;
+  UINT64                           CurBase;
+  UINT64                           CurSize;
+  UINT64                           Attributes;
+  MemoryInfo                       MemInfo;
+  EFI_GCD_MEMORY_SPACE_DESCRIPTOR  GcdDescriptor;
+
+  Status = gBS->LocateProtocol (
+                  &gEfiCpuArchProtocolGuid,
+                  NULL,
+                  (VOID **)&Cpu
+                  );
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Check for memory node and add the memory spaces except the lowest one
+  //
+  NumMemNodes = GetMemNodeCount();
+  for (index = 0; index < NumMemNodes; index++){
+    GetMemInfo(index, &MemInfo);
+    CurBase = MemInfo.AddressBase;
+    CurSize = MemInfo.AddressSize;
+
+    if (CurBase > PcdGet64 (PcdSystemMemoryBase)) {
+      Status = gDS->GetMemorySpaceDescriptor (CurBase, &GcdDescriptor);
+      if (EFI_ERROR (Status)) {
+        DEBUG ((
+          DEBUG_WARN,
+          "%a: Region 0x%lx - 0x%lx not found in the GCD memory space map\n",
+          __func__,
+          CurBase,
+          CurBase + CurSize - 1
+          ));
+        continue;
+      }
+
+      if (GcdDescriptor.GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
+        Status = gDS->AddMemorySpace (
+                        EfiGcdMemoryTypeSystemMemory,
+                        CurBase,
+                        CurSize,
+                        EFI_MEMORY_WB
+                        );
+
+        if (EFI_ERROR (Status)) {
+          DEBUG ((
+            DEBUG_ERROR,
+            "%a: Failed to add System RAM @ 0x%lx - 0x%lx (%r)\n",
+            __func__,
+            CurBase,
+            CurBase + CurSize - 1,
+            Status
+            ));
+          continue;
+        }
+
+        Status = gDS->SetMemorySpaceAttributes (
+                        CurBase,
+                        CurSize,
+                        EFI_MEMORY_WB
+                        );
+        if (EFI_ERROR (Status)) {
+          DEBUG ((
+            DEBUG_WARN,
+            "%a: gDS->SetMemorySpaceAttributes() failed on region 0x%lx - 0x%lx (%r)\n",
+            __func__,
+            CurBase,
+            CurBase + CurSize - 1,
+            Status
+            ));
+        }
+
+        Attributes = EFI_MEMORY_WB;
+        if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) &
+              (1U << (UINT32)EfiConventionalMemory)) != 0)
+        {
+          Attributes |= EFI_MEMORY_XP;
+        }
+
+        Status = Cpu->SetMemoryAttributes (Cpu, CurBase, CurSize, Attributes);
+
+        if (EFI_ERROR (Status)) {
+          DEBUG ((
+            DEBUG_ERROR,
+            "%a: Failed to set System RAM @ 0x%lx - 0x%lx attribute (%r)\n",
+            __func__,
+            CurBase,
+            CurBase + CurSize - 1,
+            Status
+            ));
+        } else {
+          DEBUG ((
+            DEBUG_INFO,
+            "%a: Add System RAM @ 0x%lx - 0x%lx\n",
+            __func__,
+            CurBase,
+            CurBase + CurSize - 1
+            ));
+        }
+      }
+    }
+  }
+
+  return EFI_SUCCESS;
+}
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117168): https://edk2.groups.io/g/devel/message/117168
Mute This Topic: https://groups.io/mt/105177586/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v4 1/1] SbsaQemu: add memory space for the high memory nodes
  2024-03-27 14:01 ` [edk2-devel] [PATCH v4 1/1] SbsaQemu: add memory space for the high " Xiong Yining
@ 2024-03-28 13:18   ` Leif Lindholm
  0 siblings, 0 replies; 3+ messages in thread
From: Leif Lindholm @ 2024-03-28 13:18 UTC (permalink / raw)
  To: Xiong Yining; +Cc: devel, ardb+tianocore, graeme, marcin.juszkiewicz, chenbaozi

On Wed, Mar 27, 2024 at 14:01:43 +0000, Xiong Yining wrote:
> To support more memory nodes, we refer to the implement of
> "OvmfPkg/Fdt/HighMemDxe" to add memory space for the high memory nodes
> except the first one.

"HighMem" doesn't really make sense outside x86.
But I also don't want to delay merging this any furtner because of
arguing about names.

There are a few stule things below that I will fix up before pushing
though:

> Signed-off-by: Xiong Yining <xiongyining1480@phytium.com.cn>
> Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>

Drop additional Signed-off-by, as discussed on other set.

> Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> ---
>  Platform/Qemu/SbsaQemu/SbsaQemu.dsc           |   1 +
>  Platform/Qemu/SbsaQemu/SbsaQemu.fdf           |   1 +
>  .../SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf |  45 ++++++
>  .../SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c   | 134 ++++++++++++++++++
>  4 files changed, 181 insertions(+)
>  create mode 100644 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
>  create mode 100644 Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c
> 
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> index 3b936f6e6386..22017792bad2 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> @@ -671,6 +671,7 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE       = FALSE
>    ArmPkg/Drivers/TimerDxe/TimerDxe.inf
>    OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
>    MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> +  Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
>  
>    #
>    # FAT filesystem + GPT/MBR partitioning
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> index 6fcfd25faaeb..b35f42e11aa4 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.fdf
> @@ -161,6 +161,7 @@ READ_LOCK_STATUS   = TRUE
>  
>    INF MdeModulePkg/Core/Dxe/DxeMain.inf
>    INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  INF Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
>  
>    #
>    # PI DXE Drivers producing Architectural Protocols (EFI Services)
> diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
> new file mode 100644
> index 000000000000..304f47392298
> --- /dev/null
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.inf
> @@ -0,0 +1,45 @@
> +## @file
> +#  High memory node enumeration DXE driver for SbsaQemu
> +#
> +#  Copyright (c) 2023, Linaro Ltd. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = SbsaQemuHighMemDxe
> +  FILE_GUID                      = 9E749C5E-C282-32F8-7CC3-E5A3DDE15329
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +
> +  ENTRY_POINT                    = InitializeHighMemDxe
> +
> +[Sources]
> +  SbsaQemuHighMemDxe.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ArmPkg/ArmPkg.dec
> +  Silicon/Qemu/SbsaQemu/SbsaQemu.dec

Sort these alphabetically.

> +
> +[LibraryClasses]
> +  BaseLib
> +  DebugLib
> +  DxeServicesTableLib
> +  PcdLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +  HardwareInfoLib

Sort these alphabetically.

> +
> +[Protocols]
> +  gEfiCpuArchProtocolGuid                 ## CONSUMES
> +
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase

Sort these alphabetically.

> +
> +[Depex]
> +  gEfiCpuArchProtocolGuid
> diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c
> new file mode 100644
> index 000000000000..004a8c0cf654
> --- /dev/null
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuHighMemDxe/SbsaQemuHighMemDxe.c
> @@ -0,0 +1,134 @@
> +/** @file
> +*  High memory node enumeration DXE driver for SbsaQemu
> +*  Virtual Machines
> +*
> +*  Copyright (c) 2023, Linaro Ltd. All rights reserved.
> +*
> +*  SPDX-License-Identifier: BSD-2-Clause-Patent
> +*
> +**/
> +
> +#include <Library/BaseLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/DxeServicesTableLib.h>
> +#include <Library/PcdLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/HardwareInfoLib.h>
> +
> +#include <Protocol/Cpu.h>
> +
> +EFI_STATUS
> +EFIAPI
> +InitializeHighMemDxe (
> +  IN EFI_HANDLE        ImageHandle,
> +  IN EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  EFI_CPU_ARCH_PROTOCOL            *Cpu;
> +  EFI_STATUS                       Status;
> +  UINT32                           NumMemNodes;
> +  UINT32                           index;

Renamed "index" to "Index" to follow coding style.

With that:
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Pushed as 6105ecb0aa06.

Thanks!

/
    Leif

> +  UINT64                           CurBase;
> +  UINT64                           CurSize;
> +  UINT64                           Attributes;
> +  MemoryInfo                       MemInfo;
> +  EFI_GCD_MEMORY_SPACE_DESCRIPTOR  GcdDescriptor;
> +
> +  Status = gBS->LocateProtocol (
> +                  &gEfiCpuArchProtocolGuid,
> +                  NULL,
> +                  (VOID **)&Cpu
> +                  );
> +  ASSERT_EFI_ERROR (Status);
> +
> +  //
> +  // Check for memory node and add the memory spaces except the lowest one
> +  //
> +  NumMemNodes = GetMemNodeCount();
> +  for (index = 0; index < NumMemNodes; index++){
> +    GetMemInfo(index, &MemInfo);
> +    CurBase = MemInfo.AddressBase;
> +    CurSize = MemInfo.AddressSize;
> +
> +    if (CurBase > PcdGet64 (PcdSystemMemoryBase)) {
> +      Status = gDS->GetMemorySpaceDescriptor (CurBase, &GcdDescriptor);
> +      if (EFI_ERROR (Status)) {
> +        DEBUG ((
> +          DEBUG_WARN,
> +          "%a: Region 0x%lx - 0x%lx not found in the GCD memory space map\n",
> +          __func__,
> +          CurBase,
> +          CurBase + CurSize - 1
> +          ));
> +        continue;
> +      }
> +
> +      if (GcdDescriptor.GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
> +        Status = gDS->AddMemorySpace (
> +                        EfiGcdMemoryTypeSystemMemory,
> +                        CurBase,
> +                        CurSize,
> +                        EFI_MEMORY_WB
> +                        );
> +
> +        if (EFI_ERROR (Status)) {
> +          DEBUG ((
> +            DEBUG_ERROR,
> +            "%a: Failed to add System RAM @ 0x%lx - 0x%lx (%r)\n",
> +            __func__,
> +            CurBase,
> +            CurBase + CurSize - 1,
> +            Status
> +            ));
> +          continue;
> +        }
> +
> +        Status = gDS->SetMemorySpaceAttributes (
> +                        CurBase,
> +                        CurSize,
> +                        EFI_MEMORY_WB
> +                        );
> +        if (EFI_ERROR (Status)) {
> +          DEBUG ((
> +            DEBUG_WARN,
> +            "%a: gDS->SetMemorySpaceAttributes() failed on region 0x%lx - 0x%lx (%r)\n",
> +            __func__,
> +            CurBase,
> +            CurBase + CurSize - 1,
> +            Status
> +            ));
> +        }
> +
> +        Attributes = EFI_MEMORY_WB;
> +        if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) &
> +              (1U << (UINT32)EfiConventionalMemory)) != 0)
> +        {
> +          Attributes |= EFI_MEMORY_XP;
> +        }
> +
> +        Status = Cpu->SetMemoryAttributes (Cpu, CurBase, CurSize, Attributes);
> +
> +        if (EFI_ERROR (Status)) {
> +          DEBUG ((
> +            DEBUG_ERROR,
> +            "%a: Failed to set System RAM @ 0x%lx - 0x%lx attribute (%r)\n",
> +            __func__,
> +            CurBase,
> +            CurBase + CurSize - 1,
> +            Status
> +            ));
> +        } else {
> +          DEBUG ((
> +            DEBUG_INFO,
> +            "%a: Add System RAM @ 0x%lx - 0x%lx\n",
> +            __func__,
> +            CurBase,
> +            CurBase + CurSize - 1
> +            ));
> +        }
> +      }
> +    }
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> -- 
> 2.34.1
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117210): https://edk2.groups.io/g/devel/message/117210
Mute This Topic: https://groups.io/mt/105177586/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-28 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 14:01 [edk2-devel] [PATCH v4 0/1] support multi memory nodes Xiong Yining
2024-03-27 14:01 ` [edk2-devel] [PATCH v4 1/1] SbsaQemu: add memory space for the high " Xiong Yining
2024-03-28 13:18   ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox