aboutsummaryrefslogtreecommitdiffstats
path: root/arm
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2014-05-27 11:24:19 +0100
committerWill Deacon <will.deacon@arm.com>2015-06-01 16:39:55 +0100
commit4123ca555b1d466b08c630763a378b4d53de9ec5 (patch)
tree65d4aa0bf3dce7b05026790ec35bd68dc3a5e5a3 /arm
parentfc9d8ec3e459b744c012b9c82924aa397099ab19 (diff)
downloadkvmtool-4123ca555b1d466b08c630763a378b4d53de9ec5.tar.gz
kvmtool: virtio: pass trapped vcpu to IO accessors
The recent introduction of bi-endianness on arm/arm64 had the odd effect of breaking virtio-pci support on these platforms, as the device endian field defaults to being VIRTIO_ENDIAN_HOST, which is the wrong thing to have on a bi-endian capable architecture. The fix is to check for the endianness on the ioport path the same way we do it for mmio, which implies passing the vcpu all the way down. Patch is a bit ugly, but aligns MMIO and ioport nicely. Tested on arm64 and x86. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'arm')
-rw-r--r--arm/include/arm-common/kvm-cpu-arch.h2
-rw-r--r--arm/kvm-cpu.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/arm/include/arm-common/kvm-cpu-arch.h b/arm/include/arm-common/kvm-cpu-arch.h
index 355a02d7..83cd8b83 100644
--- a/arm/include/arm-common/kvm-cpu-arch.h
+++ b/arm/include/arm-common/kvm-cpu-arch.h
@@ -36,7 +36,7 @@ struct kvm_arm_target {
int kvm_cpu__register_kvm_arm_target(struct kvm_arm_target *target);
-static inline bool kvm_cpu__emulate_io(struct kvm *kvm, u16 port, void *data,
+static inline bool kvm_cpu__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data,
int direction, int size, u32 count)
{
return false;
diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c
index 53afa359..aeaa4cfb 100644
--- a/arm/kvm-cpu.c
+++ b/arm/kvm-cpu.c
@@ -106,7 +106,7 @@ bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data,
} else if (arm_addr_in_ioport_region(phys_addr)) {
int direction = is_write ? KVM_EXIT_IO_OUT : KVM_EXIT_IO_IN;
u16 port = (phys_addr - KVM_IOPORT_AREA) & USHRT_MAX;
- return kvm__emulate_io(vcpu->kvm, port, data, direction, len, 1);
+ return kvm__emulate_io(vcpu, port, data, direction, len, 1);
} else if (arm_addr_in_pci_region(phys_addr)) {
return kvm__emulate_mmio(vcpu, phys_addr, data, len, is_write);
}