Commit 15e1c3d6 authored by Isaku Yamahata's avatar Isaku Yamahata Committed by Paolo Bonzini

KVM: x86: Use this_cpu_ptr() instead of per_cpu_ptr(smp_processor_id())

Use this_cpu_ptr() instead of open coding the equivalent in various
user return MSR helpers.
Signed-off-by: default avatarIsaku Yamahata <isaku.yamahata@intel.com>
Reviewed-by: default avatarChao Gao <chao.gao@intel.com>
Reviewed-by: default avatarYuan Yao <yuan.yao@intel.com>
[sean: massage changelog]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Reviewed-by: default avatarPankaj Gupta <pankaj.gupta@amd.com>
Message-ID: <20240802201630.339306-1-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b098495e
...@@ -427,8 +427,7 @@ static void kvm_user_return_msr_cpu_online(void) ...@@ -427,8 +427,7 @@ static void kvm_user_return_msr_cpu_online(void)
int kvm_set_user_return_msr(unsigned slot, u64 value, u64 mask) int kvm_set_user_return_msr(unsigned slot, u64 value, u64 mask)
{ {
unsigned int cpu = smp_processor_id(); struct kvm_user_return_msrs *msrs = this_cpu_ptr(user_return_msrs);
struct kvm_user_return_msrs *msrs = per_cpu_ptr(user_return_msrs, cpu);
int err; int err;
value = (value & mask) | (msrs->values[slot].host & ~mask); value = (value & mask) | (msrs->values[slot].host & ~mask);
...@@ -450,8 +449,7 @@ EXPORT_SYMBOL_GPL(kvm_set_user_return_msr); ...@@ -450,8 +449,7 @@ EXPORT_SYMBOL_GPL(kvm_set_user_return_msr);
static void drop_user_return_notifiers(void) static void drop_user_return_notifiers(void)
{ {
unsigned int cpu = smp_processor_id(); struct kvm_user_return_msrs *msrs = this_cpu_ptr(user_return_msrs);
struct kvm_user_return_msrs *msrs = per_cpu_ptr(user_return_msrs, cpu);
if (msrs->registered) if (msrs->registered)
kvm_on_user_return(&msrs->urn); kvm_on_user_return(&msrs->urn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment