mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-06 13:41:44 +00:00
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>
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
#ifndef KVM__KVM_CPU_ARCH_H
|
|
#define KVM__KVM_CPU_ARCH_H
|
|
|
|
/* Architecture-specific kvm_cpu definitions. */
|
|
|
|
#include <linux/kvm.h> /* for struct kvm_regs */
|
|
#include "kvm/kvm.h" /* for kvm__emulate_{mm}io() */
|
|
#include <stdbool.h>
|
|
#include <pthread.h>
|
|
|
|
struct kvm;
|
|
|
|
struct kvm_cpu {
|
|
pthread_t thread; /* VCPU thread */
|
|
|
|
unsigned long cpu_id;
|
|
|
|
struct kvm *kvm; /* parent KVM */
|
|
int vcpu_fd; /* For VCPU ioctls() */
|
|
struct kvm_run *kvm_run;
|
|
|
|
struct kvm_regs regs;
|
|
struct kvm_sregs sregs;
|
|
struct kvm_fpu fpu;
|
|
|
|
struct kvm_msrs *msrs; /* dynamically allocated */
|
|
|
|
u8 is_running;
|
|
u8 paused;
|
|
u8 needs_nmi;
|
|
|
|
struct kvm_coalesced_mmio_ring *ring;
|
|
};
|
|
|
|
/*
|
|
* As these are such simple wrappers, let's have them in the header so they'll
|
|
* be cheaper to call:
|
|
*/
|
|
static inline bool kvm_cpu__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, int direction, int size, u32 count)
|
|
{
|
|
return kvm__emulate_io(vcpu, port, data, direction, size, count);
|
|
}
|
|
|
|
static inline bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, u32 len, u8 is_write)
|
|
{
|
|
return kvm__emulate_mmio(vcpu, phys_addr, data, len, is_write);
|
|
}
|
|
|
|
#endif /* KVM__KVM_CPU_ARCH_H */
|