KVM: ia64: fix zero extending for mmio ld1/2/4 emulation in KVM

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, June 11, 2008 - 6:05 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f20d27...
Commit:     f20d2752980c144c82649eb18746ef0c29f508dd
Parent:     39b945a37bac2b692773a470890c8ba301485b15
Author:     Jes Sorensen <jes@sgi.com>
AuthorDate: Tue May 20 13:13:50 2008 +0200
Committer:  Avi Kivity <avi@qumranet.com>
CommitDate: Fri Jun 6 21:08:25 2008 +0300

    KVM: ia64: fix zero extending for mmio ld1/2/4 emulation in KVM
    
    Only copy in the data actually requested by the instruction emulation
    and zero pad the destination register first. This avoids the problem
    where emulated mmio access got garbled data from ld2.acq instructions
    in the vga console driver.
    
    Signed-off-by: Jes Sorensen <jes@sgi.com>
    Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
    Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 arch/ia64/kvm/mmio.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/ia64/kvm/mmio.c b/arch/ia64/kvm/mmio.c
index 351bf70..7f1a858 100644
--- a/arch/ia64/kvm/mmio.c
+++ b/arch/ia64/kvm/mmio.c
@@ -159,7 +159,8 @@ static void mmio_access(struct kvm_vcpu *vcpu, u64 src_pa, u64 *dest,
 
 	if (p->u.ioreq.state == STATE_IORESP_READY) {
 		if (dir == IOREQ_READ)
-			*dest = p->u.ioreq.data;
+			/* it's necessary to ensure zero extending */
+			*dest = p->u.ioreq.data & (~0UL >> (64-(s*8)));
 	} else
 		panic_vm(vcpu);
 out:
--
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: ia64: fix zero extending for mmio ld1/2/4 emulation i ..., Linux Kernel Mailing ..., (Wed Jun 11, 6:05 pm)