[RFC PATCH 05/11] kvm tools: allow ioports to be offset from 0

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

 



Architectures without a legacy ioport may wish to emulate one, but not
at address 0x0.

This patch introduces KVM_IOPORT_AREA, which each architecture defines
to be the start of the ioport region (i.e. where port addresses are
offset from).

Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
---
 tools/kvm/arm/include/arm-common/kvm-arch.h | 5 +++--
 tools/kvm/powerpc/include/kvm/kvm-arch.h    | 1 +
 tools/kvm/x86/include/kvm/kvm-arch.h        | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/arm/include/arm-common/kvm-arch.h b/tools/kvm/arm/include/arm-common/kvm-arch.h
index 03ead5b..72b204f 100644
--- a/tools/kvm/arm/include/arm-common/kvm-arch.h
+++ b/tools/kvm/arm/include/arm-common/kvm-arch.h
@@ -21,6 +21,7 @@
 #define ARM_VIRTIO_MMIO_SIZE	(ARM_AXI_AREA - (ARM_MMIO_AREA + ARM_GIC_SIZE))
 #define ARM_PCI_MMIO_SIZE	(ARM_MEMORY_AREA - ARM_AXI_AREA)
 
+#define KVM_IOPORT_AREA		ARM_IOPORT_AREA
 #define KVM_PCI_MMIO_AREA	ARM_AXI_AREA
 #define KVM_VIRTIO_MMIO_AREA	ARM_MMIO_AREA
 
@@ -28,8 +29,8 @@
 
 static inline bool arm_addr_in_ioport_region(u64 phys_addr)
 {
-	u64 limit = ARM_IOPORT_AREA + ARM_IOPORT_SIZE;
-	return phys_addr >= ARM_IOPORT_AREA && phys_addr < limit;
+	u64 limit = KVM_IOPORT_AREA + ARM_IOPORT_SIZE;
+	return phys_addr >= KVM_IOPORT_AREA && phys_addr < limit;
 }
 
 static inline bool arm_addr_in_virtio_mmio_region(u64 phys_addr)
diff --git a/tools/kvm/powerpc/include/kvm/kvm-arch.h b/tools/kvm/powerpc/include/kvm/kvm-arch.h
index d93e142..96dea91 100644
--- a/tools/kvm/powerpc/include/kvm/kvm-arch.h
+++ b/tools/kvm/powerpc/include/kvm/kvm-arch.h
@@ -37,6 +37,7 @@
  * This is the address that pci_get_io_space_block() starts allocating
  * from.  Note that this is a PCI bus address.
  */
+#define KVM_IOPORT_AREA			0x0
 #define KVM_PCI_MMIO_AREA		0x1000000
 #define KVM_VIRTIO_MMIO_AREA		0x2000000
 
diff --git a/tools/kvm/x86/include/kvm/kvm-arch.h b/tools/kvm/x86/include/kvm/kvm-arch.h
index 1e0949e..6d59c8e5 100644
--- a/tools/kvm/x86/include/kvm/kvm-arch.h
+++ b/tools/kvm/x86/include/kvm/kvm-arch.h
@@ -20,6 +20,7 @@
 /* This is the address that pci_get_io_space_block() starts allocating
  * from.  Note that this is a PCI bus address (though same on x86).
  */
+#define KVM_IOPORT_AREA		0x0
 #define KVM_PCI_MMIO_AREA	(KVM_MMIO_START + 0x1000000)
 #define KVM_VIRTIO_MMIO_AREA	(KVM_MMIO_START + 0x2000000)
 
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux