[PATCH] Add MSI support to puc(9)

John Baldwin jhb at freebsd.org
Thu Feb 27 20:09:25 UTC 2014


On Wednesday, February 26, 2014 2:22:48 pm Ryan Stone wrote:
> The Exar XR17V358 is a PCIe device and it supports a single MSI
> interrupt.  This patch will make puc(9) use an MSI interrupt on
> devices that declare that they support it:
> 
> http://people.freebsd.org/~rstone/patches/puc_msi.diff
> 
> This patch may be overly paranoid; I was worried that it's wasn't
> guaranteed that I could always call pci_alloc_msi() (forgetting that
> the P in puc stands for PCI) so I added a new puc_cfg_cmd that
> individual device config methods could implement to advertise support
> rather than depending on pci_alloc_msi() to behave sanely.
> 
> I have tested the patch on both a XR17V358 and a XR17V258 (which is a
> legacy PCI device that does not support PCI)

I would suggest reworking this so that you try MSI for all PCI devices.
I would do this by removing the 'sc_irid = 0' from puc_bfe_attach() so 
that it can be set by callers.  You could then add attach/detach routines in 
puc_pci.c that use pci_alloc_msi() and set sc_irid to 1 if MSI works.  The 
sc_irid value would also work as a flag for knowing if detach needs to call 
pci_release_msi() (or puc_pci_attach() handling failure in puc_bfe_attach()) 
(though I wouldn't be opposed to keeping sc_msi as a separate flag).

-- 
John Baldwin


More information about the freebsd-hackers mailing list