Skip to contentSkip to conversation

arm: Rework target/ headers to build various hw/ files once

PATCH Applied Philippe Mathieu-Daudé 3 participants 25 messages Jan 18, 2024 – Apr 15, 2024

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

cover arm: Rework target/ headers to build various hw/ files once

Hi,

In order to fix a bug noticed [*] by Cédric and Fabiano in my "Remove one use of qemu_get_cpu() in A7/A15 MPCore priv" series, I ended reusing commits from other branches and it grew quite a lot. This is the first "cleanup" part, unrelated on MPCorePriv.

Please review,

Phil.

Philippe Mathieu-Daudé (18):
hw/arm/exynos4210: Include missing 'exec/tswap.h' header hw/arm/xilinx_zynq: Include missing 'exec/tswap.h' header hw/arm/smmuv3: Include missing 'hw/registerfields.h' header hw/arm/xlnx-versal: Include missing 'cpu.h' header target/arm/cpu-features: Include missing 'hw/registerfields.h' header target/arm/cpregs: Include missing 'hw/registerfields.h' header target/arm/cpregs: Include missing 'kvm-consts.h' header target/arm: Expose arm_cpu_mp_affinity() in 'multiprocessing.h' header target/arm: Declare ARM_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h' hw/cpu/a9mpcore: Build it only once hw/misc/xlnx-versal-crl: Include generic 'cpu-qom.h' instead of

    'cpu.h'

hw/misc/xlnx-versal-crl: Build it only once
target/arm: Expose M-profile register bank index definitions hw/arm/armv7m: Make 'hw/intc/armv7m_nvic.h' a target agnostic header target/arm: Move ARM_CPU_IRQ/FIQ definitions to 'cpu-qom.h' header target/arm: Move e2h_access() helper around
target/arm: Move GTimer definitions to new 'gtimer.h' header hw/arm: Build various units only once

Richard Henderson (2):
target/arm: Rename arm_cpu_mp_affinity
target/arm: Create arm_cpu_mp_affinity

 hw/arm/smmuv3-internal.h          |  1 +
 include/hw/arm/xlnx-versal.h      |  1 +
 include/hw/intc/armv7m_nvic.h     |  2 +-
 include/hw/misc/xlnx-versal-crl.h |  2 +-
 target/arm/cpregs.h               |  3 +++
 target/arm/cpu-features.h         |  2 ++
 target/arm/cpu-qom.h              | 24 ++++++++++++++++++++++
 target/arm/cpu.h                  | 34 +++----------------------------
 target/arm/gtimer.h               | 21 +++++++++++++++++++
 target/arm/multiprocessing.h      | 16 +++++++++++++++
 hw/arm/allwinner-a10.c            |  1 +
 hw/arm/allwinner-h3.c             |  2 ++
 hw/arm/allwinner-r40.c            |  2 ++
 hw/arm/armv7m.c                   |  2 ++
 hw/arm/aspeed_ast2400.c           |  1 +
 hw/arm/aspeed_ast2600.c           |  1 +
 hw/arm/bcm2836.c                  |  2 ++
 hw/arm/collie.c                   |  1 -
 hw/arm/exynos4210.c               |  2 ++
 hw/arm/fsl-imx25.c                |  1 +
 hw/arm/fsl-imx31.c                |  1 +
 hw/arm/fsl-imx6.c                 |  1 +
 hw/arm/fsl-imx6ul.c               |  1 +
 hw/arm/fsl-imx7.c                 |  1 +
 hw/arm/gumstix.c                  |  1 -
 hw/arm/highbank.c                 |  1 +
 hw/arm/integratorcp.c             |  2 +-
 hw/arm/mainstone.c                |  1 -
 hw/arm/musicpal.c                 |  2 +-
 hw/arm/npcm7xx.c                  |  3 ++-
 hw/arm/omap1.c                    |  1 +
 hw/arm/omap2.c                    |  2 +-
 hw/arm/omap_sx1.c                 |  1 -
 hw/arm/palm.c                     |  1 -
 hw/arm/realview.c                 |  1 +
 hw/arm/sbsa-ref.c                 |  4 +++-
 hw/arm/spitz.c                    |  1 -
 hw/arm/strongarm.c                |  2 +-
 hw/arm/versatilepb.c              |  2 +-
 hw/arm/vexpress.c                 |  2 +-
 hw/arm/virt-acpi-build.c          |  4 ++--
 hw/arm/virt.c                     | 11 ++++++----
 hw/arm/xilinx_zynq.c              |  3 ++-
 hw/arm/xlnx-versal-virt.c         |  5 +++--
 hw/arm/xlnx-versal.c              |  2 ++
 hw/arm/xlnx-zynqmp.c              |  2 ++
 hw/arm/z2.c                       |  1 -
 hw/cpu/a15mpcore.c                |  1 +
 hw/cpu/a9mpcore.c                 |  2 +-
 hw/misc/xlnx-versal-crl.c         |  5 +++--
 target/arm/arm-powerctl.c         |  3 ++-
 target/arm/cpu.c                  | 13 +++++++++---
 target/arm/helper.c               | 30 ++++++++++++++-------------
 target/arm/hvf/hvf.c              |  6 ++++--
 target/arm/kvm.c                  |  1 +
 target/arm/machine.c              |  1 +
 target/arm/tcg/psci.c             |  3 ++-
 hw/arm/meson.build                | 23 +++++++++++----------
 hw/cpu/meson.build                |  2 +-
 hw/misc/meson.build               |  2 +-
 60 files changed, 178 insertions(+), 94 deletions(-)
 create mode 100644 target/arm/gtimer.h
 create mode 100644 target/arm/multiprocessing.h
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/20 hw/arm/exynos4210: Include missing 'exec/tswap.h' header

hw/arm/exynos4210.c calls tswap32() which is declared in "exec/tswap.h". Include it in order to avoid when refactoring unrelated headers:

hw/arm/exynos4210.c:499:22: error: call to undeclared function 'tswap32';
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

          smpboot[n] = tswap32(smpboot[n]);
                       ^
---
 hw/arm/exynos4210.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/exynos4210.c +1 -0
index de39fb0ece..af511a153d 100644
@@ -23,6 +23,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "exec/tswap.h"
 #include "cpu.h"
 #include "hw/cpu/a9mpcore.h"
 #include "hw/irq.h"
Signature · 1 line
2.41.0
#2 lore raw

PATCH 2/20 hw/arm/xilinx_zynq: Include missing 'exec/tswap.h' header

In reply to Philippe Mathieu-Daudé

hw/arm/xilinx_zynq.c calls tswap32() which is declared in "exec/tswap.h". Include it in order to avoid when refactoring unrelated headers:

hw/arm/xilinx_zynq.c:103:31: error: call to undeclared function 'tswap32';
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

          board_setup_blob[n] = tswap32(board_setup_blob[n]);
                                ^
---
 hw/arm/xilinx_zynq.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/xilinx_zynq.c +1 -0
index dbb9793aa1..d4c817ecdc 100644
@@ -37,6 +37,7 @@
 #include "hw/qdev-clock.h"
 #include "sysemu/reset.h"
 #include "qom/object.h"
+#include "exec/tswap.h"
 
 #define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9")
 OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)
Signature · 1 line
2.41.0
#3 lore raw

PATCH 3/20 hw/arm/smmuv3: Include missing 'hw/registerfields.h' header

In reply to Philippe Mathieu-Daudé

hw/arm/smmuv3-internal.h uses the REG32() and FIELD() macros defined in "hw/registerfields.h". Include it in order to avoid when refactoring unrelated headers:

In file included from ../../hw/arm/smmuv3.c:34:
hw/arm/smmuv3-internal.h:36:28: error: expected identifier
REG32(IDR0, 0x0)

                             ^
  hw/arm/smmuv3-internal.h:37:5: error: expected function body after function declarator
      FIELD(IDR0, S2P,         0 , 1)
      ^
---
 hw/arm/smmuv3-internal.h | 1 +
 1 file changed, 1 insertion(+)
hw/arm/smmuv3-internal.h +1 -0
index 6076025ad6..e987bc4686 100644
@@ -21,6 +21,7 @@
 #ifndef HW_ARM_SMMUV3_INTERNAL_H
 #define HW_ARM_SMMUV3_INTERNAL_H
 
+#include "hw/registerfields.h"
 #include "hw/arm/smmu-common.h"
 
 typedef enum SMMUTranslationStatus {
Signature · 1 line
2.41.0
#4 lore raw

PATCH 4/20 hw/arm/xlnx-versal: Include missing 'cpu.h' header

In reply to Philippe Mathieu-Daudé

include/hw/arm/xlnx-versal.h uses the ARMCPU structure which is defined in the "target/arm/cpu.h" header. Include it in order to avoid when refactoring unrelated headers:

In file included from hw/arm/xlnx-versal-virt.c:20:
include/hw/arm/xlnx-versal.h:62:23: error: array has incomplete element type 'ARMCPU' (aka 'struct ArchCPU')

              ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
                        ^
---
 include/hw/arm/xlnx-versal.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/arm/xlnx-versal.h +1 -0
index b24fa64557..025beb5532 100644
@@ -34,6 +34,7 @@
 #include "hw/net/xlnx-versal-canfd.h"
 #include "hw/misc/xlnx-versal-cfu.h"
 #include "hw/misc/xlnx-versal-cframe-reg.h"
+#include "target/arm/cpu.h"
 
 #define TYPE_XLNX_VERSAL "xlnx-versal"
 OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL)
Signature · 1 line
2.41.0
#5 lore raw

PATCH 5/20 target/arm/cpu-features: Include missing 'hw/registerfields.h' header

In reply to Philippe Mathieu-Daudé

target/arm/cpu-features.h uses the FIELD_EX32() macro defined in "hw/registerfields.h". Include it in order to avoid when refactoring unrelated headers:

target/arm/cpu-features.h:44:12: error: call to undeclared function 'FIELD_EX32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

      return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) != 0;
             ^
---
 target/arm/cpu-features.h | 2 ++
 1 file changed, 2 insertions(+)
target/arm/cpu-features.h +2 -0
index 7a590c824c..028795ff23 100644
@@ -20,6 +20,8 @@
 #ifndef TARGET_ARM_FEATURES_H
 #define TARGET_ARM_FEATURES_H
 
+#include "hw/registerfields.h"
+
 /*
  * Naming convention for isar_feature functions:
  * Functions which test 32-bit ID registers should have _aa32_ in
Signature · 1 line
2.41.0
#6 lore raw

PATCH 6/20 target/arm/cpregs: Include missing 'hw/registerfields.h' header

In reply to Philippe Mathieu-Daudé

target/arm/cpregs.h uses the FIELD() macro defined in "hw/registerfields.h". Include it in order to avoid when refactoring unrelated headers:

target/arm/cpregs.h:347:30: error: expected identifier FIELD(HFGRTR_EL2, AFSR0_EL1, 0, 1)

                               ^
---
 target/arm/cpregs.h | 2 ++
 1 file changed, 2 insertions(+)
target/arm/cpregs.h +2 -0
index b6fdd0f3eb..ca2d6006ce 100644
@@ -21,6 +21,8 @@
 #ifndef TARGET_ARM_CPREGS_H
 #define TARGET_ARM_CPREGS_H
 
+#include "hw/registerfields.h"
+
 /*
  * ARMCPRegInfo type field bits:
  */
Signature · 1 line
2.41.0
#7 lore raw

PATCH 7/20 target/arm/cpregs: Include missing 'kvm-consts.h' header

In reply to Philippe Mathieu-Daudé

target/arm/cpregs.h uses the CP_REG_ARCH_* definitions from "target/arm/kvm-consts.h". Include it in order to avoid when refactoring unrelated headers:

target/arm/cpregs.h:191:18: error: use of undeclared identifier 'CP_REG_ARCH_MASK'

      if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
                   ^
---
 target/arm/cpregs.h | 1 +
 1 file changed, 1 insertion(+)
target/arm/cpregs.h +1 -0
index ca2d6006ce..cc7c54378f 100644
@@ -22,6 +22,7 @@
 #define TARGET_ARM_CPREGS_H
 
 #include "hw/registerfields.h"
+#include "target/arm/kvm-consts.h"
 
 /*
  * ARMCPRegInfo type field bits:
Signature · 1 line
2.41.0
#8 lore raw

PATCH 8/20 target/arm: Rename arm_cpu_mp_affinity

In reply to Philippe Mathieu-Daudé

From: Richard Henderson <[email protected]>

Rename to arm_build_mp_affinity. This frees up the name for other usage, and emphasizes that the cpu object is not involved.

---
 target/arm/cpu.h  | 2 +-
 hw/arm/npcm7xx.c  | 2 +-
 hw/arm/sbsa-ref.c | 2 +-
 hw/arm/virt.c     | 2 +-
 target/arm/cpu.c  | 6 +++---
 5 files changed, 7 insertions(+), 7 deletions(-)
target/arm/cpu.h +1 -1
index ec276fcd57..55a19e8539 100644
@@ -1171,7 +1171,7 @@ void arm_cpu_post_init(Object *obj);
     (ARM_AFF0_MASK | ARM_AFF1_MASK | ARM_AFF2_MASK | ARM_AFF3_MASK)
 #define ARM64_AFFINITY_INVALID (~ARM64_AFFINITY_MASK)
 
-uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz);
+uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz);
 
 #ifndef CONFIG_USER_ONLY
 extern const VMStateDescription vmstate_arm_cpu;
hw/arm/npcm7xx.c +1 -1
index 15ff21d047..7fb0a233b2 100644
@@ -474,7 +474,7 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
     /* CPUs */
     for (i = 0; i < nc->num_cpus; i++) {
         object_property_set_int(OBJECT(&s->cpu[i]), "mp-affinity",
-                                arm_cpu_mp_affinity(i, NPCM7XX_MAX_NUM_CPUS),
+                                arm_build_mp_affinity(i, NPCM7XX_MAX_NUM_CPUS),
                                 &error_abort);
         object_property_set_int(OBJECT(&s->cpu[i]), "reset-cbar",
                                 NPCM7XX_GIC_CPU_IF_ADDR, &error_abort);
hw/arm/sbsa-ref.c +1 -1
index 477dca0637..b8857d1e9e 100644
@@ -148,7 +148,7 @@ static const int sbsa_ref_irqmap[] = {
 static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
 {
     uint8_t clustersz = ARM_DEFAULT_CPUS_PER_CLUSTER;
-    return arm_cpu_mp_affinity(idx, clustersz);
+    return arm_build_mp_affinity(idx, clustersz);
 }
 
 static void sbsa_fdt_add_gic_node(SBSAMachineState *sms)
hw/arm/virt.c +1 -1
index 2793121cb4..3fc144236b 100644
@@ -1676,7 +1676,7 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
             clustersz = GICV3_TARGETLIST_BITS;
         }
     }
-    return arm_cpu_mp_affinity(idx, clustersz);
+    return arm_build_mp_affinity(idx, clustersz);
 }
 
 static inline bool *virt_get_high_memmap_enabled(VirtMachineState *vms,
target/arm/cpu.c +3 -3
index 826ce842c0..0bbba48faa 100644
@@ -1307,7 +1307,7 @@ static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
     }
 }
 
-uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz)
+uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz)
 {
     uint32_t Aff1 = idx / clustersz;
     uint32_t Aff0 = idx % clustersz;
@@ -2113,8 +2113,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
      * so these bits always RAZ.
      */
     if (cpu->mp_affinity == ARM64_AFFINITY_INVALID) {
-        cpu->mp_affinity = arm_cpu_mp_affinity(cs->cpu_index,
-                                               ARM_DEFAULT_CPUS_PER_CLUSTER);
+        cpu->mp_affinity = arm_build_mp_affinity(cs->cpu_index,
+                                                 ARM_DEFAULT_CPUS_PER_CLUSTER);
     }
 
     if (cpu->reset_hivecs) {
Signature · 1 line
2.41.0
#9 lore raw

Re: [PATCH 08/20] target/arm: Rename arm_cpu_mp_affinity

Quoted 8 lines · Philippe Mathieu-Daudé

From: Richard Henderson <[email protected]>

Rename to arm_build_mp_affinity. This frees up the name for other usage, and emphasizes that the cpu object is not involved.

Hi; I just had cause to re-look at this commit. The problem here is that to determine the right MP affinity value the CPU *should* be involved. This is because for some Arm CPUs the MPIDR MT bit is 0, and the CPU number is in Aff0, but for others the MPIDR MT bit is 1, and the CPU number is in Aff1, and Aff0 is 0. We don't currently model the latter CPUs correctly, treating everything as MT=0, but we should. So really arm_build_mp_affinity() ought to take a CPU argument (which is awkward because we don't always have one to hand at the callsite)...

thanks
-- PMM

#10 lore raw

PATCH 9/20 target/arm: Create arm_cpu_mp_affinity

In reply to Philippe Mathieu-Daudé

From: Richard Henderson <[email protected]>

Wrapper to return the mp affinity bits from the cpu.

---
 target/arm/cpu.h          | 5 +++++
 hw/arm/virt-acpi-build.c  | 2 +-
 hw/arm/virt.c             | 6 +++---
 hw/arm/xlnx-versal-virt.c | 3 ++-
 hw/misc/xlnx-versal-crl.c | 4 ++--
 target/arm/arm-powerctl.c | 2 +-
 target/arm/hvf/hvf.c      | 4 ++--
 target/arm/tcg/psci.c     | 2 +-
 8 files changed, 17 insertions(+), 11 deletions(-)
target/arm/cpu.h +5 -0
index 55a19e8539..d1584bdb3b 100644
@@ -1173,6 +1173,11 @@ void arm_cpu_post_init(Object *obj);
 
 uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz);
 
+static inline uint64_t arm_cpu_mp_affinity(ARMCPU *cpu)
+{
+    return cpu->mp_affinity;
+}
+
 #ifndef CONFIG_USER_ONLY
 extern const VMStateDescription vmstate_arm_cpu;
 
hw/arm/virt-acpi-build.c +1 -1
index a22a2f43a5..2127778c1e 100644
@@ -720,7 +720,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
         build_append_int_noprefix(table_data, vgic_interrupt, 4);
         build_append_int_noprefix(table_data, 0, 8);    /* GICR Base Address*/
         /* MPIDR */
-        build_append_int_noprefix(table_data, armcpu->mp_affinity, 8);
+        build_append_int_noprefix(table_data, arm_cpu_mp_affinity(armcpu), 8);
         /* Processor Power Efficiency Class */
         build_append_int_noprefix(table_data, 0, 1);
         /* Reserved */
hw/arm/virt.c +3 -3
index 3fc144236b..34cba9ebd8 100644
@@ -370,7 +370,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
     for (cpu = 0; cpu < smp_cpus; cpu++) {
         ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
 
-        if (armcpu->mp_affinity & ARM_AFF3_MASK) {
+        if (arm_cpu_mp_affinity(armcpu) & ARM_AFF3_MASK) {
             addr_cells = 2;
             break;
         }
@@ -397,10 +397,10 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
 
         if (addr_cells == 2) {
             qemu_fdt_setprop_u64(ms->fdt, nodename, "reg",
-                                 armcpu->mp_affinity);
+                                 arm_cpu_mp_affinity(armcpu));
         } else {
             qemu_fdt_setprop_cell(ms->fdt, nodename, "reg",
-                                  armcpu->mp_affinity);
+                                  arm_cpu_mp_affinity(armcpu));
         }
 
         if (ms->possible_cpus->cpus[cs->cpu_index].props.has_node_id) {
hw/arm/xlnx-versal-virt.c +2 -1
index 537118224f..841ef69df6 100644
@@ -107,7 +107,8 @@ static void fdt_add_cpu_nodes(VersalVirt *s, uint32_t psci_conduit)
         ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
 
         qemu_fdt_add_subnode(s->fdt, name);
-        qemu_fdt_setprop_cell(s->fdt, name, "reg", armcpu->mp_affinity);
+        qemu_fdt_setprop_cell(s->fdt, name, "reg",
+                              arm_cpu_mp_affinity(armcpu));
         if (psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) {
             qemu_fdt_setprop_string(s->fdt, name, "enable-method", "psci");
         }
hw/misc/xlnx-versal-crl.c +2 -2
index ac6889fcf2..9bfa9baa15 100644
@@ -67,9 +67,9 @@ static void crl_reset_cpu(XlnxVersalCRL *s, ARMCPU *armcpu,
                           bool rst_old, bool rst_new)
 {
     if (rst_new) {
-        arm_set_cpu_off(armcpu->mp_affinity);
+        arm_set_cpu_off(arm_cpu_mp_affinity(armcpu));
     } else {
-        arm_set_cpu_on_and_reset(armcpu->mp_affinity);
+        arm_set_cpu_on_and_reset(arm_cpu_mp_affinity(armcpu));
     }
 }
 
target/arm/arm-powerctl.c +1 -1
index 8850381565..6c86e90102 100644
@@ -37,7 +37,7 @@ CPUState *arm_get_cpu_by_id(uint64_t id)
     CPU_FOREACH(cpu) {
         ARMCPU *armcpu = ARM_CPU(cpu);
 
-        if (armcpu->mp_affinity == id) {
+        if (arm_cpu_mp_affinity(armcpu) == id) {
             return cpu;
         }
     }
target/arm/hvf/hvf.c +2 -2
index a537a5bc94..659401e12c 100644
@@ -1016,7 +1016,7 @@ static void hvf_raise_exception(CPUState *cpu, uint32_t excp,
 
 static void hvf_psci_cpu_off(ARMCPU *arm_cpu)
 {
-    int32_t ret = arm_set_cpu_off(arm_cpu->mp_affinity);
+    int32_t ret = arm_set_cpu_off(arm_cpu_mp_affinity(arm_cpu));
     assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS);
 }
 
@@ -1045,7 +1045,7 @@ static bool hvf_handle_psci_call(CPUState *cpu)
     int32_t ret = 0;
 
     trace_hvf_psci_call(param[0], param[1], param[2], param[3],
-                        arm_cpu->mp_affinity);
+                        arm_cpu_mp_affinity(arm_cpu));
 
     switch (param[0]) {
     case QEMU_PSCI_0_2_FN_PSCI_VERSION:
target/arm/tcg/psci.c +1 -1
index 9080a91d9c..50d4b23d26 100644
@@ -215,7 +215,7 @@ err:
     return;
 
 cpu_off:
-    ret = arm_set_cpu_off(cpu->mp_affinity);
+    ret = arm_set_cpu_off(arm_cpu_mp_affinity(cpu));
     /* notreached */
     /* sanity check in case something failed */
     assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS);
Signature · 1 line
2.41.0
#11 lore raw

PATCH 10/20 target/arm: Expose arm_cpu_mp_affinity() in 'multiprocessing.h' header

In reply to Philippe Mathieu-Daudé

Declare arm_cpu_mp_affinity() prototype in the new
"target/arm/multiprocessing.h" header so units in
hw/arm/ can use it without having to include the huge target-specific "cpu.h".

File list to include the new header generated using:

  $ git grep -lw arm_cpu_mp_affinity
---
 target/arm/cpu.h             |  6 +-----
 target/arm/multiprocessing.h | 16 ++++++++++++++++
 hw/arm/virt-acpi-build.c     |  1 +
 hw/arm/virt.c                |  1 +
 hw/arm/xlnx-versal-virt.c    |  1 +
 hw/misc/xlnx-versal-crl.c    |  1 +
 target/arm/arm-powerctl.c    |  1 +
 target/arm/cpu.c             |  5 +++++
 target/arm/hvf/hvf.c         |  1 +
 target/arm/tcg/psci.c        |  1 +
 10 files changed, 29 insertions(+), 5 deletions(-)
 create mode 100644 target/arm/multiprocessing.h
target/arm/cpu.h +1 -5
index d1584bdb3b..cecac4c0a1 100644
@@ -26,6 +26,7 @@
 #include "cpu-qom.h"
 #include "exec/cpu-defs.h"
 #include "qapi/qapi-types-common.h"
+#include "target/arm/multiprocessing.h"
 
 /* ARM processors have a weak memory model */
 #define TCG_GUEST_DEFAULT_MO      (0)
@@ -1173,11 +1174,6 @@ void arm_cpu_post_init(Object *obj);
 
 uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz);
 
-static inline uint64_t arm_cpu_mp_affinity(ARMCPU *cpu)
-{
-    return cpu->mp_affinity;
-}
-
 #ifndef CONFIG_USER_ONLY
 extern const VMStateDescription vmstate_arm_cpu;
 
