* [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API
@ 2023-11-23 18:35 Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header Philippe Mathieu-Daudé
` (17 more replies)
0 siblings, 18 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Half of the API takes CPUState, the other ARMCPU...
$ git grep -F 'CPUState *' target/arm/kvm_arm.h | wc -l
16
$ git grep -F 'ARMCPU *' target/arm/kvm_arm.h | wc -l
14
Since this is ARM specific, have it always take ARMCPU, and
call the generic KVM API casting with the CPU() macro.
Based-on: <20231123044219.896776-1-richard.henderson@linaro.org>
"target/arm: kvm cleanups"
https://lore.kernel.org/qemu-devel/20231123044219.896776-1-richard.henderson@linaro.org/
Philippe Mathieu-Daudé (16):
hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header
target/arm/kvm: Remove unused includes
target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU
argument
target/arm/kvm: Have kvm_arm_sve_set_vls take a ARMCPU argument
target/arm/kvm: Have kvm_arm_sve_get_vls take a ARMCPU argument
target/arm/kvm: Have kvm_arm_set_device_attr take a ARMCPU argument
target/arm/kvm: Have kvm_arm_pvtime_init take a ARMCPU argument
target/arm/kvm: Have kvm_arm_pmu_init take a ARMCPU argument
target/arm/kvm: Have kvm_arm_pmu_set_irq take a ARMCPU argument
target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument
target/arm/kvm: Have kvm_arm_vcpu_finalize take a ARMCPU argument
target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take ARMCPU
argument
target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg
target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument
target/arm/kvm: Have kvm_arm_handle_debug take a ARMCPU argument
target/arm/kvm: Have kvm_arm_hw_debug_active take a ARMCPU argument
target/arm/kvm_arm.h | 26 ++++-----
hw/arm/virt.c | 9 +--
hw/intc/arm_gicv3_its_kvm.c | 1 +
target/arm/cpu.c | 2 +-
target/arm/cpu64.c | 2 +-
target/arm/kvm.c | 111 +++++++++++++++++-------------------
6 files changed, 73 insertions(+), 78 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 3:54 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 02/16] target/arm/kvm: Remove unused includes Philippe Mathieu-Daudé
` (16 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
kvm_arm_its_reset_hold() calls warn_report(), itself declared
in "qemu/error-report.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/intc/arm_gicv3_its_kvm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
index f7df602cff..3befc960db 100644
--- a/hw/intc/arm_gicv3_its_kvm.c
+++ b/hw/intc/arm_gicv3_its_kvm.c
@@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
+#include "qemu/error-report.h"
#include "hw/intc/arm_gicv3_its_common.h"
#include "hw/qdev-properties.h"
#include "sysemu/runstate.h"
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 02/16] target/arm/kvm: Remove unused includes
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 3:59 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument Philippe Mathieu-Daudé
` (15 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Both MemoryRegion and Error types are forward declared
in "qemu/typedefs.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm_arm.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 2037b2d7ea..50967f4ae9 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -12,8 +12,6 @@
#define QEMU_KVM_ARM_H
#include "sysemu/kvm.h"
-#include "exec/memory.h"
-#include "qemu/error-report.h"
#define KVM_ARM_VGIC_V2 (1 << 0)
#define KVM_ARM_VGIC_V3 (1 << 1)
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 02/16] target/arm/kvm: Remove unused includes Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:05 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 04/16] target/arm/kvm: Have kvm_arm_sve_set_vls " Philippe Mathieu-Daudé
` (14 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm_arm.h | 4 ++--
target/arm/cpu.c | 2 +-
target/arm/kvm.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 50967f4ae9..6fb8a5f67e 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -153,7 +153,7 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
* Add all KVM specific CPU properties to the CPU object. These
* are the CPU properties with "kvm-" prefixed names.
*/
-void kvm_arm_add_vcpu_properties(Object *obj);
+void kvm_arm_add_vcpu_properties(ARMCPU *cpu);
/**
* kvm_arm_steal_time_finalize:
@@ -243,7 +243,7 @@ static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
g_assert_not_reached();
}
-static inline void kvm_arm_add_vcpu_properties(Object *obj)
+static inline void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
{
g_assert_not_reached();
}
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 25e9d2ae7b..97081e0c70 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1686,7 +1686,7 @@ void arm_cpu_post_init(Object *obj)
}
if (kvm_enabled()) {
- kvm_arm_add_vcpu_properties(obj);
+ kvm_arm_add_vcpu_properties(cpu);
}
#ifndef CONFIG_USER_ONLY
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 6e3fea1879..03195f5627 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -495,10 +495,10 @@ static void kvm_steal_time_set(Object *obj, bool value, Error **errp)
}
/* KVM VCPU properties should be prefixed with "kvm-". */
-void kvm_arm_add_vcpu_properties(Object *obj)
+void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
{
- ARMCPU *cpu = ARM_CPU(obj);
CPUARMState *env = &cpu->env;
+ Object *obj = OBJECT(cpu);
if (arm_feature(env, ARM_FEATURE_GENERIC_TIMER)) {
cpu->kvm_adjvtime = true;
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 04/16] target/arm/kvm: Have kvm_arm_sve_set_vls take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:07 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls " Philippe Mathieu-Daudé
` (13 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 03195f5627..71833a845a 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1857,14 +1857,13 @@ uint32_t kvm_arm_sve_get_vls(CPUState *cs)
return vls[0];
}
-static int kvm_arm_sve_set_vls(CPUState *cs)
+static int kvm_arm_sve_set_vls(ARMCPU *cpu)
{
- ARMCPU *cpu = ARM_CPU(cs);
uint64_t vls[KVM_ARM64_SVE_VLS_WORDS] = { cpu->sve_vq.map };
assert(cpu->sve_max_vq <= KVM_ARM64_SVE_VQ_MAX);
- return kvm_set_one_reg(cs, KVM_REG_ARM64_SVE_VLS, &vls[0]);
+ return kvm_set_one_reg(CPU(cpu), KVM_REG_ARM64_SVE_VLS, &vls[0]);
}
#define ARM_CPU_ID_MPIDR 3, 0, 0, 0, 5
@@ -1921,7 +1920,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
}
if (cpu_isar_feature(aa64_sve, cpu)) {
- ret = kvm_arm_sve_set_vls(cs);
+ ret = kvm_arm_sve_set_vls(cpu);
if (ret) {
return ret;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 04/16] target/arm/kvm: Have kvm_arm_sve_set_vls " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:12 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 06/16] target/arm/kvm: Have kvm_arm_set_device_attr " Philippe Mathieu-Daudé
` (12 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm_arm.h | 6 +++---
target/arm/cpu64.c | 2 +-
target/arm/kvm.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 6fb8a5f67e..84f87f5ed7 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -129,13 +129,13 @@ void kvm_arm_destroy_scratch_host_vcpu(int *fdarray);
/**
* kvm_arm_sve_get_vls:
- * @cs: CPUState
+ * @cpu: ARMCPU
*
* Get all the SVE vector lengths supported by the KVM host, setting
* the bits corresponding to their length in quadwords minus one
* (vq - 1) up to ARM_MAX_VQ. Return the resulting map.
*/
-uint32_t kvm_arm_sve_get_vls(CPUState *cs);
+uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu);
/**
* kvm_arm_set_cpu_features_from_host:
@@ -278,7 +278,7 @@ static inline void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp)
g_assert_not_reached();
}
-static inline uint32_t kvm_arm_sve_get_vls(CPUState *cs)
+static inline uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu)
{
g_assert_not_reached();
}
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 1e9c6c85ae..8e30a7993e 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -66,7 +66,7 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
*/
if (kvm_enabled()) {
if (kvm_arm_sve_supported()) {
- cpu->sve_vq.supported = kvm_arm_sve_get_vls(CPU(cpu));
+ cpu->sve_vq.supported = kvm_arm_sve_get_vls(cpu);
vq_supported = cpu->sve_vq.supported;
} else {
assert(!cpu_isar_feature(aa64_sve, cpu));
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 71833a845a..766a077bcf 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1803,7 +1803,7 @@ bool kvm_arm_sve_supported(void)
QEMU_BUILD_BUG_ON(KVM_ARM64_SVE_VQ_MIN != 1);
-uint32_t kvm_arm_sve_get_vls(CPUState *cs)
+uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu)
{
/* Only call this function if kvm_arm_sve_supported() returns true. */
static uint64_t vls[KVM_ARM64_SVE_VLS_WORDS];
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 06/16] target/arm/kvm: Have kvm_arm_set_device_attr take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:13 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 07/16] target/arm/kvm: Have kvm_arm_pvtime_init " Philippe Mathieu-Daudé
` (11 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 766a077bcf..73f4e5a0fa 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1691,18 +1691,18 @@ void kvm_arch_remove_all_hw_breakpoints(void)
}
}
-static bool kvm_arm_set_device_attr(CPUState *cs, struct kvm_device_attr *attr,
+static bool kvm_arm_set_device_attr(ARMCPU *cpu, struct kvm_device_attr *attr,
const char *name)
{
int err;
- err = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, attr);
+ err = kvm_vcpu_ioctl(CPU(cpu), KVM_HAS_DEVICE_ATTR, attr);
if (err != 0) {
error_report("%s: KVM_HAS_DEVICE_ATTR: %s", name, strerror(-err));
return false;
}
- err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, attr);
+ err = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_DEVICE_ATTR, attr);
if (err != 0) {
error_report("%s: KVM_SET_DEVICE_ATTR: %s", name, strerror(-err));
return false;
@@ -1721,7 +1721,7 @@ void kvm_arm_pmu_init(CPUState *cs)
if (!ARM_CPU(cs)->has_pmu) {
return;
}
- if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) {
+ if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
error_report("failed to init PMU");
abort();
}
@@ -1738,7 +1738,7 @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
if (!ARM_CPU(cs)->has_pmu) {
return;
}
- if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) {
+ if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
error_report("failed to set irq for PMU");
abort();
}
@@ -1755,7 +1755,7 @@ void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa)
if (ARM_CPU(cs)->kvm_steal_time == ON_OFF_AUTO_OFF) {
return;
}
- if (!kvm_arm_set_device_attr(cs, &attr, "PVTIME IPA")) {
+ if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PVTIME IPA")) {
error_report("failed to init PVTIME IPA");
abort();
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 07/16] target/arm/kvm: Have kvm_arm_pvtime_init take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 06/16] target/arm/kvm: Have kvm_arm_set_device_attr " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:15 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init " Philippe Mathieu-Daudé
` (10 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm_arm.h | 6 +++---
hw/arm/virt.c | 5 +++--
target/arm/kvm.c | 6 +++---
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 84f87f5ed7..0e12a008ab 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -205,12 +205,12 @@ void kvm_arm_pmu_init(CPUState *cs);
/**
* kvm_arm_pvtime_init:
- * @cs: CPUState
+ * @cpu: ARMCPU
* @ipa: Per-vcpu guest physical base address of the pvtime structures
*
* Initializes PVTIME for the VCPU, setting the PVTIME IPA to @ipa.
*/
-void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa);
+void kvm_arm_pvtime_init(ARMCPU *cpu, uint64_t ipa);
int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level);
@@ -268,7 +268,7 @@ static inline void kvm_arm_pmu_init(CPUState *cs)
g_assert_not_reached();
}
-static inline void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa)
+static inline void kvm_arm_pvtime_init(ARMCPU *cpu, uint64_t ipa)
{
g_assert_not_reached();
}
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index be2856c018..b6efe9da4d 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2003,8 +2003,9 @@ static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
kvm_arm_pmu_init(cpu);
}
if (steal_time) {
- kvm_arm_pvtime_init(cpu, pvtime_reg_base +
- cpu->cpu_index * PVTIME_SIZE_PER_CPU);
+ kvm_arm_pvtime_init(ARM_CPU(cpu), pvtime_reg_base
+ + cpu->cpu_index
+ * PVTIME_SIZE_PER_CPU);
}
}
} else {
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 73f4e5a0fa..82c5924ab5 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1744,7 +1744,7 @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
}
}
-void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa)
+void kvm_arm_pvtime_init(ARMCPU *cpu, uint64_t ipa)
{
struct kvm_device_attr attr = {
.group = KVM_ARM_VCPU_PVTIME_CTRL,
@@ -1752,10 +1752,10 @@ void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa)
.addr = (uint64_t)&ipa,
};
- if (ARM_CPU(cs)->kvm_steal_time == ON_OFF_AUTO_OFF) {
+ if (cpu->kvm_steal_time == ON_OFF_AUTO_OFF) {
return;
}
- if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PVTIME IPA")) {
+ if (!kvm_arm_set_device_attr(cpu, &attr, "PVTIME IPA")) {
error_report("failed to init PVTIME IPA");
abort();
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 07/16] target/arm/kvm: Have kvm_arm_pvtime_init " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:20 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 09/16] target/arm/kvm: Have kvm_arm_pmu_set_irq " Philippe Mathieu-Daudé
` (9 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm_arm.h | 4 ++--
hw/arm/virt.c | 2 +-
target/arm/kvm.c | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 0e12a008ab..fde1c45609 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -200,8 +200,8 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa);
int kvm_arm_vgic_probe(void);
+void kvm_arm_pmu_init(ARMCPU *cpu);
void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
-void kvm_arm_pmu_init(CPUState *cs);
/**
* kvm_arm_pvtime_init:
@@ -263,7 +263,7 @@ static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
g_assert_not_reached();
}
-static inline void kvm_arm_pmu_init(CPUState *cs)
+static inline void kvm_arm_pmu_init(ARMCPU *cpu)
{
g_assert_not_reached();
}
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index b6efe9da4d..63f3c0b750 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2000,7 +2000,7 @@ static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
if (kvm_irqchip_in_kernel()) {
kvm_arm_pmu_set_irq(cpu, VIRTUAL_PMU_IRQ);
}
- kvm_arm_pmu_init(cpu);
+ kvm_arm_pmu_init(ARM_CPU(cpu));
}
if (steal_time) {
kvm_arm_pvtime_init(ARM_CPU(cpu), pvtime_reg_base
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 82c5924ab5..e7cbe1ff05 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1711,17 +1711,17 @@ static bool kvm_arm_set_device_attr(ARMCPU *cpu, struct kvm_device_attr *attr,
return true;
}
-void kvm_arm_pmu_init(CPUState *cs)
+void kvm_arm_pmu_init(ARMCPU *cpu)
{
struct kvm_device_attr attr = {
.group = KVM_ARM_VCPU_PMU_V3_CTRL,
.attr = KVM_ARM_VCPU_PMU_V3_INIT,
};
- if (!ARM_CPU(cs)->has_pmu) {
+ if (!cpu->has_pmu) {
return;
}
- if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
+ if (!kvm_arm_set_device_attr(cpu, &attr, "PMU")) {
error_report("failed to init PMU");
abort();
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 09/16] target/arm/kvm: Have kvm_arm_pmu_set_irq take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:21 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init " Philippe Mathieu-Daudé
` (8 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm_arm.h | 4 ++--
hw/arm/virt.c | 2 +-
target/arm/kvm.c | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index fde1c45609..55fcc35ed7 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -201,7 +201,7 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa);
int kvm_arm_vgic_probe(void);
void kvm_arm_pmu_init(ARMCPU *cpu);
-void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
+void kvm_arm_pmu_set_irq(ARMCPU *cpu, int irq);
/**
* kvm_arm_pvtime_init:
@@ -258,7 +258,7 @@ static inline int kvm_arm_vgic_probe(void)
g_assert_not_reached();
}
-static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
+static inline void kvm_arm_pmu_set_irq(ARMCPU *cpu, int irq)
{
g_assert_not_reached();
}
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 63f3c0b750..040ca2d794 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1998,7 +1998,7 @@ static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
if (pmu) {
assert(arm_feature(&ARM_CPU(cpu)->env, ARM_FEATURE_PMU));
if (kvm_irqchip_in_kernel()) {
- kvm_arm_pmu_set_irq(cpu, VIRTUAL_PMU_IRQ);
+ kvm_arm_pmu_set_irq(ARM_CPU(cpu), VIRTUAL_PMU_IRQ);
}
kvm_arm_pmu_init(ARM_CPU(cpu));
}
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index e7cbe1ff05..f17e706e48 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1727,7 +1727,7 @@ void kvm_arm_pmu_init(ARMCPU *cpu)
}
}
-void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
+void kvm_arm_pmu_set_irq(ARMCPU *cpu, int irq)
{
struct kvm_device_attr attr = {
.group = KVM_ARM_VCPU_PMU_V3_CTRL,
@@ -1735,10 +1735,10 @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
.attr = KVM_ARM_VCPU_PMU_V3_IRQ,
};
- if (!ARM_CPU(cs)->has_pmu) {
+ if (!cpu->has_pmu) {
return;
}
- if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
+ if (!kvm_arm_set_device_attr(cpu, &attr, "PMU")) {
error_report("failed to set irq for PMU");
abort();
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 09/16] target/arm/kvm: Have kvm_arm_pmu_set_irq " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:24 ` Gavin Shan
2023-11-27 4:25 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 11/16] target/arm/kvm: Have kvm_arm_vcpu_finalize " Philippe Mathieu-Daudé
` (7 subsequent siblings)
17 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index f17e706e48..854e423135 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -60,7 +60,7 @@ static ARMHostCPUFeatures arm_host_cpu_features;
/**
* kvm_arm_vcpu_init:
- * @cs: CPUState
+ * @cpu: ARMCPU
*
* Initialize (or reinitialize) the VCPU by invoking the
* KVM_ARM_VCPU_INIT ioctl with the CPU type and feature
@@ -68,15 +68,14 @@ static ARMHostCPUFeatures arm_host_cpu_features;
*
* Returns: 0 if success else < 0 error code
*/
-static int kvm_arm_vcpu_init(CPUState *cs)
+static int kvm_arm_vcpu_init(ARMCPU *cpu)
{
- ARMCPU *cpu = ARM_CPU(cs);
struct kvm_vcpu_init init;
init.target = cpu->kvm_target;
memcpy(init.features, cpu->kvm_init_features, sizeof(init.features));
- return kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, &init);
+ return kvm_vcpu_ioctl(CPU(cpu), KVM_ARM_VCPU_INIT, &init);
}
/**
@@ -984,7 +983,7 @@ void kvm_arm_reset_vcpu(ARMCPU *cpu)
/* Re-init VCPU so that all registers are set to
* their respective reset values.
*/
- ret = kvm_arm_vcpu_init(CPU(cpu));
+ ret = kvm_arm_vcpu_init(cpu);
if (ret < 0) {
fprintf(stderr, "kvm_arm_vcpu_init failed: %s\n", strerror(-ret));
abort();
@@ -1914,7 +1913,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
}
/* Do KVM_ARM_VCPU_INIT ioctl */
- ret = kvm_arm_vcpu_init(cs);
+ ret = kvm_arm_vcpu_init(cpu);
if (ret) {
return ret;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 11/16] target/arm/kvm: Have kvm_arm_vcpu_finalize take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:26 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 12/16] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take " Philippe Mathieu-Daudé
` (6 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 854e423135..dba2c9c6a9 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -80,7 +80,7 @@ static int kvm_arm_vcpu_init(ARMCPU *cpu)
/**
* kvm_arm_vcpu_finalize:
- * @cs: CPUState
+ * @cpu: ARMCPU
* @feature: feature to finalize
*
* Finalizes the configuration of the specified VCPU feature by
@@ -90,9 +90,9 @@ static int kvm_arm_vcpu_init(ARMCPU *cpu)
*
* Returns: 0 if success else < 0 error code
*/
-static int kvm_arm_vcpu_finalize(CPUState *cs, int feature)
+static int kvm_arm_vcpu_finalize(ARMCPU *cpu, int feature)
{
- return kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_FINALIZE, &feature);
+ return kvm_vcpu_ioctl(CPU(cpu), KVM_ARM_VCPU_FINALIZE, &feature);
}
bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,
@@ -1923,7 +1923,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
if (ret) {
return ret;
}
- ret = kvm_arm_vcpu_finalize(cs, KVM_ARM_VCPU_SVE);
+ ret = kvm_arm_vcpu_finalize(cpu, KVM_ARM_VCPU_SVE);
if (ret) {
return ret;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 12/16] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 11/16] target/arm/kvm: Have kvm_arm_vcpu_finalize " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:29 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 13/16] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg Philippe Mathieu-Daudé
` (5 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index dba2c9c6a9..57615ef4d1 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1036,20 +1036,19 @@ static int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu)
/**
* kvm_arm_get_virtual_time:
- * @cs: CPUState
+ * @cpu: ARMCPU
*
* Gets the VCPU's virtual counter and stores it in the KVM CPU state.
*/
-static void kvm_arm_get_virtual_time(CPUState *cs)
+static void kvm_arm_get_virtual_time(ARMCPU *cpu)
{
- ARMCPU *cpu = ARM_CPU(cs);
int ret;
if (cpu->kvm_vtime_dirty) {
return;
}
- ret = kvm_get_one_reg(cs, KVM_REG_ARM_TIMER_CNT, &cpu->kvm_vtime);
+ ret = kvm_get_one_reg(CPU(cpu), KVM_REG_ARM_TIMER_CNT, &cpu->kvm_vtime);
if (ret) {
error_report("Failed to get KVM_REG_ARM_TIMER_CNT");
abort();
@@ -1060,20 +1059,19 @@ static void kvm_arm_get_virtual_time(CPUState *cs)
/**
* kvm_arm_put_virtual_time:
- * @cs: CPUState
+ * @cpu: ARMCPU
*
* Sets the VCPU's virtual counter to the value stored in the KVM CPU state.
*/
-static void kvm_arm_put_virtual_time(CPUState *cs)
+static void kvm_arm_put_virtual_time(ARMCPU *cpu)
{
- ARMCPU *cpu = ARM_CPU(cs);
int ret;
if (!cpu->kvm_vtime_dirty) {
return;
}
- ret = kvm_set_one_reg(cs, KVM_REG_ARM_TIMER_CNT, &cpu->kvm_vtime);
+ ret = kvm_set_one_reg(CPU(cpu), KVM_REG_ARM_TIMER_CNT, &cpu->kvm_vtime);
if (ret) {
error_report("Failed to set KVM_REG_ARM_TIMER_CNT");
abort();
@@ -1291,16 +1289,15 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
static void kvm_arm_vm_state_change(void *opaque, bool running, RunState state)
{
- CPUState *cs = opaque;
- ARMCPU *cpu = ARM_CPU(cs);
+ ARMCPU *cpu = opaque;
if (running) {
if (cpu->kvm_adjvtime) {
- kvm_arm_put_virtual_time(cs);
+ kvm_arm_put_virtual_time(cpu);
}
} else {
if (cpu->kvm_adjvtime) {
- kvm_arm_get_virtual_time(cs);
+ kvm_arm_get_virtual_time(cpu);
}
}
}
@@ -1881,7 +1878,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
return -EINVAL;
}
- qemu_add_vm_change_state_handler(kvm_arm_vm_state_change, cs);
+ qemu_add_vm_change_state_handler(kvm_arm_vm_state_change, cpu);
/* Determine init features for this CPU */
memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features));
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 13/16] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 12/16] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:31 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 14/16] target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument Philippe Mathieu-Daudé
` (4 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 57615ef4d1..91773c767b 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1172,18 +1172,18 @@ static int kvm_get_vcpu_events(ARMCPU *cpu)
/**
* kvm_arm_verify_ext_dabt_pending:
- * @cs: CPUState
+ * @cpu: ARMCPU
*
* Verify the fault status code wrt the Ext DABT injection
*
* Returns: true if the fault status code is as expected, false otherwise
*/
-static bool kvm_arm_verify_ext_dabt_pending(CPUState *cs)
+static bool kvm_arm_verify_ext_dabt_pending(ARMCPU *cpu)
{
+ CPUState *cs = CPU(cpu);
uint64_t dfsr_val;
if (!kvm_get_one_reg(cs, ARM64_REG_ESR_EL1, &dfsr_val)) {
- ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
int aarch64_mode = arm_feature(env, ARM_FEATURE_AARCH64);
int lpae = 0;
@@ -1220,7 +1220,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run)
* an IMPLEMENTATION DEFINED exception (for 32-bit EL1)
*/
if (!arm_feature(env, ARM_FEATURE_AARCH64) &&
- unlikely(!kvm_arm_verify_ext_dabt_pending(cs))) {
+ unlikely(!kvm_arm_verify_ext_dabt_pending(cpu))) {
error_report("Data abort exception with no valid ISS generated by "
"guest memory access. KVM unable to emulate faulting "
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 14/16] target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 13/16] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:33 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 15/16] target/arm/kvm: Have kvm_arm_handle_debug " Philippe Mathieu-Daudé
` (3 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 91773c767b..9f58a08710 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1304,17 +1304,16 @@ static void kvm_arm_vm_state_change(void *opaque, bool running, RunState state)
/**
* kvm_arm_handle_dabt_nisv:
- * @cs: CPUState
+ * @cpu: ARMCPU
* @esr_iss: ISS encoding (limited) for the exception from Data Abort
* ISV bit set to '0b0' -> no valid instruction syndrome
* @fault_ipa: faulting address for the synchronous data abort
*
* Returns: 0 if the exception has been handled, < 0 otherwise
*/
-static int kvm_arm_handle_dabt_nisv(CPUState *cs, uint64_t esr_iss,
+static int kvm_arm_handle_dabt_nisv(ARMCPU *cpu, uint64_t esr_iss,
uint64_t fault_ipa)
{
- ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
/*
* Request KVM to inject the external data abort into the guest
@@ -1330,7 +1329,7 @@ static int kvm_arm_handle_dabt_nisv(CPUState *cs, uint64_t esr_iss,
*/
events.exception.ext_dabt_pending = 1;
/* KVM_CAP_ARM_INJECT_EXT_DABT implies KVM_CAP_VCPU_EVENTS */
- if (!kvm_vcpu_ioctl(cs, KVM_SET_VCPU_EVENTS, &events)) {
+ if (!kvm_vcpu_ioctl(CPU(cpu), KVM_SET_VCPU_EVENTS, &events)) {
env->ext_dabt_raised = 1;
return 0;
}
@@ -1422,6 +1421,7 @@ static bool kvm_arm_handle_debug(CPUState *cs,
int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
{
+ ARMCPU *cpu = ARM_CPU(cs);
int ret = 0;
switch (run->exit_reason) {
@@ -1432,7 +1432,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
break;
case KVM_EXIT_ARM_NISV:
/* External DABT with no valid iss to decode */
- ret = kvm_arm_handle_dabt_nisv(cs, run->arm_nisv.esr_iss,
+ ret = kvm_arm_handle_dabt_nisv(cpu, run->arm_nisv.esr_iss,
run->arm_nisv.fault_ipa);
break;
default:
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 15/16] target/arm/kvm: Have kvm_arm_handle_debug take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 14/16] target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:34 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 16/16] target/arm/kvm: Have kvm_arm_hw_debug_active " Philippe Mathieu-Daudé
` (2 subsequent siblings)
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 9f58a08710..1f6da5529f 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1344,7 +1344,7 @@ static int kvm_arm_handle_dabt_nisv(ARMCPU *cpu, uint64_t esr_iss,
/**
* kvm_arm_handle_debug:
- * @cs: CPUState
+ * @cpu: ARMCPU
* @debug_exit: debug part of the KVM exit structure
*
* Returns: TRUE if the debug exception was handled.
@@ -1355,11 +1355,11 @@ static int kvm_arm_handle_dabt_nisv(ARMCPU *cpu, uint64_t esr_iss,
* ABI just provides user-space with the full exception syndrome
* register value to be decoded in QEMU.
*/
-static bool kvm_arm_handle_debug(CPUState *cs,
+static bool kvm_arm_handle_debug(ARMCPU *cpu,
struct kvm_debug_exit_arch *debug_exit)
{
int hsr_ec = syn_get_ec(debug_exit->hsr);
- ARMCPU *cpu = ARM_CPU(cs);
+ CPUState *cs = CPU(cpu);
CPUARMState *env = &cpu->env;
/* Ensure PC is synchronised */
@@ -1426,7 +1426,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
switch (run->exit_reason) {
case KVM_EXIT_DEBUG:
- if (kvm_arm_handle_debug(cs, &run->debug.arch)) {
+ if (kvm_arm_handle_debug(cpu, &run->debug.arch)) {
ret = EXCP_DEBUG;
} /* otherwise return to guest */
break;
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH-for-9.0 16/16] target/arm/kvm: Have kvm_arm_hw_debug_active take a ARMCPU argument
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 15/16] target/arm/kvm: Have kvm_arm_handle_debug " Philippe Mathieu-Daudé
@ 2023-11-23 18:35 ` Philippe Mathieu-Daudé
2023-11-27 4:36 ` Gavin Shan
2023-11-26 13:59 ` [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Richard Henderson
2023-12-11 14:36 ` Peter Maydell
17 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-23 18:35 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini, Philippe Mathieu-Daudé
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/kvm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 1f6da5529f..cbfea689cc 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1455,11 +1455,11 @@ int kvm_arch_process_async_events(CPUState *cs)
/**
* kvm_arm_hw_debug_active:
- * @cs: CPU State
+ * @cpu: ARMCPU
*
* Return: TRUE if any hardware breakpoints in use.
*/
-static bool kvm_arm_hw_debug_active(CPUState *cs)
+static bool kvm_arm_hw_debug_active(ARMCPU *cpu)
{
return ((cur_hw_wps > 0) || (cur_hw_bps > 0));
}
@@ -1493,7 +1493,7 @@ void kvm_arch_update_guest_debug(CPUState *cs, struct kvm_guest_debug *dbg)
if (kvm_sw_breakpoints_active(cs)) {
dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;
}
- if (kvm_arm_hw_debug_active(cs)) {
+ if (kvm_arm_hw_debug_active(ARM_CPU(cs))) {
dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW;
kvm_arm_copy_hw_debug_data(&dbg->arch);
}
--
2.41.0
^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (15 preceding siblings ...)
2023-11-23 18:35 ` [PATCH-for-9.0 16/16] target/arm/kvm: Have kvm_arm_hw_debug_active " Philippe Mathieu-Daudé
@ 2023-11-26 13:59 ` Richard Henderson
2023-12-11 14:36 ` Peter Maydell
17 siblings, 0 replies; 41+ messages in thread
From: Richard Henderson @ 2023-11-26 13:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/23/23 12:35, Philippe Mathieu-Daudé wrote:
> Half of the API takes CPUState, the other ARMCPU...
>
> $ git grep -F 'CPUState *' target/arm/kvm_arm.h | wc -l
> 16
> $ git grep -F 'ARMCPU *' target/arm/kvm_arm.h | wc -l
> 14
>
> Since this is ARM specific, have it always take ARMCPU, and
> call the generic KVM API casting with the CPU() macro.
>
> Based-on: <20231123044219.896776-1-richard.henderson@linaro.org>
> "target/arm: kvm cleanups"
> https://lore.kernel.org/qemu-devel/20231123044219.896776-1-richard.henderson@linaro.org/
>
> Philippe Mathieu-Daudé (16):
> hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header
> target/arm/kvm: Remove unused includes
> target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU
> argument
> target/arm/kvm: Have kvm_arm_sve_set_vls take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_sve_get_vls take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_set_device_attr take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_pvtime_init take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_pmu_init take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_pmu_set_irq take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_vcpu_finalize take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take ARMCPU
> argument
> target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg
> target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_handle_debug take a ARMCPU argument
> target/arm/kvm: Have kvm_arm_hw_debug_active take a ARMCPU argument
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header
2023-11-23 18:35 ` [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header Philippe Mathieu-Daudé
@ 2023-11-27 3:54 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 3:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> kvm_arm_its_reset_hold() calls warn_report(), itself declared
> in "qemu/error-report.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/intc/arm_gicv3_its_kvm.c | 1 +
> 1 file changed, 1 insertion(+)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 02/16] target/arm/kvm: Remove unused includes
2023-11-23 18:35 ` [PATCH-for-9.0 02/16] target/arm/kvm: Remove unused includes Philippe Mathieu-Daudé
@ 2023-11-27 3:59 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 3:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Both MemoryRegion and Error types are forward declared
> in "qemu/typedefs.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm_arm.h | 2 --
> 1 file changed, 2 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument Philippe Mathieu-Daudé
@ 2023-11-27 4:05 ` Gavin Shan
2023-11-28 6:52 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
Hi Phil,
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm_arm.h | 4 ++--
> target/arm/cpu.c | 2 +-
> target/arm/kvm.c | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
With the following comments resolved:
Reviewed-by: Gavin Shan <gshan@redhat.com>
> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index 50967f4ae9..6fb8a5f67e 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -153,7 +153,7 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
> * Add all KVM specific CPU properties to the CPU object. These
> * are the CPU properties with "kvm-" prefixed names.
> */
> -void kvm_arm_add_vcpu_properties(Object *obj);
> +void kvm_arm_add_vcpu_properties(ARMCPU *cpu);
>
The function's description needs to be modified since @obj has been
renamed to @cpu?
/**
* kvm_arm_add_vcpu_properties:
* @obj: The CPU object to add the properties to
*
*/
> /**
> * kvm_arm_steal_time_finalize:
> @@ -243,7 +243,7 @@ static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
> g_assert_not_reached();
> }
>
> -static inline void kvm_arm_add_vcpu_properties(Object *obj)
> +static inline void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
> {
> g_assert_not_reached();
> }
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 25e9d2ae7b..97081e0c70 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -1686,7 +1686,7 @@ void arm_cpu_post_init(Object *obj)
> }
>
> if (kvm_enabled()) {
> - kvm_arm_add_vcpu_properties(obj);
> + kvm_arm_add_vcpu_properties(cpu);
> }
>
> #ifndef CONFIG_USER_ONLY
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 6e3fea1879..03195f5627 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -495,10 +495,10 @@ static void kvm_steal_time_set(Object *obj, bool value, Error **errp)
> }
>
> /* KVM VCPU properties should be prefixed with "kvm-". */
> -void kvm_arm_add_vcpu_properties(Object *obj)
> +void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
> {
> - ARMCPU *cpu = ARM_CPU(obj);
> CPUARMState *env = &cpu->env;
> + Object *obj = OBJECT(cpu);
>
> if (arm_feature(env, ARM_FEATURE_GENERIC_TIMER)) {
> cpu->kvm_adjvtime = true;
Thanks,
Gavin
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 04/16] target/arm/kvm: Have kvm_arm_sve_set_vls take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 04/16] target/arm/kvm: Have kvm_arm_sve_set_vls " Philippe Mathieu-Daudé
@ 2023-11-27 4:07 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:07 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls " Philippe Mathieu-Daudé
@ 2023-11-27 4:12 ` Gavin Shan
2023-11-28 6:52 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:12 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
Hi Phil,
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm_arm.h | 6 +++---
> target/arm/cpu64.c | 2 +-
> target/arm/kvm.c | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index 6fb8a5f67e..84f87f5ed7 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -129,13 +129,13 @@ void kvm_arm_destroy_scratch_host_vcpu(int *fdarray);
>
> /**
> * kvm_arm_sve_get_vls:
> - * @cs: CPUState
> + * @cpu: ARMCPU
> *
> * Get all the SVE vector lengths supported by the KVM host, setting
> * the bits corresponding to their length in quadwords minus one
> * (vq - 1) up to ARM_MAX_VQ. Return the resulting map.
> */
> -uint32_t kvm_arm_sve_get_vls(CPUState *cs);
> +uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu);
>
Either @cs or @cpu isn't dereferenced in kvm_arm_sve_get_vls(). So I guess
the argument can be simply droped?
> /**
> * kvm_arm_set_cpu_features_from_host:
> @@ -278,7 +278,7 @@ static inline void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp)
> g_assert_not_reached();
> }
>
> -static inline uint32_t kvm_arm_sve_get_vls(CPUState *cs)
> +static inline uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu)
> {
> g_assert_not_reached();
> }
> diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
> index 1e9c6c85ae..8e30a7993e 100644
> --- a/target/arm/cpu64.c
> +++ b/target/arm/cpu64.c
> @@ -66,7 +66,7 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
> */
> if (kvm_enabled()) {
> if (kvm_arm_sve_supported()) {
> - cpu->sve_vq.supported = kvm_arm_sve_get_vls(CPU(cpu));
> + cpu->sve_vq.supported = kvm_arm_sve_get_vls(cpu);
> vq_supported = cpu->sve_vq.supported;
> } else {
> assert(!cpu_isar_feature(aa64_sve, cpu));
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 71833a845a..766a077bcf 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -1803,7 +1803,7 @@ bool kvm_arm_sve_supported(void)
>
> QEMU_BUILD_BUG_ON(KVM_ARM64_SVE_VQ_MIN != 1);
>
> -uint32_t kvm_arm_sve_get_vls(CPUState *cs)
> +uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu)
> {
> /* Only call this function if kvm_arm_sve_supported() returns true. */
> static uint64_t vls[KVM_ARM64_SVE_VLS_WORDS];
Thanks,
Gavin
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 06/16] target/arm/kvm: Have kvm_arm_set_device_attr take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 06/16] target/arm/kvm: Have kvm_arm_set_device_attr " Philippe Mathieu-Daudé
@ 2023-11-27 4:13 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 07/16] target/arm/kvm: Have kvm_arm_pvtime_init take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 07/16] target/arm/kvm: Have kvm_arm_pvtime_init " Philippe Mathieu-Daudé
@ 2023-11-27 4:15 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:15 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm_arm.h | 6 +++---
> hw/arm/virt.c | 5 +++--
> target/arm/kvm.c | 6 +++---
> 3 files changed, 9 insertions(+), 8 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init " Philippe Mathieu-Daudé
@ 2023-11-27 4:20 ` Gavin Shan
2023-11-28 6:46 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:20 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
Hi Phil,
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm_arm.h | 4 ++--
> hw/arm/virt.c | 2 +-
> target/arm/kvm.c | 6 +++---
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
One nit below, but I guess it doesn't matter.
Reviewed-by: Gavin Shan <gshan@redhat.com>
> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index 0e12a008ab..fde1c45609 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -200,8 +200,8 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa);
>
> int kvm_arm_vgic_probe(void);
>
> +void kvm_arm_pmu_init(ARMCPU *cpu);
> void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
> -void kvm_arm_pmu_init(CPUState *cs);
>
Why the order of the declaration is changed? I guess the reason would be
kvm_arm_pmu_init() is called prior to kvm_arm_pmu_set_irq().
> /**
> * kvm_arm_pvtime_init:
> @@ -263,7 +263,7 @@ static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq)
> g_assert_not_reached();
> }
>
> -static inline void kvm_arm_pmu_init(CPUState *cs)
> +static inline void kvm_arm_pmu_init(ARMCPU *cpu)
> {
> g_assert_not_reached();
> }
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index b6efe9da4d..63f3c0b750 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -2000,7 +2000,7 @@ static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
> if (kvm_irqchip_in_kernel()) {
> kvm_arm_pmu_set_irq(cpu, VIRTUAL_PMU_IRQ);
> }
> - kvm_arm_pmu_init(cpu);
> + kvm_arm_pmu_init(ARM_CPU(cpu));
> }
> if (steal_time) {
> kvm_arm_pvtime_init(ARM_CPU(cpu), pvtime_reg_base
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 82c5924ab5..e7cbe1ff05 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -1711,17 +1711,17 @@ static bool kvm_arm_set_device_attr(ARMCPU *cpu, struct kvm_device_attr *attr,
> return true;
> }
>
> -void kvm_arm_pmu_init(CPUState *cs)
> +void kvm_arm_pmu_init(ARMCPU *cpu)
> {
> struct kvm_device_attr attr = {
> .group = KVM_ARM_VCPU_PMU_V3_CTRL,
> .attr = KVM_ARM_VCPU_PMU_V3_INIT,
> };
>
> - if (!ARM_CPU(cs)->has_pmu) {
> + if (!cpu->has_pmu) {
> return;
> }
> - if (!kvm_arm_set_device_attr(ARM_CPU(cs), &attr, "PMU")) {
> + if (!kvm_arm_set_device_attr(cpu, &attr, "PMU")) {
> error_report("failed to init PMU");
> abort();
> }
Thanks,
Gavin
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 09/16] target/arm/kvm: Have kvm_arm_pmu_set_irq take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 09/16] target/arm/kvm: Have kvm_arm_pmu_set_irq " Philippe Mathieu-Daudé
@ 2023-11-27 4:21 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm_arm.h | 4 ++--
> hw/arm/virt.c | 2 +-
> target/arm/kvm.c | 6 +++---
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init " Philippe Mathieu-Daudé
@ 2023-11-27 4:24 ` Gavin Shan
2023-11-27 4:25 ` Gavin Shan
1 sibling, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init " Philippe Mathieu-Daudé
2023-11-27 4:24 ` Gavin Shan
@ 2023-11-27 4:25 ` Gavin Shan
1 sibling, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:25 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 11/16] target/arm/kvm: Have kvm_arm_vcpu_finalize take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 11/16] target/arm/kvm: Have kvm_arm_vcpu_finalize " Philippe Mathieu-Daudé
@ 2023-11-27 4:26 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 12/16] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 12/16] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take " Philippe Mathieu-Daudé
@ 2023-11-27 4:29 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:29 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 13/16] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg
2023-11-23 18:35 ` [PATCH-for-9.0 13/16] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg Philippe Mathieu-Daudé
@ 2023-11-27 4:31 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:31 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 14/16] target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 14/16] target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument Philippe Mathieu-Daudé
@ 2023-11-27 4:33 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:33 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 15/16] target/arm/kvm: Have kvm_arm_handle_debug take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 15/16] target/arm/kvm: Have kvm_arm_handle_debug " Philippe Mathieu-Daudé
@ 2023-11-27 4:34 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:34 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 16/16] target/arm/kvm: Have kvm_arm_hw_debug_active take a ARMCPU argument
2023-11-23 18:35 ` [PATCH-for-9.0 16/16] target/arm/kvm: Have kvm_arm_hw_debug_active " Philippe Mathieu-Daudé
@ 2023-11-27 4:36 ` Gavin Shan
0 siblings, 0 replies; 41+ messages in thread
From: Gavin Shan @ 2023-11-27 4:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
Hi Phil,
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/kvm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
With the following comments addressed:
Reviewed-by: Gavin Shan <gshan@redhat.com>
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 1f6da5529f..cbfea689cc 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -1455,11 +1455,11 @@ int kvm_arch_process_async_events(CPUState *cs)
>
> /**
> * kvm_arm_hw_debug_active:
> - * @cs: CPU State
> + * @cpu: ARMCPU
> *
> * Return: TRUE if any hardware breakpoints in use.
> */
> -static bool kvm_arm_hw_debug_active(CPUState *cs)
> +static bool kvm_arm_hw_debug_active(ARMCPU *cpu)
> {
> return ((cur_hw_wps > 0) || (cur_hw_bps > 0));
> }
Either @cs or @cpu isn't dereferenced in kvm_arm_hw_debug_active(). So I guess
the argument can be simply droped?
> @@ -1493,7 +1493,7 @@ void kvm_arch_update_guest_debug(CPUState *cs, struct kvm_guest_debug *dbg)
> if (kvm_sw_breakpoints_active(cs)) {
> dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;
> }
> - if (kvm_arm_hw_debug_active(cs)) {
> + if (kvm_arm_hw_debug_active(ARM_CPU(cs))) {
> dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW;
> kvm_arm_copy_hw_debug_data(&dbg->arch);
> }
Thanks,
Gavin
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init take a ARMCPU argument
2023-11-27 4:20 ` Gavin Shan
@ 2023-11-28 6:46 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-28 6:46 UTC (permalink / raw)
To: Gavin Shan, qemu-devel; +Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 27/11/23 05:20, Gavin Shan wrote:
> Hi Phil,
>
> On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
>> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
>> take a ARMCPU* argument. Use the CPU() QOM cast macro When
>> calling the generic vCPU API from "sysemu/kvm.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/arm/kvm_arm.h | 4 ++--
>> hw/arm/virt.c | 2 +-
>> target/arm/kvm.c | 6 +++---
>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>
>
> One nit below, but I guess it doesn't matter.
>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
>
>> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
>> index 0e12a008ab..fde1c45609 100644
>> --- a/target/arm/kvm_arm.h
>> +++ b/target/arm/kvm_arm.h
>> @@ -200,8 +200,8 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms,
>> bool *fixed_ipa);
>> int kvm_arm_vgic_probe(void);
>> +void kvm_arm_pmu_init(ARMCPU *cpu);
>> void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
>> -void kvm_arm_pmu_init(CPUState *cs);
>
> Why the order of the declaration is changed? I guess the reason would be
> kvm_arm_pmu_init() is called prior to kvm_arm_pmu_set_irq().
Yes, exactly. Not worth mentioning IMHO.
Thanks!
Phil.
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls take a ARMCPU argument
2023-11-27 4:12 ` Gavin Shan
@ 2023-11-28 6:52 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-28 6:52 UTC (permalink / raw)
To: Gavin Shan, qemu-devel; +Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
Hi Gavin,
On 27/11/23 05:12, Gavin Shan wrote:
> Hi Phil,
>
> On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
>> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
>> take a ARMCPU* argument. Use the CPU() QOM cast macro When
>> calling the generic vCPU API from "sysemu/kvm.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/arm/kvm_arm.h | 6 +++---
>> target/arm/cpu64.c | 2 +-
>> target/arm/kvm.c | 2 +-
>> 3 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
>> index 6fb8a5f67e..84f87f5ed7 100644
>> --- a/target/arm/kvm_arm.h
>> +++ b/target/arm/kvm_arm.h
>> @@ -129,13 +129,13 @@ void kvm_arm_destroy_scratch_host_vcpu(int
>> *fdarray);
>> /**
>> * kvm_arm_sve_get_vls:
>> - * @cs: CPUState
>> + * @cpu: ARMCPU
>> *
>> * Get all the SVE vector lengths supported by the KVM host, setting
>> * the bits corresponding to their length in quadwords minus one
>> * (vq - 1) up to ARM_MAX_VQ. Return the resulting map.
>> */
>> -uint32_t kvm_arm_sve_get_vls(CPUState *cs);
>> +uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu);
>
> Either @cs or @cpu isn't dereferenced in kvm_arm_sve_get_vls(). So I guess
> the argument can be simply droped?
If KVM eventually supports heterogeneous vCPUs such big.LITTLE, we'd
de-reference. But then we'd have a major rework of the code.
Peter, do you have a preference?
Thanks,
Phil.
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument
2023-11-27 4:05 ` Gavin Shan
@ 2023-11-28 6:52 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-28 6:52 UTC (permalink / raw)
To: Gavin Shan, qemu-devel; +Cc: Peter Maydell, qemu-arm, kvm, Paolo Bonzini
On 27/11/23 05:05, Gavin Shan wrote:
> Hi Phil,
>
> On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
>> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
>> take a ARMCPU* argument. Use the CPU() QOM cast macro When
>> calling the generic vCPU API from "sysemu/kvm.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/arm/kvm_arm.h | 4 ++--
>> target/arm/cpu.c | 2 +-
>> target/arm/kvm.c | 4 ++--
>> 3 files changed, 5 insertions(+), 5 deletions(-)
>>
>
> With the following comments resolved:
>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
>
>> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
>> index 50967f4ae9..6fb8a5f67e 100644
>> --- a/target/arm/kvm_arm.h
>> +++ b/target/arm/kvm_arm.h
>> @@ -153,7 +153,7 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
>> * Add all KVM specific CPU properties to the CPU object. These
>> * are the CPU properties with "kvm-" prefixed names.
>> */
>> -void kvm_arm_add_vcpu_properties(Object *obj);
>> +void kvm_arm_add_vcpu_properties(ARMCPU *cpu);
>
> The function's description needs to be modified since @obj has been
> renamed to @cpu?
>
> /**
> * kvm_arm_add_vcpu_properties:
> * @obj: The CPU object to add the properties to
> *
> */
Oops thanks!
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
` (16 preceding siblings ...)
2023-11-26 13:59 ` [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Richard Henderson
@ 2023-12-11 14:36 ` Peter Maydell
2023-12-13 9:42 ` Philippe Mathieu-Daudé
17 siblings, 1 reply; 41+ messages in thread
From: Peter Maydell @ 2023-12-11 14:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, qemu-arm, kvm, Paolo Bonzini
On Thu, 23 Nov 2023 at 18:35, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Half of the API takes CPUState, the other ARMCPU...
>
> $ git grep -F 'CPUState *' target/arm/kvm_arm.h | wc -l
> 16
> $ git grep -F 'ARMCPU *' target/arm/kvm_arm.h | wc -l
> 14
>
> Since this is ARM specific, have it always take ARMCPU, and
> call the generic KVM API casting with the CPU() macro.
Applied to target-arm.next for 9.0, thanks.
-- PMM
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API
2023-12-11 14:36 ` Peter Maydell
@ 2023-12-13 9:42 ` Philippe Mathieu-Daudé
2023-12-14 15:34 ` Peter Maydell
0 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-13 9:42 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, qemu-arm, kvm, Paolo Bonzini
On 11/12/23 15:36, Peter Maydell wrote:
> On Thu, 23 Nov 2023 at 18:35, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Half of the API takes CPUState, the other ARMCPU...
>>
>> $ git grep -F 'CPUState *' target/arm/kvm_arm.h | wc -l
>> 16
>> $ git grep -F 'ARMCPU *' target/arm/kvm_arm.h | wc -l
>> 14
>>
>> Since this is ARM specific, have it always take ARMCPU, and
>> call the generic KVM API casting with the CPU() macro.
>
>
>
> Applied to target-arm.next for 9.0, thanks.
Thanks Peter, the only change I added from Gavin review is
on top of patch #3:
-- >8 --
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 6fb8a5f67e..3abbef0260 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -148,7 +148,7 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
/**
* kvm_arm_add_vcpu_properties:
- * @obj: The CPU object to add the properties to
+ * @cpu: The CPU object to add the properties to
*
* Add all KVM specific CPU properties to the CPU object. These
* are the CPU properties with "kvm-" prefixed names.
---
^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API
2023-12-13 9:42 ` Philippe Mathieu-Daudé
@ 2023-12-14 15:34 ` Peter Maydell
0 siblings, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2023-12-14 15:34 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, qemu-arm, kvm, Paolo Bonzini
On Wed, 13 Dec 2023 at 09:42, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 11/12/23 15:36, Peter Maydell wrote:
> > On Thu, 23 Nov 2023 at 18:35, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> >>
> >> Half of the API takes CPUState, the other ARMCPU...
> >>
> >> $ git grep -F 'CPUState *' target/arm/kvm_arm.h | wc -l
> >> 16
> >> $ git grep -F 'ARMCPU *' target/arm/kvm_arm.h | wc -l
> >> 14
> >>
> >> Since this is ARM specific, have it always take ARMCPU, and
> >> call the generic KVM API casting with the CPU() macro.
> >
> >
> >
> > Applied to target-arm.next for 9.0, thanks.
>
> Thanks Peter, the only change I added from Gavin review is
> on top of patch #3:
OK, I've squashed that in.
-- PMM
^ permalink raw reply [flat|nested] 41+ messages in thread
end of thread, other threads:[~2023-12-14 15:34 UTC | newest]
Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23 18:35 [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header Philippe Mathieu-Daudé
2023-11-27 3:54 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 02/16] target/arm/kvm: Remove unused includes Philippe Mathieu-Daudé
2023-11-27 3:59 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument Philippe Mathieu-Daudé
2023-11-27 4:05 ` Gavin Shan
2023-11-28 6:52 ` Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 04/16] target/arm/kvm: Have kvm_arm_sve_set_vls " Philippe Mathieu-Daudé
2023-11-27 4:07 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls " Philippe Mathieu-Daudé
2023-11-27 4:12 ` Gavin Shan
2023-11-28 6:52 ` Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 06/16] target/arm/kvm: Have kvm_arm_set_device_attr " Philippe Mathieu-Daudé
2023-11-27 4:13 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 07/16] target/arm/kvm: Have kvm_arm_pvtime_init " Philippe Mathieu-Daudé
2023-11-27 4:15 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init " Philippe Mathieu-Daudé
2023-11-27 4:20 ` Gavin Shan
2023-11-28 6:46 ` Philippe Mathieu-Daudé
2023-11-23 18:35 ` [PATCH-for-9.0 09/16] target/arm/kvm: Have kvm_arm_pmu_set_irq " Philippe Mathieu-Daudé
2023-11-27 4:21 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init " Philippe Mathieu-Daudé
2023-11-27 4:24 ` Gavin Shan
2023-11-27 4:25 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 11/16] target/arm/kvm: Have kvm_arm_vcpu_finalize " Philippe Mathieu-Daudé
2023-11-27 4:26 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 12/16] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take " Philippe Mathieu-Daudé
2023-11-27 4:29 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 13/16] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg Philippe Mathieu-Daudé
2023-11-27 4:31 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 14/16] target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument Philippe Mathieu-Daudé
2023-11-27 4:33 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 15/16] target/arm/kvm: Have kvm_arm_handle_debug " Philippe Mathieu-Daudé
2023-11-27 4:34 ` Gavin Shan
2023-11-23 18:35 ` [PATCH-for-9.0 16/16] target/arm/kvm: Have kvm_arm_hw_debug_active " Philippe Mathieu-Daudé
2023-11-27 4:36 ` Gavin Shan
2023-11-26 13:59 ` [PATCH-for-9.0 00/16] target/arm/kvm: Unify kvm_arm_FOO() API Richard Henderson
2023-12-11 14:36 ` Peter Maydell
2023-12-13 9:42 ` Philippe Mathieu-Daudé
2023-12-14 15:34 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.