mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: michael@ellerman.id.au
Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Matthew Wilcox <willy@linux.intel.com>
Subject: Re: [PATCH 1/2] PCI/MSI: Introduce pci_msix_table_size()
Date: Wed, 21 Jan 2009 16:52:38 +0100	[thread overview]
Message-ID: <200901211652.39584.rjw@sisk.pl> (raw)
In-Reply-To: <1232505015.11241.51.camel@localhost>

On Wednesday 21 January 2009, Michael Ellerman wrote:
> On Wed, 2009-01-21 at 01:18 +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > 
> > Introduce new function pci_msix_table_size() returning the size of
> > the MSI-X table of given PCI device or 0 if the device doesn't
> > support MSI-X.
> > 
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > ---
> >  drivers/pci/msi.c   |   24 +++++++++++++++++++-----
> >  include/linux/pci.h |    5 +++++
> >  2 files changed, 24 insertions(+), 5 deletions(-)
> > 
> > Index: linux-2.6/drivers/pci/msi.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/pci/msi.c
> > +++ linux-2.6/drivers/pci/msi.c
> > @@ -670,6 +670,23 @@ static int msi_free_irqs(struct pci_dev*
> >  }
> >  
> >  /**
> > + * pci_msix_table_size - return the number of device's MSI-X table entries
> > + * @dev: pointer to the pci_dev data structure of MSI-X device function
> > + */
> > +int pci_msix_table_size(struct pci_dev *dev)
> > +{
> > +	int pos;
> > +	u16 control;
> > +
> > +	pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
> > +	if (!pos)
> > +		return 0;
> > +
> > +	pci_read_config_word(dev, msi_control_reg(pos), &control);
> > +	return multi_msix_capable(control);
> > +}
> > +
> > +/**
> >   * pci_enable_msix - configure device's MSI-X capability structure
> >   * @dev: pointer to the pci_dev data structure of MSI-X device function
> >   * @entries: pointer to an array of MSI-X entries
> > @@ -686,9 +703,8 @@ static int msi_free_irqs(struct pci_dev*
> >   **/
> >  int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
> >  {
> > -	int status, pos, nr_entries;
> > +	int status, nr_entries;
> >  	int i, j;
> > -	u16 control;
> >  
> >  	if (!entries)
> >   		return -EINVAL;
> > @@ -697,9 +713,7 @@ int pci_enable_msix(struct pci_dev* dev,
> >  	if (status)
> >  		return status;
> >  
> > -	pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
> > -	pci_read_config_word(dev, msi_control_reg(pos), &control);
> > -	nr_entries = multi_msix_capable(control);
> > +	nr_entries = pci_msix_table_size(dev);
> >  	if (nvec > nr_entries)
> >  		return -EINVAL;
> 
> I see similar code in msix_capability_init(), although it still needs
> pos. Did you deliberately not replace that, or just miss it?

I didn't replace it exactly because it required the pos anyway.

Thanks,
Rafael

  reply	other threads:[~2009-01-21 15:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 13:57 [PATCH] PCI PCIe portdrv: Fix allocation of interrupts (rev. 3) Rafael J. Wysocki
2009-01-15  7:24 ` Kenji Kaneshige
2009-01-15  7:52   ` Hidetoshi Seto
2009-01-15 10:15     ` Kenji Kaneshige
2009-01-17  0:19       ` Rafael J. Wysocki
2009-01-17 13:40         ` [PATCH PCI PCIe portdrv: Fix allocation of interrupts (rev. 5) (was: Re: [PATCH] PCI PCIe portdrv: Fix allocation ...) Rafael J. Wysocki
2009-01-19  3:39           ` [PATCH PCI PCIe portdrv: Fix allocation of interrupts (rev. 5) Hidetoshi Seto
2009-01-19  9:00             ` Kenji Kaneshige
2009-01-21  0:16               ` Rafael J. Wysocki
2009-01-21  0:18                 ` [PATCH 1/2] PCI/MSI: Introduce pci_msix_table_size() Rafael J. Wysocki
2009-01-21  0:33                   ` [PATCH 2/2] PCI PCIe portdrv: Fix allocation of interrupts (rev. 6) Rafael J. Wysocki
2009-01-21  1:17                     ` Hidetoshi Seto
2009-01-21 15:53                       ` Rafael J. Wysocki
2009-01-21  1:17                   ` [PATCH 1/2] PCI/MSI: Introduce pci_msix_table_size() Hidetoshi Seto
2009-01-21  2:30                   ` Michael Ellerman
2009-01-21 15:52                     ` Rafael J. Wysocki [this message]
2009-01-20 23:57             ` [PATCH PCI PCIe portdrv: Fix allocation of interrupts (rev. 5) Rafael J. Wysocki
2009-01-21  0:12               ` Kenji Kaneshige
2009-01-23 23:19 [PATCH 0/2] PCI/PCIe port driver: Fix allocation of interrupts Rafael J. Wysocki
2009-01-23 23:21 ` [PATCH 1/2] PCI/MSI: Introduce pci_msix_table_size() Rafael J. Wysocki
2009-01-25  5:29   ` Grant Grundler
2009-01-25  5:35     ` Grant Grundler
2009-01-25 19:01       ` Rafael J. Wysocki
2009-01-27 18:57   ` Jesse Barnes

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=200901211652.39584.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=michael@ellerman.id.au \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=willy@linux.intel.com \
    /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

Powered by JetHome