[PATCH kvmtool 11/16] arm/pci: Remove unused ioports

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

 



ARM does not use the PCI_CONFIG_DATA and PCI_CONFIG_ADDRESS I/O ports and
has no way of knowing about them, since they are not generated in the DTB
file. Do not register these I/O addresses for the ARM architecture.

Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
---
 pci.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/pci.c b/pci.c
index 689869cb79a3..88ee78ad7d08 100644
--- a/pci.c
+++ b/pci.c
@@ -68,7 +68,9 @@ static void *pci_config_address_ptr(u16 port)
 	return base + offset;
 }
 
-static bool pci_config_address_out(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void *data, int size)
+static bool __used pci_config_address_out(struct ioport *ioport,
+					  struct kvm_cpu *vcpu,
+					  u16 port, void *data, int size)
 {
 	void *p = pci_config_address_ptr(port);
 
@@ -77,7 +79,9 @@ static bool pci_config_address_out(struct ioport *ioport, struct kvm_cpu *vcpu,
 	return true;
 }
 
-static bool pci_config_address_in(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void *data, int size)
+static bool __used pci_config_address_in(struct ioport *ioport,
+					 struct kvm_cpu *vcpu,
+					 u16 port, void *data, int size)
 {
 	void *p = pci_config_address_ptr(port);
 
@@ -86,7 +90,7 @@ static bool pci_config_address_in(struct ioport *ioport, struct kvm_cpu *vcpu, u
 	return true;
 }
 
-static struct ioport_operations pci_config_address_ops = {
+static struct ioport_operations __used pci_config_address_ops = {
 	.io_in	= pci_config_address_in,
 	.io_out	= pci_config_address_out,
 };
@@ -106,7 +110,9 @@ static bool pci_device_exists(u8 bus_number, u8 device_number, u8 function_numbe
 	return !IS_ERR_OR_NULL(device__find_dev(DEVICE_BUS_PCI, device_number));
 }
 
-static bool pci_config_data_out(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void *data, int size)
+static bool __used pci_config_data_out(struct ioport *ioport,
+				       struct kvm_cpu *vcpu,
+				       u16 port, void *data, int size)
 {
 	union pci_config_address pci_config_address;
 
@@ -122,7 +128,9 @@ static bool pci_config_data_out(struct ioport *ioport, struct kvm_cpu *vcpu, u16
 	return true;
 }
 
-static bool pci_config_data_in(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void *data, int size)
+static bool __used pci_config_data_in(struct ioport *ioport,
+				      struct kvm_cpu *vcpu,
+				      u16 port, void *data, int size)
 {
 	union pci_config_address pci_config_address;
 
@@ -138,7 +146,7 @@ static bool pci_config_data_in(struct ioport *ioport, struct kvm_cpu *vcpu, u16
 	return true;
 }
 
-static struct ioport_operations pci_config_data_ops = {
+static struct ioport_operations __used pci_config_data_ops = {
 	.io_in	= pci_config_data_in,
 	.io_out	= pci_config_data_out,
 };
@@ -225,6 +233,13 @@ struct pci_device_header *pci__find_dev(u8 dev_num)
 	return hdr->data;
 }
 
+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
+int pci__init(struct kvm *kvm)
+{
+	return kvm__register_mmio(kvm, KVM_PCI_CFG_AREA, PCI_CFG_SIZE, false,
+				  pci_config_mmio_access, kvm);
+}
+#else
 int pci__init(struct kvm *kvm)
 {
 	int r;
@@ -250,6 +265,7 @@ err_unregister_data:
 	ioport__unregister(kvm, PCI_CONFIG_DATA);
 	return r;
 }
+#endif
 dev_base_init(pci__init);
 
 int pci__exit(struct kvm *kvm)
-- 
2.7.4




[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