1

KVM: Rename arch hooks related to per-CPU virtualization enabling

Rename the per-CPU hooks used to enable virtualization in hardware to
align with the KVM-wide helpers in kvm_main.c, and to better capture that
the callbacks are invoked on every online CPU.

No functional change intended.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Message-ID: <20240830043600.127750-5-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Sean Christopherson 2024-08-29 21:35:54 -07:00 committed by Paolo Bonzini
parent 70c0194337
commit 071f24ad28
7 changed files with 16 additions and 16 deletions

View File

@ -2163,7 +2163,7 @@ static void cpu_hyp_uninit(void *discard)
} }
} }
int kvm_arch_hardware_enable(void) int kvm_arch_enable_virtualization_cpu(void)
{ {
/* /*
* Most calls to this function are made with migration * Most calls to this function are made with migration
@ -2183,7 +2183,7 @@ int kvm_arch_hardware_enable(void)
return 0; return 0;
} }
void kvm_arch_hardware_disable(void) void kvm_arch_disable_virtualization_cpu(void)
{ {
kvm_timer_cpu_down(); kvm_timer_cpu_down();
kvm_vgic_cpu_down(); kvm_vgic_cpu_down();
@ -2379,7 +2379,7 @@ static int __init do_pkvm_init(u32 hyp_va_bits)
/* /*
* The stub hypercalls are now disabled, so set our local flag to * The stub hypercalls are now disabled, so set our local flag to
* prevent a later re-init attempt in kvm_arch_hardware_enable(). * prevent a later re-init attempt in kvm_arch_enable_virtualization_cpu().
*/ */
__this_cpu_write(kvm_hyp_initialized, 1); __this_cpu_write(kvm_hyp_initialized, 1);
preempt_enable(); preempt_enable();

View File

@ -261,7 +261,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
int kvm_arch_hardware_enable(void) int kvm_arch_enable_virtualization_cpu(void)
{ {
unsigned long env, gcfg = 0; unsigned long env, gcfg = 0;
@ -300,7 +300,7 @@ int kvm_arch_hardware_enable(void)
return 0; return 0;
} }
void kvm_arch_hardware_disable(void) void kvm_arch_disable_virtualization_cpu(void)
{ {
write_csr_gcfg(0); write_csr_gcfg(0);
write_csr_gstat(0); write_csr_gstat(0);

View File

@ -125,12 +125,12 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
return 1; return 1;
} }
int kvm_arch_hardware_enable(void) int kvm_arch_enable_virtualization_cpu(void)
{ {
return kvm_mips_callbacks->hardware_enable(); return kvm_mips_callbacks->hardware_enable();
} }
void kvm_arch_hardware_disable(void) void kvm_arch_disable_virtualization_cpu(void)
{ {
kvm_mips_callbacks->hardware_disable(); kvm_mips_callbacks->hardware_disable();
} }

View File

@ -20,7 +20,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
return -EINVAL; return -EINVAL;
} }
int kvm_arch_hardware_enable(void) int kvm_arch_enable_virtualization_cpu(void)
{ {
csr_write(CSR_HEDELEG, KVM_HEDELEG_DEFAULT); csr_write(CSR_HEDELEG, KVM_HEDELEG_DEFAULT);
csr_write(CSR_HIDELEG, KVM_HIDELEG_DEFAULT); csr_write(CSR_HIDELEG, KVM_HIDELEG_DEFAULT);
@ -35,7 +35,7 @@ int kvm_arch_hardware_enable(void)
return 0; return 0;
} }
void kvm_arch_hardware_disable(void) void kvm_arch_disable_virtualization_cpu(void)
{ {
kvm_riscv_aia_disable(); kvm_riscv_aia_disable();

View File

@ -355,7 +355,7 @@ static void kvm_on_user_return(struct user_return_notifier *urn)
/* /*
* Disabling irqs at this point since the following code could be * Disabling irqs at this point since the following code could be
* interrupted and executed through kvm_arch_hardware_disable() * interrupted and executed through kvm_arch_disable_virtualization_cpu()
*/ */
local_irq_save(flags); local_irq_save(flags);
if (msrs->registered) { if (msrs->registered) {
@ -12512,7 +12512,7 @@ void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector)
} }
EXPORT_SYMBOL_GPL(kvm_vcpu_deliver_sipi_vector); EXPORT_SYMBOL_GPL(kvm_vcpu_deliver_sipi_vector);
int kvm_arch_hardware_enable(void) int kvm_arch_enable_virtualization_cpu(void)
{ {
struct kvm *kvm; struct kvm *kvm;
struct kvm_vcpu *vcpu; struct kvm_vcpu *vcpu;
@ -12608,7 +12608,7 @@ int kvm_arch_hardware_enable(void)
return 0; return 0;
} }
void kvm_arch_hardware_disable(void) void kvm_arch_disable_virtualization_cpu(void)
{ {
kvm_x86_call(hardware_disable)(); kvm_x86_call(hardware_disable)();
drop_user_return_notifiers(); drop_user_return_notifiers();

View File

@ -1521,8 +1521,8 @@ static inline void kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) {}
#endif #endif
#ifdef CONFIG_KVM_GENERIC_HARDWARE_ENABLING #ifdef CONFIG_KVM_GENERIC_HARDWARE_ENABLING
int kvm_arch_hardware_enable(void); int kvm_arch_enable_virtualization_cpu(void);
void kvm_arch_hardware_disable(void); void kvm_arch_disable_virtualization_cpu(void);
#endif #endif
int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu);

View File

@ -5583,7 +5583,7 @@ static int kvm_enable_virtualization_cpu(void)
if (__this_cpu_read(virtualization_enabled)) if (__this_cpu_read(virtualization_enabled))
return 0; return 0;
if (kvm_arch_hardware_enable()) { if (kvm_arch_enable_virtualization_cpu()) {
pr_info("kvm: enabling virtualization on CPU%d failed\n", pr_info("kvm: enabling virtualization on CPU%d failed\n",
raw_smp_processor_id()); raw_smp_processor_id());
return -EIO; return -EIO;
@ -5608,7 +5608,7 @@ static void kvm_disable_virtualization_cpu(void *ign)
if (!__this_cpu_read(virtualization_enabled)) if (!__this_cpu_read(virtualization_enabled))
return; return;
kvm_arch_hardware_disable(); kvm_arch_disable_virtualization_cpu();
__this_cpu_write(virtualization_enabled, false); __this_cpu_write(virtualization_enabled, false);
} }