From: Yinghai Lu <yinghai@kernel.org>
To: Prakash Punnoor <prakash@punnoor.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Robert Hancock <hancockrwd@gmail.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Andrew Morton <akpm@linux-foundation.org>,
david@lang.hm, Matthew Wilcox <matthew@wil.cx>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-scsi@vger.kernel.org, DL-MPTFusionLinux@lsi.com,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] pci: enable MSI on 8132
Date: Sun, 22 Feb 2009 22:18:34 -0800 [thread overview]
Message-ID: <49A23FBA.2020004@kernel.org> (raw)
In-Reply-To: <200902221617.21621.prakash@punnoor.de>
please try, you may need Eric's patch too.
[PATCH] pci: don't enable too much HT MSI mapping
Impact: fix bug
Prakesh reported that his c51-mcp51 system ondie sound card doesn't work MSI
but if he hack out the HT-MSI on mcp51, the MSI will work well with sound card.
this patch rework the nv_msi_ht_cap_quirk()
and will only enable ht_msi and try to avoid to enable ht_msi both.
Reported-by: Prakesh Punnoor <prakash@punnoor.de>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/quirks.c | 115 ++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 100 insertions(+), 15 deletions(-)
Index: linux-2.6/drivers/pci/quirks.c
===================================================================
--- linux-2.6.orig/drivers/pci/quirks.c
+++ linux-2.6/drivers/pci/quirks.c
@@ -2050,11 +2050,101 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NV
PCI_DEVICE_ID_NVIDIA_NVENET_15,
nvenet_msi_disable);
-static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
+static void __devinit nv_ht_enable_msi_mapping(struct pci_dev *dev)
{
struct pci_dev *host_bridge;
+ int pos;
+ int i, dev_no;
+ int found = 0;
+
+ dev_no = dev->devfn >> 3;
+ for (i = dev_no; i >= 0; i--) {
+ host_bridge = pci_get_slot(dev->bus, PCI_DEVFN(i, 0));
+ if (!host_bridge)
+ continue;
+
+ pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
+ if (pos != 0) {
+ found = 1;
+ break;
+ }
+ pci_dev_put(host_bridge);
+ }
+
+ if (!found)
+ return;
+
+ /* root did that ! */
+ if (msi_ht_cap_enabled(host_bridge))
+ goto out;
+
+ ht_enable_msi_mapping(dev);
+
+out:
+ pci_dev_put(host_bridge);
+}
+
+static void __devinit ht_disable_msi_mapping(struct pci_dev *dev)
+{
int pos, ttl = 48;
+ pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
+ while (pos && ttl--) {
+ u8 flags;
+
+ if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
+ &flags) == 0) {
+ dev_info(&dev->dev, "Enabling HT MSI Mapping\n");
+
+ pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+ flags & ~HT_MSI_FLAGS_ENABLE);
+ }
+ pos = pci_find_next_ht_capability(dev, pos,
+ HT_CAPTYPE_MSI_MAPPING);
+ }
+}
+
+static int __devinit ht_check_msi_mapping(struct pci_dev *dev)
+{
+ int pos, ttl = 48;
+ int found = 0;
+
+ /* check if there is HT MSI cap or enabled on this device */
+ pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
+ while (pos && ttl--) {
+ u8 flags;
+
+ if (found < 1)
+ found = 1;
+ if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
+ &flags) == 0) {
+ if (flags & HT_MSI_FLAGS_ENABLE) {
+ if (found < 2) {
+ found = 2;
+ break;
+ }
+ }
+ }
+ pos = pci_find_next_ht_capability(dev, pos,
+ HT_CAPTYPE_MSI_MAPPING);
+ }
+
+ return found;
+}
+
+static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
+{
+ struct pci_dev *host_bridge;
+ int pos;
+ int found;
+
+ /* check if there is HT MSI cap or enabled on this device */
+ found = ht_check_msi_mapping(dev);
+
+ /* no HT MSI CAP */
+ if (found == 0)
+ return;
+
/*
* HT MSI mapping should be disabled on devices that are below
* a non-Hypertransport host bridge. Locate the host bridge...
@@ -2069,24 +2159,19 @@ static void __devinit nv_msi_ht_cap_quir
pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
if (pos != 0) {
/* Host bridge is to HT */
- ht_enable_msi_mapping(dev);
+ if (found == 1) {
+ /* it is not enabled, try to enable it */
+ nv_ht_enable_msi_mapping(dev);
+ }
return;
}
- /* Host bridge is not to HT, disable HT MSI mapping on this device */
- pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
- while (pos && ttl--) {
- u8 flags;
+ /* HT MSI is not enabled */
+ if (found == 1)
+ return;
- if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
- &flags) == 0) {
- dev_info(&dev->dev, "Disabling HT MSI mapping");
- pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
- flags & ~HT_MSI_FLAGS_ENABLE);
- }
- pos = pci_find_next_ht_capability(dev, pos,
- HT_CAPTYPE_MSI_MAPPING);
- }
+ /* Host bridge is not to HT, disable HT MSI mapping on this device */
+ ht_disable_msi_mapping(dev);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk);
next prev parent reply other threads:[~2009-02-23 6:19 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-17 22:24 mpt fusion broken sometime since 2.6.24 david
2009-02-17 21:44 ` david
2009-02-17 23:00 ` Matthew Wilcox
2009-02-17 23:07 ` david
2009-02-17 23:11 ` Matthew Wilcox
2009-02-17 23:20 ` Yinghai Lu
2009-02-17 23:21 ` david
2009-02-17 23:11 ` Yinghai Lu
2009-02-17 23:20 ` david
2009-02-17 23:22 ` Yinghai Lu
2009-02-17 23:37 ` david
2009-02-18 2:01 ` Yinghai Lu
2009-02-18 2:03 ` david
2009-02-18 2:14 ` Yinghai Lu
2009-02-18 2:32 ` david
2009-02-18 2:28 ` Yinghai Lu
2009-02-18 2:34 ` david
2009-02-18 2:40 ` david
2009-02-18 2:49 ` Yinghai Lu
2009-02-18 3:26 ` david
2009-02-18 3:28 ` Yinghai Lu
2009-02-18 3:35 ` david
2009-02-18 3:45 ` david
2009-02-18 3:47 ` Yinghai Lu
2009-02-18 4:14 ` david
2009-02-18 4:36 ` Yinghai Lu
2009-02-18 5:06 ` Yinghai Lu
2009-02-18 5:10 ` Yinghai Lu
2009-02-18 4:40 ` [PATCH] pci: enable MSI on 8132 Yinghai Lu
2009-02-18 12:21 ` Matthew Wilcox
2009-02-18 12:27 ` david
2009-02-18 18:04 ` Andrew Morton
2009-02-18 18:18 ` david
2009-02-18 18:32 ` Greg KH
2009-02-18 18:38 ` James Bottomley
2009-02-18 18:40 ` david
2009-02-18 19:08 ` Yinghai Lu
2009-02-18 19:14 ` James Bottomley
2009-02-18 19:25 ` Yinghai Lu
2009-02-18 20:12 ` Jeff Garzik
2009-02-18 20:18 ` James Bottomley
2009-02-18 19:15 ` Andrew Morton
2009-02-18 19:29 ` Yinghai Lu
2009-02-18 19:33 ` James Bottomley
2009-02-19 4:21 ` Prakash, Sathya
2009-02-18 19:00 ` Jesse Barnes
2009-02-19 3:39 ` Robert Hancock
2009-02-21 7:50 ` Eric W. Biederman
2009-02-21 8:31 ` Yinghai Lu
2009-02-21 8:58 ` Eric W. Biederman
2009-02-21 10:23 ` Yinghai Lu
2009-02-21 18:59 ` Robert Hancock
2009-02-22 12:08 ` Prakash Punnoor
2009-02-22 12:54 ` Eric W. Biederman
2009-02-22 15:17 ` Prakash Punnoor
2009-02-22 21:45 ` Yinghai Lu
2009-02-22 22:07 ` Yinghai Lu
2009-02-23 6:18 ` Yinghai Lu [this message]
2009-02-23 18:21 ` Prakash Punnoor
2009-02-23 18:50 ` Yinghai Lu
2009-02-23 19:01 ` Prakash Punnoor
2009-02-23 19:51 ` [PATCH] pci: don't enable too many HT MSI mapping Yinghai Lu
2009-02-24 17:37 ` Jesse Barnes
2009-02-27 6:52 ` Prakash Punnoor
2009-02-27 20:59 ` Yinghai Lu
2009-02-28 8:25 ` Prakash Punnoor
2009-02-28 20:57 ` Yinghai Lu
2009-02-28 22:43 ` Yinghai Lu
2009-03-01 7:50 ` Prakash Punnoor
2009-03-01 7:58 ` Prakash Punnoor
2009-03-01 8:12 ` Yinghai Lu
2009-03-01 8:29 ` Prakash Punnoor
2009-03-04 7:15 ` Prakash Punnoor
2009-03-04 8:21 ` Yinghai Lu
2009-03-05 17:01 ` Matthew Wilcox
2009-03-05 17:15 ` Matthew Wilcox
2009-03-05 23:26 ` Yinghai Lu
2009-03-05 23:45 ` Prakash Punnoor
2009-03-06 1:10 ` Matthew Wilcox
2009-03-06 4:15 ` Yinghai Lu
2009-03-06 9:10 ` Prakash Punnoor
2009-03-21 2:29 ` [PATCH] pci: don't enable too much HT MSI mapping -v5 -resend Yinghai Lu
2009-03-26 23:10 ` Jesse Barnes
2009-03-28 12:34 ` Prakash Punnoor
2009-03-28 13:31 ` Prakash Punnoor
2009-03-28 20:18 ` Yinghai Lu
2009-03-28 22:11 ` Prakash Punnoor
2009-03-28 20:52 ` Yinghai Lu
2009-03-28 22:16 ` Prakash Punnoor
2009-03-28 23:15 ` Yinghai Lu
2009-03-29 1:33 ` Yinghai Lu
2009-03-29 9:15 ` Prakash Punnoor
2009-03-29 9:32 ` Yinghai Lu
2009-03-29 12:50 ` Prakash Punnoor
2009-03-29 19:27 ` Yinghai Lu
2009-03-29 19:30 ` [PATCH] pci: don't enable too much HT MSI mapping -v6 Yinghai Lu
2009-03-30 19:17 ` Jesse Barnes
2009-02-22 23:42 ` [PATCH] pci: enable MSI on 8132 Matthew Wilcox
2009-02-22 3:42 ` Grant Grundler
2009-02-18 3:12 ` mpt fusion broken sometime since 2.6.24 david
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=49A23FBA.2020004@kernel.org \
--to=yinghai@kernel.org \
--cc=DL-MPTFusionLinux@lsi.com \
--cc=akpm@linux-foundation.org \
--cc=david@lang.hm \
--cc=ebiederm@xmission.com \
--cc=hancockrwd@gmail.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=prakash@punnoor.de \
/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).