Skip to content

Commit 4fa0efb

Browse files
committed
KVM: x86: Rename and invert async #PF's send_user_only flag to send_always
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>
1 parent b9595d1 commit 4fa0efb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/x86/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ struct kvm_vcpu_arch {
997997
u64 msr_int_val; /* MSR_KVM_ASYNC_PF_INT */
998998
u16 vec;
999999
u32 id;
1000-
bool send_user_only;
10011000
u32 host_apf_flags;
1001+
bool send_always;
10021002
bool delivery_as_pf_vmexit;
10031003
bool pageready_pending;
10041004
} apf;

arch/x86/kvm/x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3554,7 +3554,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
35543554
sizeof(u64)))
35553555
return 1;
35563556

3557-
vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS);
3557+
vcpu->arch.apf.send_always = (data & KVM_ASYNC_PF_SEND_ALWAYS);
35583558
vcpu->arch.apf.delivery_as_pf_vmexit = data & KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT;
35593559

35603560
kvm_async_pf_wakeup_all(vcpu);
@@ -13386,7 +13386,7 @@ static bool kvm_can_deliver_async_pf(struct kvm_vcpu *vcpu)
1338613386
if (!kvm_pv_async_pf_enabled(vcpu))
1338713387
return false;
1338813388

13389-
if (vcpu->arch.apf.send_user_only &&
13389+
if (!vcpu->arch.apf.send_always &&
1339013390
(vcpu->arch.guest_state_protected || !kvm_x86_call(get_cpl)(vcpu)))
1339113391
return false;
1339213392

0 commit comments

Comments
 (0)