LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH]quirks: set 'En' bit of MSI Mapping for devices on HT-based nvidia platform
@ 2008-01-10 14:41 peerchen
2008-01-11 0:43 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: peerchen @ 2008-01-10 14:41 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, ebiederm, acurrid, pchen
Signed-off-by: Andy Currid <acurrid@nvidia.com>
Signed-off-by: Peer Chen <pchen@nvidia.com>
---
--- linux-2.6.24-rc7/drivers/pci/quirks.c.orig 2008-01-09 16:37:36.000000000 -0500
+++ linux-2.6.24-rc7/drivers/pci/quirks.c 2008-01-10 15:03:09.000000000 -0500
@@ -1705,6 +1705,70 @@ static void __devinit quirk_nvidia_ck804
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_msi_ht_cap);
+/*
+ * Force enable MSI mapping capability on HT bridges */
+static inline void ht_enable_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) {
+ printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
+ dev->dev.bus_id);
+
+ 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 void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) {
+
+ struct pci_dev *host_bridge;
+ int pos, ttl = 48;
+
+ /* HT MSI mapping should be disabled on devices that are below
+ * a non-Hypertransport host bridge. Locate the host bridge...
+ */
+
+ if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+ printk(KERN_WARNING
+ "PCI: nv_msi_ht_cap_quirk didn't locate host bridge\n");
+ return;
+ }
+
+ if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 0) {
+ /* Host bridge is to HT */
+ 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;
+
+ if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, &flags) == 0) {
+ printk(KERN_INFO "PCI: Quirk disabling HT MSI mapping on %s\n",
+ pci_name(dev));
+
+ 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);
+ }
+}
+
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+ nv_msi_ht_cap_quirk);
+
static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
{
dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]quirks: set 'En' bit of MSI Mapping for devices on HT-based nvidia platform
2008-01-10 14:41 [PATCH]quirks: set 'En' bit of MSI Mapping for devices on HT-based nvidia platform peerchen
@ 2008-01-11 0:43 ` Andrew Morton
2008-01-11 13:43 ` Re: [PATCH]quirks: set 'En' bit of MSI Mapping for devices onHT-based " peerchen
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-01-11 0:43 UTC (permalink / raw)
To: peerchen; +Cc: linux-kernel, ebiederm, acurrid, pchen
On Thu, 10 Jan 2008 22:41:58 +0800
"peerchen" <peerchen@gmail.com> wrote:
> Subject: [PATCH]quirks: set 'En' bit of MSI Mapping for devices on HT-based nvidia platform
>
> Signed-off-by: Andy Currid <acurrid@nvidia.com>
> Signed-off-by: Peer Chen <pchen@nvidia.com>
You didn't provide a reason for making this change to the kernel.
Please do so, and include it in the patch's changelog, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH]quirks: set 'En' bit of MSI Mapping for devices onHT-based nvidia platform
2008-01-11 0:43 ` Andrew Morton
@ 2008-01-11 13:43 ` peerchen
0 siblings, 0 replies; 3+ messages in thread
From: peerchen @ 2008-01-11 13:43 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, ebiederm, acurrid, pchen
According to HT spec, to get message interrupt from devices mapped to HT interrupt message,
the 'En' bit of MSI Mapping capability need to be set.
The patch do this setting in quirks code for the devices on HT-based nvidia platform.
Signed-off-by: Andy Currid <acurrid@nvidia.com>
Signed-off-by: Peer Chen <pchen@nvidia.com>
---
--- linux-2.6.24-rc7/drivers/pci/quirks.c.orig 2008-01-09 16:37:36.000000000 -0500
+++ linux-2.6.24-rc7/drivers/pci/quirks.c 2008-01-10 15:03:09.000000000 -0500
@@ -1705,6 +1705,70 @@ static void __devinit quirk_nvidia_ck804
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_msi_ht_cap);
+/*
+ * Force enable MSI mapping capability on HT bridges */
+static inline void ht_enable_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) {
+ printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
+ dev->dev.bus_id);
+
+ 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 void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) {
+
+ struct pci_dev *host_bridge;
+ int pos, ttl = 48;
+
+ /* HT MSI mapping should be disabled on devices that are below
+ * a non-Hypertransport host bridge. Locate the host bridge...
+ */
+
+ if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+ printk(KERN_WARNING
+ "PCI: nv_msi_ht_cap_quirk didn't locate host bridge\n");
+ return;
+ }
+
+ if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 0) {
+ /* Host bridge is to HT */
+ 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;
+
+ if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, &flags) == 0) {
+ printk(KERN_INFO "PCI: Quirk disabling HT MSI mapping on %s\n",
+ pci_name(dev));
+
+ 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);
+ }
+}
+
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+ nv_msi_ht_cap_quirk);
+
static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
{
dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-11 13:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-10 14:41 [PATCH]quirks: set 'En' bit of MSI Mapping for devices on HT-based nvidia platform peerchen
2008-01-11 0:43 ` Andrew Morton
2008-01-11 13:43 ` Re: [PATCH]quirks: set 'En' bit of MSI Mapping for devices onHT-based " peerchen
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).