Skip to contentSkip to conversation

increment pos before looking for the next cap in __pci_find_next_ht_cap

PATCH Applied Brice Goglin 2 participants 2 messages Jan 5, 2007 – Jan 7, 2007 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 increment pos before looking for the next cap in __pci_find_next_ht_cap

Hi,

While testing 2.6.20-rc3 on a machine with some CK804 chipsets, we noticed that quirk_nvidia_ck804_msi_ht_cap() was not detecting HT MSI capabilities anymore. It is actually caused by the MSI mapping on the root chipset being the 2nd HT capability in the chain. pci_find_ht_capability() does not seem to find anything but the first HT cap correctly, because it forgets to increment the position before looking for the next cap. The following patch seems to fix it.

At least, this prooves that having a ttl is good idea since the machine would have been stucked in an infinite loop if we didn't have a ttl :)

The patch should go in 2.6.20 since this quirk was working fine in 2.6.19.
---
[PATCH] increment pos before looking for the next cap in __pci_find_next_ht_cap

We have to pass pos + PCI_CAP_LIST_NEXT to __pci_find_next_cap_ttl to get the next HT cap instead of the same one again.

---
 drivers/pci/pci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pci.c +2 -1
Index: linux-rc/drivers/pci/pci.c
===================================================================
@@ -254,7 +254,8 @@
 		if ((cap & mask) == ht_cap)
 			return pos;
 
-		pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn, pos,
+		pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn,
+					      pos + PCI_CAP_LIST_NEXT,
 					      PCI_CAP_ID_HT, &ttl);
 	}
 
#1 lore raw

patch pci-increment-pos-before-looking-for-the-next-cap-in-__pci_find_next_ht_cap.patch added to gregkh-2.6 tree

This is a note to let you know that I've just added the patch titled

Subject: PCI: increment pos before looking for the next cap in __pci_find_next_ht_cap

to my gregkh-2.6 tree. Its filename is

pci-increment-pos-before-looking-for-the-next-cap-in-__pci_find_next_ht_cap.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line

From [email protected] Fri Jan 5 15:01:21 2007

From: Brice Goglin <[email protected]>
Date: Fri, 05 Jan 2007 23:52:14 +0100
Subject: PCI: increment pos before looking for the next cap in __pci_find_next_ht_cap
To: Greg KH <[email protected]>, Michael Ellerman <[email protected]>
Cc: LKML <[email protected]>
Message-ID: <[email protected]>

While testing 2.6.20-rc3 on a machine with some CK804 chipsets, we noticed that quirk_nvidia_ck804_msi_ht_cap() was not detecting HT MSI capabilities anymore. It is actually caused by the MSI mapping on the root chipset being the 2nd HT capability in the chain. pci_find_ht_capability() does not seem to find anything but the first HT cap correctly, because it forgets to increment the position before looking for the next cap. The following patch seems to fix it.

At least, this prooves that having a ttl is good idea since the machine would have been stucked in an infinite loop if we didn't have a ttl :)

---
 drivers/pci/pci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pci.c +2 -1
@@ -254,7 +254,8 @@ static int __pci_find_next_ht_cap(struct
 		if ((cap & mask) == ht_cap)
 			return pos;
 
-		pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn, pos,
+		pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn,
+					      pos + PCI_CAP_LIST_NEXT,
 					      PCI_CAP_ID_HT, &ttl);
 	}
 

Patches currently in gregkh-2.6 which might be from [email protected] are