aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm/nested.c
diff options
context:
space:
mode:
authorSean Christopherson <[email protected]>2025-06-10 22:57:33 +0000
committerSean Christopherson <[email protected]>2025-06-20 20:07:35 +0000
commit5904ba5172464cdf688567a06346351ab3a61fd3 (patch)
tree386ac75eddc7dded73ebf40db74e74619e24ef72 /arch/x86/kvm/svm/nested.c
parentKVM: nSVM: Access MSRPM in 4-byte chunks only for merging L0 and L1 bitmaps (diff)
downloadkernel-5904ba5172464cdf688567a06346351ab3a61fd3.tar.gz
kernel-5904ba5172464cdf688567a06346351ab3a61fd3.zip
KVM: SVM: Return -EINVAL instead of MSR_INVALID to signal out-of-range MSR
Return -EINVAL instead of MSR_INVALID from svm_msrpm_bit_nr() to indicate that the MSR isn't covered by one of the (currently) three MSRPM ranges, and delete the MSR_INVALID macro now that all users are gone. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'arch/x86/kvm/svm/nested.c')
-rw-r--r--arch/x86/kvm/svm/nested.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index fb0ac87df00a..7ca45361ced3 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -223,10 +223,10 @@ int __init nested_svm_init_msrpm_merge_offsets(void)
int i, j;
for (i = 0; i < ARRAY_SIZE(merge_msrs); i++) {
- u32 bit_nr = svm_msrpm_bit_nr(merge_msrs[i]);
+ int bit_nr = svm_msrpm_bit_nr(merge_msrs[i]);
u32 offset;
- if (WARN_ON(bit_nr == MSR_INVALID))
+ if (WARN_ON(bit_nr < 0))
return -EIO;
/*
@@ -1354,9 +1354,9 @@ void svm_leave_nested(struct kvm_vcpu *vcpu)
static int nested_svm_exit_handled_msr(struct vcpu_svm *svm)
{
gpa_t base = svm->nested.ctl.msrpm_base_pa;
- u32 msr, bit_nr;
+ int write, bit_nr;
u8 value, mask;
- int write;
+ u32 msr;
if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT)))
return NESTED_EXIT_HOST;
@@ -1365,7 +1365,7 @@ static int nested_svm_exit_handled_msr(struct vcpu_svm *svm)
bit_nr = svm_msrpm_bit_nr(msr);
write = svm->vmcb->control.exit_info_1 & 1;
- if (bit_nr == MSR_INVALID)
+ if (bit_nr < 0)
return NESTED_EXIT_DONE;
if (kvm_vcpu_read_guest(&svm->vcpu, base + bit_nr / BITS_PER_BYTE,