]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: x86: Rename and invert async #PF's send_user_only flag to send_always
authorSean Christopherson <seanjc@google.com>
Sat, 15 Feb 2025 01:06:09 +0000 (17:06 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 25 Feb 2025 15:10:47 +0000 (07:10 -0800)
Rename send_user_only to avoid "user", because KVM's ABI is to not inject
page faults into CPL0, whereas "user" in x86 is specifically CPL3.  Invert
the polarity to keep the naming simple and unambiguous.  E.g. while KVM
often refers to CPL0 as "kernel", that terminology isn't ubiquitous, and
"send_kernel" could be misconstrued as "send only to kernel".

Link: https://lore.kernel.org/r/20250215010609.1199982-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c

index 94b14b3a3b8d2b71f8dc3520d7c87618c093c743..fef8f07cdc826b53fd0cd2ba7f39e0db70b10cc0 100644 (file)
@@ -997,8 +997,8 @@ struct kvm_vcpu_arch {
                u64 msr_int_val; /* MSR_KVM_ASYNC_PF_INT */
                u16 vec;
                u32 id;
-               bool send_user_only;
                u32 host_apf_flags;
+               bool send_always;
                bool delivery_as_pf_vmexit;
                bool pageready_pending;
        } apf;
index 3d84a79583b121a4a439c49bbd4c1382de2a94cd..a13e98f90a0ed055f83b445f52a5d5d0f19845e2 100644 (file)
@@ -3554,7 +3554,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
                                        sizeof(u64)))
                return 1;
 
-       vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS);
+       vcpu->arch.apf.send_always = (data & KVM_ASYNC_PF_SEND_ALWAYS);
        vcpu->arch.apf.delivery_as_pf_vmexit = data & KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT;
 
        kvm_async_pf_wakeup_all(vcpu);
@@ -13386,7 +13386,7 @@ static bool kvm_can_deliver_async_pf(struct kvm_vcpu *vcpu)
        if (!kvm_pv_async_pf_enabled(vcpu))
                return false;
 
-       if (vcpu->arch.apf.send_user_only &&
+       if (!vcpu->arch.apf.send_always &&
            (vcpu->arch.guest_state_protected || !kvm_x86_call(get_cpl)(vcpu)))
                return false;