public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib
@ 2024-08-08 14:20 Marcin Juszkiewicz
  2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 1/3] SbsaQemu: move SMC calls to HardwareInfoLib Marcin Juszkiewicz
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Marcin Juszkiewicz @ 2024-08-08 14:20 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Graeme Gregory, Marcin Juszkiewicz

During last weeks Ard updated ArmMonitorLib to current SMCCC
specification. This allows to use 18 registers as both arguments and
return values.

We already have one SMC call with 5 return values (GetCpuTopology) so
let move all calls to use of ArmMonitorLib to simplify code.

First patch also moves all SMC calls we use into HardwareInfoLib to have
all hardware related queries in one place.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>

---
Marcin Juszkiewicz (3):
      SbsaQemu: move SMC calls to HardwareInfoLib
      SbsaQemu: move from ArmSmcLib to ArmMonitorLib
      SbsaQemu: drop not needed packages

 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf     |   4 +-
 .../SbsaQemuHardwareInfoLib.inf                     |   8 +-
 .../Qemu/SbsaQemu/Include/Library/HardwareInfoLib.h |  31 +++++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c       |  57 +++------
 .../SbsaQemuHardwareInfoLib.c                       | 132 ++++++++++++++------
 5 files changed, 145 insertions(+), 87 deletions(-)
---
base-commit: a8344967ba17584c13620a639fb24990be020878
change-id: 20240808-move-from-armsmclib-to-armmonitorlib-7ce6c2456c95

Best regards,
-- 
Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>



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



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

* [edk2-devel] [PATCH edk2-platforms 1/3] SbsaQemu: move SMC calls to HardwareInfoLib
  2024-08-08 14:20 [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
@ 2024-08-08 14:20 ` Marcin Juszkiewicz
  2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 2/3] SbsaQemu: move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Marcin Juszkiewicz @ 2024-08-08 14:20 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Graeme Gregory, Marcin Juszkiewicz

We now have HardwareInfo library so let move all hardware queries there.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf      |  2 +-
 .../SbsaQemuHardwareInfoLib.inf                      |  5 ++
 .../Qemu/SbsaQemu/Include/Library/HardwareInfoLib.h  | 31 +++++++++++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c        | 57 +++++---------------
 .../SbsaQemuHardwareInfoLib.c                        | 57 ++++++++++++++++++++
 5 files changed, 108 insertions(+), 44 deletions(-)

diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 19534b7a274a..72492df11342 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -28,9 +28,9 @@ [Packages]
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
-  ArmSmcLib
   PcdLib
   DebugLib
+  HardwareInfoLib
   NonDiscoverableDeviceRegistrationLib
   UefiDriverEntryPoint
 
diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
index 2acb2a1e7c76..58a9c03f18b8 100644
--- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
+++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
@@ -27,3 +27,8 @@ [Packages]
 [LibraryClasses]
   ArmSmcLib
   ResetSystemLib
+
+[Pcd]
+  gArmTokenSpaceGuid.PcdGicDistributorBase
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdGicItsBase
diff --git a/Silicon/Qemu/SbsaQemu/Include/Library/HardwareInfoLib.h b/Silicon/Qemu/SbsaQemu/Include/Library/HardwareInfoLib.h
index 7e0bd962f8a9..03335609bef6 100644
--- a/Silicon/Qemu/SbsaQemu/Include/Library/HardwareInfoLib.h
+++ b/Silicon/Qemu/SbsaQemu/Include/Library/HardwareInfoLib.h
@@ -28,6 +28,17 @@ typedef struct {
   UINT32    Threads;
 } CpuTopology;
 
+typedef struct {
+  UINTN    DistributorBase;
+  UINTN    RedistributorBase;
+  UINTN    ItsBase;
+} GicInfo;
+
+typedef struct {
+  UINT32    Major;
+  UINT32    Minor;
+} PlatformVersion;
+
 /**
   Get CPU count from information passed by Qemu.
 
@@ -109,4 +120,24 @@ GetCpuTopology (
   OUT CpuTopology  *CpuTopo
   );
 
+/**
+  Get GIC information (base of GICD, GICR, GICI) from TF-A.
+
+  @param [out]  GicInfo     A pointer to the GIC information.
+**/
+VOID
+GetGicInformation (
+  OUT GicInfo  *GicInfo
+  );
+
+/**
+  Get Platform version from TF-A.
+
+  @param [out]  PlatVer     A pointer to the Platform version.
+**/
+VOID
+GetPlatformVersion (
+  OUT PlatformVersion  *PlatVer
+  );
+
 #endif /* HARDWARE_INFO_LIB */
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index 657f9700062b..a9c664e1db1f 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -7,14 +7,13 @@
 *
 **/
 
-#include <Library/ArmSmcLib.h>
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
+#include <Library/HardwareInfoLib.h>
 #include <Library/NonDiscoverableDeviceRegistrationLib.h>
 #include <Library/PcdLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/UefiDriverEntryPoint.h>
-#include <IndustryStandard/SbsaQemuSmc.h>
 #include <IndustryStandard/SbsaQemuPlatformVersion.h>
 
 EFI_STATUS
@@ -24,13 +23,11 @@ InitializeSbsaQemuPlatformDxe (
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
-  EFI_STATUS     Status;
-  UINTN          Size;
-  VOID           *Base;
-  UINTN          Arg0;
-  UINTN          Arg1;
-  UINTN          SmcResult;
-  RETURN_STATUS  Result;
+  EFI_STATUS       Status;
+  UINTN            Size;
+  VOID             *Base;
+  GicInfo          GicInfo;
+  PlatformVersion  PlatVer;
 
   DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", __FUNCTION__));
 
@@ -68,44 +65,18 @@ InitializeSbsaQemuPlatformDxe (
     return Status;
   }
 
-  SmcResult = ArmCallSmc0 (SIP_SVC_VERSION, &Arg0, &Arg1, NULL);
-  if (SmcResult == SMC_ARCH_CALL_SUCCESS) {
-    Result = PcdSet32S (PcdPlatformVersionMajor, Arg0);
-    ASSERT_RETURN_ERROR (Result);
-    Result = PcdSet32S (PcdPlatformVersionMinor, Arg1);
-    ASSERT_RETURN_ERROR (Result);
-  }
+  GetPlatformVersion (&PlatVer);
 
-  Arg0 = PcdGet32 (PcdPlatformVersionMajor);
-  Arg1 = PcdGet32 (PcdPlatformVersionMinor);
+  PcdSet32S (PcdPlatformVersionMajor, PlatVer.Major);
+  PcdSet32S (PcdPlatformVersionMinor, PlatVer.Minor);
 
-  DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", Arg0, Arg1));
+  DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", PlatVer.Major, PlatVer.Minor));
 
-  SmcResult = ArmCallSmc0 (SIP_SVC_GET_GIC, &Arg0, &Arg1, NULL);
-  if (SmcResult == SMC_ARCH_CALL_SUCCESS) {
-    Result = PcdSet64S (PcdGicDistributorBase, Arg0);
-    ASSERT_RETURN_ERROR (Result);
-    Result = PcdSet64S (PcdGicRedistributorsBase, Arg1);
-    ASSERT_RETURN_ERROR (Result);
-  }
+  GetGicInformation (&GicInfo);
 
-  Arg0 = PcdGet64 (PcdGicDistributorBase);
-
-  DEBUG ((DEBUG_INFO, "GICD base: 0x%x\n", Arg0));
-
-  Arg0 = PcdGet64 (PcdGicRedistributorsBase);
-
-  DEBUG ((DEBUG_INFO, "GICR base: 0x%x\n", Arg0));
-
-  SmcResult = ArmCallSmc0 (SIP_SVC_GET_GIC_ITS, &Arg0, NULL, NULL);
-  if (SmcResult == SMC_ARCH_CALL_SUCCESS) {
-    Result = PcdSet64S (PcdGicItsBase, Arg0);
-    ASSERT_RETURN_ERROR (Result);
-  }
-
-  Arg0 = PcdGet64 (PcdGicItsBase);
-
-  DEBUG ((DEBUG_INFO, "GICI base: 0x%x\n", Arg0));
+  PcdSet64S (PcdGicDistributorBase, GicInfo.DistributorBase);
+  PcdSet64S (PcdGicRedistributorsBase, GicInfo.RedistributorBase);
+  PcdSet64S (PcdGicItsBase, GicInfo.ItsBase);
 
   if (!PLATFORM_VERSION_LESS_THAN (0, 3)) {
     Base = (VOID *)(UINTN)PcdGet64 (PcdPlatformXhciBase);
diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
index b8d1abe2d0bc..1d5291cf5b28 100644
--- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
+++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
@@ -216,3 +216,60 @@ GetCpuTopology (
     CpuTopo->Threads
     ));
 }
+
+/**
+  Get GIC information from TF-A.
+
+  If run on old platform then use values from EDK2 configuration.
+**/
+VOID
+GetGicInformation (
+  OUT GicInfo  *GicInfo
+  )
+{
+  ARM_MONITOR_ARGS  SmcArgs;
+
+  SmcArgs.Arg0 = SIP_SVC_GET_GIC;
+  ArmMonitorCall (&SmcArgs);
+
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
+    GicInfo->DistributorBase   = PcdGet64 (PcdGicDistributorBase);
+    GicInfo->RedistributorBase = PcdGet64 (PcdGicRedistributorsBase);
+  } else {
+    GicInfo->DistributorBase   = SmcArgs.Arg1;
+    GicInfo->RedistributorBase = SmcArgs.Arg2;
+  }
+
+  SmcArgs.Arg0 = SIP_SVC_GET_GIC_ITS;
+  ArmMonitorCall (&SmcArgs);
+
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
+    GicInfo->ItsBase = PcdGet64 (PcdGicItsBase);
+  } else {
+    GicInfo->ItsBase = SmcArgs.Arg1;
+  }
+}
+
+/**
+  Get Platform version from TF-A.
+
+  If run on old platform then 0.0 value is used.
+**/
+VOID
+GetPlatformVersion (
+  OUT PlatformVersion  *PlatVer
+  )
+{
+  ARM_MONITOR_ARGS  SmcArgs;
+
+  SmcArgs.Arg0 = SIP_SVC_VERSION;
+  ArmMonitorCall (&SmcArgs);
+
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
+    PlatVer->Major = 0;
+    PlatVer->Minor = 0;
+  } else {
+    PlatVer->Major = SmcArgs.Arg1;
+    PlatVer->Minor = SmcArgs.Arg2;
+  }
+}

-- 
2.45.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120296): https://edk2.groups.io/g/devel/message/120296
Mute This Topic: https://groups.io/mt/107790446/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] 6+ messages in thread

* [edk2-devel] [PATCH edk2-platforms 2/3] SbsaQemu: move from ArmSmcLib to ArmMonitorLib
  2024-08-08 14:20 [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
  2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 1/3] SbsaQemu: move SMC calls to HardwareInfoLib Marcin Juszkiewicz
@ 2024-08-08 14:20 ` Marcin Juszkiewicz
  2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 3/3] SbsaQemu: drop not needed packages Marcin Juszkiewicz
  2024-08-08 16:51 ` [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Leif Lindholm
  3 siblings, 0 replies; 6+ messages in thread
From: Marcin Juszkiewicz @ 2024-08-08 14:20 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Graeme Gregory, Marcin Juszkiewicz

ArmMonitorLib allows to use 18 registers are both arguments and results.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 .../SbsaQemuHardwareInfoLib.inf                      |  2 +-
 .../SbsaQemuHardwareInfoLib.c                        | 75 ++++++++++----------
 2 files changed, 37 insertions(+), 40 deletions(-)

diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
index 58a9c03f18b8..dd920546b11a 100644
--- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
+++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
@@ -25,7 +25,7 @@ [Packages]
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
-  ArmSmcLib
+  ArmMonitorLib
   ResetSystemLib
 
 [Pcd]
diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
index 1d5291cf5b28..cd9db02ba9fe 100644
--- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
+++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
@@ -7,7 +7,6 @@
 *
 **/
 
-#include <Library/ArmSmcLib.h>
 #include <Library/ArmMonitorLib.h>
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
@@ -24,18 +23,19 @@ GetCpuCount (
   VOID
   )
 {
-  UINTN  Arg0;
-  UINTN  SmcResult;
+  ARM_MONITOR_ARGS  SmcArgs;
 
-  SmcResult = ArmCallSmc0 (SIP_SVC_GET_CPU_COUNT, &Arg0, NULL, NULL);
-  if (SmcResult != SMC_SIP_CALL_SUCCESS) {
+  SmcArgs.Arg0 = SIP_SVC_GET_CPU_COUNT;
+  ArmMonitorCall (&SmcArgs);
+
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
     DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_CPU_COUNT call failed. We have no cpu information.\n", __FUNCTION__));
     ResetShutdown ();
   }
 
-  DEBUG ((DEBUG_INFO, "%a: We have %d cpus.\n", __FUNCTION__, Arg0));
+  DEBUG ((DEBUG_INFO, "%a: We have %d cpus.\n", __FUNCTION__, SmcArgs.Arg1));
 
-  return Arg0;
+  return SmcArgs.Arg1;
 }
 
 /**
@@ -50,21 +50,20 @@ GetMpidr (
   IN UINTN  CpuId
   )
 {
-  UINTN  SmcResult;
-  UINTN  Arg0;
-  UINTN  Arg1;
+  ARM_MONITOR_ARGS  SmcArgs;
 
-  Arg0 = CpuId;
+  SmcArgs.Arg0 = SIP_SVC_GET_CPU_NODE;
+  SmcArgs.Arg1 = CpuId;
+  ArmMonitorCall (&SmcArgs);
 
-  SmcResult = ArmCallSmc0 (SIP_SVC_GET_CPU_NODE, &Arg0, &Arg1, NULL);
-  if (SmcResult != SMC_SIP_CALL_SUCCESS) {
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
     DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_CPU_NODE call failed. We have no MPIDR for CPU%d.\n", __FUNCTION__, CpuId));
     ResetShutdown ();
   }
 
-  DEBUG ((DEBUG_INFO, "%a: MPIDR for CPU%d: = %d\n", __FUNCTION__, CpuId, Arg1));
+  DEBUG ((DEBUG_INFO, "%a: MPIDR for CPU%d: = %d\n", __FUNCTION__, CpuId, SmcArgs.Arg2));
 
-  return Arg1;
+  return SmcArgs.Arg2;
 }
 
 /**
@@ -79,21 +78,20 @@ GetCpuNumaNode (
   IN UINTN  CpuId
   )
 {
-  UINTN  SmcResult;
-  UINTN  Arg0;
-  UINTN  Arg1;
+  ARM_MONITOR_ARGS  SmcArgs;
 
-  Arg0 = CpuId;
+  SmcArgs.Arg0 = SIP_SVC_GET_CPU_NODE;
+  SmcArgs.Arg1 = CpuId;
+  ArmMonitorCall (&SmcArgs);
 
-  SmcResult = ArmCallSmc0 (SIP_SVC_GET_CPU_NODE, &Arg0, &Arg1, NULL);
-  if (SmcResult != SMC_SIP_CALL_SUCCESS) {
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
     DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_CPU_NODE call failed. Could not find information for CPU%d.\n", __FUNCTION__, CpuId));
     return 0;
   }
 
-  DEBUG ((DEBUG_INFO, "%a: NUMA node for CPU%d: = %d\n", __FUNCTION__, CpuId, Arg0));
+  DEBUG ((DEBUG_INFO, "%a: NUMA node for CPU%d: = %d\n", __FUNCTION__, CpuId, SmcArgs.Arg1));
 
-  return Arg0;
+  return SmcArgs.Arg1;
 }
 
 UINT32
@@ -101,17 +99,18 @@ GetMemNodeCount (
   VOID
   )
 {
-  UINTN  SmcResult;
-  UINTN  Arg0;
+  ARM_MONITOR_ARGS  SmcArgs;
 
-  SmcResult = ArmCallSmc0 (SIP_SVC_GET_MEMORY_NODE_COUNT, &Arg0, NULL, NULL);
-  if (SmcResult != SMC_SIP_CALL_SUCCESS) {
+  SmcArgs.Arg0 = SIP_SVC_GET_MEMORY_NODE_COUNT;
+  ArmMonitorCall (&SmcArgs);
+
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
     DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_MEMORY_NODE_COUNT call failed. We have no memory information.\n", __FUNCTION__));
     ResetShutdown ();
   }
 
-  DEBUG ((DEBUG_INFO, "%a: The number of the memory nodes is %ld\n", __FUNCTION__, Arg0));
-  return (UINT32)Arg0;
+  DEBUG ((DEBUG_INFO, "%a: The number of the memory nodes is %ld\n", __FUNCTION__, SmcArgs.Arg1));
+  return (UINT32)SmcArgs.Arg1;
 }
 
 VOID
@@ -120,21 +119,19 @@ GetMemInfo (
   OUT MemoryInfo  *MemInfo
   )
 {
-  UINTN  SmcResult;
-  UINTN  Arg0;
-  UINTN  Arg1;
-  UINTN  Arg2;
+  ARM_MONITOR_ARGS  SmcArgs;
 
-  Arg0 = MemoryId;
+  SmcArgs.Arg0 = SIP_SVC_GET_MEMORY_NODE;
+  SmcArgs.Arg1 = MemoryId;
+  ArmMonitorCall (&SmcArgs);
 
-  SmcResult = ArmCallSmc1 (SIP_SVC_GET_MEMORY_NODE, &Arg0, &Arg1, &Arg2);
-  if (SmcResult != SMC_SIP_CALL_SUCCESS) {
+  if (SmcArgs.Arg0 != SMC_SIP_CALL_SUCCESS) {
     DEBUG ((DEBUG_ERROR, "%a: SIP_SVC_GET_MEMORY_NODE call failed. We have no memory information.\n", __FUNCTION__));
     ResetShutdown ();
   } else {
-    MemInfo->NodeId      = Arg0;
-    MemInfo->AddressBase = Arg1;
-    MemInfo->AddressSize = Arg2;
+    MemInfo->NodeId      = SmcArgs.Arg1;
+    MemInfo->AddressBase = SmcArgs.Arg2;
+    MemInfo->AddressSize = SmcArgs.Arg3;
   }
 
   DEBUG ((

-- 
2.45.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120297): https://edk2.groups.io/g/devel/message/120297
Mute This Topic: https://groups.io/mt/107790447/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] 6+ messages in thread

* [edk2-devel] [PATCH edk2-platforms 3/3] SbsaQemu: drop not needed packages
  2024-08-08 14:20 [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
  2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 1/3] SbsaQemu: move SMC calls to HardwareInfoLib Marcin Juszkiewicz
  2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 2/3] SbsaQemu: move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
@ 2024-08-08 14:20 ` Marcin Juszkiewicz
  2024-08-08 16:51 ` [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Leif Lindholm
  3 siblings, 0 replies; 6+ messages in thread
From: Marcin Juszkiewicz @ 2024-08-08 14:20 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Graeme Gregory, Marcin Juszkiewicz

SbsaQemuPlatformDxe does not need ArmVirtPkg and EmbeddedPkg.
SbsaHardwareInfoLib does not need EmbeddedPkg.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 .../Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf   | 2 --
 .../Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf         | 1 -
 2 files changed, 3 deletions(-)

diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 72492df11342..b94f01cc0e6d 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -21,8 +21,6 @@ [Sources]
 
 [Packages]
   ArmPkg/ArmPkg.dec
-  ArmVirtPkg/ArmVirtPkg.dec
-  EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
index dd920546b11a..1f3525eb95f9 100644
--- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
+++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
@@ -19,7 +19,6 @@ [Sources]
 
 [Packages]
   ArmPkg/ArmPkg.dec
-  EmbeddedPkg/EmbeddedPkg.dec
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec

-- 
2.45.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120298): https://edk2.groups.io/g/devel/message/120298
Mute This Topic: https://groups.io/mt/107790449/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] 6+ messages in thread

* Re: [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib
  2024-08-08 14:20 [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
                   ` (2 preceding siblings ...)
  2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 3/3] SbsaQemu: drop not needed packages Marcin Juszkiewicz
@ 2024-08-08 16:51 ` Leif Lindholm
  2024-08-08 17:53   ` Marcin Juszkiewicz
  3 siblings, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2024-08-08 16:51 UTC (permalink / raw)
  To: Marcin Juszkiewicz, devel; +Cc: Ard Biesheuvel, Graeme Gregory

On 2024-08-08 15:20, Marcin Juszkiewicz wrote:
> During last weeks Ard updated ArmMonitorLib to current SMCCC
> specification. This allows to use 18 registers as both arguments and
> return values.
> 
> We already have one SMC call with 5 return values (GetCpuTopology) so
> let move all calls to use of ArmMonitorLib to simplify code.
> 
> First patch also moves all SMC calls we use into HardwareInfoLib to have
> all hardware related queries in one place.
> 
> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>

For the series:
Leif Lindholm <quic_llindhol@quicinc.com>

Thanks!

> ---
> Marcin Juszkiewicz (3):
>        SbsaQemu: move SMC calls to HardwareInfoLib
>        SbsaQemu: move from ArmSmcLib to ArmMonitorLib
>        SbsaQemu: drop not needed packages
> 
>   .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf     |   4 +-
>   .../SbsaQemuHardwareInfoLib.inf                     |   8 +-
>   .../Qemu/SbsaQemu/Include/Library/HardwareInfoLib.h |  31 +++++
>   .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c       |  57 +++------
>   .../SbsaQemuHardwareInfoLib.c                       | 132 ++++++++++++++------
>   5 files changed, 145 insertions(+), 87 deletions(-)
> ---
> base-commit: a8344967ba17584c13620a639fb24990be020878
> change-id: 20240808-move-from-armsmclib-to-armmonitorlib-7ce6c2456c95
> 
> Best regards,



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



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

