mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
KVM: VMX: Introduce vmx_msr_bitmap_l01_changed() helper
commit b84155c380
upstream.
In preparation to enabling 'Enlightened MSR Bitmap' feature for Hyper-V
guests move MSR bitmap update tracking to a dedicated helper.
Note: vmx_msr_bitmap_l01_changed() is called when MSR bitmap might be
updated. KVM doesn't check if the bit we're trying to set is already set
(or the bit it's trying to clear is already cleared). Such situations
should not be common and a few false positives should not be a problem.
No functional change intended.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211129094704.326635-3-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3f519afb03
commit
10ce7e4bd6
1 changed files with 13 additions and 4 deletions
|
@ -3772,6 +3772,17 @@ void free_vpid(int vpid)
|
|||
spin_unlock(&vmx_vpid_lock);
|
||||
}
|
||||
|
||||
static void vmx_msr_bitmap_l01_changed(struct vcpu_vmx *vmx)
|
||||
{
|
||||
/*
|
||||
* When KVM is a nested hypervisor on top of Hyper-V and uses
|
||||
* 'Enlightened MSR Bitmap' feature L0 needs to know that MSR
|
||||
* bitmap has changed.
|
||||
*/
|
||||
if (static_branch_unlikely(&enable_evmcs))
|
||||
evmcs_touch_msr_bitmap();
|
||||
}
|
||||
|
||||
void vmx_disable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
|
||||
{
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
|
@ -3780,8 +3791,7 @@ void vmx_disable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
|
|||
if (!cpu_has_vmx_msr_bitmap())
|
||||
return;
|
||||
|
||||
if (static_branch_unlikely(&enable_evmcs))
|
||||
evmcs_touch_msr_bitmap();
|
||||
vmx_msr_bitmap_l01_changed(vmx);
|
||||
|
||||
/*
|
||||
* Mark the desired intercept state in shadow bitmap, this is needed
|
||||
|
@ -3825,8 +3835,7 @@ void vmx_enable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
|
|||
if (!cpu_has_vmx_msr_bitmap())
|
||||
return;
|
||||
|
||||
if (static_branch_unlikely(&enable_evmcs))
|
||||
evmcs_touch_msr_bitmap();
|
||||
vmx_msr_bitmap_l01_changed(vmx);
|
||||
|
||||
/*
|
||||
* Mark the desired intercept state in shadow bitmap, this is needed
|
||||
|
|
Loading…
Add table
Reference in a new issue