Skip to content

Commit db07f3d

Browse files
committed
KVM: x86: Use double-underscore read/write MSR helpers as appropriate
Use the double-underscore helpers for emulating MSR reads and writes in he no-underscore versions to better capture the relationship between the two sets of APIs (the double-underscore versions don't honor userspace MSR filters). No functional change intended. Signed-off-by: Chao Gao <chao.gao@intel.com> Tested-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Link: https://lore.kernel.org/r/20250812025606.74625-3-chao.gao@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent d2dcf25 commit db07f3d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

arch/x86/kvm/x86.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,33 +1933,36 @@ static int kvm_get_msr_ignored_check(struct kvm_vcpu *vcpu,
19331933
__kvm_get_msr);
19341934
}
19351935

1936+
int __kvm_emulate_msr_read(struct kvm_vcpu *vcpu, u32 index, u64 *data)
1937+
{
1938+
return kvm_get_msr_ignored_check(vcpu, index, data, false);
1939+
}
1940+
EXPORT_SYMBOL_GPL(__kvm_emulate_msr_read);
1941+
1942+
int __kvm_emulate_msr_write(struct kvm_vcpu *vcpu, u32 index, u64 data)
1943+
{
1944+
return kvm_set_msr_ignored_check(vcpu, index, data, false);
1945+
}
1946+
EXPORT_SYMBOL_GPL(__kvm_emulate_msr_write);
1947+
19361948
int kvm_emulate_msr_read(struct kvm_vcpu *vcpu, u32 index, u64 *data)
19371949
{
19381950
if (!kvm_msr_allowed(vcpu, index, KVM_MSR_FILTER_READ))
19391951
return KVM_MSR_RET_FILTERED;
1940-
return kvm_get_msr_ignored_check(vcpu, index, data, false);
1952+
1953+
return __kvm_emulate_msr_read(vcpu, index, data);
19411954
}
19421955
EXPORT_SYMBOL_GPL(kvm_emulate_msr_read);
19431956

19441957
int kvm_emulate_msr_write(struct kvm_vcpu *vcpu, u32 index, u64 data)
19451958
{
19461959
if (!kvm_msr_allowed(vcpu, index, KVM_MSR_FILTER_WRITE))
19471960
return KVM_MSR_RET_FILTERED;
1948-
return kvm_set_msr_ignored_check(vcpu, index, data, false);
1949-
}
1950-
EXPORT_SYMBOL_GPL(kvm_emulate_msr_write);
19511961

1952-
int __kvm_emulate_msr_read(struct kvm_vcpu *vcpu, u32 index, u64 *data)
1953-
{
1954-
return kvm_get_msr_ignored_check(vcpu, index, data, false);
1962+
return __kvm_emulate_msr_write(vcpu, index, data);
19551963
}
1956-
EXPORT_SYMBOL_GPL(__kvm_emulate_msr_read);
1964+
EXPORT_SYMBOL_GPL(kvm_emulate_msr_write);
19571965

1958-
int __kvm_emulate_msr_write(struct kvm_vcpu *vcpu, u32 index, u64 data)
1959-
{
1960-
return kvm_set_msr_ignored_check(vcpu, index, data, false);
1961-
}
1962-
EXPORT_SYMBOL_GPL(__kvm_emulate_msr_write);
19631966

19641967
static void complete_userspace_rdmsr(struct kvm_vcpu *vcpu)
19651968
{

0 commit comments

Comments
 (0)