All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] Added code to ensure hot-added PCI devices are given an IRQ on rescan
@ 2014-07-10 15:47 Matthew Minter
  2014-07-16 22:00 ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Minter @ 2014-07-10 15:47 UTC (permalink / raw)
  To: linux-pci, bhelgaas

Some boards which contain physically hot-pluggable PCIe slots such as
8639 connectors can hot-add devices simply by connecting them while up
and writing to /sys/bus/pci/rescan.

This probes the device and loads a driver. However when a device is
added in this way it is not given an interrupt. Irqs seem to be passed
by the PCI BIOS, or emulated PCI BIOS in the case of non x86 arches
and so these hot-added cards naturally do not get one.

This means that when a device is added in this way, unless the device
and driver use only MSI/MSI-X it will try to request irq vector 0
which does not end well. To prevent this I have added a check for an
empty irq vector and use pdev_fixup_irq to set one at run time if one
has not been provided. This is done inside an unlikely block in order
to make negligible the performance impact on the normal PCI device
adding code path, this should not be a performance critical area
anyway as devices are not often added.

I have looked into instead modifying the rescan code however this
would be a less effective solution as there is no convenient way there
to run code between device probing and the driver loading and so would
need a significant redesign.

If anyone has any suggestions or feedback on this patch, or a better
way to solve this issue should there be one, I would be very grateful.

In addition I have only had the opportunity to test this code on non
x86 platforms so if anyone has a x86 or AMD64 PC with physical hot-add
capability I would be very appreciative if you could try running this.

Best regards,
Matthew

drivers/pci/bus.c | 11 +++++++++++
drivers/pci/setup-irq.c | 2 +-
include/linux/pci.h | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)

-- 


------------------------------
For additional information including the registered office and the treatment of Xyratex confidential information please visit www.xyratex.com

------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH RFC] Ensure hot-added PCI devices are given an IRQ on rescan
@ 2014-07-10 15:40 matthew_minter
  2014-07-10 15:40 ` [PATCH RFC] Added code to ensure " matthew_minter
  0 siblings, 1 reply; 6+ messages in thread
From: matthew_minter @ 2014-07-10 15:40 UTC (permalink / raw)
  To: linux-pci, bhelgaas

Some boards which contain physically hot-pluggable PCIe slots such as 8639 connectors can hot-add 
devices simply by connecting them while up and writing to /sys/bus/pci/rescan.

This probes the device and loads a driver. However when a device is added in this way it is not given 
an interrupt. Irqs seem to be passed by the PCI BIOS, or emulated PCI BIOS in the case of non x86 
arches and so these hot-added cards naturally do not get one.

This means that when a device is added in this way, unless the device and driver use only MSI/MSI-X it 
will try to request irq vector 0 which does not end well. To prevent this I have added a check for an 
empty irq vector and use pdev_fixup_irq to set one at run time if one has not been provided. This is 
done inside an unlikely block in order to make negligible the performance impact on the normal PCI 
device adding code path, this should not be a performance critical area anyway as devices are not 
often added.

I have looked into instead modifying the rescan code however this would be a less effective solution  
as there is no convenient way there to run code between device probing and the driver loading and so 
would need a significant redesign.

If anyone has any suggestions or feedback on this patch, or a better way to solve this issue should 
there be one, I would be very grateful.

In addition I have only had the opportunity to test this code on non x86 platforms so if anyone has a 
x86 or AMD64 PC with physical hot-add capability I would be very appreciative if you could try running 
this.

Best regards,
Matthew

 drivers/pci/bus.c       | 11 +++++++++++
 drivers/pci/setup-irq.c |  2 +-
 include/linux/pci.h     |  2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-08-06 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-10 15:47 [PATCH RFC] Added code to ensure hot-added PCI devices are given an IRQ on rescan Matthew Minter
2014-07-16 22:00 ` Bjorn Helgaas
2014-07-17 10:54   ` Matthew Minter
2014-07-20 23:41     ` Bjorn Helgaas
2014-08-06 16:00       ` Matthew Minter
  -- strict thread matches above, loose matches on Subject: below --
2014-07-10 15:40 [PATCH RFC] Ensure " matthew_minter
2014-07-10 15:40 ` [PATCH RFC] Added code to ensure " matthew_minter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.