[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/20] target/arm: Create arm_cpu_mp_affinity
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 09/20] target/arm: Create arm_cpu_mp_affinity |
Date: |
Thu, 18 Jan 2024 21:06:30 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Wrapper to return the mp affinity bits from the cpu.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
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(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 55a19e8539..d1584bdb3b 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -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;
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index a22a2f43a5..2127778c1e 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -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 */
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 3fc144236b..34cba9ebd8 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -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) {
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 537118224f..841ef69df6 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -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");
}
diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c
index ac6889fcf2..9bfa9baa15 100644
--- a/hw/misc/xlnx-versal-crl.c
+++ b/hw/misc/xlnx-versal-crl.c
@@ -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));
}
}
diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c
index 8850381565..6c86e90102 100644
--- a/target/arm/arm-powerctl.c
+++ b/target/arm/arm-powerctl.c
@@ -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;
}
}
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index a537a5bc94..659401e12c 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -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:
diff --git a/target/arm/tcg/psci.c b/target/arm/tcg/psci.c
index 9080a91d9c..50d4b23d26 100644
--- a/target/arm/tcg/psci.c
+++ b/target/arm/tcg/psci.c
@@ -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);
--
2.41.0
- [PATCH 00/20] arm: Rework target/ headers to build various hw/ files once, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 01/20] hw/arm/exynos4210: Include missing 'exec/tswap.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 02/20] hw/arm/xilinx_zynq: Include missing 'exec/tswap.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 03/20] hw/arm/smmuv3: Include missing 'hw/registerfields.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 04/20] hw/arm/xlnx-versal: Include missing 'cpu.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 05/20] target/arm/cpu-features: Include missing 'hw/registerfields.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 06/20] target/arm/cpregs: Include missing 'hw/registerfields.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 07/20] target/arm/cpregs: Include missing 'kvm-consts.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 08/20] target/arm: Rename arm_cpu_mp_affinity, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 09/20] target/arm: Create arm_cpu_mp_affinity,
Philippe Mathieu-Daudé <=
- [PATCH 10/20] target/arm: Expose arm_cpu_mp_affinity() in 'multiprocessing.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 11/20] target/arm: Declare ARM_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h', Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 12/20] hw/cpu/a9mpcore: Build it only once, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 13/20] hw/misc/xlnx-versal-crl: Include generic 'cpu-qom.h' instead of 'cpu.h', Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 14/20] hw/misc/xlnx-versal-crl: Build it only once, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 15/20] target/arm: Expose M-profile register bank index definitions, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 16/20] hw/arm/armv7m: Make 'hw/intc/armv7m_nvic.h' a target agnostic header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 17/20] target/arm: Move ARM_CPU_IRQ/FIQ definitions to 'cpu-qom.h' header, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 18/20] target/arm: Move e2h_access() helper around, Philippe Mathieu-Daudé, 2024/01/18
- [PATCH 19/20] target/arm: Move GTimer definitions to new 'gtimer.h' header, Philippe Mathieu-Daudé, 2024/01/18