aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2015-03-09 15:27:43 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2015-03-13 12:27:54 -0400
commitb34a80517bfcd917bc59d9670d8f465a564af3b9 (patch)
tree62ef3413dcba6273b8e59c892308ef8c5292e29c /arch/x86
parent5e57518d99725e8b4ee34cc94669afb79e4cfe4e (diff)
KVM: x86: Fix re-execution of patched vmmcall
For a very long time (since 2b3d2a20), the path handling a vmmcall instruction of the guest on an Intel host only applied the patch but no longer handled the hypercall. The reverse case, vmcall on AMD hosts, is fine. As both em_vmcall and em_vmmcall actually have to do the same, we can fix the issue by consolidating both into the same handler. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/emulate.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 106c01557f2b..c941abe800ef 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3323,7 +3323,7 @@ static int em_clts(struct x86_emulate_ctxt *ctxt)
3323 return X86EMUL_CONTINUE; 3323 return X86EMUL_CONTINUE;
3324} 3324}
3325 3325
3326static int em_vmcall(struct x86_emulate_ctxt *ctxt) 3326static int em_hypercall(struct x86_emulate_ctxt *ctxt)
3327{ 3327{
3328 int rc = ctxt->ops->fix_hypercall(ctxt); 3328 int rc = ctxt->ops->fix_hypercall(ctxt);
3329 3329
@@ -3395,17 +3395,6 @@ static int em_lgdt(struct x86_emulate_ctxt *ctxt)
3395 return em_lgdt_lidt(ctxt, true); 3395 return em_lgdt_lidt(ctxt, true);
3396} 3396}
3397 3397
3398static int em_vmmcall(struct x86_emulate_ctxt *ctxt)
3399{
3400 int rc;
3401
3402 rc = ctxt->ops->fix_hypercall(ctxt);
3403
3404 /* Disable writeback. */
3405 ctxt->dst.type = OP_NONE;
3406 return rc;
3407}
3408
3409static int em_lidt(struct x86_emulate_ctxt *ctxt) 3398static int em_lidt(struct x86_emulate_ctxt *ctxt)
3410{ 3399{
3411 return em_lgdt_lidt(ctxt, false); 3400 return em_lgdt_lidt(ctxt, false);
@@ -3769,7 +3758,7 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt)
3769 3758
3770static const struct opcode group7_rm0[] = { 3759static const struct opcode group7_rm0[] = {
3771 N, 3760 N,
3772 I(SrcNone | Priv | EmulateOnUD, em_vmcall), 3761 I(SrcNone | Priv | EmulateOnUD, em_hypercall),
3773 N, N, N, N, N, N, 3762 N, N, N, N, N, N,
3774}; 3763};
3775 3764
@@ -3781,7 +3770,7 @@ static const struct opcode group7_rm1[] = {
3781 3770
3782static const struct opcode group7_rm3[] = { 3771static const struct opcode group7_rm3[] = {
3783 DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa), 3772 DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa),
3784 II(SrcNone | Prot | EmulateOnUD, em_vmmcall, vmmcall), 3773 II(SrcNone | Prot | EmulateOnUD, em_hypercall, vmmcall),
3785 DIP(SrcNone | Prot | Priv, vmload, check_svme_pa), 3774 DIP(SrcNone | Prot | Priv, vmload, check_svme_pa),
3786 DIP(SrcNone | Prot | Priv, vmsave, check_svme_pa), 3775 DIP(SrcNone | Prot | Priv, vmsave, check_svme_pa),
3787 DIP(SrcNone | Prot | Priv, stgi, check_svme), 3776 DIP(SrcNone | Prot | Priv, stgi, check_svme),