From 25c437b01f3a04af5362c7fd80ba91a0ec74f007 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang Date: Wed, 7 May 2008 17:34:52 +0800 Subject: KVM: ia64: fix GVMM module including position-dependent objects The GVMM module is position independent since it is relocated to the guest address space. Commit ea696f9cf ("ia64 kvm fixes for O=... builds") broke this by linking GVMM with non-PIC objects. Fix by creating two files: memset.S and memcpy.S which just include the files under arch/ia64/lib/{memset.S, memcpy.S} respectively. [akpm: don't delete files which we need] Signed-off-by: Xiantao Zhang Signed-off-by: Andrew Morton Signed-off-by: Avi Kivity --- arch/ia64/kvm/Makefile | 3 +-- arch/ia64/kvm/memcpy.S | 1 + arch/ia64/kvm/memset.S | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 arch/ia64/kvm/memcpy.S create mode 100644 arch/ia64/kvm/memset.S (limited to 'arch/ia64/kvm') diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile index 52353397a1a4..112791dd2542 100644 --- a/arch/ia64/kvm/Makefile +++ b/arch/ia64/kvm/Makefile @@ -7,7 +7,6 @@ offsets-file := asm-offsets.h always := $(offsets-file) targets := $(offsets-file) targets += arch/ia64/kvm/asm-offsets.s -clean-files := $(addprefix $(objtree)/,$(targets) $(obj)/memcpy.S $(obj)/memset.S) # Default sed regexp - multiline due to syntax constraints define sed-y @@ -54,5 +53,5 @@ EXTRA_CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127 kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ vtlb.o process.o #Add link memcpy and memset to avoid possible structure assignment error -kvm-intel-objs += ../lib/memset.o ../lib/memcpy.o +kvm-intel-objs += memcpy.o memset.o obj-$(CONFIG_KVM_INTEL) += kvm-intel.o diff --git a/arch/ia64/kvm/memcpy.S b/arch/ia64/kvm/memcpy.S new file mode 100644 index 000000000000..c04cdbe9f80f --- /dev/null +++ b/arch/ia64/kvm/memcpy.S @@ -0,0 +1 @@ +#include "../lib/memcpy.S" diff --git a/arch/ia64/kvm/memset.S b/arch/ia64/kvm/memset.S new file mode 100644 index 000000000000..83c3066d844a --- /dev/null +++ b/arch/ia64/kvm/memset.S @@ -0,0 +1 @@ +#include "../lib/memset.S" -- cgit v1.2.3 From f20d2752980c144c82649eb18746ef0c29f508dd Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Tue, 20 May 2008 13:13:50 +0200 Subject: 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 Acked-by: Xiantao Zhang Signed-off-by: Avi Kivity --- arch/ia64/kvm/mmio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/ia64/kvm') diff --git a/arch/ia64/kvm/mmio.c b/arch/ia64/kvm/mmio.c index 351bf70da463..7f1a858bc69f 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: -- cgit v1.2.3