mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 15:55:28 -04:00
KVM: SVM: Massage name and param of helper that merges vmcb01 and vmcb12 MSRPMs
Rename nested_svm_vmrun_msrpm() to nested_svm_merge_msrpm() to better capture its role, and opportunistically feed it @vcpu instead of @svm, as grabbing "svm" only to turn around and grab svm->vcpu is rather silly. No functional change intended. Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Link: https://lore.kernel.org/r/20250610225737.156318-9-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
@@ -189,8 +189,9 @@ void recalc_intercepts(struct vcpu_svm *svm)
|
||||
* is optimized in that it only merges the parts where KVM MSR permission bitmap
|
||||
* may contain zero bits.
|
||||
*/
|
||||
static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
|
||||
static bool nested_svm_merge_msrpm(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct vcpu_svm *svm = to_svm(vcpu);
|
||||
int i;
|
||||
|
||||
/*
|
||||
@@ -205,7 +206,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
|
||||
if (!svm->nested.force_msr_bitmap_recalc) {
|
||||
struct hv_vmcb_enlightenments *hve = &svm->nested.ctl.hv_enlightenments;
|
||||
|
||||
if (kvm_hv_hypercall_enabled(&svm->vcpu) &&
|
||||
if (kvm_hv_hypercall_enabled(vcpu) &&
|
||||
hve->hv_enlightenments_control.msr_bitmap &&
|
||||
(svm->nested.ctl.clean & BIT(HV_VMCB_NESTED_ENLIGHTENMENTS)))
|
||||
goto set_msrpm_base_pa;
|
||||
@@ -230,7 +231,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
|
||||
|
||||
offset = svm->nested.ctl.msrpm_base_pa + (p * 4);
|
||||
|
||||
if (kvm_vcpu_read_guest(&svm->vcpu, offset, &value, 4))
|
||||
if (kvm_vcpu_read_guest(vcpu, offset, &value, 4))
|
||||
return false;
|
||||
|
||||
svm->nested.msrpm[p] = svm->msrpm[p] | value;
|
||||
@@ -937,7 +938,7 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu)
|
||||
if (enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, true))
|
||||
goto out_exit_err;
|
||||
|
||||
if (nested_svm_vmrun_msrpm(svm))
|
||||
if (nested_svm_merge_msrpm(vcpu))
|
||||
goto out;
|
||||
|
||||
out_exit_err:
|
||||
@@ -1819,13 +1820,11 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
|
||||
|
||||
static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct vcpu_svm *svm = to_svm(vcpu);
|
||||
|
||||
if (WARN_ON(!is_guest_mode(vcpu)))
|
||||
return true;
|
||||
|
||||
if (!vcpu->arch.pdptrs_from_userspace &&
|
||||
!nested_npt_enabled(svm) && is_pae_paging(vcpu))
|
||||
!nested_npt_enabled(to_svm(vcpu)) && is_pae_paging(vcpu))
|
||||
/*
|
||||
* Reload the guest's PDPTRs since after a migration
|
||||
* the guest CR3 might be restored prior to setting the nested
|
||||
@@ -1834,7 +1833,7 @@ static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu)
|
||||
if (CC(!load_pdptrs(vcpu, vcpu->arch.cr3)))
|
||||
return false;
|
||||
|
||||
if (!nested_svm_vmrun_msrpm(svm)) {
|
||||
if (!nested_svm_merge_msrpm(vcpu)) {
|
||||
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
|
||||
vcpu->run->internal.suberror =
|
||||
KVM_INTERNAL_ERROR_EMULATION;
|
||||
|
||||
@@ -3124,7 +3124,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
|
||||
*
|
||||
* For nested:
|
||||
* The handling of the MSR bitmap for L2 guests is done in
|
||||
* nested_svm_vmrun_msrpm.
|
||||
* nested_svm_merge_msrpm().
|
||||
* We update the L1 MSR bit as well since it will end up
|
||||
* touching the MSR anyway now.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user