tech-kern archive

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

RE: change MSI/MSI-X APIs



> From: tech-kern-owner%NetBSD.org@localhost [mailto:tech-kern-owner%NetBSD.org@localhost] On
> Behalf Of Kengo NAKAHARA
> 
> Hi
> 
> On 2015/05/11 23:18, Christos Zoulas wrote:
> > Can't we have a:
> >
> > 	int pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ih);
> >
> > for the drivers that have only one interrupt, and:
> >
> > 	int pci_intr_vector_map(struct pci_attach_args *pa,
> > 	    pci_intr_handle_t **ihp, size_t *nih);
> >
> > for drivers that can handle more than one?
> 
> Because some device drivers must select INTx, MSI, or MSI-X depending
> on using devices; e.g. some devices have errata about MSI-X,
> so the device driver cannot use MSI-X even if the devices have
> MSI-X capability. In addition, some other the device drivers should
> use MSI-X and INTx only since some devices have errata about MSI.
> In a similar way, other device drivers should use MSI-X and MSI only.
> 
> These selection logic codes can be done only in the device drivers
> codes, therefore it is required for the device drivers to be able to
> select interrupt types by allocation APIs.

I completely understand that *some* devices have this problem. But many
devices do not. It seems that the current API penalizes drivers for devices
that are done correctly. Would it not make more sense to make drivers more
complex only for devices that require the complexity?

One way to handle this without multiplying APIs unnecessarily is to have a
flags argument to pci_intr_map() and pci_intr_vector_map() that allows the
driver to restrict the mapping. The driver for the broken case would have to
fill out more of the interrupt structure, but the simple driver could be
simple.

I'm sure there are even better ways to handle this variation; just making a
concrete example of how it might be done.

Best regards,
--Terry




Home | Main Index | Thread Index | Old Index