[tip:tools/kvm] kvm tools: ARM: route guest PCI accesses to the emulation layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  5e5ddcaf5d6b027dd55b3fb7466d7c062dabbdad
Gitweb:     http://git.kernel.org/tip/5e5ddcaf5d6b027dd55b3fb7466d7c062dabbdad
Author:     Will Deacon <will.deacon@xxxxxxx>
AuthorDate: Tue, 4 Feb 2014 16:54:02 +0000
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Sun, 16 Feb 2014 21:54:59 +0200

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@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 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(-)

diff --git a/tools/kvm/arm/include/arm-common/kvm-arch.h b/tools/kvm/arm/include/arm-common/kvm-arch.h
index 348e88d..8adfcd4 100644
--- a/tools/kvm/arm/include/arm-common/kvm-arch.h
+++ b/tools/kvm/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/tools/kvm/arm/kvm-cpu.c b/tools/kvm/arm/kvm-cpu.c
index d31e7b1..b017994 100644
--- a/tools/kvm/arm/kvm-cpu.c
+++ b/tools/kvm/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;
diff --git a/tools/kvm/arm/kvm.c b/tools/kvm/arm/kvm.c
index 008b7fe..6db646b 100644
--- a/tools/kvm/arm/kvm.c
+++ b/tools/kvm/arm/kvm.c
@@ -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)
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux