Re: Do other USB hosts support MSI?

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

 



> 
> > It appears that common MSI code is easy, but that implementing MSI-X
> > still requires replacing most of the generic hcd interrupt handling code
> > (either with a callback or by replacing the interrupt later).
> 
> Perhaps the HCD could provide an MSI/MSI-X call back function?  That
> would fit with Dong's current patch.
> 
> There's also issues with mapping IRQ to internal data structures.  The
> xHCI host is going to need to be able to map the irq number for the
> MSI-X vector into a specific event ring that needs to be serviced.
> I'm not exactly sure how that's going to work, maybe Dong has an idea?
> 
The HCD interrupt handling code can provide a MSI/MSI-X callback routine
with irq number so we can map into xHCI event ring to be serviced. Each
event ring and spin lock will associate with each irq number for the
MSI-X vector.

Thanks,
Dong  




> Sarah Sharp
> 
> > ---8<-------------------------------------------------------------->8---
> > USB: allow PCI controllers to use message-signaled interrupts
> > 
> > This patch adds the capability to use MSI to the PCI HCD framework.
> > 
> > To avoid problems with broken chips that have never been tested with
> > MSI, the HCD driver must explicitly consent before enabling MSI is
> > attempted.
> > 
> > NOT-yet-signed-off-by: Clemens Ladisch <clemens@xxxxxxxxxx>
> > ---
> >  include/linux/usb/hcd.h    |    3 +++
> >  drivers/usb/core/hcd-pci.c |   10 +++++++++-
> >  2 files changed, 12 insertions(+), 1 deletion(-)
> > 
> > --- a/include/linux/usb/hcd.h
> > +++ b/include/linux/usb/hcd.h
> > @@ -190,6 +190,9 @@ struct hc_driver {
> >  #define	HCD_USB3	0x0040		/* USB 3.0 */
> >  #define	HCD_MASK	0x0070
> >  
> > +	/* determines if hcd-pci should try to enable MSI */
> > +	bool	(*is_pci_msi_allowed) (struct usb_hcd *hcd);
> > +
> >  	/* called to init HCD and root hub */
> >  	int	(*reset) (struct usb_hcd *hcd);
> >  	int	(*start) (struct usb_hcd *hcd);
> > --- a/drivers/usb/core/hcd-pci.c
> > +++ b/drivers/usb/core/hcd-pci.c
> > @@ -176,6 +176,7 @@ int usb_hcd_pci_probe(struct pci_dev *de
> >  {
> >  	struct hc_driver	*driver;
> >  	struct usb_hcd		*hcd;
> > +	unsigned long		irqflags;
> >  	int			retval;
> >  
> >  	if (usb_disabled())
> > @@ -246,13 +247,19 @@ int usb_hcd_pci_probe(struct pci_dev *de
> >  
> >  	pci_set_master(dev);
> >  
> > -	retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
> > +	irqflags = IRQF_DISABLED | IRQF_SHARED;
> > +	if (driver->is_pci_msi_allowed && driver->is_pci_msi_allowed(hcd))
> > +		if (pci_enable_msi(dev) == 0)
> > +			irqflags &= ~IRQF_SHARED;
> > +
> > +	retval = usb_add_hcd(hcd, dev->irq, irqflags);
> >  	if (retval != 0)
> >  		goto err4;
> >  	set_hs_companion(dev, hcd);
> >  	return retval;
> >  
> >   err4:
> > +	pci_disable_msi(dev);
> >  	if (driver->flags & HCD_MEMORY) {
> >  		iounmap(hcd->regs);
> >   err3:
> > @@ -293,6 +300,7 @@ void usb_hcd_pci_remove(struct pci_dev *
> >  		return;
> >  
> >  	usb_remove_hcd(hcd);
> > +	pci_disable_msi(dev);
> >  	if (hcd->driver->flags & HCD_MEMORY) {
> >  		iounmap(hcd->regs);
> >  		release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> 



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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux