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

-----Original Message-----
From: Sunil V L <suni...@ventanamicro.com> 
Sent: Tuesday, February 21, 2023 8:37 PM
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>; Yao, Jiewen 
<jiewen....@intel.com>; Justen, Jordan L <jordan.l.jus...@intel.com>; Gerd 
Hoffmann <kra...@redhat.com>; Warkentin, Andrei <andrei.warken...@intel.com>; 
Heinrich Schuchardt <heinrich.schucha...@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+tianoc...@kernel.org>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Andrei Warkentin <andrei.warken...@intel.com>
Reported-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
Signed-off-by: Sunil V L <suni...@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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100434): https://edk2.groups.io/g/devel/message/100434
Mute This Topic: https://groups.io/mt/97152061/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to