linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tj@kernel.org (Tejun Heo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] AHCI: Add generic MSI-X interrupt support to SATA PCI driver
Date: Wed, 13 May 2015 10:33:53 -0400	[thread overview]
Message-ID: <20150513143353.GU11388@htj.duckdns.org> (raw)
In-Reply-To: <20150511171810.GB29499@rric.localhost>

Hello, Robert.

On Mon, May 11, 2015 at 07:18:10PM +0200, Robert Richter wrote:
> static int ahci_init_msix(struct pci_dev *pdev, unsigned int n_ports,
> 			  struct ahci_host_priv *hpriv)
> {
> 	int rc, nvec;
> 	struct msix_entry entry = {};
> 
> 	/* check if msix is supported */
> 	nvec = pci_msix_vec_count(pdev);
> 	if (nvec <= 0)
> 		return 0;
> 
> 	/*
> 	 * Per-port msix interrupts are not supported. Assume single
> 	 * port interrupts for:
> 	 *
> 	 *  n_ports == 1, or
> 	 *  nvec < n_ports.
> 	 *
> 	 * We also need to check for n_ports != 0 which is implicitly
> 	 * covered here since nvec > 0.
> 	 */
> 	if (n_ports != 1 && nvec >= n_ports)
> 		return -ENOSYS;

Why are failing the whole thing when nvec >= n_ports?  Can't we just
print some warning and configure it for single interrupt mode?

> > Also, shouldn't we be printing a warning message here explaining why
> > probing is failing?
> 
> I didn't want to print a warning in case -ENOSYS for backward
> compatability. Only if msi-x code fails there is a message, see
> __ahci_init_interrupts(). In any other case the behaviour is as
> before, thus no message is printed.

I'm confused here.  Why are we implementing msix support at all if it
only support single interrupt mode?  I kinda assumed that that was
because you're trying to support a controller which does only msix,
no?  At any rate, I don't think it's wrong to print an informational /
warning message when a controller declares msix support but has wacko
parameters.

> > > +
> > > +   /* only enable the first entry (entry.entry = 0) */
> > > +   rc = pci_enable_msix_exact(pdev, &entry, 1);
> >
> > So, enabling the first msix works if nvec > 1 && nvec < n_ports but
> > not if nvec >= n_ports?
> 
> For n_ports > 1 && nvec >= n_ports we need to assume per-port
> interrupts. There are enough vectors for all ports then.

Again, and we fail irq init in that case?

Thanks.

-- 
tejun

  parent reply	other threads:[~2015-05-13 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04  7:45 [PATCH v2] AHCI: Add generic MSI-X interrupt support to SATA PCI driver Robert Richter
2015-05-04 16:06 ` Tejun Heo
2015-05-11 17:18   ` Robert Richter
2015-05-12 11:46     ` Robert Richter
2015-05-13 14:39       ` Tejun Heo
2015-05-13 17:28         ` Robert Richter
2015-05-13 17:46           ` Tejun Heo
2015-05-13 18:07             ` Robert Richter
2015-05-13 18:10               ` Tejun Heo
2015-05-13 14:33     ` Tejun Heo [this message]
2015-05-17  7:33 ` Alexander Gordeev
2015-05-18  8:06   ` Robert Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150513143353.GU11388@htj.duckdns.org \
    --to=tj@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).