[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V4 10/10] target/arm/kvm: Write CPU state back to KVM on reset
From: |
Salil Mehta |
Subject: |
[PATCH V4 10/10] target/arm/kvm: Write CPU state back to KVM on reset |
Date: |
Mon, 9 Oct 2023 21:36:01 +0100 |
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
When a KVM vCPU is reset following a PSCI CPU_ON call, its power state
is not synchronized with KVM at the moment. Because the vCPU is not
marked dirty, we miss the call to kvm_arch_put_registers() that writes
to KVM's MP_STATE. Force mp_state synchronization.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
---
target/arm/kvm.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index b66b936a95..8cb70b9e7c 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -642,11 +642,12 @@ void kvm_arm_cpu_post_load(ARMCPU *cpu)
void kvm_arm_reset_vcpu(ARMCPU *cpu)
{
int ret;
+ CPUState *cs = CPU(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(cs);
if (ret < 0) {
fprintf(stderr, "kvm_arm_vcpu_init failed: %s\n", strerror(-ret));
abort();
@@ -663,6 +664,11 @@ void kvm_arm_reset_vcpu(ARMCPU *cpu)
* for the same reason we do so in kvm_arch_get_registers().
*/
write_list_to_cpustate(cpu);
+ /*
+ * Ensure we call kvm_arch_put_registers(). The vCPU isn't marked dirty if
+ * it was parked in KVM and is now booting from a PSCI CPU_ON call.
+ */
+ cs->vcpu_dirty = true;
}
/*
--
2.34.1
- Re: [PATCH V4 03/10] hw/acpi: Add ACPI CPU hotplug init stub, (continued)
- [PATCH V4 04/10] hw/acpi: Init GED framework with CPU hotplug events, Salil Mehta, 2023/10/09
- [PATCH V4 05/10] hw/acpi: Update CPUs AML with cpu-(ctrl)dev change, Salil Mehta, 2023/10/09
- [PATCH V4 06/10] hw/acpi: Update GED _EVT method AML with CPU scan, Salil Mehta, 2023/10/09
- [PATCH V4 07/10] hw/acpi: Update ACPI GED framework to support vCPU Hotplug, Salil Mehta, 2023/10/09
- [PATCH V4 08/10] physmem: Add helper function to destroy CPU AddressSpace, Salil Mehta, 2023/10/09
- [PATCH V4 09/10] gdbstub: Add helper function to unregister GDB register space, Salil Mehta, 2023/10/09
- [PATCH V4 10/10] target/arm/kvm: Write CPU state back to KVM on reset,
Salil Mehta <=
- Re: [PATCH V4 00/10] Add architecture agnostic code to support vCPU Hotplug, Vishnu Pajjuri, 2023/10/11