Skip to contentSkip to conversation

vfio: fix link failures when CONFIG_PCI_MSI is disabled

PATCH In review Luis Henriques 2 participants 5 messages Feb 3, 2016 – Feb 17, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: fix link failures when CONFIG_PCI_MSI is disabled

The following link failure occurs when CONFIG_PCI_MSI is not set:

drivers/built-in.o: In function `vfio_msi_set_vector_signal':
:(.text+0x626640): undefined reference to `pci_write_msi_msg'

---
 drivers/vfio/pci/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/Kconfig +1 -1
index 02912f180c6d..b9dbfc9aeee1 100644
@@ -1,6 +1,6 @@
 config VFIO_PCI
 	tristate "VFIO support for PCI devices"
-	depends on VFIO && PCI && EVENTFD
+	depends on VFIO && PCI_MSI && EVENTFD
 	select VFIO_VIRQFD
 	select IRQ_BYPASS_MANAGER
 	help

Cheers,

#1 lore raw
Quoted 16 lines · On Wed, 3 Feb 2016 20:51:08 +0000 Luis Henriques…

The following link failure occurs when CONFIG_PCI_MSI is not set:

drivers/built-in.o: In function `vfio_msi_set_vector_signal':
:(.text+0x626640): undefined reference to `pci_write_msi_msg'

---
 drivers/vfio/pci/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/Kconfig +0 -0
index 02912f180c6d..b9dbfc9aeee1 100644

drivers/vfio/pci/Kconfig line 6

Quoted 7 lines
drivers/vfio/pci/Kconfig +1 -1
@@ -1,6 +1,6 @@
 config VFIO_PCI
 	tristate "VFIO support for PCI devices"
-	depends on VFIO && PCI && EVENTFD
+	depends on VFIO && PCI_MSI && EVENTFD
 	select VFIO_VIRQFD
 	select IRQ_BYPASS_MANAGER
 	help

It seems like a better solution would be to have pci stub these out with static inlines when !CONFIG_PCI_MSI, we already do that for quite a lot of MSI and MSI-X callbacks. MSI/X on the device clearly won't work if the host doesn't support MSI, and maybe there are improvements to be made there, but MSI is a subcomponent of vfio-pci, the module itself shouldn't depend on MSI. Thanks,

Alex

#2 lore raw
Quoted 35 lines · Alex Williamson
Quoted 16 lines · On Wed, 3 Feb 2016 20:51:08 +0000 Luis Henriques…

The following link failure occurs when CONFIG_PCI_MSI is not set:

drivers/built-in.o: In function `vfio_msi_set_vector_signal':
:(.text+0x626640): undefined reference to `pci_write_msi_msg'

---
 drivers/vfio/pci/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/Kconfig +0 -0
index 02912f180c6d..b9dbfc9aeee1 100644

drivers/vfio/pci/Kconfig line 6

Quoted 7 lines
drivers/vfio/pci/Kconfig +1 -1
@@ -1,6 +1,6 @@
 config VFIO_PCI
 	tristate "VFIO support for PCI devices"
-	depends on VFIO && PCI && EVENTFD
+	depends on VFIO && PCI_MSI && EVENTFD
 	select VFIO_VIRQFD
 	select IRQ_BYPASS_MANAGER
 	help

It seems like a better solution would be to have pci stub these out with static inlines when !CONFIG_PCI_MSI, we already do that for quite a lot of MSI and MSI-X callbacks. MSI/X on the device clearly won't work if the host doesn't support MSI, and maybe there are improvements to be made there, but MSI is a subcomponent of vfio-pci, the module itself shouldn't depend on MSI. Thanks,

Quoted 2 lines

Alex

Thanks for reviewing. I'll submit a new patch later today, stubbing pci_write_msi_msg() to fix this failure.

Cheers,

#3 lore raw

PATCH 1/1 PCI/MSI: stub pci_write_msi_msg when CONFIG_PCI_MSI is disabled

In reply to Luis Henriques

Stubbing function pci_write_msi_msg when CONFIG_PCI_MSI is disabled fixes a link failure in vfio:

drivers/built-in.o: In function `vfio_msi_set_vector_signal':
:(.text+0x626640): undefined reference to `pci_write_msi_msg'

---
 include/linux/msi.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/msi.h +2 -1
index a2a0068a8387..09dc375d11d8 100644
@@ -105,18 +105,19 @@ struct msi_desc {
 
 struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc);
 void *msi_desc_to_pci_sysdata(struct msi_desc *desc);
+void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
 #else /* CONFIG_PCI_MSI */
 static inline void *msi_desc_to_pci_sysdata(struct msi_desc *desc)
 {
 	return NULL;
 }
+static inline void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg) { }
 #endif /* CONFIG_PCI_MSI */
 
 struct msi_desc *alloc_msi_entry(struct device *dev);
 void free_msi_entry(struct msi_desc *entry);
 void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
 void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
-void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
 
 u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag);
 u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag);
#4 lore raw

Re: [PATCH] PCI/MSI: stub pci_write_msi_msg when CONFIG_PCI_MSI is disabled

[cc +bjorn, +linux-pci]

Quoted 36 lines · On Wed, 17 Feb 2016 21:05:38 +0000 Luis Henriques…

Stubbing function pci_write_msi_msg when CONFIG_PCI_MSI is disabled fixes a link failure in vfio:

drivers/built-in.o: In function `vfio_msi_set_vector_signal':
:(.text+0x626640): undefined reference to `pci_write_msi_msg'

---
 include/linux/msi.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/msi.h +2 -1
index a2a0068a8387..09dc375d11d8 100644
@@ -105,18 +105,19 @@ struct msi_desc {
 
 struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc);
 void *msi_desc_to_pci_sysdata(struct msi_desc *desc);
+void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
 #else /* CONFIG_PCI_MSI */
 static inline void *msi_desc_to_pci_sysdata(struct msi_desc *desc)
 {
 	return NULL;
 }
+static inline void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg) { }
 #endif /* CONFIG_PCI_MSI */
 
 struct msi_desc *alloc_msi_entry(struct device *dev);
 void free_msi_entry(struct msi_desc *entry);
 void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
 void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
-void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
 
 u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag);
 u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag);