]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg: fix ASSERT in ArmVirtGicArchLib with virtualization=on
authorLeif Lindholm <leif@nuviainc.com>
Wed, 11 Mar 2020 15:10:18 +0000 (15:10 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 17 Mar 2020 15:06:11 +0000 (15:06 +0000)
ArmVirtGicArchLib was originally implemented before virtualization
emulation was implemented in QEMU, and the GICv2 model implemented only
the physical copy of control registers.

Enabling virtualization emulation to QEMU adds also the virtual copy,
doubling the RegSize returned by FindCompatibleNodeReg () in
ArmVirtGicArchLibConstructor (). This triggered an ASSERT when running
QEMU with -M virt,virtualization=on. Address this by testing for both
possible valid values of RegSize.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2588

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c

index af6b3af60edf17c6ee2ab78a3c2403effe9cc838..5448865ad8e81b8edac21bd5eb34eb18703fad6a 100644 (file)
@@ -110,7 +110,12 @@ ArmVirtGicArchLibConstructor (
     break;\r
 \r
   case 2:\r
-    ASSERT (RegSize == 32);\r
+    //\r
+    // When the GICv2 is emulated with virtualization=on, it adds a virtual\r
+    // set of control registers. This means the register property can be\r
+    // either 32 or 64 bytes in size.\r
+    //\r
+    ASSERT ((RegSize == 32) || (RegSize == 64));\r
 \r
     DistBase = SwapBytes64 (Reg[0]);\r
     CpuBase  = SwapBytes64 (Reg[2]);\r