* Re: [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib
  2024-08-08 16:51 ` [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Leif Lindholm
@ 2024-08-08 17:53   ` Marcin Juszkiewicz
  0 siblings, 0 replies; 6+ messages in thread
From: Marcin Juszkiewicz @ 2024-08-08 17:53 UTC (permalink / raw)
  To: devel, quic_llindhol; +Cc: Ard Biesheuvel, Graeme Gregory

On 8.08.2024 18:51, Leif Lindholm via groups.io wrote:
>> During last weeks Ard updated ArmMonitorLib to current SMCCC
>> specification. This allows to use 18 registers as both arguments and
>> return values.
>>
>> We already have one SMC call with 5 return values (GetCpuTopology) so
>> let move all calls to use of ArmMonitorLib to simplify code.
>>
>> First patch also moves all SMC calls we use into HardwareInfoLib to have
>> all hardware related queries in one place.
>>
>> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> 
> For the series:
> Leif Lindholm <quic_llindhol@quicinc.com>
> 
> Thanks!

Thanks, pushed as 22ed007688b181a7682e4f82ae4537def48186c0.


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



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

end of thread, other threads:[~2024-08-08 17:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 14:20 [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 1/3] SbsaQemu: move SMC calls to HardwareInfoLib Marcin Juszkiewicz
2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 2/3] SbsaQemu: move from ArmSmcLib to ArmMonitorLib Marcin Juszkiewicz
2024-08-08 14:20 ` [edk2-devel] [PATCH edk2-platforms 3/3] SbsaQemu: drop not needed packages Marcin Juszkiewicz
2024-08-08 16:51 ` [edk2-devel] [PATCH edk2-platforms 0/3] SbsaQemu: Move from ArmSmcLib to ArmMonitorLib Leif Lindholm
2024-08-08 17:53   ` Marcin Juszkiewicz

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