Re: [PATCH] pci/msi: Allow arch code to return the number of MSI-X available

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

 



On Tue, 2009-02-10 at 22:53 -0700, Matthew Wilcox wrote:
> I've been working on support for systems with large numbers of MSI-X
> vectors.  Here's the architecture interface I'm currently working with:
> 
> extern int arch_msi_check_device(struct pci_dev *, int nvec, int type);
> extern int arch_setup_msi_irqs(struct pci_dev *, int nvec);
> extern int arch_setup_msix_irq(struct pci_dev *, int irq);
> extern void arch_teardown_msi_irqs(struct pci_dev *);
> 
> and the MSI-X code looks like this:
> 
>         for (i = 0; i < nvec; i++) {
>                 unsigned irq, table_entry = entries[i].entry;
>                 struct msi_desc desc;
>                 ret = arch_setup_msix_irq(dev, table_entry);
> 
> I now perceive this would throw a bit of a spanner in the works for ppc.

If that was the generic code then yes. We can't (sanely) allocate them
one at a time.

> How about the following API?
> 
> /*
>  * Set up nvec MSI interrupts.  Returns 0 on success, a positive number if
>  * it could have set up fewer interrupts than requested, or -Errno for other
>  * errors
>  */
> int arch_msi_setup_irqs(struct pci_dev *, int nvec);
> void arch_msi_free_irqs(struct pci_dev *);
> 
> /*
>  * Allocate nvec MSI-X interrupts.  Returns 0 on success, a positive number if
>  * it could have set up fewer interrupts than requested, or -Errno for other
>  * errors
>  */
> int arch_msix_alloc_irqs(struct pci_dev *, int nvec);
> 
> /*
>  * Program the @table_entry MSI-X interrupt on the card.  Returns the Linux
>  * interrupt number on success or -Errno if an error occurs.
>  */
> int arch_msix_setup_irq(struct pci_dev *, int table_entry);
> void arch_msix_free_irqs(struct pci_dev *);
> 
> There's a lot more I can say about the heavily patched msi.c file I have
> here ... but perhaps I'll save that for another day.


I'm not quite sure I follow. Your MSI-X routine is still setting up just
one irq, that won't work for us.

I don't understand why you'd want a different interface for MSI vs
MSI-X, rather than just passing the type as we currently do.

I say that because in general the arch code doesn't care whether it's
MSI or MSI-X, it's just an irq. And it's simpler to have one interface
with a type argument for the rare case where it matters. Looking at the
current implementations, type is used exactly once.

arch/x86/kernel/io_apic.c
arch/powerpc/platforms/cell/axon_msi.c
arch/powerpc/sysdev/fsl_msi.c
arch/powerpc/sysdev/mpic_pasemi_msi.c
arch/powerpc/platforms/pseries/msi.c    <- uses type

And that's only because we have a different argument to the firmware
call for MSI-X. The rest of the code is the same.


I take it you're planning on replacing the list of msi_descs with
something more compact? It seems to me we could do that fairly easily
without changing the arch interface much at all - just replace the list
with some per-pci_dev attributes and then an array of per-MSI info.

But I haven't thought about lots of MSI-X much, so perhaps there are
some requirements I'm missing.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux