@@ -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 {
@@ -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)
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> --- tools/kvm/arm/include/arm-common/kvm-arch.h | 6 +++--- tools/kvm/arm/kvm-cpu.c | 4 ++-- tools/kvm/arm/kvm.c | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-)