From: Michael Ellerman <michael@ellerman.id.au>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, jeff@garzik.org,
barkalow@iabervon.org, linas@austin.ibm.com,
chunhao.huang@hotmail.com, gregkh@suse.de, htejun@gmail.com,
brice.goglin@gmail.com, david.gaarenstroom@gmail.com,
linux-pci@atrey.karlin.mff.cuni.cz, shane.huang@amd.com,
linux-ide@vger.kernel.org, brice@myri.com, mchan@broadcom.com
Subject: Re: [PATCH 3/4]: [PCI]: Add quirk for devices which disable MSI when INTX_DISABLE is set.
Date: Wed, 24 Oct 2007 15:30:21 +1000 [thread overview]
Message-ID: <1193203821.8788.4.camel@concordia> (raw)
In-Reply-To: <20071023.195310.131105752.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 3223 bytes --]
On Tue, 2007-10-23 at 19:53 -0700, David Miller wrote:
> A reasonably common problem with some devices is that they will
> disable MSI generation when the INTX_DISABLE bit is set in the
> PCI_COMMAND register.
>
> Quirk this explicitly, guarding the pci_intx() calls in msi.c with
> this quirk indication.
>
> The first entries for this quirk are for 5714 and 5780 Tigon3 chips,
> and thus we can remove the workaround code from the tg3.c driver.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 87e0161..a8dd18c 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -237,7 +237,8 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
> entry = get_irq_msi(dev->irq);
> pos = entry->msi_attrib.pos;
>
> - pci_intx(dev, 0); /* disable intx */
> + if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
> + pci_intx(dev, 0); /* disable intx */
> msi_set_enable(dev, 0);
> write_msi_msg(dev->irq, &entry->msg);
> if (entry->msi_attrib.maskbit)
> @@ -260,7 +261,8 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
> return;
>
> /* route the table */
> - pci_intx(dev, 0); /* disable intx */
> + if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
> + pci_intx(dev, 0); /* disable intx */
> msix_set_enable(dev, 0);
>
> list_for_each_entry(entry, &dev->msi_list, list) {
> @@ -343,7 +345,8 @@ static int msi_capability_init(struct pci_dev *dev)
> }
>
> /* Set MSI enabled bits */
> - pci_intx(dev, 0); /* disable intx */
> + if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
> + pci_intx(dev, 0); /* disable intx */
> msi_set_enable(dev, 1);
> dev->msi_enabled = 1;
>
> @@ -433,7 +436,8 @@ static int msix_capability_init(struct pci_dev *dev,
> i++;
> }
> /* Set MSI-X enabled bits */
> - pci_intx(dev, 0); /* disable intx */
> + if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
> + pci_intx(dev, 0); /* disable intx */
> msix_set_enable(dev, 1);
> dev->msix_enabled = 1;
>
> @@ -528,7 +532,8 @@ void pci_disable_msi(struct pci_dev* dev)
> return;
>
> msi_set_enable(dev, 0);
> - pci_intx(dev, 1); /* enable intx */
> + if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
> + pci_intx(dev, 1); /* enable intx */
> dev->msi_enabled = 0;
>
> BUG_ON(list_empty(&dev->msi_list));
> @@ -640,7 +645,8 @@ void pci_disable_msix(struct pci_dev* dev)
> return;
>
> msix_set_enable(dev, 0);
> - pci_intx(dev, 1); /* enable intx */
> + if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
> + pci_intx(dev, 1); /* enable intx */
> dev->msix_enabled = 0;
>
> msix_free_all_irqs(dev);
That looks like 6 hunks doing exactly the same thing? What about
creating a pci_intx_quirked() (or something) that checks the flag and
then does/or does not call pci_intx().
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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-10-24 5:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-24 2:53 [PATCH 3/4]: [PCI]: Add quirk for devices which disable MSI when INTX_DISABLE is set David Miller
2007-10-24 4:59 ` Michael Chan
2007-10-24 5:06 ` David Miller
2007-10-24 5:30 ` Michael Ellerman [this message]
2007-10-24 5:33 ` David Miller
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=1193203821.8788.4.camel@concordia \
--to=michael@ellerman.id.au \
--cc=barkalow@iabervon.org \
--cc=brice.goglin@gmail.com \
--cc=brice@myri.com \
--cc=chunhao.huang@hotmail.com \
--cc=davem@davemloft.net \
--cc=david.gaarenstroom@gmail.com \
--cc=gregkh@suse.de \
--cc=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=linas@austin.ibm.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=mchan@broadcom.com \
--cc=shane.huang@amd.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