aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>2010-02-05 03:52:46 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:36:09 -0500
commit1976d2d2c91246a37fcb8246b811de735aa6e9a4 (patch)
treeb4e12a5300fee56dafb59ad3b3d410d92a3b5f63 /arch
parent6316e1c8c6af6ccb55ff8564231710660608f46c (diff)
KVM: Remove redundant reading of rax on OUT instructions
kvm_emulate_pio() and complete_pio() both read out the RAX register value and copy it to a place into which the value read out from the port will be copied later. This patch removes this redundancy. /*** snippet from arch/x86/kvm/x86.c ***/ int complete_pio(struct kvm_vcpu *vcpu) { ... if (!io->string) { if (io->in) { val = kvm_register_read(vcpu, VCPU_REGS_RAX); memcpy(&val, vcpu->arch.pio_data, io->size); kvm_register_write(vcpu, VCPU_REGS_RAX, val); } ... Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/x86.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c91007f81660..bd3161c6daed 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3551,8 +3551,10 @@ int kvm_emulate_pio(struct kvm_vcpu *vcpu, int in, int size, unsigned port)
3551 trace_kvm_pio(vcpu->run->io.direction == KVM_EXIT_IO_OUT, port, 3551 trace_kvm_pio(vcpu->run->io.direction == KVM_EXIT_IO_OUT, port,
3552 size, 1); 3552 size, 1);
3553 3553
3554 val = kvm_register_read(vcpu, VCPU_REGS_RAX); 3554 if (!vcpu->arch.pio.in) {
3555 memcpy(vcpu->arch.pio_data, &val, 4); 3555 val = kvm_register_read(vcpu, VCPU_REGS_RAX);
3556 memcpy(vcpu->arch.pio_data, &val, 4);
3557 }
3556 3558
3557 if (!kernel_pio(vcpu, vcpu->arch.pio_data)) { 3559 if (!kernel_pio(vcpu, vcpu->arch.pio_data)) {
3558 complete_pio(vcpu); 3560 complete_pio(vcpu);