public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2 1/1] OvmfPkg/RiscVVirt: Fix SCT memory allocation test case failure
@ 2023-02-22  2:36 Sunil V L
  2023-02-22  7:21 ` Andrei Warkentin
  0 siblings, 1 reply; 2+ messages in thread
From: Sunil V L @ 2023-02-22  2:36 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann,
	Andrei Warkentin, Heinrich Schuchardt

Fix the UEFI memory range calculation by including the correct
stack memory range. Without this fix, SCT hangs in MemoryAllocation
test cases which call AllocateAddress().

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Andrei Warkentin <andrei.warkentin@intel.com>
Reported-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
Changes since V1:
	1) Fixed the inaccurate description regarding stack
	   growth (Thanks Andrei!)
	2) Simplified the fix.

 OvmfPkg/RiscVVirt/Sec/SecMain.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/RiscVVirt/Sec/SecMain.c b/OvmfPkg/RiscVVirt/Sec/SecMain.c
index 054e49ef0c1e..73b9b21a67ba 100644
--- a/OvmfPkg/RiscVVirt/Sec/SecMain.c
+++ b/OvmfPkg/RiscVVirt/Sec/SecMain.c
@@ -71,8 +71,9 @@ SecStartup (
   FirmwareContext.FlattenedDeviceTree = (UINT64)DeviceTreeAddress;
   SetFirmwareContextPointer (&FirmwareContext);
 
-  StackBase      = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase);
-  UefiMemoryBase = StackBase +  FixedPcdGet32 (PcdOvmfSecPeiTempRamSize) - SIZE_32MB;
+  StackBase = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) +
+              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize);
+  UefiMemoryBase = StackBase - SIZE_32MB;
 
   // Declare the PI/UEFI memory region
   HobList = HobConstructor (
-- 
2.34.1


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

* Re: [PATCH V2 1/1] OvmfPkg/RiscVVirt: Fix SCT memory allocation test case failure
  2023-02-22  2:36 [PATCH V2 1/1] OvmfPkg/RiscVVirt: Fix SCT memory allocation test case failure Sunil V L
@ 2023-02-22  7:21 ` Andrei Warkentin
  0 siblings, 0 replies; 2+ messages in thread
From: Andrei Warkentin @ 2023-02-22  7:21 UTC (permalink / raw)
  To: Sunil V L, devel@edk2.groups.io
  Cc: Ard Biesheuvel, Yao, Jiewen, Justen, Jordan L, Gerd Hoffmann,
	Heinrich Schuchardt

Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>

-----Original Message-----
From: Sunil V L <sunilvl@ventanamicro.com> 
Sent: Tuesday, February 21, 2023 8:37 PM
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen <jiewen.yao@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Warkentin, Andrei <andrei.warkentin@intel.com>; Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Subject: [PATCH V2 1/1] OvmfPkg/RiscVVirt: Fix SCT memory allocation test case failure

Fix the UEFI memory range calculation by including the correct stack memory range. Without this fix, SCT hangs in MemoryAllocation test cases which call AllocateAddress().

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Andrei Warkentin <andrei.warkentin@intel.com>
Reported-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
Changes since V1:
	1) Fixed the inaccurate description regarding stack
	   growth (Thanks Andrei!)
	2) Simplified the fix.

 OvmfPkg/RiscVVirt/Sec/SecMain.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/RiscVVirt/Sec/SecMain.c b/OvmfPkg/RiscVVirt/Sec/SecMain.c index 054e49ef0c1e..73b9b21a67ba 100644
--- a/OvmfPkg/RiscVVirt/Sec/SecMain.c
+++ b/OvmfPkg/RiscVVirt/Sec/SecMain.c
@@ -71,8 +71,9 @@ SecStartup (
   FirmwareContext.FlattenedDeviceTree = (UINT64)DeviceTreeAddress;
   SetFirmwareContextPointer (&FirmwareContext);
 
-  StackBase      = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase);
-  UefiMemoryBase = StackBase +  FixedPcdGet32 (PcdOvmfSecPeiTempRamSize) - SIZE_32MB;
+  StackBase = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) +
+              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize);  UefiMemoryBase 
+ = StackBase - SIZE_32MB;
 
   // Declare the PI/UEFI memory region
   HobList = HobConstructor (
--
2.34.1


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

end of thread, other threads:[~2023-02-22  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-22  2:36 [PATCH V2 1/1] OvmfPkg/RiscVVirt: Fix SCT memory allocation test case failure Sunil V L
2023-02-22  7:21 ` Andrei Warkentin

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