Skip to contentSkip to conversation

PCI: use fixed-up device class when configuring device

PATCH Applied Yu Zhao 3 participants 5 messages May 27, 2009 – Jun 4, 2009 PCI

lore
Share & tools
lore

Yu Zhao

author
#0 lore raw

PATCH 1/1 PCI: use fixed-up device class when configuring device

The device class may be changed after the early fixup. Need to re-read the class value from pci_dev when configuring the device. Otherwise some devices such as JMicron SATA controller won't work.

---
 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/pci/probe.c +2 -0
index e3c3e08..f1ae247 100644
@@ -745,6 +745,8 @@ int pci_setup_device(struct pci_dev *dev)
 
 	/* Early fixups, before probing the BARs */
 	pci_fixup_device(pci_fixup_early, dev);
+	/* device class may be changed after fixup */
+	class = dev->class >> 8;
 
 	switch (dev->hdr_type) {		    /* header type */
 	case PCI_HEADER_TYPE_NORMAL:		    /* standard header */
Signature · 1 line
1.6.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Yu Zhao

The device class may be changed after the early fixup. Need to re-read the class value from pci_dev when configuring the device. Otherwise some devices such as JMicron SATA controller won't work.

I looked at pci_setup_device() and was thinking pci_fixup_device() should be called before pci_cfg_space_size() and thus avoid having to setup local "class" variable twice. pci_cfg_space_size() only seems to care if the device is a PCI_CLASS_BRIDGE_HOST (or not).

But dev->class has to be set up in any case and the current order makes more sense to me.

thanks,
grant

Quoted 26 lines
---
 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/pci/probe.c +2 -0
index e3c3e08..f1ae247 100644
@@ -745,6 +745,8 @@ int pci_setup_device(struct pci_dev *dev)
 
 	/* Early fixups, before probing the BARs */
 	pci_fixup_device(pci_fixup_early, dev);
+	/* device class may be changed after fixup */
+	class = dev->class >> 8;
 
 	switch (dev->hdr_type) {		    /* header type */
 	case PCI_HEADER_TYPE_NORMAL:		    /* standard header */
Signature · 6 lines
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#2 lore raw

Hi Jesse,

Can you please take this fix for 2.6.30 RC if possible? It fixes a regression introduced by the SR-IOV patch series.

Thanks,
Yu

Quoted 44 lines · Grant Grundler
Quoted 3 lines · Yu Zhao

The device class may be changed after the early fixup. Need to re-read the class value from pci_dev when configuring the device. Otherwise some devices such as JMicron SATA controller won't work.

I looked at pci_setup_device() and was thinking pci_fixup_device() should be called before pci_cfg_space_size() and thus avoid having to setup local "class" variable twice. pci_cfg_space_size() only seems to care if the device is a PCI_CLASS_BRIDGE_HOST (or not).

But dev->class has to be set up in any case and the current order makes more sense to me.

thanks,
grant

Quoted 26 lines
---
 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/pci/probe.c +2 -0
index e3c3e08..f1ae247 100644
@@ -745,6 +745,8 @@ int pci_setup_device(struct pci_dev *dev)
 
 	/* Early fixups, before probing the BARs */
 	pci_fixup_device(pci_fixup_early, dev);
+	/* device class may be changed after fixup */
+	class = dev->class >> 8;
 
 	switch (dev->hdr_type) {		    /* header type */
 	case PCI_HEADER_TYPE_NORMAL:		    /* standard header */
Signature · 6 lines
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

Yeah I should have queued this for the last pull. I'll send another request with this patch as soon as Linus pulls.

Jesse

Quoted 55 lines · On Mon, 01 Jun 2009 09:50:07 +0800 Yu Zhao <[email protected]> wrote:

Hi Jesse,

Can you please take this fix for 2.6.30 RC if possible? It fixes a regression introduced by the SR-IOV patch series.

Thanks,
Yu

Quoted 44 lines · Grant Grundler
Quoted 3 lines · Yu Zhao

The device class may be changed after the early fixup. Need to re-read the class value from pci_dev when configuring the device. Otherwise some devices such as JMicron SATA controller won't work.

I looked at pci_setup_device() and was thinking pci_fixup_device() should be called before pci_cfg_space_size() and thus avoid having to setup local "class" variable twice. pci_cfg_space_size() only seems to care if the device is a PCI_CLASS_BRIDGE_HOST (or not).

But dev->class has to be set up in any case and the current order makes more sense to me.

thanks,
grant

Quoted 26 lines
---
 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/pci/probe.c +2 -0
index e3c3e08..f1ae247 100644
@@ -745,6 +745,8 @@ int pci_setup_device(struct pci_dev *dev)
 
 	/* Early fixups, before probing the BARs */
 	pci_fixup_device(pci_fixup_early, dev);
+	/* device class may be changed after fixup */
+	class = dev->class >> 8;
 
 	switch (dev->hdr_type) {		    /* header

type */ case PCI_HEADER_TYPE_NORMAL: /*
standard header */ --
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#4 lore raw
In reply to Yu Zhao
Quoted 4 lines · On Mon, 01 Jun 2009 09:50:07 +0800 Yu Zhao <[email protected]> wrote:

Hi Jesse,

Can you please take this fix for 2.6.30 RC if possible? It fixes a regression introduced by the SR-IOV patch series.

Applied to my for-linus tree. I'll try to get it to Linus before he releases the final 2.6.30.

Jesse