[PATCH 00/19] target/arm: More header rework around arm_feature() & multiprocessing.h

Philippe Mathieu-Daudé posted 19 patches 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250513173928.77376-1-philmd@linaro.org
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Bernhard Beschow <shentey@gmail.com>, Rob Herring <robh@kernel.org>, Jean-Christophe Dubois <jcd@tribudubois.net>, Andrey Smirnov <andrew.smirnov@gmail.com>, Tyrone Ting <kfting@nuvoton.com>, Hao Wu <wuhaotsh@google.com>, Niek Linnenbank <nieklinnenbank@gmail.com>, Radoslaw Biernacki <rad@semihalf.com>, Leif Lindholm <leif.lindholm@oss.qualcomm.com>, Eric Auger <eric.auger@redhat.com>, Shannon Zhao <shannon.zhaosl@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Alistair Francis <alistair@alistair23.me>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Alexander Graf <agraf@csgraf.de>, Phil Dennis-Jordan <phil@philjordan.eu>, Paolo Bonzini <pbonzini@redhat.com>
MAINTAINERS                    |  1 +
include/hw/arm/boot.h          |  3 +-
target/arm/cpregs.h            |  1 +
target/arm/cpu-features.h      |  1 +
target/arm/cpu.h               | 79 ++--------------------------------
target/arm/cpu_has_feature.h   | 67 ++++++++++++++++++++++++++++
target/arm/hvf_arm.h           | 18 +-------
target/arm/kvm_arm.h           |  1 +
target/arm/multiprocessing.h   | 18 ++++++++
target/arm/psci.h              | 18 ++++++++
target/arm/tcg/translate.h     |  2 +-
hw/arm/aspeed_ast2600.c        |  1 +
hw/arm/aspeed_ast27x0.c        |  2 +
hw/arm/bananapi_m2u.c          |  1 +
hw/arm/bcm2838.c               |  1 +
hw/arm/boot.c                  |  2 +
hw/arm/exynos4210.c            |  3 +-
hw/arm/fsl-imx8mp.c            |  1 +
hw/arm/highbank.c              |  2 +-
hw/arm/imx8mp-evk.c            |  1 +
hw/arm/mcimx6ul-evk.c          |  1 +
hw/arm/mcimx7d-sabre.c         |  1 +
hw/arm/mps3r.c                 |  2 +-
hw/arm/npcm8xx.c               |  2 +
hw/arm/orangepi.c              |  1 +
hw/arm/realview.c              | 10 ++---
hw/arm/sbsa-ref.c              |  2 +
hw/arm/smmuv3.c                |  1 -
hw/arm/virt-acpi-build.c       |  4 +-
hw/arm/virt.c                  |  1 +
hw/arm/xlnx-versal-virt.c      |  1 +
hw/arm/xlnx-zcu102.c           |  1 +
hw/vmapple/vmapple.c           |  3 ++
target/arm/arch_dump.c         |  2 +-
target/arm/arm-powerctl.c      |  2 +-
target/arm/arm-qmp-cmds.c      |  1 +
target/arm/cortex-regs.c       |  2 +-
target/arm/cpu.c               | 10 ++++-
target/arm/cpu64.c             |  2 +-
target/arm/debug_helper.c      |  2 +-
target/arm/gdbstub.c           |  2 +-
target/arm/gdbstub64.c         |  2 +-
target/arm/helper.c            |  3 +-
target/arm/hvf-stub.c          | 20 +++++++++
target/arm/hvf/hvf.c           |  1 +
target/arm/hyp_gdbstub.c       |  2 +-
target/arm/kvm-stub.c          |  2 +-
target/arm/kvm.c               |  3 +-
target/arm/machine.c           |  2 +-
target/arm/ptw.c               |  2 +-
target/arm/tcg-stubs.c         |  2 +-
target/arm/tcg/cpu-v7m.c       |  2 +-
target/arm/tcg/cpu32.c         |  2 +-
target/arm/tcg/cpu64.c         |  2 +-
target/arm/tcg/helper-a64.c    |  2 +-
target/arm/tcg/hflags.c        |  2 +-
target/arm/tcg/iwmmxt_helper.c |  2 +-
target/arm/tcg/m_helper.c      |  2 +-
target/arm/tcg/mte_helper.c    |  2 +-
target/arm/tcg/mve_helper.c    |  2 +-
target/arm/tcg/neon_helper.c   |  2 +-
target/arm/tcg/op_helper.c     |  4 +-
target/arm/tcg/pauth_helper.c  |  2 +-
target/arm/tcg/psci.c          |  3 +-
target/arm/tcg/sme_helper.c    |  2 +-
target/arm/tcg/sve_helper.c    |  2 +-
target/arm/tcg/tlb-insns.c     |  2 +-
target/arm/tcg/tlb_helper.c    |  2 +-
target/arm/tcg/vec_helper.c    |  2 +-
target/arm/tcg/vfp_helper.c    |  2 +-
target/arm/vfp_fpscr.c         |  2 +-
target/arm/meson.build         |  4 +-
target/arm/tcg/meson.build     |  2 +
73 files changed, 221 insertions(+), 143 deletions(-)
create mode 100644 target/arm/cpu_has_feature.h
create mode 100644 target/arm/psci.h
create mode 100644 target/arm/hvf-stub.c
[PATCH 00/19] target/arm: More header rework around arm_feature() & multiprocessing.h
Posted by Philippe Mathieu-Daudé 6 months ago
Before I respin my "single-binary: Make hw/arm/ common" [1] I'm
extracting these random cleanup patches. Some aren't necessary
anymore because now units in arm_common_ss[] can access "cpu.h",
but the patches are reviewed and simplify a bit IMO.

