diff options
author | Will Deacon <will.deacon@arm.com> | 2014-02-04 16:54:02 +0000 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2015-06-01 16:39:55 +0100 |
commit | fcc922bf629aca8ceae687d549b33cbfb4b6499d (patch) | |
tree | c9d491b69983ceeace5663e450f26ab16816ee6e | |
parent | b59816369a88e95a8b47b0d16aee31ef074e35fd (diff) | |
download | kvmtool-fcc922bf629aca8ceae687d549b33cbfb4b6499d.tar.gz |
kvm tools: ARM: route guest PCI accesses to the emulation layer
This patch routes guest PCI accesses to kvm__emulate_mmio, rather than
exiting lkvm via a die invocation. The guest command-line is also
updated to prevent the guest from attempting to program the BARs with
new addresses (i.e. probe-only).
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | arm/include/arm-common/kvm-arch.h | 6 | ||||
-rw-r--r-- | arm/kvm-cpu.c | 4 | ||||
-rw-r--r-- | arm/kvm.c | 5 |
3 files changed, 10 insertions, 5 deletions
diff --git a/arm/include/arm-common/kvm-arch.h b/arm/include/arm-common/kvm-arch.h index 348e88d0..8adfcd49 100644 --- a/arm/include/arm-common/kvm-arch.h +++ b/arm/include/arm-common/kvm-arch.h @@ -46,10 +46,10 @@ static inline bool arm_addr_in_virtio_mmio_region(u64 phys_addr) return phys_addr >= KVM_VIRTIO_MMIO_AREA && phys_addr < limit; } -static inline bool arm_addr_in_pci_mmio_region(u64 phys_addr) +static inline bool arm_addr_in_pci_region(u64 phys_addr) { - u64 limit = KVM_PCI_MMIO_AREA + ARM_PCI_MMIO_SIZE; - return phys_addr >= KVM_PCI_MMIO_AREA && phys_addr < limit; + u64 limit = KVM_PCI_CFG_AREA + ARM_PCI_CFG_SIZE + ARM_PCI_MMIO_SIZE; + return phys_addr >= KVM_PCI_CFG_AREA && phys_addr < limit; } struct kvm_arch { diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c index d31e7b15..b017994f 100644 --- a/arm/kvm-cpu.c +++ b/arm/kvm-cpu.c @@ -107,8 +107,8 @@ bool kvm_cpu__emulate_mmio(struct kvm *kvm, u64 phys_addr, u8 *data, u32 len, int direction = is_write ? KVM_EXIT_IO_OUT : KVM_EXIT_IO_IN; u16 port = phys_addr & USHRT_MAX; return kvm__emulate_io(kvm, port, data, direction, len, 1); - } else if (arm_addr_in_pci_mmio_region(phys_addr)) { - die("PCI emulation not supported on ARM!"); + } else if (arm_addr_in_pci_region(phys_addr)) { + return kvm__emulate_mmio(kvm, phys_addr, data, len, is_write); } return false; @@ -56,6 +56,11 @@ void kvm__arch_read_term(struct kvm *kvm) void kvm__arch_set_cmdline(char *cmdline, bool video) { + /* + * We don't support movable BARs, so force the guest to use what + * we tell it. + */ + strcpy(cmdline, "pci=firmware"); } void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size) |