All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Cc: "x86@kernel.org" <x86@kernel.org>, "Felipe Balbi" <balbi@ti.com>,
	"Yu Zhao" <yu.zhao@intel.com>, "Huang Rui" <ray.huang@amd.com>,
	"Krzysztof Hałasa" <khalasa@piap.pl>,
	"Jason Chang" <jason.chang@amd.com>,
	"Mathias Nyman" <mathias.nyman@intel.com>
Subject: Re: [PATCH 4/6] PCI: Fix Intel generic reset quirk class code check
Date: Wed, 24 Jun 2015 15:46:02 -0500	[thread overview]
Message-ID: <CAErSpo5uq2Tq7=smQFabW8SjogO7S1-3vK9-1q0xxJ34j8qC7w@mail.gmail.com> (raw)
In-Reply-To: <CAErSpo6JtrMS9wvF8KHfVank+iLzP9BqvE9xZo_he_3w-+zA3Q@mail.gmail.com>

On Fri, Jun 19, 2015 at 6:06 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> [-cc Dexuan, Matthew (bounced)]
> [+cc Mathias, since MAINTAINERS mentions USB, Intel, and you in one entry :)]
>
> On Fri, Jun 19, 2015 at 5:42 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> We checked for "dev->class == PCI_CLASS_SERIAL_USB", but dev->class
>> contains the entire three-byte base class/sub-class/interface, while
>> PCI_CLASS_SERIAL_USB is only the two-byte base class/sub-class.
>>
>> This error meant that we used the Intel device-specific reset on devices
>> with class code 0x000c03 instead of those with class code 0x0c03xx.
>> 0x000c03 is a reserved value in the 0x00 backwards compatibility base class
>> and shouldn't match any devices, so I think reset_intel_generic_dev()
>> always failed.
>>
>> Shift dev->class to discard the interface byte before comparing with
>> PCI_CLASS_SERIAL_USB.
>>
>> Fixes: aeb30016fec3 ("PCI: add Intel USB specific reset method")
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> CC: Dexuan Cui <dexuan.cui@intel.com>
>> CC: Yu Zhao <yu.zhao@intel.com>
>> ---
>>  drivers/pci/quirks.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> index 8bc60c2..356a401 100644
>> --- a/drivers/pci/quirks.c
>> +++ b/drivers/pci/quirks.c
>> @@ -3358,7 +3358,7 @@ static int reset_intel_generic_dev(struct pci_dev *dev, int probe)
>>         int pos;
>>
>>         /* only implement PCI_CLASS_SERIAL_USB at present */
>> -       if (dev->class == PCI_CLASS_SERIAL_USB) {
>> +       if ((dev->class >> 8) == PCI_CLASS_SERIAL_USB) {
>
> I'm a little bit concerned about this change because it *looks* like
> this has always been broken, but I assume it was tested and somebody
> would have noticed.

Unless we get confirmation that somebody cares about
reset_intel_generic_dev() and it has been tested, I'm inclined to
revert aeb30016fec3 ("PCI: add Intel USB specific reset method")
instead of applying this fix.

I think reset_intel_generic_dev() always returns -ENOTTY except for
devices with "class == 0x000c03", which is an invalid class code.  If
I "fix" it by putting in the shift, it will start poking at config
space on Intel USB devices.  I have no way of testing that, and I
haven't seen a problem report related to this, so a change is just as
likely to break something as to fix something.

So the safest thing looks like just dropping the quirk altogether,
which shouldn't change behavior at all.

>>                 pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
>>                 if (!pos)
>>                         return -ENOTTY;
>>

  reply	other threads:[~2015-06-24 20:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 22:42 [PATCH 0/6] PCI: Fix class code usage Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 1/6] PCI: Use PCI_CLASS_SERIAL_USB instead of bare number Bjorn Helgaas
2015-06-23  2:07   ` Huang Rui
2015-06-19 22:42 ` [PATCH 2/6] PCI: Fix generic NCR 53c810 class code quirk Bjorn Helgaas
2015-06-19 22:58   ` Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 3/6] PCI: Fix TI816X " Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 4/6] PCI: Fix Intel generic reset quirk class code check Bjorn Helgaas
2015-06-19 23:06   ` Bjorn Helgaas
2015-06-24 20:46     ` Bjorn Helgaas [this message]
2015-06-19 22:42 ` [PATCH 5/6] PCI: Simplify reset_intel_generic_dev() Bjorn Helgaas
2015-06-19 22:42 ` [PATCH 6/6] PCI: Shift PCI_CLASS_NOT_DEFINED consistently with other classes Bjorn Helgaas

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='CAErSpo5uq2Tq7=smQFabW8SjogO7S1-3vK9-1q0xxJ34j8qC7w@mail.gmail.com' \
    --to=bhelgaas@google.com \
    --cc=balbi@ti.com \
    --cc=jason.chang@amd.com \
    --cc=khalasa@piap.pl \
    --cc=linux-pci@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=ray.huang@amd.com \
    --cc=x86@kernel.org \
    --cc=yu.zhao@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.