[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <49aa53f11283b826ccbca3755e2548464b7f8db7.1660974106.git.isaku.yamahata@intel.com>
Date: Fri, 19 Aug 2022 23:00:21 -0700
From: isaku.yamahata@...el.com
To: kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: isaku.yamahata@...el.com, isaku.yamahata@...il.com,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Kai Huang <kai.huang@...el.com>, Chao Gao <chao.gao@...el.com>,
Will Deacon <will@...nel.org>
Subject: [RFC PATCH 15/18] KVM: x86: Delete kvm_arch_hardware_enable/disable()
From: Isaku Yamahata <isaku.yamahata@...el.com>
Now they're function call and there is no point to keep them.
Opportunistically make kvm_arch_pre_hardware_unsetup() empty.
Suggested-by: Sean Christopherson <seanjc@...gle.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
---
arch/x86/kvm/x86.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a1e8d15aa6b8..5aa6d5308ee8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -354,7 +354,7 @@ static void kvm_on_user_return(struct user_return_notifier *urn)
/*
* Disabling irqs at this point since the following code could be
- * interrupted and executed through kvm_arch_hardware_disable()
+ * interrupted and executed through hardware_disable()
*/
local_irq_save(flags);
if (msrs->registered) {
@@ -11830,17 +11830,6 @@ void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector)
}
EXPORT_SYMBOL_GPL(kvm_vcpu_deliver_sipi_vector);
-int kvm_arch_hardware_enable(void)
-{
- return static_call(kvm_x86_hardware_enable)();
-}
-
-void kvm_arch_hardware_disable(void)
-{
- static_call(kvm_x86_hardware_disable)();
- drop_user_return_notifiers();
-}
-
static cpumask_t cpus_hardware_enabled = CPU_MASK_NONE;
static int __hardware_enable(void)
@@ -11852,7 +11841,7 @@ static int __hardware_enable(void)
if (cpumask_test_cpu(cpu, &cpus_hardware_enabled))
return 0;
- r = kvm_arch_hardware_enable();
+ r = static_call(kvm_x86_hardware_enable)();
if (r)
pr_info("kvm: enabling virtualization on CPU%d failed\n", cpu);
else
@@ -11877,12 +11866,13 @@ static void hardware_disable(void *junk)
if (!cpumask_test_cpu(cpu, &cpus_hardware_enabled))
return;
cpumask_clear_cpu(cpu, &cpus_hardware_enabled);
- kvm_arch_hardware_disable();
+ static_call(kvm_x86_hardware_disable)();
+ drop_user_return_notifiers();
}
void kvm_arch_pre_hardware_unsetup(void)
{
- on_each_cpu(hardware_disable, NULL, 1);
+ /* TODO: eliminate this function */
}
/*
@@ -11968,7 +11958,7 @@ void kvm_arch_resume(int usage_count)
if (kvm_arch_check_processor_compat())
return;
- if (kvm_arch_hardware_enable())
+ if (static_call(kvm_x86_hardware_enable)())
return;
local_tsc = rdtsc();
@@ -12109,6 +12099,8 @@ int kvm_arch_hardware_setup(void *opaque)
void kvm_arch_hardware_unsetup(void)
{
+ on_each_cpu(hardware_disable, NULL, 1);
+
kvm_unregister_perf_callbacks();
static_call(kvm_x86_hardware_unsetup)();
--
2.25.1
Powered by blists - more mailing lists