KVM: fix kvm_fix_hypercall() to return X86EMUL_*

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, March 5, 2010 - 3:00 pm

Gitweb:     http://git.kernel.org/linus/7edcface95c6e593faa40c70e0464500515db573
Commit:     7edcface95c6e593faa40c70e0464500515db573
Parent:     c125c607326928001983f51109c3d0c190f0a8bb
Author:     Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
AuthorDate: Mon Feb 1 22:11:52 2010 +0900
Committer:  Marcelo Tosatti <mtosatti@redhat.com>
CommitDate: Mon Mar 1 12:36:07 2010 -0300

    KVM: fix kvm_fix_hypercall() to return X86EMUL_*
    
    This patch fixes kvm_fix_hypercall() to propagate X86EMUL_*
    info generated by emulator_write_emulated() to its callers:
    suggested by Marcelo.
    
    The effect of this is x86_emulate_insn() will begin to handle
    the page faults which occur in emulator_write_emulated():
    this should be OK because emulator_write_emulated_onepage()
    always injects page fault when emulator_write_emulated()
    returns X86EMUL_PROPAGATE_FAULT.
    
    Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
    Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
---
 arch/x86/kvm/x86.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 01f0b03..c91007f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3888,10 +3888,8 @@ EXPORT_SYMBOL_GPL(kvm_emulate_hypercall);
 int kvm_fix_hypercall(struct kvm_vcpu *vcpu)
 {
 	char instruction[3];
-	int ret = 0;
 	unsigned long rip = kvm_rip_read(vcpu);
 
-
 	/*
 	 * Blow out the MMU to ensure that no other VCPU has an active mapping
 	 * to ensure that the updated hypercall appears atomically across all
@@ -3900,11 +3898,8 @@ int kvm_fix_hypercall(struct kvm_vcpu *vcpu)
 	kvm_mmu_zap_all(vcpu->kvm);
 
 	kvm_x86_ops->patch_hypercall(vcpu, instruction);
-	if (emulator_write_emulated(rip, instruction, 3, vcpu)
-	    != X86EMUL_CONTINUE)
-		ret = -EFAULT;
 
-	return ret;
+	return emulator_write_emulated(rip, instruction, 3, vcpu);
 }
 
 static u64 mk_cr_64(u64 curr_cr, u32 new_val)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
KVM: fix kvm_fix_hypercall() to return X86EMUL_*, Linux Kernel Mailing ..., (Fri Mar 5, 3:00 pm)