From 01ce872739d2f0cd3a8917be2180381db5f0391e Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Wed, 11 Mar 2020 15:10:18 +0000 Subject: ArmVirtPkg: fix ASSERT in ArmVirtGicArchLib with virtualization=on 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 Cc: Ard Biesheuvel Signed-off-by: Leif Lindholm Reviewed-by: Laszlo Ersek --- ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ArmVirtPkg') diff --git a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c index af6b3af60e..5448865ad8 100644 --- a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c +++ b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c @@ -110,7 +110,12 @@ ArmVirtGicArchLibConstructor ( break; case 2: - ASSERT (RegSize == 32); + // + // When the GICv2 is emulated with virtualization=on, it adds a virtual + // set of control registers. This means the register property can be + // either 32 or 64 bytes in size. + // + ASSERT ((RegSize == 32) || (RegSize == 64)); DistBase = SwapBytes64 (Reg[0]); CpuBase = SwapBytes64 (Reg[2]); -- cgit v1.2.3