Skip to contentSkip to conversation

hw/intc: Fix arm kvm gicv3 selection

PATCH Applied Richard Henderson 3 participants 5 messages Aug 12 – Aug 17 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/intc: Fix arm kvm gicv3 selection

While 39a8c3941e may have fixed WHPX, it certainly didn't help KVM:

  $ QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/arm-cpu-features
  ...
  qemu-system-aarch64: unknown type 'kvm-arm-gicv3'

That patch did remove a test for TARGET_AARCH64, which is fine because it has been a long time since we supported KVM for AArch32.

Fixes 39a8c3941e ("hw/intc/arm_gicv3: Fix ARM_GICV3 dependency for KVM / WHPX")
---
 hw/intc/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/meson.build +1 -1
index a1401cb521..faf63a0145 100644
@@ -48,7 +48,7 @@ specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
 specific_ss.add(when: ['CONFIG_WHPX', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_whpx.c'))
 specific_ss.add(when: ['CONFIG_HVF', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_hvf.c'))
 stub_ss.add(files('arm_gicv3_hvf_stub.c'))
-specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
+specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
 arm_common_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
 specific_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_irqmp.c'))
 specific_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))
Signature · 1 line
2.43.0
#1 lore raw
Quoted 20 lines · Richard Henderson

While 39a8c3941e may have fixed WHPX, it certainly didn't help KVM:

   $ QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/arm-cpu-features
   ...
   qemu-system-aarch64: unknown type 'kvm-arm-gicv3'

That patch did remove a test for TARGET_AARCH64, which is fine because it has been a long time since we supported KVM for AArch32.

Fixes 39a8c3941e ("hw/intc/arm_gicv3: Fix ARM_GICV3 dependency for KVM / WHPX")
---
  hw/intc/meson.build | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/meson.build +0 -0
index a1401cb521..faf63a0145 100644

hw/intc/meson.build specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) · line 54

Quoted 8 lines
hw/intc/meson.build +1 -1
@@ -48,7 +48,7 @@ specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
  specific_ss.add(when: ['CONFIG_WHPX', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_whpx.c'))
  specific_ss.add(when: ['CONFIG_HVF', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_hvf.c'))
  stub_ss.add(files('arm_gicv3_hvf_stub.c'))
-specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
+specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
  arm_common_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
  specific_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_irqmp.c'))
  specific_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))

Alternately, we need to adjust

config ARM_GIC
bool
select ARM_GICV3 if TCG
select ARM_GIC_KVM if KVM
select MSI_NONBROKEN

Though I'm not sure how ARM_GICV3 + WHPX would ever get selected?

Alternately, given the very tight connection between all GIC revisions and the cpu, how does it make sense for any version of GIC to be non-selected? Just remove all the GIC configury and include it with just TARGET_AARCH64 (not vs TARGET_ARM, but vs any other valid virtualization host).

r~

#2 lore raw
Quoted 39 lines · Richard Henderson
Quoted 20 lines · Richard Henderson

While 39a8c3941e may have fixed WHPX, it certainly didn't help KVM:

   $ QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/arm-cpu-features
   ...
   qemu-system-aarch64: unknown type 'kvm-arm-gicv3'

That patch did remove a test for TARGET_AARCH64, which is fine because it has been a long time since we supported KVM for AArch32.

Fixes 39a8c3941e ("hw/intc/arm_gicv3: Fix ARM_GICV3 dependency for KVM / WHPX")
---
  hw/intc/meson.build | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/meson.build +0 -0
index a1401cb521..faf63a0145 100644

hw/intc/meson.build specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) · line 54

Quoted 8 lines
hw/intc/meson.build +1 -1
@@ -48,7 +48,7 @@ specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
  specific_ss.add(when: ['CONFIG_WHPX', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_whpx.c'))
  specific_ss.add(when: ['CONFIG_HVF', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_hvf.c'))
  stub_ss.add(files('arm_gicv3_hvf_stub.c'))
-specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
+specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
  arm_common_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
  specific_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_irqmp.c'))
  specific_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))

Alternately, we need to adjust

config ARM_GIC
bool
select ARM_GICV3 if TCG
select ARM_GIC_KVM if KVM
select MSI_NONBROKEN

Quoted 6 lines

Though I'm not sure how ARM_GICV3 + WHPX would ever get selected?

Alternately, given the very tight connection between all GIC revisions and the cpu, how does it make sense for any version of GIC to be non-selected? Just remove all the GIC configury and include it with just TARGET_AARCH64 (not vs TARGET_ARM, but vs any other valid virtualization host).

I think the rationale behind the kconfig handling here is that for a KVM-only build we would prefer not to compile in all the emulated GICv3 code (only the base class and the KVM subclass), so that in that more security-sensitive configuration a user/distro/etc can be confident that all that emulation code is not in the binary at all.

thanks
-- PMM

#3 lore raw
In reply to Richard Henderson
Quoted 20 lines · Richard Henderson

While 39a8c3941e may have fixed WHPX, it certainly didn't help KVM:

   $ QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/arm-cpu-features
   ...
   qemu-system-aarch64: unknown type 'kvm-arm-gicv3'

That patch did remove a test for TARGET_AARCH64, which is fine because it has been a long time since we supported KVM for AArch32.

Fixes 39a8c3941e ("hw/intc/arm_gicv3: Fix ARM_GICV3 dependency for KVM / WHPX")
---
  hw/intc/meson.build | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/meson.build +0 -0
index a1401cb521..faf63a0145 100644

hw/intc/meson.build specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) · line 54

Quoted 8 lines
hw/intc/meson.build +1 -1
@@ -48,7 +48,7 @@ specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
  specific_ss.add(when: ['CONFIG_WHPX', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_whpx.c'))
  specific_ss.add(when: ['CONFIG_HVF', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_hvf.c'))
  stub_ss.add(files('arm_gicv3_hvf_stub.c'))
-specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
+specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
  arm_common_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
  specific_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_irqmp.c'))
  specific_ss.add(when: 'CONFIG_IOAPIC', if_true: files('ioapic.c'))

Yeah sorry.

The other fix I mentioned but never posted is:

-- >8 --

hw/intc/Kconfig +1 -1
index 636d00b7e88..1fec78f3bf1 100644
@@ -23,7 +23,7 @@ config APIC
 
 config ARM_GIC
     bool
-    select ARM_GICV3 if TCG
+    select ARM_GICV3 if TCG || HVF || WHPX
     select ARM_GIC_KVM if KVM
     select MSI_NONBROKEN
 

---

#4 lore raw
In reply to Richard Henderson
Quoted 7 lines · Richard Henderson

While 39a8c3941e may have fixed WHPX, it certainly didn't help KVM:

  $ QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/arm-cpu-features
  ...
  qemu-system-aarch64: unknown type 'kvm-arm-gicv3'
Quoted 6 lines

That patch did remove a test for TARGET_AARCH64, which is fine because it has been a long time since we supported KVM for AArch32.

Fixes 39a8c3941e ("hw/intc/arm_gicv3: Fix ARM_GICV3 dependency for KVM / WHPX")

---

Applied to target-arm.next, thanks.

-- PMM