[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/43] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take AR
From: |
Peter Maydell |
Subject: |
[PULL 33/43] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take ARMCPU argument |
Date: |
Tue, 19 Dec 2023 19:12:57 +0000 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Message-id: 20231123183518.64569-13-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@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 a2370bc5747..5973fbedde1 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -1034,20 +1034,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();
@@ -1058,20 +1057,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();
@@ -1289,16 +1287,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);
}
}
}
@@ -1879,7 +1876,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.34.1
- [PULL 10/43] target/arm/kvm: Move kvm_arm_get_host_cpu_features and unexport, (continued)
- [PULL 10/43] target/arm/kvm: Move kvm_arm_get_host_cpu_features and unexport, Peter Maydell, 2023/12/19
- [PULL 19/43] target/arm/kvm: Unexport kvm_{get,put}_vcpu_events, Peter Maydell, 2023/12/19
- [PULL 23/43] target/arm/kvm: Remove unused includes, Peter Maydell, 2023/12/19
- [PULL 17/43] target/arm/kvm: Unexport kvm_arm_init_cpreg_list, Peter Maydell, 2023/12/19
- [PULL 20/43] target/arm/kvm: Unexport and tidy kvm_arm_sync_mpstate_to_{kvm, qemu}, Peter Maydell, 2023/12/19
- [PULL 18/43] target/arm/kvm: Init cap_has_inject_serror_esr in kvm_arch_init, Peter Maydell, 2023/12/19
- [PULL 27/43] target/arm/kvm: Have kvm_arm_set_device_attr take a ARMCPU argument, Peter Maydell, 2023/12/19
- [PULL 16/43] target/arm/kvm: Unexport kvm_arm_vcpu_finalize, Peter Maydell, 2023/12/19
- [PULL 14/43] target/arm/kvm: Merge kvm64.c into kvm.c, Peter Maydell, 2023/12/19
- [PULL 24/43] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument, Peter Maydell, 2023/12/19
- [PULL 33/43] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take ARMCPU argument,
Peter Maydell <=
- [PULL 36/43] target/arm/kvm: Have kvm_arm_handle_debug take a ARMCPU argument, Peter Maydell, 2023/12/19
- [PULL 37/43] target/arm/kvm: Have kvm_arm_hw_debug_active take a ARMCPU argument, Peter Maydell, 2023/12/19
- [PULL 21/43] target/arm/kvm: Unexport kvm_arm_vm_state_change, Peter Maydell, 2023/12/19
- [PULL 28/43] target/arm/kvm: Have kvm_arm_pvtime_init take a ARMCPU argument, Peter Maydell, 2023/12/19
- [PULL 31/43] target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument, Peter Maydell, 2023/12/19
- [PULL 32/43] target/arm/kvm: Have kvm_arm_vcpu_finalize take a ARMCPU argument, Peter Maydell, 2023/12/19
- [PULL 34/43] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg, Peter Maydell, 2023/12/19
- [PULL 22/43] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header, Peter Maydell, 2023/12/19
- [PULL 38/43] target/arm: Don't implement *32_EL2 registers when EL1 is AArch64 only, Peter Maydell, 2023/12/19
- [PULL 39/43] target/arm: Restrict TCG specific helpers, Peter Maydell, 2023/12/19