]> git.proxmox.com Git - mirror_qemu.git/commitdiff
KVM: remove kvm_arch_cpu_check_are_resettable
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 18 Mar 2024 18:41:33 +0000 (14:41 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 23 Apr 2024 15:35:25 +0000 (17:35 +0200)
Board reset requires writing a fresh CPU state.  As far as KVM is
concerned, the only thing that blocks reset is that CPU state is
encrypted; therefore, kvm_cpus_are_resettable() can simply check
if that is the case.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/kvm/kvm-accel-ops.c
accel/kvm/kvm-all.c
include/sysemu/kvm.h
target/arm/kvm.c
target/i386/kvm/kvm.c
target/loongarch/kvm/kvm.c
target/mips/kvm.c
target/ppc/kvm.c
target/riscv/kvm/kvm-cpu.c
target/s390x/kvm/kvm.c

index f5ac643fca30fb907fb5bef7defdc0c702e46fe9..94c828ac8dac7d6b9f0d9d25a52866654a879923 100644 (file)
@@ -82,7 +82,7 @@ static bool kvm_vcpu_thread_is_idle(CPUState *cpu)
 
 static bool kvm_cpus_are_resettable(void)
 {
-    return !kvm_enabled() || kvm_cpu_check_are_resettable();
+    return !kvm_enabled() || !kvm_state->guest_state_protected;
 }
 
 #ifdef TARGET_KVM_HAVE_GUEST_DEBUG
index d6ebadbf386a15b76d94f6bc23aed522ee350815..5a2fbee32a36c6ba939ab1e77dc23a05e400b896 100644 (file)
@@ -2696,11 +2696,6 @@ void kvm_flush_coalesced_mmio_buffer(void)
     s->coalesced_flush_in_progress = false;
 }
 
-bool kvm_cpu_check_are_resettable(void)
-{
-    return kvm_arch_cpu_check_are_resettable();
-}
-
 static void do_kvm_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
 {
     if (!cpu->vcpu_dirty && !kvm_state->guest_state_protected) {
index 14b1ddb3be19513542df68c9283ca58a3fa110da..bd247f3a23951ed7ecb7b7025b8d9381c5dfc37e 100644 (file)
@@ -525,16 +525,6 @@ int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target);
 /* Notify resamplefd for EOI of specific interrupts. */
 void kvm_resample_fd_notify(int gsi);
 
-/**
- * kvm_cpu_check_are_resettable - return whether CPUs can be reset
- *
- * Returns: true: CPUs are resettable
- *          false: CPUs are not resettable
- */
-bool kvm_cpu_check_are_resettable(void);
-
-bool kvm_arch_cpu_check_are_resettable(void);
-
 bool kvm_dirty_ring_enabled(void);
 
 uint32_t kvm_dirty_ring_size(void);
index ab85d628a8bb610430ee493c9a9bf3f6301f2e1a..21ebbf3b8f8334c556a185e4ca817c5dbf095c30 100644 (file)
@@ -1598,11 +1598,6 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
     return (data - 32) & 0xffff;
 }
 
-bool kvm_arch_cpu_check_are_resettable(void)
-{
-    return true;
-}
-
 static void kvm_arch_get_eager_split_size(Object *obj, Visitor *v,
                                           const char *name, void *opaque,
                                           Error **errp)
index c64b9562c08252fb4c98e58f48234eb5225e4d86..c8fdab40fc6c05fa3ed69349cd59d3cf6a09be7c 100644 (file)
@@ -5619,11 +5619,6 @@ bool kvm_has_waitpkg(void)
     return has_msr_umwait;
 }
 
-bool kvm_arch_cpu_check_are_resettable(void)
-{
-    return !sev_es_enabled();
-}
-
 #define ARCH_REQ_XCOMP_GUEST_PERM       0x1025
 
 void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask)
index d630cc39cb2fbe030344040cfd8e3c94b02a41ff..8224d943331beddf9bf3c35aaa64fce23ddd515a 100644 (file)
@@ -733,11 +733,6 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cs)
     return true;
 }
 
-bool kvm_arch_cpu_check_are_resettable(void)
-{
-    return true;
-}
-
 int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
 {
     int ret = 0;
index 6c52e59f55dbda5d30adce8e935758d716224966..a631ab544f5a4241382a56879d4a8bb2dfb42540 100644 (file)
@@ -1273,11 +1273,6 @@ int kvm_arch_get_default_type(MachineState *machine)
     return -1;
 }
 
-bool kvm_arch_cpu_check_are_resettable(void)
-{
-    return true;
-}
-
 void kvm_arch_accel_class_init(ObjectClass *oc)
 {
 }
index 8231feb2d4553e6bcd721d05b55a102f578e687d..63930d4a77d17d1c6c0a11c00930e6a0435962ea 100644 (file)
@@ -2956,11 +2956,6 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset)
     }
 }
 
-bool kvm_arch_cpu_check_are_resettable(void)
-{
-    return true;
-}
-
 void kvm_arch_accel_class_init(ObjectClass *oc)
 {
 }
index 6a6c6cae80f146b43a6c1a4d42163f4328e71844..49d2f3ad58c0e2a95c790a5c6bfa96f2e7f34573 100644 (file)
@@ -1475,11 +1475,6 @@ void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level)
     }
 }
 
-bool kvm_arch_cpu_check_are_resettable(void)
-{
-    return true;
-}
-
 static int aia_mode;
 
 static const char *kvm_aia_mode_str(uint64_t mode)
index 4ce809c5d46b060e7de560ae34aed229a53d0c6f..4dcd757cdcc30639880c01ec6fe434afce31377d 100644 (file)
@@ -2622,11 +2622,6 @@ void kvm_s390_stop_interrupt(S390CPU *cpu)
     kvm_s390_vcpu_interrupt(cpu, &irq);
 }
 
-bool kvm_arch_cpu_check_are_resettable(void)
-{
-    return true;
-}
-
 int kvm_s390_get_zpci_op(void)
 {
     return cap_zpci_op;