target/arm: Build fixes related to GICv3/v5 and hw accelerators
cover target/arm: Build fixes related to GICv3/v5 and hw accelerators
Build fixes for when QEMU is configured using --disable-tcg or --without-default-devices. First 3 patches might be candidate for the next release, but still these configs are not covered on our CI, I can't complain.
Philippe Mathieu-Daudé (4):
hw/intc/arm_gicv3: Fix ARM_GICV3 dependency for KVM / WHPX target/arm: Add stub for define_gicv5_cpuif_regs() target/arm: Only compile gicv5-cpuif.c when GICv5 is selected target/arm: Build TCG stubs as stub library
target/arm/gicv5-stubs.c | 17 +++++++++++++++++ target/arm/tcg-stubs.c | 4 ---- hw/intc/meson.build | 4 ++-- target/arm/meson.build | 6 +++--- target/arm/tcg/meson.build | 4 +++- 5 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 target/arm/gicv5-stubs.c
Signature · 1 line
2.53.0
PATCH 1/4 hw/intc/arm_gicv3: Fix ARM_GICV3 dependency for KVM / WHPX
KVM and WHPX GICv3 implementations call gicv3_init_irqs_and_mmio() which is defined in arm_gicv3_common.c, itself build when ARM_GIC is selected. Both KVM and WHPX are conditional on ARM_GICV3, itself selecting ARM_GIC. Only build the ARM_GICV3 accelerator variants when ARM_GICV3 is selected.
$ git grep -w gicv3_init_irqs_and_mmio hw/intc/arm_gicv3_common.c:314:void gicv3_init_irqs_and_mmio(GICv3State *s, hw/intc/arm_gicv3.c:450: gicv3_init_irqs_and_mmio(s, gicv3_set_irq, gic_ops); hw/intc/arm_gicv3_hvf.c:710: gicv3_init_irqs_and_mmio(s, hvf_gicv3_set_irq, NULL); hw/intc/arm_gicv3_kvm.c:822: gicv3_init_irqs_and_mmio(s, kvm_arm_gicv3_set_irq, NULL); hw/intc/arm_gicv3_whpx.c:186: gicv3_init_irqs_and_mmio(s, whpx_gicv3_set_irq, NULL);
--- hw/intc/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/intc/meson.build +2 -2
@@ -45,10 +45,10 @@ specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) arm_common_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) arm_common_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_WHPX', 'TARGET_AARCH64'], if_true: files('arm_gicv3_whpx.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', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) +specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'CONFIG_ARM_GICV3'], 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.53.0
PATCH 2/4 target/arm: Add stub for define_gicv5_cpuif_regs()
In reply to Philippe Mathieu-DaudéThe common helper.c file calls define_gicv5_cpuif_regs() which is only defined when TCG is built:
$ git grep -w define_gicv5_cpuif_regs target/arm/internals.h:1885:void define_gicv5_cpuif_regs(ARMCPU *cpu); target/arm/helper.c:6334: define_gicv5_cpuif_regs(cpu); target/arm/tcg/gicv5-cpuif.c:923:void define_gicv5_cpuif_regs(ARMCPU *cpu)
This fixes when building on macOS with --disable-tcg:
Undefined symbols for architecture arm64:
"_define_gicv5_cpuif_regs", referenced from:
_register_cp_regs_for_features in target_arm_helper.c.o
Define the GICv5 stubs in their own compilation unit, otherwise we get the following error:
duplicate symbol '_raise_exception_ra' in:
libsystem_arm.a.p/target_arm_tcg_op_helper.c.o
libstubs_arm.a[4](target_arm_tcg-stubs.c.o)--- target/arm/gicv5-stubs.c | 17 +++++++++++++++++ target/arm/tcg-stubs.c | 4 ---- target/arm/meson.build | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 target/arm/gicv5-stubs.c
target/arm/gicv5-stubs.c new file +17 -0
@@ -0,0 +1,17 @@ +/* +* QEMU ARM stubs for GICv5 TCG helper functions +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "internals.h" + +void define_gicv5_cpuif_regs (ARMCPU *cpu) +{ +g_assert_not_reached (); +} + +void gicv5_update_ppi_state (CPUARMState *env,int ppi,bool level) +{ +}
target/arm/tcg-stubs.c +0 -4
@@ -43,7 +43,3 @@ void vfp_clear_float_status_exc_flags(CPUARMState *env)void vfp_set_fpcr_to_host (CPUARMState *env,uint32_t val,uint32_t mask) { } - -void gicv5_update_ppi_state (CPUARMState *env,int ppi,bool level) -{ -}
target/arm/meson.build +1 -0
@@ -37,6 +37,7 @@ arm_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c')) arm_user_ss.add(files('cpu.c')) arm_stubs_ss.add(files( 'cpu32-stubs.c', + 'gicv5-stubs.c', 'kvm-stub.c' )) arm_user_ss.add(files(
Signature · 1 line
2.53.0
PATCH 3/4 target/arm: Only compile gicv5-cpuif.c when GICv5 is selected
In reply to Philippe Mathieu-DaudéOnly compile gicv5-cpuif.c when ARM_GICV5 is Kconfig-selected, otherwise we get when building with --without-default-devices:
Undefined symbols for architecture arm64:
"_gicv5_activate", referenced from:
_gicr_cdia_read in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_deactivate", referenced from:
_gic_cddi_write in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_get_hppi", referenced from:
_gic_hppi in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_request_config", referenced from:
_gic_cdrcfg_write in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_enabled", referenced from:
_gic_cddis_write in target_arm_tcg_gicv5-cpuif.c.o _gic_cden_write in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_handling", referenced from:
_gic_cdhm_write in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_pending", referenced from:
_gic_cdpend_write in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_priority", referenced from:
_gic_cdpri_write in target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_target", referenced from:
_gic_cdaff_write in target_arm_tcg_gicv5-cpuif.c.o
--- target/arm/tcg/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/arm/tcg/meson.build +3 -1
@@ -83,11 +83,13 @@ arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files( arm_common_system_ss.add(files( 'cpregs-at.c', 'cpu32-system.c', - 'gicv5-cpuif.c', 'psci.c', 'tlb_helper.c', 'tlb-insns.c', )) +arm_common_system_ss.add(when: 'CONFIG_ARM_GICV5', if_true: files( + 'gicv5-cpuif.c', +)) arm_user_ss.add(files( 'tlb_helper.c', ))
Signature · 1 line
2.53.0
Re: [PATCH 3/4] target/arm: Only compile gicv5-cpuif.c when GICv5 is selected
Hi,
looks like this patch was applied incorrectly. I do not see removal of gicv5-cpuif.c from unconditional adding. Is this being fixed?
Mirek
Quoted 54 lines · Philippe Mathieu-Daudé
Only compile
gicv5-cpuif.cwhenARM_GICV5is Kconfig-selected, otherwise we get when building with --without-default-devices:Undefined symbols for architecture arm64:
"_gicv5_activate", referenced from:
_gicr_cdia_readin target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_deactivate", referenced from:
_gic_cddi_writein target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_get_hppi", referenced from:
_gic_hppiin target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_request_config", referenced from:
_gic_cdrcfg_writein target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_enabled", referenced from:
_gic_cddis_writein target_arm_tcg_gicv5-cpuif.c.o_gic_cden_writein target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_handling", referenced from:
_gic_cdhm_writein target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_pending", referenced from:
_gic_cdpend_writein target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_priority", referenced from:
_gic_cdpri_writein target_arm_tcg_gicv5-cpuif.c.o
"_gicv5_set_target", referenced from:
_gic_cdaff_writein target_arm_tcg_gicv5-cpuif.c.oFixes ee0f1ce00db ("target/arm: GICv5 cpuif: Initial skeleton and GSB barrier insns")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/tcg/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)target/arm/tcg/meson.build +3
-2@@ -83,11 +83,13 @@ arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files( arm_common_system_ss.add(files( 'cpregs-at.c', 'cpu32-system.c', - 'gicv5-cpuif.c', 'psci.c', 'tlb_helper.c', 'tlb-insns.c', )) +arm_common_system_ss.add(when: 'CONFIG_ARM_GICV5', if_true: files( + 'gicv5-cpuif.c', +)) arm_user_ss.add(files( 'tlb_helper.c', )) --2.53.0
Signature · 2 lines
Miroslav Řezanina Virtualization Team - Maintainer
PATCH 4/4 target/arm: Build TCG stubs as stub library
In reply to Philippe Mathieu-DaudéUse the stub library introduced in commit 0da978cdbc6 ("target/arm:
define stub library") to prevent symbol conflicts.
--- target/arm/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
target/arm/meson.build +2 -3
@@ -38,7 +38,8 @@ arm_user_ss.add(files('cpu.c')) arm_stubs_ss.add(files( 'cpu32-stubs.c', 'gicv5-stubs.c', - 'kvm-stub.c' + 'kvm-stub.c', + 'tcg-stubs.c', )) arm_user_ss.add(files( 'el2-stubs.c',
@@ -65,8 +66,6 @@ subdir('whpx') if 'CONFIG_TCG' in config_all_accel subdir('tcg') -else - arm_common_system_ss.add(files('tcg-stubs.c')) endif arm_user_ss.add_all(arm_common_user_system_ss)
Signature · 1 line
2.53.0
Quoted 5 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (4):
hw/intc/arm_gicv3: FixARM_GICV3dependency for KVM / WHPX target/arm: Add stub fordefine_gicv5_cpuif_regs()target/arm: Only compilegicv5-cpuif.cwhen GICv5 is selected target/arm: Build TCG stubs as stub library
r~
Peter Maydell
AppliedQuoted 6 lines · Philippe Mathieu-Daudé
Build fixes for when QEMU is configured using --disable-tcg or --without-default-devices. First 3 patches might be candidate for the next release, but still these configs are not covered on our CI, I can't complain.
Quoted 6 lines
Philippe Mathieu-Daudé (4):
hw/intc/arm_gicv3: FixARM_GICV3dependency for KVM / WHPX target/arm: Add stub fordefine_gicv5_cpuif_regs()target/arm: Only compilegicv5-cpuif.cwhen GICv5 is selected target/arm: Build TCG stubs as stub library
Applied to target-arm.next, thanks.
-- PMM