Messages in this thread Patch in this message | | | From | Vitaly Kuznetsov <> | Subject | Re: [PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM | Date | Thu, 03 Feb 2022 10:51:49 +0100 |
| |
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 2/2/22 10:50, Vitaly Kuznetsov wrote: ... >> KVM: nSVM: Implement Enlightened MSR-Bitmap feature ... > > Queued, thanks.
While writing a selftest for the feature, I've discovered an embarassing bug: in nested_svm_vmrun_msrpm() I check bit number instead of bit mask. It worked in testing by pure luck, it seems genuine Hyper-V sets some other clean fields simultaneously.
Would it be possible to squash the attached patch in? Thanks!
I'll be sending out selftests shortly.
-- Vitaly
From cfb538876ccc59dade7cadde553863bea8312f90 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov <vkuznets@redhat.com> Date: Thu, 3 Feb 2022 10:22:30 +0100 Subject: [PATCH] KVM: nSVM: Fix the check for VMCB_HV_NESTED_ENLIGHTENMENTS bin in nested_svm_vmrun_msrpm()
VMCB_HV_NESTED_ENLIGHTENMENTS (VMCB_SW) is a bit number, not a bit mask.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- arch/x86/kvm/svm/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 7b26a4b518f7..7acf4f2aa445 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -188,7 +188,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm) if (!svm->nested.force_msr_bitmap_recalc && kvm_hv_hypercall_enabled(&svm->vcpu) && hve->hv_enlightenments_control.msr_bitmap && - (svm->nested.ctl.clean & VMCB_HV_NESTED_ENLIGHTENMENTS)) + (svm->nested.ctl.clean & BIT(VMCB_HV_NESTED_ENLIGHTENMENTS))) goto set_msrpm_base_pa; if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT))) -- 2.34.1
| |