On 4/4/25 10:12, Pierrick Bouvier wrote:
> On 4/3/25 16:57, Philippe Mathieu-Daudé wrote:
>> Hi,
>>
>> At this point this series is mostly a draft for Pierrick.
>>
>> After introducing the generic TargetInfo API [*], we implement
>> the ARM variants, then use the API to remove target-specific code,
>> allowing to eventually remove the target-specific arm_ss[] source
>> set in meson.build, having all objects in arm_common_ss[].
>> Various header cleanups are necessary before getting there.
>>
>
> As there are some changes asked on this API, I think it's better if we
> review this series later.
>
> I'll still comment a few commits here that point some problems in the
> approach.
>
To summarize the problems reported:
- It's not needed to remove cpu.h inclusion, as this header has been
previously made target (variant) agnostic.
- No, we can't unpoison CONFIG_{accel}, we need to cleanup associated
code instead.
- We need a target_aarch64() common function
>> Regards,
>>
>> Phil.
>>
>> Available here, based on tcg-next:
>> https://gitlab.com/philmd/qemu/-/tags/single-binary-hw-arm-rfc-v1
>>
>> [*] https://lore.kernel.org/qemu-devel/20250403234914.9154-1-philmd@linaro.org/
>>
>> Philippe Mathieu-Daudé (39):
>> target/arm: Implement per-binary TargetInfo structures
>> target/arm: Register TYPE_BINARY_QEMU_SYSTEM_ARM/AARCH64 interfaces
>> target/arm: Filter CPU types for binary
>> hw/arm: Filter machine types for binary
>> hw/arm/aspeed: Filter machine types for binary
>> hw/arm/aspeed: Build objects once
>> hw/arm/raspi: Filter machine types for binary
>> hw/arm/raspi: Build objects once
>> target/arm/cpregs: Include missing 'target/arm/cpu.h' header
>> hw/arm/boot: Include missing 'system/memory.h' header
>> hw/arm: Use full "target/arm/cpu.h" path to include target's "cpu.h"
>> target/arm/cpu-features: Include missing 'cpu.h' header
>> target/arm/qmp: Include missing 'cpu.h' header
>> target/arm/kvm: Include missing 'cpu-qom.h' header
>> target/arm/hvf: Include missing 'cpu-qom.h' header
>> hw/arm: Remove unnecessary 'cpu.h' header
>> target/arm: Restrict inclusion of 'multiprocessing.h'
>> target/arm: Move some definitions from 'cpu.h' to 'multiprocessing.h'
>> hw/arm: Include missing 'target/arm/gtimer.h' header
>> target/arm: Extract PSCI definitions to 'psci.h'
>> target/arm: Extract feature definitions to 'cpu_has_feature.h' header
>> target/arm: Add arm_cpu_has_feature() helper
>> hw/arm/realview: Replace arm_feature() -> arm_cpu_has_feature()
>> hw/arm/virt-acpi: Replace arm_feature() -> arm_cpu_has_feature()
>> hw/arm: Build virt-acpi-build.c once
>> system/hvf: Avoid including 'cpu.h'
>> system/hvf: Expose hvf_enabled() to common code
>> exec: Do not poison hardware accelerators
>> hw/arm: Build sbsa-ref.c once
>> target/arm: Replace target_ulong -> hwaddr in ARMMMUFaultInfo
>> target/arm: Replace target_ulong -> uint64_t for HWBreakpoint
>> target/arm: Replace target_ulong -> vaddr for CPUWatchpoint
>> hw/core/machine: Allow dynamic registration of valid CPU types
>> hw/arm/virt: Register valid CPU types dynamically
>> hw/arm/virt: Replace TARGET_AARCH64 -> target_long_bits()
>> target/arm: Expose Aarch64 helpers indistinctly
>> hw/arm: Build virt.c once
>> hw/arm: Move xen files to arm_common_ss[]
>> hw/arm/meson: Remove arm_ss[] source set
>>
>> MAINTAINERS | 1 +
>> meson.build | 1 +
>> include/exec/poison.h | 4 --
>> include/hw/arm/boot.h | 3 +-
>> include/hw/arm/digic.h | 2 +-
>> include/hw/arm/fsl-imx6.h | 2 +-
>> include/hw/arm/fsl-imx6ul.h | 2 +-
>> include/hw/arm/fsl-imx7.h | 2 +-
>> include/hw/arm/fsl-imx8mp.h | 2 +-
>> include/hw/boards.h | 8 +++
>> include/qemu/target_info-qom.h | 20 ++++++
>> include/system/hvf.h | 17 ++++--
>> include/system/hvf_int.h | 2 +
>> target/arm/cpregs.h | 1 +
>> target/arm/cpu-features.h | 1 +
>> target/arm/cpu.h | 78 +-----------------------
>> target/arm/cpu_has_feature.h | 67 ++++++++++++++++++++
>> target/arm/hvf_arm.h | 2 +-
>> target/arm/internals.h | 22 +++----
>> target/arm/kvm_arm.h | 1 +
>> target/arm/multiprocessing.h | 18 ++++++
>> target/arm/psci.h | 18 ++++++
>> accel/stubs/hvf-stub.c | 12 ++++
>> hw/arm/aspeed.c | 30 ++++++---
>> hw/arm/aspeed_ast2600.c | 1 +
>> hw/arm/aspeed_ast27x0.c | 2 +
>> hw/arm/b-l475e-iot01a.c | 1 +
>> hw/arm/bananapi_m2u.c | 1 +
>> hw/arm/bcm2836.c | 4 --
>> hw/arm/bcm2838.c | 1 +
>> hw/arm/boot.c | 2 +
>> hw/arm/collie.c | 1 +
>> hw/arm/exynos4210.c | 3 +-
>> hw/arm/exynos4_boards.c | 1 +
>> hw/arm/fby35.c | 1 +
>> hw/arm/fsl-imx8mp.c | 1 +
>> hw/arm/highbank.c | 4 +-
>> hw/arm/imx8mp-evk.c | 1 +
>> hw/arm/mcimx6ul-evk.c | 1 +
>> hw/arm/mcimx7d-sabre.c | 1 +
>> hw/arm/microbit.c | 1 +
>> hw/arm/mps2-tz.c | 4 ++
>> hw/arm/mps2.c | 4 ++
>> hw/arm/mps3r.c | 3 +-
>> hw/arm/musca.c | 2 +
>> hw/arm/npcm8xx.c | 2 +
>> hw/arm/omap_sx1.c | 2 +
>> hw/arm/orangepi.c | 1 +
>> hw/arm/raspi.c | 9 +--
>> hw/arm/raspi4b.c | 1 +
>> hw/arm/realview.c | 14 +++--
>> hw/arm/sbsa-ref.c | 3 +
>> hw/arm/smmuv3.c | 1 -
>> hw/arm/stellaris.c | 3 +
>> hw/arm/versatilepb.c | 1 +
>> hw/arm/vexpress.c | 2 +
>> hw/arm/virt-acpi-build.c | 4 +-
>> hw/arm/virt.c | 44 +++++++------
>> hw/arm/xilinx_zynq.c | 1 +
>> hw/arm/xlnx-versal-virt.c | 2 +
>> hw/arm/xlnx-zcu102.c | 2 +
>> hw/core/machine.c | 28 +++++++++
>> hw/vmapple/vmapple.c | 3 +
>> target/arm/arm-qmp-cmds.c | 1 +
>> target/arm/cpu.c | 10 +++
>> target/arm/cpu64.c | 2 +
>> target/arm/helper.c | 1 +
>> target/arm/hvf/hvf.c | 1 +
>> target/arm/hyp_gdbstub.c | 14 ++---
>> target/arm/kvm.c | 1 +
>> target/arm/target_info-aarch64-softmmu.c | 24 ++++++++
>> target/arm/target_info-arm-softmmu.c | 24 ++++++++
>> target/arm/tcg/op_helper.c | 2 +
>> target/arm/tcg/psci.c | 1 +
>> target_info-qom.c | 8 +++
>> accel/stubs/meson.build | 1 +
>> hw/arm/meson.build | 22 ++++---
>> scripts/make-config-poison.sh | 4 ++
>> target/arm/meson.build | 5 ++
>> 79 files changed, 429 insertions(+), 171 deletions(-)
>> create mode 100644 target/arm/cpu_has_feature.h
>> create mode 100644 target/arm/psci.h
>> create mode 100644 accel/stubs/hvf-stub.c
>> create mode 100644 target/arm/target_info-aarch64-softmmu.c
>> create mode 100644 target/arm/target_info-arm-softmmu.c
>>
>