public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: use fixed-up device class when configuring device
@ 2009-05-27 16:25 Yu Zhao
  2009-05-29 17:19 ` Grant Grundler
  0 siblings, 1 reply; 5+ messages in thread
From: Yu Zhao @ 2009-05-27 16:25 UTC (permalink / raw)
  To: jbarnes; +Cc: linux-pci, marc.c.dionne, linux-kernel, 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.

Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
---
 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e3c3e08..f1ae247 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: use fixed-up device class when configuring device
  2009-05-27 16:25 [PATCH] PCI: use fixed-up device class when configuring device Yu Zhao
@ 2009-05-29 17:19 ` Grant Grundler
  2009-06-01  1:50   ` Yu Zhao
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Grundler @ 2009-05-29 17:19 UTC (permalink / raw)
  To: Yu Zhao; +Cc: jbarnes, linux-pci, marc.c.dionne, linux-kernel

On Thu, May 28, 2009 at 12:25:05AM +0800, Yu Zhao wrote:
> 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.

Reviewed-by: Grant Grundler <grundler@parisc-linux.org>

thanks,
grant

> Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
> ---
>  drivers/pci/probe.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index e3c3e08..f1ae247 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: use fixed-up device class when configuring device
  2009-05-29 17:19 ` Grant Grundler
@ 2009-06-01  1:50   ` Yu Zhao
  2009-06-01  8:31     ` Jesse Barnes
  2009-06-04 10:32     ` Jesse Barnes
  0 siblings, 2 replies; 5+ messages in thread
From: Yu Zhao @ 2009-06-01  1:50 UTC (permalink / raw)
  To: jbarnes@virtuousgeek.org
  Cc: Grant Grundler, linux-pci@vger.kernel.org,
	marc.c.dionne@gmail.com, linux-kernel@vger.kernel.org

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

Grant Grundler wrote:
> On Thu, May 28, 2009 at 12:25:05AM +0800, Yu Zhao wrote:
>> 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.
> 
> Reviewed-by: Grant Grundler <grundler@parisc-linux.org>
> 
> thanks,
> grant
> 
>> Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
>> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
>> ---
>>  drivers/pci/probe.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
>> index e3c3e08..f1ae247 100644
>> --- a/drivers/pci/probe.c
>> +++ b/drivers/pci/probe.c
>> @@ -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 majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: use fixed-up device class when configuring device
  2009-06-01  1:50   ` Yu Zhao
@ 2009-06-01  8:31     ` Jesse Barnes
  2009-06-04 10:32     ` Jesse Barnes
  1 sibling, 0 replies; 5+ messages in thread
From: Jesse Barnes @ 2009-06-01  8:31 UTC (permalink / raw)
  To: Yu Zhao
  Cc: Grant Grundler, linux-pci@vger.kernel.org,
	marc.c.dionne@gmail.com, linux-kernel@vger.kernel.org

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

Jesse

On Mon, 01 Jun 2009 09:50:07 +0800
Yu Zhao <yu.zhao@intel.com> 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
> 
> Grant Grundler wrote:
> > On Thu, May 28, 2009 at 12:25:05AM +0800, Yu Zhao wrote:
> >> 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.
> > 
> > Reviewed-by: Grant Grundler <grundler@parisc-linux.org>
> > 
> > thanks,
> > grant
> > 
> >> Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
> >> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
> >> ---
> >>  drivers/pci/probe.c |    2 ++
> >>  1 files changed, 2 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> >> index e3c3e08..f1ae247 100644
> >> --- a/drivers/pci/probe.c
> >> +++ b/drivers/pci/probe.c
> >> @@ -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 majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: use fixed-up device class when configuring device
  2009-06-01  1:50   ` Yu Zhao
  2009-06-01  8:31     ` Jesse Barnes
@ 2009-06-04 10:32     ` Jesse Barnes
  1 sibling, 0 replies; 5+ messages in thread
From: Jesse Barnes @ 2009-06-04 10:32 UTC (permalink / raw)
  To: Yu Zhao
  Cc: Grant Grundler, linux-pci@vger.kernel.org,
	marc.c.dionne@gmail.com, linux-kernel@vger.kernel.org

On Mon, 01 Jun 2009 09:50:07 +0800
Yu Zhao <yu.zhao@intel.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-04 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-27 16:25 [PATCH] PCI: use fixed-up device class when configuring device Yu Zhao
2009-05-29 17:19 ` Grant Grundler
2009-06-01  1:50   ` Yu Zhao
2009-06-01  8:31     ` Jesse Barnes
2009-06-04 10:32     ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox