From: Gleb Natapov on
If guest indicates that it can handle async pf in kernel mode too send
it, but only if interrupt are enabled.

Reviewed-by: Rik van Riel <riel(a)redhat.com>
Signed-off-by: Gleb Natapov <gleb(a)redhat.com>
---
arch/x86/kvm/mmu.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 12d1a7b..ed87b1c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2361,7 +2361,13 @@ static bool can_do_async_pf(struct kvm_vcpu *vcpu)
if (!vcpu->arch.apf_data || kvm_event_needs_reinjection(vcpu))
return false;

- return !!kvm_x86_ops->get_cpl(vcpu);
+ if (vcpu->arch.apf_send_user_only)
+ return !!kvm_x86_ops->get_cpl(vcpu);
+
+ if (!kvm_x86_ops->interrupt_allowed(vcpu))
+ return false;
+
+ return true;
}

static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, u32 error_code,
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/