From: Liran Alon <liran.alon@oracle.com>
To: pbonzini@redhat.com, rkrcmar@redhat.com, kvm@vger.kernel.org
Cc: brijesh.singh@amd.com, Liran Alon <liran.alon@oracle.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: [PATCH 2/2] KVM: x86: Rename need_emulation_on_page_fault() to handle_no_insn_on_page_fault()
Date: Mon, 15 Jul 2019 23:30:43 +0300 [thread overview]
Message-ID: <20190715203043.100483-3-liran.alon@oracle.com> (raw)
In-Reply-To: <20190715203043.100483-1-liran.alon@oracle.com>
I think this name is more appropriate to what the x86_ops method does.
In addition, modify VMX callback to return true as #PF handler can
proceed to emulation in this case. This didn't result in a bug
only because the callback is called when DecodeAssist is supported
which is currently supported only on SVM.
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
arch/x86/include/asm/kvm_host.h | 3 ++-
arch/x86/kvm/mmu.c | 2 +-
arch/x86/kvm/svm.c | 4 ++--
arch/x86/kvm/vmx/vmx.c | 6 +++---
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 450d69a1e6fa..536fd56f777d 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1201,7 +1201,8 @@ struct kvm_x86_ops {
uint16_t *vmcs_version);
uint16_t (*nested_get_evmcs_version)(struct kvm_vcpu *vcpu);
- bool (*need_emulation_on_page_fault)(struct kvm_vcpu *vcpu);
+ /* Returns true if #PF handler can proceed to emulation */
+ bool (*handle_no_insn_on_page_fault)(struct kvm_vcpu *vcpu);
};
struct kvm_arch_async_pf {
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1e9ba81accba..889de3ccf655 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5423,7 +5423,7 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code,
* guest, with the exception of AMD Erratum 1096 which is unrecoverable.
*/
if (unlikely(insn && !insn_len)) {
- if (!kvm_x86_ops->need_emulation_on_page_fault(vcpu))
+ if (!kvm_x86_ops->handle_no_insn_on_page_fault(vcpu))
return 1;
}
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 79023a41f7a7..ab89bb0de8df 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -7118,7 +7118,7 @@ static int nested_enable_evmcs(struct kvm_vcpu *vcpu,
return -ENODEV;
}
-static bool svm_need_emulation_on_page_fault(struct kvm_vcpu *vcpu)
+static bool svm_handle_no_insn_on_page_fault(struct kvm_vcpu *vcpu)
{
bool is_user, smap;
@@ -7291,7 +7291,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
.nested_enable_evmcs = nested_enable_evmcs,
.nested_get_evmcs_version = nested_get_evmcs_version,
- .need_emulation_on_page_fault = svm_need_emulation_on_page_fault,
+ .handle_no_insn_on_page_fault = svm_handle_no_insn_on_page_fault,
};
static int __init svm_init(void)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index f64bcbb03906..088fc6d943e9 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7419,9 +7419,9 @@ static int enable_smi_window(struct kvm_vcpu *vcpu)
return 0;
}
-static bool vmx_need_emulation_on_page_fault(struct kvm_vcpu *vcpu)
+static bool vmx_handle_no_insn_on_page_fault(struct kvm_vcpu *vcpu)
{
- return 0;
+ return true;
}
static __init int hardware_setup(void)
@@ -7726,7 +7726,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
.set_nested_state = NULL,
.get_vmcs12_pages = NULL,
.nested_enable_evmcs = NULL,
- .need_emulation_on_page_fault = vmx_need_emulation_on_page_fault,
+ .handle_no_insn_on_page_fault = vmx_handle_no_insn_on_page_fault,
};
static void vmx_cleanup_l1d_flush(void)
--
2.20.1
next prev parent reply other threads:[~2019-07-15 20:31 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-15 20:30 KVM: SVM: Fix workaround for AMD Errata 1096 Liran Alon
2019-07-15 20:30 ` [PATCH 1/2] " Liran Alon
2019-07-16 15:48 ` Singh, Brijesh
2019-07-16 15:56 ` Liran Alon
2019-07-16 16:07 ` Liran Alon
2019-07-16 16:10 ` Singh, Brijesh
2019-07-16 16:20 ` Liran Alon
2019-07-16 16:41 ` Sean Christopherson
2019-07-16 16:56 ` Liran Alon
2019-07-16 17:27 ` Sean Christopherson
2019-07-16 17:27 ` Paolo Bonzini
2019-07-16 17:35 ` Liran Alon
2019-07-16 19:28 ` Singh, Brijesh
2019-07-16 19:34 ` Liran Alon
2019-07-16 19:39 ` Paolo Bonzini
2019-07-16 19:45 ` Sean Christopherson
2019-07-16 19:50 ` Liran Alon
2019-07-16 19:47 ` Liran Alon
2019-07-16 19:41 ` Sean Christopherson
2019-07-16 19:52 ` Liran Alon
2019-07-16 20:02 ` Singh, Brijesh
2019-07-16 20:07 ` Sean Christopherson
2019-07-16 20:13 ` Paolo Bonzini
2019-07-16 20:09 ` Liran Alon
2019-07-16 20:27 ` Singh, Brijesh
2019-07-16 20:54 ` Sean Christopherson
2019-07-16 21:53 ` Liran Alon
2019-07-16 18:05 ` Singh, Brijesh
2019-07-16 18:06 ` Singh, Brijesh
2019-07-15 20:30 ` Liran Alon [this message]
2019-07-16 15:48 ` [PATCH 2/2] KVM: x86: Rename need_emulation_on_page_fault() to handle_no_insn_on_page_fault() Sean Christopherson
2019-07-16 16:01 ` Liran Alon
2019-07-16 16:10 ` Sean Christopherson
2019-07-16 19:33 ` Singh, Brijesh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190715203043.100483-3-liran.alon@oracle.com \
--to=liran.alon@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=brijesh.singh@amd.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).