hw/intc: Select generic ARM_GICV3 when KVM is not available
cover hw/intc: Select generic ARM_GICV3 when KVM is not available
ARM_GICV3 is not restricted to TCG and can be used on HVF.
Philippe Mathieu-Daudé (2):
hw/intc: Remove TCG dependency on ARM_GICV3
hw/intc: Have ARM_GIC select ARM_GICV3 when KVM is not available
hw/intc/Kconfig | 6 +++--- hw/intc/meson.build | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.47.1
PATCH 1/2 hw/intc: Remove TCG dependency on ARM_GICV3
The TYPE_ARM_GICV3 model doesn't have any particular dependency on TCG, remove it. Rename the Kconfig selector ARM_GICV3_TCG -> ARM_GICV3.
--- hw/intc/Kconfig | 6 +++--- hw/intc/meson.build | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
hw/intc/Kconfig +3 -3
@@ -23,13 +23,13 @@ config APIC config ARM_GIC bool - select ARM_GICV3_TCG if TCG + select ARM_GICV3 if TCG select ARM_GIC_KVM if KVM select MSI_NONBROKEN -config ARM_GICV3_TCG +config ARM_GICV3 bool - depends on ARM_GIC && TCG + depends on ARM_GIC config ARM_GIC_KVM bool
hw/intc/meson.build +2 -2
@@ -6,7 +6,7 @@ system_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( 'arm_gicv3_common.c', 'arm_gicv3_its_common.c', )) -system_ss.add(when: 'CONFIG_ARM_GICV3_TCG', if_true: files( +system_ss.add(when: 'CONFIG_ARM_GICV3', if_true: files( 'arm_gicv3.c', 'arm_gicv3_dist.c', 'arm_gicv3_its.c',
@@ -39,7 +39,7 @@ endif specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) -specific_ss.add(when: 'CONFIG_ARM_GICV3_TCG', if_true: files('arm_gicv3_cpuif.c')) +specific_ss.add(when: 'CONFIG_ARM_GICV3', if_true: files('arm_gicv3_cpuif.c')) specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
Signature · 1 line
2.47.1
Re: [PATCH 1/2] hw/intc: Remove TCG dependency on ARM_GICV3
Quoted 8 lines · Philippe Mathieu-Daudé
The
TYPE_ARM_GICV3model doesn't have any particular dependency on TCG, remove it. Rename theKconfigselectorARM_GICV3_TCG->ARM_GICV3.Fixes a8a5546798c ("hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG
Kconfigselector")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 58 lines
--- hw/intc/Kconfig | 6 +++--- hw/intc/meson.build | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)hw/intc/Kconfig +3
-3@@ -23,13 +23,13 @@ config APIC config ARM_GIC bool - select ARM_GICV3_TCG if TCG + select ARM_GICV3 if TCG select ARM_GIC_KVM if KVM select MSI_NONBROKEN -config ARM_GICV3_TCG +config ARM_GICV3 bool - depends on ARM_GIC && TCG + depends on ARM_GIC config ARM_GIC_KVM boolhw/intc/meson.build +2
-2@@ -6,7 +6,7 @@ system_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( 'arm_gicv3_common.c', 'arm_gicv3_its_common.c', )) -system_ss.add(when: 'CONFIG_ARM_GICV3_TCG', if_true: files( +system_ss.add(when: 'CONFIG_ARM_GICV3', if_true: files( 'arm_gicv3.c', 'arm_gicv3_dist.c', 'arm_gicv3_its.c',@@ -39,7 +39,7 @@ endif specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) -specific_ss.add(when: 'CONFIG_ARM_GICV3_TCG', if_true: files('arm_gicv3_cpuif.c')) +specific_ss.add(when: 'CONFIG_ARM_GICV3', if_true:
files('arm_gicv3_cpuif.c'))
specific_ss.add(when: 'CONFIG_ARM_GIC_KVM',if_true:files('arm_gic_kvm.c'))
specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'],if_true:files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
--
2.47.1
PATCH 2/2 hw/intc: Have ARM_GIC select ARM_GICV3 when KVM is not available
In reply to Philippe Mathieu-DaudéWhen the KVM accelerator is selected, the Kconfig ARM_GIC key selects the KVM GIC implementation (ARM_GIC_KVM). For other accelerators (TCG, HVF, ...), select the generic implementation.
--- hw/intc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/Kconfig +1 -1
@@ -23,7 +23,7 @@ config APIC config ARM_GIC bool - select ARM_GICV3 if TCG + select ARM_GICV3 if !KVM select ARM_GIC_KVM if KVM select MSI_NONBROKEN
Signature · 1 line
2.47.1
Re: [PATCH 2/2] hw/intc: Have ARM_GIC select ARM_GICV3 when KVM is not available
Quoted 15 lines · Philippe Mathieu-Daudé
When the KVM accelerator is selected, the
KconfigARM_GICkey selects the KVM GIC implementation (ARM_GIC_KVM). For other accelerators (TCG, HVF, ...), select the generic implementation.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/intc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/intc/Kconfig +0
-0
hw/intc/Kconfig config APIC · line 27
Quoted 6 lines
hw/intc/Kconfig +1
-1@@ -23,7 +23,7 @@ config APIC config ARM_GIC bool - select ARM_GICV3 if TCG + select ARM_GICV3 if !KVM
Wouldn't this disable the ARM_GICV3 by default when building with --enable-tcg --enable-kvm? And then there would be no GIC available when running the built QEMU in TCG mode. (Bear with me, I'm a relative Meson newbie.)
Quoted 7 lines
hw/intc/Kconfig +0
-1select ARM_GIC_KVM if KVM select MSI_NONBROKEN --2.47.1
Re: [PATCH 2/2] hw/intc: Have ARM_GIC select ARM_GICV3 when KVM is not available
Quoted 21 lines · Phil Dennis-Jordan
Quoted 16 lines · Philippe Mathieu-Daudé
When the KVM accelerator is selected, the
KconfigARM_GICkey selects the KVM GIC implementation (ARM_GIC_KVM). For other accelerators (TCG, HVF, ...), select the generic implementation.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/intc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/intc/Kconfig +0
-0@@ -23,7 +23,7 @@ config APIC
Quoted 12 lines
hw/intc/Kconfig config APIC · line 29
Quoted 5 lines
hw/intc/Kconfig +1
-1config ARM_GIC bool - select ARM_GICV3 if TCG + select ARM_GICV3 if !KVMWouldn't this disable the
ARM_GICV3by default when building with --enable-tcg --enable-kvm? And then there would be no GIC available when running the built QEMU in TCG mode. (Bear with me, I'm a relative Meson newbie.)
OK, I've managed to answer my own question now by setting up a RPi5 with aarch64 RPOS and building QEMU on that with --enable-kvm --enable-tcg. With patch 1/2 applied on current upstream master, I get:
$ build/qemu-system-aarch64 -accel tcg -M virt,gic-version=3 -smp 4 -m 4G *[runs successfully]*
with 2/2 applied as well:
$ build/qemu-system-aarch64 -accel tcg -M virt,gic-version=3 -smp 4 -m 4G qemu-system-aarch64: tcg does not support GICv3 emulation $
In other words, with the proposed change, ARM_GICV3 is indeed deselected if KVM is selected even if TCG is also selected.
Possibly very basic question: is there any support for kernel-irqchip=off on aarch64/KVM?
If yes, don't we need ARM_GICV3 in that case anyway, so we should drop any accel dependency on it in the first place?
If we definitely don't need the software GIC in KVM-only builds, I guess we're down to listing each accel that needs it individually. Is that:
select ARM_GICV3 if TCG || HVF || NVMM || WHPX || XEN_EMU || XEN
or can we drop any of those? Have I missed anything? What about QTest?
Re: [PATCH 2/2] hw/intc: Have ARM_GIC select ARM_GICV3 when KVM is not available
Quoted 50 lines · Phil Dennis-Jordan
On Sat, 28 Dec 2024 at 11:48, Phil Dennis-Jordan <[email protected] <mailto:[email protected]>> wrote:
On Fri, 27 Dec 2024 at 21:24, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
When the KVM accelerator is selected, the
KconfigARM_GICkey selects the KVM GIC implementation (ARM_GIC_KVM). For other accelerators (TCG, HVF, ...), select the generic implementation.Signed-off-by Philippe Mathieu-Daudé <[email protected]<mailto:[email protected]>>
---
hw/intc/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index
7547528f2c2..762139d8df3100644 --- a/hw/intc/Kconfig
+++ b/hw/intc/Kconfig
@@ -23,7 +23,7 @@ config APICconfig
ARM_GIC
bool
- selectARM_GICV3if TCG
+ selectARM_GICV3if !KVMWouldn't this disable the
ARM_GICV3by default when building with -- enable-tcg --enable-kvm? And then there would be no GIC available when running the built QEMU in TCG mode. (Bear with me, I'm a relative Meson newbie.)OK, I've managed to answer my own question now by setting up a RPi5 with aarch64 RPOS and building QEMU on that with --enable-kvm --enable-tcg. With patch 1/2 applied on current upstream master, I get:
$ build/qemu-system-aarch64 -accel tcg -M virt,gic-version=3 -smp 4 -m 4G /[runs successfully]/with 2/2 applied as well:
$ build/qemu-system-aarch64 -accel tcg -M virt,gic-version=3 -smp 4 -m 4G qemu-system-aarch64: tcg does not support GICv3 emulation $
Quoted 5 lines
In other words, with the proposed change,
ARM_GICV3is indeed deselected if KVM is selected even if TCG is also selected.Possibly very basic question: is there any support for kernel- irqchip=off on aarch64/KVM?
If yes, don't we needARM_GICV3in that case anyway, so we should drop any accel dependency on it in the first place?
Cc'ing Alex & Gustavo who are more familiar with GIC devices.
Quoted 6 lines
If we definitely don't need the software GIC in KVM-only builds, I guess we're down to listing each accel that needs it individually. Is that:
select
ARM_GICV3if TCG || HVF || NVMM || WHPX ||XEN_EMU|| XENor can we drop any of those? Have I missed anything? What about QTest?
Hi,
Quoted 4 lines · Philippe Mathieu-Daudé
ARM_GICV3is not restricted to TCG and can be used on HVF.Philippe Mathieu-Daudé (2):
hw/intc: Remove TCG dependency onARM_GICV3
First reviewed/tested patch queued via hw-misc tree.
Thanks,
Phil.