linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Gordeev <agordeev@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-pci@vger.kernel.org, linux-ide@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>, Joerg Roedel <joro@8bytes.org>,
	Jan Beulich <JBeulich@suse.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH 3/4] AHCI: Conserve interrupts with pci_enable_msi_block_part() interface
Date: Tue, 3 Sep 2013 18:19:06 +0200	[thread overview]
Message-ID: <20130903161906.GC14221@dhcp-26-207.brq.redhat.com> (raw)
In-Reply-To: <20130903141824.GD10522@htj.dyndns.org>

On Tue, Sep 03, 2013 at 10:18:24AM -0400, Tejun Heo wrote:
> On Mon, Sep 02, 2013 at 11:00:28AM +0200, Alexander Gordeev wrote:
> > +	if (hpriv->flags & AHCI_HFLAG_NO_MSI)
> > +		goto intx;
> > +
> > +	rc = pci_enable_msi_block_part(pdev, n_ports, AHCI_MAX_PORTS);

We start with maximum possible number of ports AHCI_MAX_PORTS

> > +	if (!rc)
> > +		return AHCI_MAX_PORTS;

If we succeeded the device is indeed supports all AHCI_MAX_PORTS
and we report it.

> > +	if (rc < 0)
> > +		goto intx;

If pci_enable_msi_block_part() failed we should not make further
attempts and fallback to simple IRQ.

> > +	maxvec = rc;

The device supports a lesser of AHCI_MAX_PORTS, because the previous
pci_enable_msi_block_part() has not succeeded nor failed. Thus, rc
contains number of supported MSIs. In case of ICH this will be 16
rather than 32.

Actually, while I was writing this I realized this could be a number
of MSIs that could have been enabled this device, not the maximum
number of supported MSIs - these two may differ. I think MRSM should
be checked. But I will continue as if it always the same.

> > +	rc = pci_enable_msi_block_part(pdev, n_ports, maxvec);

Try pci_enable_msi_block_part() with the maximum number of supported MSIs.

> > +	if (!rc)
> > +		return maxvec;

If we succeeded report the number of enabled MSIs.

> > +	if (rc < 0)
> > +		goto intx;

If pci_enable_msi_block_part() failed we should not make further
attempts and fallback to simple IRQ.

> Why is the above fallback necessary?  The only other number which
> makes sense is roundup_pow_of_two(n_ports), right?  What does the
> above fallback logic buy us?

We must enable maximum possible number of MSIs - the one reported in
Multiple Message Capable register. Otherwise ICH device will fallback
to MRSM. IOW, if the result of roundup_pow_of_two(n_ports) is not what
in Multiple Message Capable register (i.e. as roundup_pow_of_two(6) vs 16)
ICH will enforce MRSM mode.

> Thanks.
> 
> -- 
> tejun

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

  reply	other threads:[~2013-09-03 16:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-02  8:59 [PATCH 0/4] AHCI: Conserve interrupts with pci_enable_msi_block_part() interface Alexander Gordeev
2013-09-02  8:59 ` [PATCH 1/4] PCI/MSI: Introduce " Alexander Gordeev
2013-09-03 14:19   ` Tejun Heo
2013-09-02  9:00 ` [PATCH 2/4] MSI/x86: Support " Alexander Gordeev
2013-09-03 13:32   ` Tejun Heo
2013-09-02  9:00 ` [PATCH 3/4] AHCI: Conserve interrupts with " Alexander Gordeev
2013-09-03 14:18   ` Tejun Heo
2013-09-03 16:19     ` Alexander Gordeev [this message]
2013-09-03 18:27       ` Tejun Heo
2013-09-04  7:22         ` Alexander Gordeev
2013-09-04 14:17           ` [PATCH v2 " Alexander Gordeev
2013-09-04 14:55           ` [PATCH " Tejun Heo
2013-09-04 16:14             ` Alexander Gordeev
2013-09-04 18:06               ` Tejun Heo
2013-09-04 18:47                 ` Alexander Gordeev
2013-09-04 18:51                   ` Tejun Heo
2013-09-02  9:00 ` [PATCH 4/4] PCI/MSI: Get rid of pci_enable_msi_block_auto() interface Alexander Gordeev
2013-09-03  7:58   ` [PATCH v2 " Alexander Gordeev
2013-09-03 13:55 ` [PATCH 0/4] AHCI: Conserve interrupts with pci_enable_msi_block_part() interface Tejun Heo
2013-09-03 14:09   ` Tejun Heo
2013-09-04 12:32     ` Alexander Gordeev
2013-09-04 14:57       ` Tejun Heo
2013-09-03 14:57   ` Alexander Gordeev
2013-09-03 16:24     ` Tejun Heo
2013-09-04  8:06       ` Alexander Gordeev
2013-09-04 15:02         ` Tejun Heo

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=20130903161906.GC14221@dhcp-26-207.brq.redhat.com \
    --to=agordeev@redhat.com \
    --cc=JBeulich@suse.com \
    --cc=bhelgaas@google.com \
    --cc=joro@8bytes.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tj@kernel.org \
    --cc=x86@kernel.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).