target/arm/multiprocessing.h new file +16 -0
new file mode 100644
index 0000000000..81715d345c
@@ -0,0 +1,16 @@
+/*
+ * ARM multiprocessor CPU helpers
+ *
+ *  Copyright (c) 2003 Fabrice Bellard
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef TARGET_ARM_MULTIPROCESSING_H
+#define TARGET_ARM_MULTIPROCESSING_H
+
+#include "target/arm/cpu-qom.h"
+
+uint64_t arm_cpu_mp_affinity(ARMCPU *cpu);
+
+#endif
hw/arm/virt-acpi-build.c +1 -0
index 2127778c1e..43ccc60f43 100644
@@ -59,6 +59,7 @@
 #include "hw/acpi/ghes.h"
 #include "hw/acpi/viot.h"
 #include "hw/virtio/virtio-acpi.h"
+#include "target/arm/multiprocessing.h"
 
 #define ARM_SPI_BASE 32
 
hw/arm/virt.c +1 -0
index 34cba9ebd8..beba151620 100644
@@ -74,6 +74,7 @@
 #include "hw/arm/smmuv3.h"
 #include "hw/acpi/acpi.h"
 #include "target/arm/internals.h"
+#include "target/arm/multiprocessing.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/mem/nvdimm.h"
 #include "hw/acpi/generic_event_device.h"
hw/arm/xlnx-versal-virt.c +1 -0
index 841ef69df6..29f4d2c2dc 100644
@@ -20,6 +20,7 @@
 #include "hw/qdev-properties.h"
 #include "hw/arm/xlnx-versal.h"
 #include "hw/arm/boot.h"
+#include "target/arm/multiprocessing.h"
 #include "qom/object.h"
 
 #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
hw/misc/xlnx-versal-crl.c +1 -0
index 9bfa9baa15..1f1762ef16 100644
@@ -19,6 +19,7 @@
 #include "hw/resettable.h"
 
 #include "target/arm/arm-powerctl.h"
+#include "target/arm/multiprocessing.h"
 #include "hw/misc/xlnx-versal-crl.h"
 
 #ifndef XLNX_VERSAL_CRL_ERR_DEBUG
target/arm/arm-powerctl.c +1 -0
index 6c86e90102..2b2055c6ac 100644
@@ -16,6 +16,7 @@
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "sysemu/tcg.h"
+#include "target/arm/multiprocessing.h"
 
 #ifndef DEBUG_ARM_POWERCTL
 #define DEBUG_ARM_POWERCTL 0
target/arm/cpu.c +5 -0
index 0bbba48faa..89e44a31fd 100644
@@ -1314,6 +1314,11 @@ uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz)
     return (Aff1 << ARM_AFF1_SHIFT) | Aff0;
 }
 
+uint64_t arm_cpu_mp_affinity(ARMCPU *cpu)
+{
+    return cpu->mp_affinity;
+}
+
 static void arm_cpu_initfn(Object *obj)
 {
     ARMCPU *cpu = ARM_CPU(obj);
target/arm/hvf/hvf.c +1 -0
index 659401e12c..71a26db188 100644
@@ -28,6 +28,7 @@
 #include "arm-powerctl.h"
 #include "target/arm/cpu.h"
 #include "target/arm/internals.h"
+#include "target/arm/multiprocessing.h"
 #include "trace/trace-target_arm_hvf.h"
 #include "migration/vmstate.h"
 
target/arm/tcg/psci.c +1 -0
index 50d4b23d26..51d2ca3d30 100644
@@ -24,6 +24,7 @@
 #include "sysemu/runstate.h"
 #include "internals.h"
 #include "arm-powerctl.h"
+#include "target/arm/multiprocessing.h"
 
 bool arm_is_psci_call(ARMCPU *cpu, int excp_type)
 {
Signature · 1 line
2.41.0
#12 lore raw

PATCH 11/20 target/arm: Declare ARM_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h'

In reply to Philippe Mathieu-Daudé

Missed in commit 2d56be5a29 ("target: Declare FOO_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h'"). See it for more details.

---
 target/arm/cpu-qom.h | 3 +++
 target/arm/cpu.h     | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
target/arm/cpu-qom.h +3 -0
index 02b914c876..f795994135 100644
@@ -33,4 +33,7 @@ typedef struct AArch64CPUClass AArch64CPUClass;
 DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
                        TYPE_AARCH64_CPU)
 
+#define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
+#define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
+
 #endif
target/arm/cpu.h +0 -2
index cecac4c0a1..41659d0ef1 100644
@@ -2837,8 +2837,6 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
 #define ARM_CPUID_TI915T      0x54029152
 #define ARM_CPUID_TI925T      0x54029252
 
-#define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
-#define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
 #define CPU_RESOLVING_TYPE TYPE_ARM_CPU
 
 #define TYPE_ARM_HOST_CPU "host-" TYPE_ARM_CPU
Signature · 1 line
2.41.0
#13 lore raw

PATCH 12/20 hw/cpu/a9mpcore: Build it only once

In reply to Philippe Mathieu-Daudé

hw/cpu/a9mpcore.c doesn't require "cpu.h" anymore. By removing it, the unit become target agnostic:
we can build it once. Update meson.

---
 hw/cpu/a9mpcore.c  | 2 +-
 hw/cpu/meson.build | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/cpu/a9mpcore.c +1 -1
index d03f57e579..c30ef72c66 100644
@@ -15,7 +15,7 @@
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "hw/core/cpu.h"
-#include "cpu.h"
+#include "target/arm/cpu-qom.h"
 
 #define A9_GIC_NUM_PRIORITY_BITS    5
 
hw/cpu/meson.build +1 -1
index 6d319947ca..38cdcfbe57 100644
@@ -2,5 +2,5 @@ system_ss.add(files('core.c', 'cluster.c'))
 
 system_ss.add(when: 'CONFIG_ARM11MPCORE', if_true: files('arm11mpcore.c'))
 system_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview_mpcore.c'))
-specific_ss.add(when: 'CONFIG_A9MPCORE', if_true: files('a9mpcore.c'))
+system_ss.add(when: 'CONFIG_A9MPCORE', if_true: files('a9mpcore.c'))
 specific_ss.add(when: 'CONFIG_A15MPCORE', if_true: files('a15mpcore.c'))
Signature · 1 line
2.41.0
#14 lore raw

PATCH 13/20 hw/misc/xlnx-versal-crl: Include generic 'cpu-qom.h' instead of 'cpu.h'

In reply to Philippe Mathieu-Daudé

"target/arm/cpu.h" is target specific, any file including it becomes target specific too, thus this is the same for any file including "hw/misc/xlnx-versal-crl.h".

"hw/misc/xlnx-versal-crl.h" doesn't require any target specific definition however, only the target-agnostic QOM definitions from "target/arm/cpu-qom.h". Include the latter header to avoid tainting unnecessary objects as target-specific.

---
 include/hw/misc/xlnx-versal-crl.h | 2 +-
 hw/misc/xlnx-versal-crl.c         | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/misc/xlnx-versal-crl.h +1 -1
index dfb8dff197..dba6d3585d 100644
@@ -11,7 +11,7 @@
 
 #include "hw/sysbus.h"
 #include "hw/register.h"
-#include "target/arm/cpu.h"
+#include "target/arm/cpu-qom.h"
 
 #define TYPE_XLNX_VERSAL_CRL "xlnx-versal-crl"
 OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCRL, XLNX_VERSAL_CRL)
hw/misc/xlnx-versal-crl.c +1 -0
index 1f1762ef16..1a596f1cf5 100644
@@ -18,6 +18,7 @@
 #include "hw/register.h"
 #include "hw/resettable.h"
 
+#include "target/arm/cpu.h"
 #include "target/arm/arm-powerctl.h"
 #include "target/arm/multiprocessing.h"
 #include "hw/misc/xlnx-versal-crl.h"
Signature · 1 line
2.41.0
#15 lore raw

PATCH 14/20 hw/misc/xlnx-versal-crl: Build it only once

In reply to Philippe Mathieu-Daudé

hw/misc/xlnx-versal-crl.c doesn't require "cpu.h"
anymore. By removing it, the unit become target
agnostic: we can build it once. Update meson.

---
 hw/misc/xlnx-versal-crl.c | 1 -
 hw/misc/meson.build       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
hw/misc/xlnx-versal-crl.c +0 -1
index 1a596f1cf5..1f1762ef16 100644
@@ -18,7 +18,6 @@
 #include "hw/register.h"
 #include "hw/resettable.h"
 
-#include "target/arm/cpu.h"
 #include "target/arm/arm-powerctl.h"
 #include "target/arm/multiprocessing.h"
 #include "hw/misc/xlnx-versal-crl.h"
hw/misc/meson.build +1 -1
index 36c20d5637..66820acac3 100644
@@ -96,8 +96,8 @@ system_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c'))
 system_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c'))
 system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c'))
 system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c'))
-specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-crl.c'))
 system_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files(
+  'xlnx-versal-crl.c',
   'xlnx-versal-xramc.c',
   'xlnx-versal-pmc-iou-slcr.c',
   'xlnx-versal-cfu.c',
Signature · 1 line
2.41.0
#16 lore raw

PATCH 15/20 target/arm: Expose M-profile register bank index definitions

In reply to Philippe Mathieu-Daudé

The ARMv7M QDev container accesses the QDev SysTickState by its secure/non-secure bank index. In order to make the "hw/intc/armv7m_nvic.h" header target-agnostic in the next commit, first move the M-profile bank index definitions to "target/arm/cpu-qom.h".

---
Or do we want these in a more specific header?

---
 target/arm/cpu-qom.h | 15 +++++++++++++++
 target/arm/cpu.h     | 15 ---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
target/arm/cpu-qom.h +15 -0
index f795994135..77bbc1f13c 100644
@@ -36,4 +36,19 @@ DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
 #define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
 #define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
 
+/* For M profile, some registers are banked secure vs non-secure;
+ * these are represented as a 2-element array where the first element
+ * is the non-secure copy and the second is the secure copy.
+ * When the CPU does not have implement the security extension then
+ * only the first element is used.
+ * This means that the copy for the current security state can be
+ * accessed via env->registerfield[env->v7m.secure] (whether the security
+ * extension is implemented or not).
+ */
+enum {
+    M_REG_NS = 0,
+    M_REG_S = 1,
+    M_REG_NUM_BANKS = 2,
+};
+
 #endif
target/arm/cpu.h +0 -15
index 41659d0ef1..d6a79482ad 100644
@@ -73,21 +73,6 @@
 #define ARMV7M_EXCP_PENDSV  14
 #define ARMV7M_EXCP_SYSTICK 15
 
-/* For M profile, some registers are banked secure vs non-secure;
- * these are represented as a 2-element array where the first element
- * is the non-secure copy and the second is the secure copy.
- * When the CPU does not have implement the security extension then
- * only the first element is used.
- * This means that the copy for the current security state can be
- * accessed via env->registerfield[env->v7m.secure] (whether the security
- * extension is implemented or not).
- */
-enum {
-    M_REG_NS = 0,
-    M_REG_S = 1,
-    M_REG_NUM_BANKS = 2,
-};
-
 /* ARM-specific interrupt pending bits.  */
 #define CPU_INTERRUPT_FIQ   CPU_INTERRUPT_TGT_EXT_1
 #define CPU_INTERRUPT_VIRQ  CPU_INTERRUPT_TGT_EXT_2
Signature · 1 line
2.41.0
#17 lore raw

PATCH 16/20 hw/arm/armv7m: Make 'hw/intc/armv7m_nvic.h' a target agnostic header

In reply to Philippe Mathieu-Daudé

Now than we can access the M-profile bank index definitions from the target-agnostic "cpu-qom.h" header, we don't need the huge "cpu.h" anymore (except in hw/arm/armv7m.c). Reduce its inclusion to the source unit.

---
 include/hw/intc/armv7m_nvic.h | 2 +-
 hw/arm/armv7m.c               | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/intc/armv7m_nvic.h +1 -1
index 6b4ae566c9..89fe8aedaa 100644
@@ -10,7 +10,7 @@
 #ifndef HW_ARM_ARMV7M_NVIC_H
 #define HW_ARM_ARMV7M_NVIC_H
 
-#include "target/arm/cpu.h"
+#include "target/arm/cpu-qom.h"
 #include "hw/sysbus.h"
 #include "hw/timer/armv7m_systick.h"
 #include "qom/object.h"
hw/arm/armv7m.c +1 -0
index 1f21827773..edcd8adc74 100644
@@ -21,6 +21,7 @@
 #include "qemu/module.h"
 #include "qemu/log.h"
 #include "target/arm/idau.h"
+#include "target/arm/cpu.h"
 #include "target/arm/cpu-features.h"
 #include "migration/vmstate.h"
 
Signature · 1 line
2.41.0
#18 lore raw

PATCH 17/20 target/arm: Move ARM_CPU_IRQ/FIQ definitions to 'cpu-qom.h' header

In reply to Philippe Mathieu-Daudé

The ARM_CPU_IRQ/FIQ definitions are used to index the GPIO IRQ created calling qdev_init_gpio_in() in ARMCPU instance_init() handler. To allow non-ARM code to raise interrupt on ARM cores, move they to 'target/arm/cpu-qom.h' which is non-ARM specific and can be included by any hw/ file.

File list to include the new header generated using:

  $ git grep -wEl 'ARM_CPU_(\w*IRQ|FIQ)'
---
 target/arm/cpu-qom.h    | 6 ++++++
 target/arm/cpu.h        | 6 ------
 hw/arm/allwinner-a10.c  | 1 +
 hw/arm/allwinner-h3.c   | 1 +
 hw/arm/allwinner-r40.c  | 1 +
 hw/arm/armv7m.c         | 1 +
 hw/arm/aspeed_ast2400.c | 1 +
 hw/arm/aspeed_ast2600.c | 1 +
 hw/arm/bcm2836.c        | 1 +
 hw/arm/exynos4210.c     | 1 +
 hw/arm/fsl-imx25.c      | 1 +
 hw/arm/fsl-imx31.c      | 1 +
 hw/arm/fsl-imx6.c       | 1 +
 hw/arm/fsl-imx6ul.c     | 1 +
 hw/arm/fsl-imx7.c       | 1 +
 hw/arm/highbank.c       | 1 +
 hw/arm/integratorcp.c   | 1 +
 hw/arm/musicpal.c       | 1 +
 hw/arm/npcm7xx.c        | 1 +
 hw/arm/omap1.c          | 1 +
 hw/arm/omap2.c          | 1 +
 hw/arm/realview.c       | 1 +
 hw/arm/sbsa-ref.c       | 1 +
 hw/arm/strongarm.c      | 1 +
 hw/arm/versatilepb.c    | 1 +
 hw/arm/vexpress.c       | 1 +
 hw/arm/virt.c           | 1 +
 hw/arm/xilinx_zynq.c    | 1 +
 hw/arm/xlnx-versal.c    | 1 +
 hw/arm/xlnx-zynqmp.c    | 1 +
 target/arm/cpu.c        | 1 +
 31 files changed, 35 insertions(+), 6 deletions(-)
target/arm/cpu-qom.h +6 -0
index 77bbc1f13c..8e032691db 100644
@@ -36,6 +36,12 @@ DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
 #define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
 #define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
 
+/* Meanings of the ARMCPU object's four inbound GPIO lines */
+#define ARM_CPU_IRQ 0
+#define ARM_CPU_FIQ 1
+#define ARM_CPU_VIRQ 2
+#define ARM_CPU_VFIQ 3
+
 /* For M profile, some registers are banked secure vs non-secure;
  * these are represented as a 2-element array where the first element
  * is the non-secure copy and the second is the secure copy.
target/arm/cpu.h +0 -6
index d6a79482ad..e8df41d642 100644
@@ -93,12 +93,6 @@
 #define offsetofhigh32(S, M) (offsetof(S, M) + sizeof(uint32_t))
 #endif
 
-/* Meanings of the ARMCPU object's four inbound GPIO lines */
-#define ARM_CPU_IRQ 0
-#define ARM_CPU_FIQ 1
-#define ARM_CPU_VIRQ 2
-#define ARM_CPU_VFIQ 3
-
 /* ARM-specific extra insn start words:
  * 1: Conditional execution bits
  * 2: Partial exception syndrome for data aborts
hw/arm/allwinner-a10.c +1 -0
index b0ea3f7f66..7e2ae7a15f 100644
@@ -26,6 +26,7 @@
 #include "hw/boards.h"
 #include "hw/usb/hcd-ohci.h"
 #include "hw/loader.h"
+#include "target/arm/cpu-qom.h"
 
 #define AW_A10_SRAM_A_BASE      0x00000000
 #define AW_A10_DRAMC_BASE       0x01c01000
hw/arm/allwinner-h3.c +1 -0
index f05afddf7e..2d684b5287 100644
@@ -30,6 +30,7 @@
 #include "hw/loader.h"
 #include "sysemu/sysemu.h"
 #include "hw/arm/allwinner-h3.h"
+#include "target/arm/cpu-qom.h"
 
 /* Memory map */
 const hwaddr allwinner_h3_memmap[] = {
hw/arm/allwinner-r40.c +1 -0
index a0d367c60d..65392dbc23 100644
@@ -32,6 +32,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/arm/allwinner-r40.h"
 #include "hw/misc/allwinner-r40-dramc.h"
+#include "target/arm/cpu-qom.h"
 
 /* Memory map */
 const hwaddr allwinner_r40_memmap[] = {
hw/arm/armv7m.c +1 -0
index edcd8adc74..7c68525a9e 100644
@@ -23,6 +23,7 @@
 #include "target/arm/idau.h"
 #include "target/arm/cpu.h"
 #include "target/arm/cpu-features.h"
+#include "target/arm/cpu-qom.h"
 #include "migration/vmstate.h"
 
 /* Bitbanded IO.  Each word corresponds to a single bit.  */
hw/arm/aspeed_ast2400.c +1 -0
index 0baa2ff96e..ad76035528 100644
@@ -21,6 +21,7 @@
 #include "hw/i2c/aspeed_i2c.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
+#include "target/arm/cpu-qom.h"
 
 #define ASPEED_SOC_IOMEM_SIZE       0x00200000
 
hw/arm/aspeed_ast2600.c +1 -0
index 3a9a303ab8..386a88d4e0 100644
@@ -16,6 +16,7 @@
 #include "hw/i2c/aspeed_i2c.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
+#include "target/arm/cpu-qom.h"
 
 #define ASPEED_SOC_IOMEM_SIZE       0x00200000
 #define ASPEED_SOC_DPMCU_SIZE       0x00040000
hw/arm/bcm2836.c +1 -0
index b0674a22a6..58a78780d2 100644
@@ -15,6 +15,7 @@
 #include "hw/arm/bcm2836.h"
 #include "hw/arm/raspi_platform.h"
 #include "hw/sysbus.h"
+#include "target/arm/cpu-qom.h"
 
 struct BCM283XClass {
     /*< private >*/
hw/arm/exynos4210.c +1 -0
index af511a153d..6c428d8eeb 100644
@@ -36,6 +36,7 @@
 #include "hw/arm/exynos4210.h"
 #include "hw/sd/sdhci.h"
 #include "hw/usb/hcd-ehci.h"
+#include "target/arm/cpu-qom.h"
 
 #define EXYNOS4210_CHIPID_ADDR         0x10000000
 
hw/arm/fsl-imx25.c +1 -0
index 9d2fb75a68..4a49507ef1 100644
@@ -28,6 +28,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/qdev-properties.h"
 #include "chardev/char.h"
+#include "target/arm/cpu-qom.h"
 
 #define IMX25_ESDHC_CAPABILITIES     0x07e20000
 
hw/arm/fsl-imx31.c +1 -0
index c0584e4dfc..4b8d9b8e4f 100644
@@ -26,6 +26,7 @@
 #include "exec/address-spaces.h"
 #include "hw/qdev-properties.h"
 #include "chardev/char.h"
+#include "target/arm/cpu-qom.h"
 
 static void fsl_imx31_init(Object *obj)
 {
hw/arm/fsl-imx6.c +1 -0
index af2e982b05..42f9058825 100644
@@ -29,6 +29,7 @@
 #include "chardev/char.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "target/arm/cpu-qom.h"
 
 #define IMX6_ESDHC_CAPABILITIES     0x057834b4
 
hw/arm/fsl-imx6ul.c +1 -0
index e37b69a5e1..486a009deb 100644
@@ -25,6 +25,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "target/arm/cpu-qom.h"
 
 #define NAME_SIZE 20
 
hw/arm/fsl-imx7.c +1 -0
index 474cfdc87c..5728109491 100644
@@ -26,6 +26,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "target/arm/cpu-qom.h"
 
 #define NAME_SIZE 20
 
hw/arm/highbank.c +1 -0
index c21e18d08f..e6e27d69af 100644
@@ -36,6 +36,7 @@
 #include "qemu/log.h"
 #include "qom/object.h"
 #include "cpu.h"
+#include "target/arm/cpu-qom.h"
 
 #define SMP_BOOT_ADDR           0x100
 #define SMP_BOOT_REG            0x40
hw/arm/integratorcp.c +1 -0
index 1830e1d785..5600616a4d 100644
@@ -28,6 +28,7 @@
 #include "hw/sd/sd.h"
 #include "qom/object.h"
 #include "audio/audio.h"
+#include "target/arm/cpu-qom.h"
 
 #define TYPE_INTEGRATOR_CM "integrator_core"
 OBJECT_DECLARE_SIMPLE_TYPE(IntegratorCMState, INTEGRATOR_CM)
hw/arm/musicpal.c +1 -0
index 3200c9f68a..d89824f600 100644
@@ -39,6 +39,7 @@
 #include "hw/net/mv88w8618_eth.h"
 #include "audio/audio.h"
 #include "qemu/error-report.h"
+#include "target/arm/cpu-qom.h"
 
 #define MP_MISC_BASE            0x80002000
 #define MP_MISC_SIZE            0x00001000
hw/arm/npcm7xx.c +1 -0
index 7fb0a233b2..e3243a520d 100644
@@ -26,6 +26,7 @@
 #include "qapi/error.h"
 #include "qemu/units.h"
 #include "sysemu/sysemu.h"
+#include "target/arm/cpu-qom.h"
 
 /*
  * This covers the whole MMIO space. We'll use this to catch any MMIO accesses
hw/arm/omap1.c +1 -0
index d5438156ee..86ee336e59 100644
@@ -40,6 +40,7 @@
 #include "hw/sysbus.h"
 #include "qemu/cutils.h"
 #include "qemu/bcd.h"
+#include "target/arm/cpu-qom.h"
 
 static inline void omap_log_badwidth(const char *funcname, hwaddr addr, int sz)
 {
hw/arm/omap2.c +1 -0
index f170728e7e..f159fb73ea 100644
@@ -39,6 +39,7 @@
 #include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "audio/audio.h"
+#include "target/arm/cpu-qom.h"
 
 /* Enhanced Audio Controller (CODEC only) */
 struct omap_eac_s {
hw/arm/realview.c +1 -0
index 132217b2ed..566deff9ce 100644
@@ -30,6 +30,7 @@
 #include "hw/i2c/arm_sbcon_i2c.h"
 #include "hw/sd/sd.h"
 #include "audio/audio.h"
+#include "target/arm/cpu-qom.h"
 
 #define SMP_BOOT_ADDR 0xe0000000
 #define SMP_BOOTREG_ADDR 0x10000030
hw/arm/sbsa-ref.c +1 -0
index b8857d1e9e..d6081bfc41 100644
@@ -50,6 +50,7 @@
 #include "net/net.h"
 #include "qapi/qmp/qlist.h"
 #include "qom/object.h"
+#include "target/arm/cpu-qom.h"
 
 #define RAMLIMIT_GB 8192
 #define RAMLIMIT_BYTES (RAMLIMIT_GB * GiB)
hw/arm/strongarm.c +1 -0
index fef3638aca..75637869cb 100644
@@ -46,6 +46,7 @@
 #include "qemu/cutils.h"
 #include "qemu/log.h"
 #include "qom/object.h"
+#include "target/arm/cpu-qom.h"
 
 //#define DEBUG
 
hw/arm/versatilepb.c +1 -0
index 4b2257787b..15b5ed0ced 100644
@@ -27,6 +27,7 @@
 #include "hw/sd/sd.h"
 #include "qom/object.h"
 #include "audio/audio.h"
+#include "target/arm/cpu-qom.h"
 
 #define VERSATILE_FLASH_ADDR 0x34000000
 #define VERSATILE_FLASH_SIZE (64 * 1024 * 1024)
hw/arm/vexpress.c +1 -0
index fd981f4c33..49dbcdcbf0 100644
@@ -46,6 +46,7 @@
 #include "qapi/qmp/qlist.h"
 #include "qom/object.h"
 #include "audio/audio.h"
+#include "target/arm/cpu-qom.h"
 
 #define VEXPRESS_BOARD_ID 0x8e0
 #define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024)
hw/arm/virt.c +1 -0
index beba151620..0ab5fd9477 100644
@@ -73,6 +73,7 @@
 #include "standard-headers/linux/input.h"
 #include "hw/arm/smmuv3.h"
 #include "hw/acpi/acpi.h"
+#include "target/arm/cpu-qom.h"
 #include "target/arm/internals.h"
 #include "target/arm/multiprocessing.h"
 #include "hw/mem/pc-dimm.h"
hw/arm/xilinx_zynq.c +1 -0
index d4c817ecdc..5809fc32af 100644
@@ -38,6 +38,7 @@
 #include "sysemu/reset.h"
 #include "qom/object.h"
 #include "exec/tswap.h"
+#include "target/arm/cpu-qom.h"
 
 #define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9")
 OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)
hw/arm/xlnx-versal.c +1 -0
index 9600551c44..87fdb39d43 100644
@@ -23,6 +23,7 @@
 #include "hw/misc/unimp.h"
 #include "hw/arm/xlnx-versal.h"
 #include "qemu/log.h"
+#include "target/arm/cpu-qom.h"
 
 #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
 #define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f")
hw/arm/xlnx-zynqmp.c +1 -0
index 5905a33015..38cb34942f 100644
@@ -25,6 +25,7 @@
 #include "sysemu/kvm.h"
 #include "sysemu/sysemu.h"
 #include "kvm_arm.h"
+#include "target/arm/cpu-qom.h"
 
 #define GIC_NUM_SPI_INTR 160
 
target/arm/cpu.c +1 -0
index 89e44a31fd..07357daabe 100644
@@ -48,6 +48,7 @@
 #include "disas/capstone.h"
 #include "fpu/softfloat.h"
 #include "cpregs.h"
+#include "target/arm/cpu-qom.h"
 
 static void arm_cpu_set_pc(CPUState *cs, vaddr value)
 {
Signature · 1 line
2.41.0
#19 lore raw

PATCH 18/20 target/arm: Move e2h_access() helper around

In reply to Philippe Mathieu-Daudé

e2h_access() was added in commit bb5972e439 ("target/arm:
Add VHE timer register redirection and aliasing") close to the generic_timer_cp_reginfo[] array, but isn't used until vhe_reginfo[] definition. Move it closer to the other e2h helpers.

---
 target/arm/helper.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
target/arm/helper.c +15 -14
index dc8f14f433..1ef00e50e4 100644
@@ -3342,20 +3342,6 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
     },
 };
 
-static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri,
-                                 bool isread)
-{
-    if (arm_current_el(env) == 1) {
-        /* This must be a FEAT_NV access */
-        /* TODO: FEAT_ECV will need to check CNTHCTL_EL2 here */
-        return CP_ACCESS_OK;
-    }
-    if (!(arm_hcr_el2_eff(env) & HCR_E2H)) {
-        return CP_ACCESS_TRAP;
-    }
-    return CP_ACCESS_OK;
-}
-
 #else
 
 /*
@@ -6543,6 +6529,21 @@ static const ARMCPRegInfo el3_cp_reginfo[] = {
 };
 
 #ifndef CONFIG_USER_ONLY
+
+static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri,
+                                 bool isread)
+{
+    if (arm_current_el(env) == 1) {
+        /* This must be a FEAT_NV access */
+        /* TODO: FEAT_ECV will need to check CNTHCTL_EL2 here */
+        return CP_ACCESS_OK;
+    }
+    if (!(arm_hcr_el2_eff(env) & HCR_E2H)) {
+        return CP_ACCESS_TRAP;
+    }
+    return CP_ACCESS_OK;
+}
+
 /* Test if system register redirection is to occur in the current state.  */
 static bool redirect_for_e2h(CPUARMState *env)
 {
Signature · 1 line
2.41.0
#20 lore raw

PATCH 19/20 target/arm: Move GTimer definitions to new 'gtimer.h' header

In reply to Philippe Mathieu-Daudé

Move Arm A-class Generic Timer definitions to the new "target/arm/gtimer.h" header so units in hw/ which don't need access to ARMCPU internals can use them without having to include the huge "cpu.h".

---
 target/arm/cpu.h       |  8 +-------
 target/arm/gtimer.h    | 21 +++++++++++++++++++++
 hw/arm/allwinner-h3.c  |  1 +
 hw/arm/allwinner-r40.c |  1 +
 hw/arm/bcm2836.c       |  1 +
 hw/arm/sbsa-ref.c      |  1 +
 hw/arm/virt.c          |  1 +
 hw/arm/xlnx-versal.c   |  1 +
 hw/arm/xlnx-zynqmp.c   |  1 +
 hw/cpu/a15mpcore.c     |  1 +
 target/arm/cpu.c       |  1 +
 target/arm/helper.c    |  1 +
 target/arm/hvf/hvf.c   |  1 +
 target/arm/kvm.c       |  1 +
 target/arm/machine.c   |  1 +
 15 files changed, 35 insertions(+), 7 deletions(-)
 create mode 100644 target/arm/gtimer.h
target/arm/cpu.h +1 -7
index e8df41d642..d3477b1601 100644
@@ -27,6 +27,7 @@
 #include "exec/cpu-defs.h"
 #include "qapi/qapi-types-common.h"
 #include "target/arm/multiprocessing.h"
+#include "target/arm/gtimer.h"
 
 /* ARM processors have a weak memory model */
 #define TCG_GUEST_DEFAULT_MO      (0)
@@ -140,13 +141,6 @@ typedef struct ARMGenericTimer {
     uint64_t ctl; /* Timer Control register */
 } ARMGenericTimer;
 
-#define GTIMER_PHYS     0
-#define GTIMER_VIRT     1
-#define GTIMER_HYP      2
-#define GTIMER_SEC      3
-#define GTIMER_HYPVIRT  4
-#define NUM_GTIMERS     5
-
 #define VTCR_NSW (1u << 29)
 #define VTCR_NSA (1u << 30)
 #define VSTCR_SW VTCR_NSW
target/arm/gtimer.h new file +21 -0
new file mode 100644
index 0000000000..b992941bef
@@ -0,0 +1,21 @@
+/*
+ * ARM generic timer definitions for Arm A-class CPU
+ *
+ *  Copyright (c) 2003 Fabrice Bellard
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef TARGET_ARM_GTIMER_H
+#define TARGET_ARM_GTIMER_H
+
+enum {
+    GTIMER_PHYS     = 0,
+    GTIMER_VIRT     = 1,
+    GTIMER_HYP      = 2,
+    GTIMER_SEC      = 3,
+    GTIMER_HYPVIRT  = 4,
+#define NUM_GTIMERS   5
+};
+
+#endif
hw/arm/allwinner-h3.c +1 -0
index 2d684b5287..380e0ec11d 100644
@@ -31,6 +31,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/arm/allwinner-h3.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/gtimer.h"
 
 /* Memory map */
 const hwaddr allwinner_h3_memmap[] = {
hw/arm/allwinner-r40.c +1 -0
index 65392dbc23..898bef9d93 100644
@@ -33,6 +33,7 @@
 #include "hw/arm/allwinner-r40.h"
 #include "hw/misc/allwinner-r40-dramc.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/gtimer.h"
 
 /* Memory map */
 const hwaddr allwinner_r40_memmap[] = {
hw/arm/bcm2836.c +1 -0
index 58a78780d2..e3ba18a8ec 100644
@@ -16,6 +16,7 @@
 #include "hw/arm/raspi_platform.h"
 #include "hw/sysbus.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/gtimer.h"
 
 struct BCM283XClass {
     /*< private >*/
hw/arm/sbsa-ref.c +1 -0
index d6081bfc41..85cb68d546 100644
@@ -51,6 +51,7 @@
 #include "qapi/qmp/qlist.h"
 #include "qom/object.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/gtimer.h"
 
 #define RAMLIMIT_GB 8192
 #define RAMLIMIT_BYTES (RAMLIMIT_GB * GiB)
hw/arm/virt.c +1 -0
index 0ab5fd9477..bdfcf028a0 100644
@@ -76,6 +76,7 @@
 #include "target/arm/cpu-qom.h"
 #include "target/arm/internals.h"
 #include "target/arm/multiprocessing.h"
+#include "target/arm/gtimer.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/mem/nvdimm.h"
 #include "hw/acpi/generic_event_device.h"
hw/arm/xlnx-versal.c +1 -0
index 87fdb39d43..2798df3730 100644
@@ -24,6 +24,7 @@
 #include "hw/arm/xlnx-versal.h"
 #include "qemu/log.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/gtimer.h"
 
 #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
 #define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f")
hw/arm/xlnx-zynqmp.c +1 -0
index 38cb34942f..65901c6e74 100644
@@ -26,6 +26,7 @@
 #include "sysemu/sysemu.h"
 #include "kvm_arm.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/gtimer.h"
 
 #define GIC_NUM_SPI_INTR 160
 
hw/cpu/a15mpcore.c +1 -0
index bfd8aa5644..967d8d3dd5 100644
@@ -26,6 +26,7 @@
 #include "hw/qdev-properties.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
+#include "target/arm/gtimer.h"
 
 static void a15mp_priv_set_irq(void *opaque, int irq, int level)
 {
target/arm/cpu.c +1 -0
index 07357daabe..4c57b9c3b8 100644
@@ -49,6 +49,7 @@
 #include "fpu/softfloat.h"
 #include "cpregs.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/gtimer.h"
 
 static void arm_cpu_set_pc(CPUState *cs, vaddr value)
 {
target/arm/helper.c +1 -0
index 1ef00e50e4..39e2ba25c8 100644
@@ -30,6 +30,7 @@
 #include "semihosting/common-semi.h"
 #endif
 #include "cpregs.h"
+#include "target/arm/gtimer.h"
 
 #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
 
target/arm/hvf/hvf.c +1 -0
index 71a26db188..e5f0f60093 100644
@@ -29,6 +29,7 @@
 #include "target/arm/cpu.h"
 #include "target/arm/internals.h"
 #include "target/arm/multiprocessing.h"
+#include "target/arm/gtimer.h"
 #include "trace/trace-target_arm_hvf.h"
 #include "migration/vmstate.h"
 
target/arm/kvm.c +1 -0
index 8f52b211f9..81813030a5 100644
@@ -38,6 +38,7 @@
 #include "qemu/log.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ghes.h"
+#include "target/arm/gtimer.h"
 
 const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
     KVM_CAP_LAST_INFO
target/arm/machine.c +1 -0
index 542be14bec..9d7dbaea54 100644
@@ -7,6 +7,7 @@
 #include "internals.h"
 #include "cpu-features.h"
 #include "migration/cpu.h"
+#include "target/arm/gtimer.h"
 
 static bool vfp_needed(void *opaque)
 {
Signature · 1 line
2.41.0
#21 lore raw

PATCH 20/20 hw/arm: Build various units only once

In reply to Philippe Mathieu-Daudé

Various files in hw/arm/ don't require "cpu.h" anymore. Except virt-acpi-build.c, all of them don't require any ARM specific knowledge anymore and can be build once as target agnostic units. Update meson accordingly.

---
 hw/arm/collie.c           |  1 -
 hw/arm/gumstix.c          |  1 -
 hw/arm/integratorcp.c     |  1 -
 hw/arm/mainstone.c        |  1 -
 hw/arm/musicpal.c         |  1 -
 hw/arm/omap2.c            |  1 -
 hw/arm/omap_sx1.c         |  1 -
 hw/arm/palm.c             |  1 -
 hw/arm/spitz.c            |  1 -
 hw/arm/strongarm.c        |  1 -
 hw/arm/versatilepb.c      |  1 -
 hw/arm/vexpress.c         |  1 -
 hw/arm/virt-acpi-build.c  |  1 -
 hw/arm/xilinx_zynq.c      |  1 -
 hw/arm/xlnx-versal-virt.c |  1 -
 hw/arm/z2.c               |  1 -
 hw/arm/meson.build        | 23 ++++++++++++-----------
 17 files changed, 12 insertions(+), 27 deletions(-)
hw/arm/collie.c +0 -1
index a0ad1b8dc7..eaa5c52d45 100644
@@ -17,7 +17,6 @@
 #include "hw/arm/boot.h"
 #include "hw/block/flash.h"
 #include "exec/address-spaces.h"
-#include "cpu.h"
 #include "qom/object.h"
 #include "qemu/error-report.h"
 
hw/arm/gumstix.c +0 -1
index 2ca4140c9f..3f2bcaa24e 100644
@@ -44,7 +44,6 @@
 #include "hw/boards.h"
 #include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
-#include "cpu.h"
 
 #define CONNEX_FLASH_SIZE   (16 * MiB)
 #define CONNEX_RAM_SIZE     (64 * MiB)
hw/arm/integratorcp.c +0 -1
index 5600616a4d..793262eca8 100644
@@ -9,7 +9,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "cpu.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/boards.h"
hw/arm/mainstone.c +0 -1
index 68329c4617..fc14e05060 100644
@@ -23,7 +23,6 @@
 #include "hw/block/flash.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
-#include "cpu.h"
 
 /* Device addresses */
 #define MST_FPGA_PHYS	0x08000000
hw/arm/musicpal.c +0 -1
index d89824f600..e46aa91807 100644
@@ -12,7 +12,6 @@
 #include "qemu/osdep.h"
 #include "qemu/units.h"
 #include "qapi/error.h"
-#include "cpu.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/arm/boot.h"
hw/arm/omap2.c +0 -1
index f159fb73ea..d9683276c6 100644
@@ -21,7 +21,6 @@
 #include "qemu/osdep.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
-#include "cpu.h"
 #include "exec/address-spaces.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/qtest.h"
hw/arm/omap_sx1.c +0 -1
index 4bf1579f8c..62d7915fb8 100644
@@ -35,7 +35,6 @@
 #include "hw/block/flash.h"
 #include "sysemu/qtest.h"
 #include "exec/address-spaces.h"
-#include "cpu.h"
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 
hw/arm/palm.c +0 -1
index b86f2c331b..8c4c831614 100644
@@ -29,7 +29,6 @@
 #include "hw/input/tsc2xxx.h"
 #include "hw/irq.h"
 #include "hw/loader.h"
-#include "cpu.h"
 #include "qemu/cutils.h"
 #include "qom/object.h"
 #include "qemu/error-report.h"
hw/arm/spitz.c +0 -1
index 1d680b61e2..643a02b180 100644
@@ -33,7 +33,6 @@
 #include "hw/adc/max111x.h"
 #include "migration/vmstate.h"
 #include "exec/address-spaces.h"
-#include "cpu.h"
 #include "qom/object.h"
 #include "audio/audio.h"
 
hw/arm/strongarm.c +0 -1
index 75637869cb..7fd99a0f14 100644
@@ -28,7 +28,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "cpu.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-properties-system.h"
hw/arm/versatilepb.c +0 -1
index 15b5ed0ced..1d813aa23b 100644
@@ -9,7 +9,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "cpu.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/arm/boot.h"
hw/arm/vexpress.c +0 -1
index 49dbcdcbf0..f1b45245d5 100644
@@ -24,7 +24,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/datadir.h"
-#include "cpu.h"
 #include "hw/sysbus.h"
 #include "hw/arm/boot.h"
 #include "hw/arm/primecell.h"
hw/arm/virt-acpi-build.c +0 -1
index 43ccc60f43..17aeec7a6f 100644
@@ -32,7 +32,6 @@
 #include "qemu/error-report.h"
 #include "trace.h"
 #include "hw/core/cpu.h"
-#include "target/arm/cpu.h"
 #include "hw/acpi/acpi-defs.h"
 #include "hw/acpi/acpi.h"
 #include "hw/nvram/fw_cfg_acpi.h"
hw/arm/xilinx_zynq.c +0 -1
index 5809fc32af..66d0de139f 100644
@@ -18,7 +18,6 @@
 #include "qemu/osdep.h"
 #include "qemu/units.h"
 #include "qapi/error.h"
-#include "cpu.h"
 #include "hw/sysbus.h"
 #include "hw/arm/boot.h"
 #include "net/net.h"
hw/arm/xlnx-versal-virt.c +0 -1
index 29f4d2c2dc..94942c55df 100644
@@ -16,7 +16,6 @@
 #include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "hw/arm/fdt.h"
-#include "cpu.h"
 #include "hw/qdev-properties.h"
 #include "hw/arm/xlnx-versal.h"
 #include "hw/arm/boot.h"
hw/arm/z2.c +0 -1
index 83741a4909..a67fba2cfd 100644
@@ -25,7 +25,6 @@
 #include "hw/audio/wm8750.h"
 #include "audio/audio.h"
 #include "exec/address-spaces.h"
-#include "cpu.h"
 #include "qom/object.h"
 #include "qapi/error.h"
 
hw/arm/meson.build +12 -11
index bb92b27db3..c401779067 100644
@@ -9,23 +9,14 @@ arm_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
 arm_ss.add(when: 'CONFIG_MAINSTONE', if_true: files('mainstone.c'))
 arm_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c'))
 arm_ss.add(when: 'CONFIG_MUSICPAL', if_true: files('musicpal.c'))
-arm_ss.add(when: 'CONFIG_NETDUINO2', if_true: files('netduino2.c'))
 arm_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c'))
 arm_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c'))
 arm_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx.c', 'npcm7xx_boards.c'))
 arm_ss.add(when: 'CONFIG_NSERIES', if_true: files('nseries.c'))
-arm_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
-arm_ss.add(when: 'CONFIG_CHEETAH', if_true: files('palm.c'))
-arm_ss.add(when: 'CONFIG_GUMSTIX', if_true: files('gumstix.c'))
-arm_ss.add(when: 'CONFIG_SPITZ', if_true: files('spitz.c'))
-arm_ss.add(when: 'CONFIG_Z2', if_true: files('z2.c'))
 arm_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview.c'))
 arm_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa-ref.c'))
 arm_ss.add(when: 'CONFIG_STELLARIS', if_true: files('stellaris.c'))
 arm_ss.add(when: 'CONFIG_STM32VLDISCOVERY', if_true: files('stm32vldiscovery.c'))
-arm_ss.add(when: 'CONFIG_COLLIE', if_true: files('collie.c'))
-arm_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
-arm_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
 arm_ss.add(when: 'CONFIG_ZYNQ', if_true: files('xilinx_zynq.c'))
 arm_ss.add(when: 'CONFIG_SABRELITE', if_true: files('sabrelite.c'))
 
@@ -33,8 +24,7 @@ arm_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m.c'))
 arm_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210.c'))
 arm_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx.c', 'pxa2xx_gpio.c', 'pxa2xx_pic.c'))
 arm_ss.add(when: 'CONFIG_DIGIC', if_true: files('digic.c'))
-arm_ss.add(when: 'CONFIG_OMAP', if_true: files('omap1.c', 'omap2.c'))
-arm_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c'))
+arm_ss.add(when: 'CONFIG_OMAP', if_true: files('omap1.c'))
 arm_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c', 'cubieboard.c'))
 arm_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c'))
 arm_ss.add(when: 'CONFIG_ALLWINNER_R40', if_true: files('allwinner-r40.c', 'bananapi_m2u.c'))
@@ -69,8 +59,19 @@ arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
 arm_ss.add(when: 'CONFIG_XEN', if_true: files('xen_arm.c'))
 
 system_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c'))
+system_ss.add(when: 'CONFIG_CHEETAH', if_true: files('palm.c'))
+system_ss.add(when: 'CONFIG_COLLIE', if_true: files('collie.c'))
 system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4_boards.c'))
+system_ss.add(when: 'CONFIG_GUMSTIX', if_true: files('gumstix.c'))
+system_ss.add(when: 'CONFIG_NETDUINO2', if_true: files('netduino2.c'))
+system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap2.c'))
 system_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_peripherals.c'))
+system_ss.add(when: 'CONFIG_SPITZ', if_true: files('spitz.c'))
+system_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c'))
+system_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
 system_ss.add(when: 'CONFIG_TOSA', if_true: files('tosa.c'))
+system_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
+system_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
+system_ss.add(when: 'CONFIG_Z2', if_true: files('z2.c'))
 
 hw_arch += {'arm': arm_ss}
Signature · 1 line
2.41.0
#22 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

Hi,

In order to fix a bug noticed [*] by Cédric and Fabiano in my "Remove one use of qemu_get_cpu() in A7/A15 MPCore priv" series, I ended reusing commits from other branches and it grew quite a lot. This is the first "cleanup" part, unrelated on MPCorePriv.

Please review,

Phil.

[*] https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 20 lines

Philippe Mathieu-Daudé (18):
hw/arm/exynos4210: Include missing 'exec/tswap.h' header hw/arm/xilinx_zynq: Include missing 'exec/tswap.h' header hw/arm/smmuv3: Include missing 'hw/registerfields.h' header hw/arm/xlnx-versal: Include missing 'cpu.h' header target/arm/cpu-features: Include missing 'hw/registerfields.h' header target/arm/cpregs: Include missing 'hw/registerfields.h' header target/arm/cpregs: Include missing 'kvm-consts.h' header target/arm: Expose arm_cpu_mp_affinity() in 'multiprocessing.h' header target/arm: Declare ARM_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h' hw/cpu/a9mpcore: Build it only once hw/misc/xlnx-versal-crl: Include generic 'cpu-qom.h' instead of

     'cpu.h'

hw/misc/xlnx-versal-crl: Build it only once
target/arm: Expose M-profile register bank index definitions hw/arm/armv7m: Make 'hw/intc/armv7m_nvic.h' a target agnostic header target/arm: Move ARM_CPU_IRQ/FIQ definitions to 'cpu-qom.h' header target/arm: Move e2h_access() helper around
target/arm: Move GTimer definitions to new 'gtimer.h' header hw/arm: Build various units only once

Reviewed-by on the v1 series
#23 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 23 lines · Philippe Mathieu-Daudé

Hi,

In order to fix a bug noticed [*] by Cédric and Fabiano in my "Remove one use of qemu_get_cpu() in A7/A15 MPCore priv" series, I ended reusing commits from other branches and it grew quite a lot. This is the first "cleanup" part, unrelated on MPCorePriv.

Please review,

Phil.

Philippe Mathieu-Daudé (18):
hw/arm/exynos4210: Include missing 'exec/tswap.h' header hw/arm/xilinx_zynq: Include missing 'exec/tswap.h' header hw/arm/smmuv3: Include missing 'hw/registerfields.h' header hw/arm/xlnx-versal: Include missing 'cpu.h' header target/arm/cpu-features: Include missing 'hw/registerfields.h' header target/arm/cpregs: Include missing 'hw/registerfields.h' header target/arm/cpregs: Include missing 'kvm-consts.h' header target/arm: Expose arm_cpu_mp_affinity() in 'multiprocessing.h' header target/arm: Declare ARM_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h' hw/cpu/a9mpcore: Build it only once hw/misc/xlnx-versal-crl: Include generic 'cpu-qom.h' instead of

Quoted 8 lines
     'cpu.h'

hw/misc/xlnx-versal-crl: Build it only once
target/arm: Expose M-profile register bank index definitions hw/arm/armv7m: Make 'hw/intc/armv7m_nvic.h' a target agnostic header target/arm: Move ARM_CPU_IRQ/FIQ definitions to 'cpu-qom.h' header target/arm: Move e2h_access() helper around
target/arm: Move GTimer definitions to new 'gtimer.h' header hw/arm: Build various units only once

r~

#24 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

Hi,

In order to fix a bug noticed [*] by Cédric and Fabiano in my "Remove one use of qemu_get_cpu() in A7/A15 MPCore priv" series, I ended reusing commits from other branches and it grew quite a lot. This is the first "cleanup" part, unrelated on MPCorePriv.

Please review,

Applied to target-arm.next, thanks.

-- PMM