[PATCH] powerpc/fsl: Add multiple MSI bank support

Michael Ellerman michael at ellerman.id.au
Mon Mar 22 10:04:56 EST 2010


On Fri, 2010-03-19 at 10:15 -0500, Kumar Gala wrote:
> On Mar 18, 2010, at 10:06 PM, Michael Ellerman wrote:
> 
> > On Thu, 2010-03-18 at 09:53 -0500, Kumar Gala wrote:
> >> From: Lan Chunhe-B25806 <B25806 at freescale.com>
> >> 
> >> Freescale QorIQ P4080 has three MSI banks and the original code
> >> can not work well. This patch adds multiple MSI banks support for
> >> Freescale processor.
> >> 
> >> Signed-off-by: Lan Chunhe-B25806 <b25806 at freescale.com>
> >> Signed-off-by: Roy Zang <tie-fei.zang at freescale.com>
> > 
> >> @@ -146,9 +149,13 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
> >> 	unsigned int virq;
> >> 	struct msi_desc *entry;
> >> 	struct msi_msg msg;
> >> -	struct fsl_msi *msi_data = fsl_msi;
> >> +	struct fsl_msi *msi_data;
> >> 
> >> 	list_for_each_entry(entry, &pdev->msi_list, list) {
> >> +		if (entry->irq == NO_IRQ)
> >> +			continue;
> > 
> > This looks wrong, entry->irq should always be 0 here because it was just
> > kzalloc'ed - you should only be doing this check in teardown.

This was the important comment, the rest was nit-picking :)

> >> -	WARN_ON(ppc_md.setup_msi_irqs);
> >> -	ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
> >> -	ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
> >> -	ppc_md.msi_check_device = fsl_msi_check_device;
> >> +	/* The multiple setting ppc_md.setup_msi_irqs will not harm things */
> >> +	if (!ppc_md.setup_msi_irqs) {
> >> +		ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
> >> +		ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
> >> +		ppc_md.msi_check_device = fsl_msi_check_device;
> >> +	} else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) {
> >> +		dev_err(&dev->dev, "Different MSI driver already installed!\n");
> >> +		err = -EBUSY; /* or some other error code */
> >> +		goto error_out;
> >> +	}
> > 
> > I liked it the way it was, because having two competing MSI backends
> > means something's probably not going to work. But it's your driver so
> > whatever you like.
> 
> The previous WARN_ON() is problematic when we have multiple (of the
> same type) MSI blocks.  The check was intended to do exactly what you
> are suggesting.  If you think its doing something else let us know.

Right, yeah I see what you mean - dev_err() is a bit harder to spot than
a WARN() but it's probably sufficient.

cheers

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100322/944ff3ac/attachment.pgp>


More information about the Linuxppc-dev mailing list