Based-on: <20250512180502.2395029-1-pierrick.bouvier@linaro.org>
          "single-binary: compile target/arm twice"

[1] https://lore.kernel.org/qemu-devel/20250403235821.9909-1-philmd@linaro.org/

Philippe Mathieu-Daudé (19):
  target/arm/tcg-stubs: compile file once (system)
  target/arm/hvf_arm: Avoid using poisoned CONFIG_HVF definition
  target/arm: Only link with zlib when TCG is enabled
  target/arm/cpregs: Include missing 'target/arm/cpu.h' header
  hw/arm/boot: Include missing 'system/memory.h' header
  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()
  target/arm: Always include full path to 'cpu.h'

 MAINTAINERS                    |  1 +
 include/hw/arm/boot.h          |  3 +-
 target/arm/cpregs.h            |  1 +
 target/arm/cpu-features.h      |  1 +
 target/arm/cpu.h               | 79 ++--------------------------------
 target/arm/cpu_has_feature.h   | 67 ++++++++++++++++++++++++++++
 target/arm/hvf_arm.h           | 18 +-------
 target/arm/kvm_arm.h           |  1 +
 target/arm/multiprocessing.h   | 18 ++++++++
 target/arm/psci.h              | 18 ++++++++
 target/arm/tcg/translate.h     |  2 +-
 hw/arm/aspeed_ast2600.c        |  1 +
 hw/arm/aspeed_ast27x0.c        |  2 +
 hw/arm/bananapi_m2u.c          |  1 +
 hw/arm/bcm2838.c               |  1 +
 hw/arm/boot.c                  |  2 +
 hw/arm/exynos4210.c            |  3 +-
 hw/arm/fsl-imx8mp.c            |  1 +
 hw/arm/highbank.c              |  2 +-
 hw/arm/imx8mp-evk.c            |  1 +
 hw/arm/mcimx6ul-evk.c          |  1 +
 hw/arm/mcimx7d-sabre.c         |  1 +
 hw/arm/mps3r.c                 |  2 +-
 hw/arm/npcm8xx.c               |  2 +
 hw/arm/orangepi.c              |  1 +
 hw/arm/realview.c              | 10 ++---
 hw/arm/sbsa-ref.c              |  2 +
 hw/arm/smmuv3.c                |  1 -
 hw/arm/virt-acpi-build.c       |  4 +-
 hw/arm/virt.c                  |  1 +
 hw/arm/xlnx-versal-virt.c      |  1 +
 hw/arm/xlnx-zcu102.c           |  1 +
 hw/vmapple/vmapple.c           |  3 ++
 target/arm/arch_dump.c         |  2 +-
 target/arm/arm-powerctl.c      |  2 +-
 target/arm/arm-qmp-cmds.c      |  1 +
 target/arm/cortex-regs.c       |  2 +-
 target/arm/cpu.c               | 10 ++++-
 target/arm/cpu64.c             |  2 +-
 target/arm/debug_helper.c      |  2 +-
 target/arm/gdbstub.c           |  2 +-
 target/arm/gdbstub64.c         |  2 +-
 target/arm/helper.c            |  3 +-
 target/arm/hvf-stub.c          | 20 +++++++++
 target/arm/hvf/hvf.c           |  1 +
 target/arm/hyp_gdbstub.c       |  2 +-
 target/arm/kvm-stub.c          |  2 +-
 target/arm/kvm.c               |  3 +-
 target/arm/machine.c           |  2 +-
 target/arm/ptw.c               |  2 +-
 target/arm/tcg-stubs.c         |  2 +-
 target/arm/tcg/cpu-v7m.c       |  2 +-
 target/arm/tcg/cpu32.c         |  2 +-
 target/arm/tcg/cpu64.c         |  2 +-
 target/arm/tcg/helper-a64.c    |  2 +-
 target/arm/tcg/hflags.c        |  2 +-
 target/arm/tcg/iwmmxt_helper.c |  2 +-
 target/arm/tcg/m_helper.c      |  2 +-
 target/arm/tcg/mte_helper.c    |  2 +-
 target/arm/tcg/mve_helper.c    |  2 +-
 target/arm/tcg/neon_helper.c   |  2 +-
 target/arm/tcg/op_helper.c     |  4 +-
 target/arm/tcg/pauth_helper.c  |  2 +-
 target/arm/tcg/psci.c          |  3 +-
 target/arm/tcg/sme_helper.c    |  2 +-
 target/arm/tcg/sve_helper.c    |  2 +-
 target/arm/tcg/tlb-insns.c     |  2 +-
 target/arm/tcg/tlb_helper.c    |  2 +-
 target/arm/tcg/vec_helper.c    |  2 +-
 target/arm/tcg/vfp_helper.c    |  2 +-
 target/arm/vfp_fpscr.c         |  2 +-
 target/arm/meson.build         |  4 +-
 target/arm/tcg/meson.build     |  2 +
 73 files changed, 221 insertions(+), 143 deletions(-)
 create mode 100644 target/arm/cpu_has_feature.h
 create mode 100644 target/arm/psci.h
 create mode 100644 target/arm/hvf-stub.c

-- 
2.47.1


Re: [PATCH 00/19] target/arm: More header rework around arm_feature() & multiprocessing.h
Posted by Philippe Mathieu-Daudé 6 months ago
On 13/5/25 19:39, Philippe Mathieu-Daudé wrote:

> Philippe Mathieu-Daudé (19):
>    target/arm/tcg-stubs: compile file once (system)
>    target/arm/hvf_arm: Avoid using poisoned CONFIG_HVF definition
>    target/arm: Only link with zlib when TCG is enabled

>    target/arm: Always include full path to 'cpu.h'

Missing review: 1-3 & 19

Re: [PATCH 00/19] target/arm: More header rework around arm_feature() & multiprocessing.h
Posted by Pierrick Bouvier 6 months ago
On 5/13/25 10:42 AM, Philippe Mathieu-Daudé wrote:
> On 13/5/25 19:39, Philippe Mathieu-Daudé wrote:
> 
>> Philippe Mathieu-Daudé (19):
>>     target/arm/tcg-stubs: compile file once (system)
>>     target/arm/hvf_arm: Avoid using poisoned CONFIG_HVF definition
>>     target/arm: Only link with zlib when TCG is enabled
> 
>>     target/arm: Always include full path to 'cpu.h'
> 
> Missing review: 1-3 & 19

Thanks Philippe,
hopefully it can be pulled at the same than its base series.

Pierrick

Re: [PATCH 00/19] target/arm: More header rework around arm_feature() & multiprocessing.h
Posted by Peter Maydell 5 months, 2 weeks ago
On Tue, 13 May 2025 at 18:39, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Before I respin my "single-binary: Make hw/arm/ common" [1] I'm
> extracting these random cleanup patches. Some aren't necessary
> anymore because now units in arm_common_ss[] can access "cpu.h",
> but the patches are reviewed and simplify a bit IMO.
>
> Based-on: <20250512180502.2395029-1-pierrick.bouvier@linaro.org>
>           "single-binary: compile target/arm twice"
>
> [1] https://lore.kernel.org/qemu-devel/20250403235821.9909-1-philmd@linaro.org/
>
> Philippe Mathieu-Daudé (19):
>   target/arm/tcg-stubs: compile file once (system)
>   target/arm/hvf_arm: Avoid using poisoned CONFIG_HVF definition
>   target/arm: Only link with zlib when TCG is enabled
>   target/arm/cpregs: Include missing 'target/arm/cpu.h' header
>   hw/arm/boot: Include missing 'system/memory.h' header
>   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

Hi; I've applied these patches to target-arm.next.

>   hw/arm: Remove unnecessary 'cpu.h' header

After this patch things fail to compile:

../../hw/arm/exynos4210.c:511:20: error: use of undeclared identifier
'ARM_AFF1_SHIFT'
  511 |     return (0x9 << ARM_AFF1_SHIFT) | cpu;

../../hw/arm/mps3r.c:295:14: error: use of undeclared identifier
'GTIMER_PHYS'; did you mean 'ITIMER_PROF'?
  295 |             [GTIMER_PHYS] = ARCH_TIMER_NS_EL1_IRQ,

etc. Probably this patch needs to go later in the series.

>   target/arm: Restrict inclusion of 'multiprocessing.h'

Starting somewhere around here the patches don't apply any
more (trivial rebase conflicts, I think, but given the compile
error above I didn't spend time on trying to sort them out).

>   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()
>   target/arm: Always include full path to 'cpu.h'

I'm not sure about the arm_cpu_has_feature() patches at
the tail end of the series, and there seemed to be some
review comments to the effect that maybe we don't need
them any more?

thanks
-- PMM