KVM: nSVM: split out __nested_vmcb_check_controls
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Nov 2021 14:14:08 +0000 (09:14 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Dec 2021 09:24:40 +0000 (04:24 -0500)
Remove the struct vmcb_control_area parameter from nested_vmcb_check_controls,
for consistency with the functions that operate on the save area.  This
way, VMRUN uses the version without underscores for both areas, while
KVM_SET_NESTED_STATE uses the version with underscores.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/nested.c

index aad09d5..565d9d4 100644 (file)
@@ -219,8 +219,8 @@ static bool nested_svm_check_tlb_ctl(struct kvm_vcpu *vcpu, u8 tlb_ctl)
        }
 }
 
-static bool nested_vmcb_check_controls(struct kvm_vcpu *vcpu,
-                                      struct vmcb_control_area *control)
+static bool __nested_vmcb_check_controls(struct kvm_vcpu *vcpu,
+                                        struct vmcb_control_area *control)
 {
        if (CC(!vmcb_is_intercept(control, INTERCEPT_VMRUN)))
                return false;
@@ -287,6 +287,14 @@ static bool nested_vmcb_check_save(struct kvm_vcpu *vcpu)
        return __nested_vmcb_check_save(vcpu, save);
 }
 
+static bool nested_vmcb_check_controls(struct kvm_vcpu *vcpu)
+{
+       struct vcpu_svm *svm = to_svm(vcpu);
+       struct vmcb_control_area *ctl = &svm->nested.ctl;
+
+       return __nested_vmcb_check_controls(vcpu, ctl);
+}
+
 static
 void __nested_copy_vmcb_control_to_cache(struct vmcb_control_area *to,
                                         struct vmcb_control_area *from)
@@ -691,7 +699,7 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu)
        nested_copy_vmcb_save_to_cache(svm, &vmcb12->save);
 
        if (!nested_vmcb_check_save(vcpu) ||
-           !nested_vmcb_check_controls(vcpu, &svm->nested.ctl)) {
+           !nested_vmcb_check_controls(vcpu)) {
                vmcb12->control.exit_code    = SVM_EXIT_ERR;
                vmcb12->control.exit_code_hi = 0;
                vmcb12->control.exit_info_1  = 0;
@@ -1379,7 +1387,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
                goto out_free;
 
        ret = -EINVAL;
-       if (!nested_vmcb_check_controls(vcpu, ctl))
+       if (!__nested_vmcb_check_controls(vcpu, ctl))
                goto out_free;
 
        /*