PCI: Avoid broken MSI on SB600 USB devices
PATCH 1/1 PCI: Avoid broken MSI on SB600 USB devices
From: Bjorn Helgaas <[email protected]>
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting PCI_COMMAND_INTX_DISABLE, MSI doesn't work either. The PCI/PCIe specs do not require software to set PCI_COMMAND_INTX_DISABLE when enabling MSI, but Linux has done that for many years.
Mick reported that 306c54d0edb6 ("usb: hcd: Try MSI interrupts on PCI devices") broke these devices. Prior to 306c54d0edb6, they used INTx. Starting with 306c54d0edb6, they use MSI, and and the fact that Linux sets PCI_COMMAND_INTX_DISABLE means both INTx and MSI are disabled on these devices.
Avoid this SB600 defect by disabling MSI so we use INTx as before.
--- drivers/pci/quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/pci/quirks.c +12 -0
@@ -1811,6 +1811,18 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_EESSC , quirk_alder_ioapic);#endif +static void quirk_no_msi (struct pci_dev *dev) +{ +pci_info (dev,"avoiding MSI to work around a hardware defect\n" ); + dev->no_msi =1 ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4386 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4387 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4388 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4389 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438a , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438b , quirk_no_msi); +static void quirk_pcie_mch (struct pci_dev *pdev) { pdev->no_msi =1 ;
Signature · 1 line
2.25.1
Quoted 15 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting
PCI_COMMAND_INTX_DISABLE, MSI doesn't work either. The PCI/PCIe specs do not require software to setPCI_COMMAND_INTX_DISABLEwhen enabling MSI, but Linux has done that for many years.Mick reported that
306c54d0edb6("usb: hcd: Try MSI interrupts on PCI devices") broke these devices. Prior to306c54d0edb6, they used INTx. Starting with306c54d0edb6, they use MSI, and and the fact that Linux setsPCI_COMMAND_INTX_DISABLEmeans both INTx and MSI are disabled on these devices.Avoid this SB600 defect by disabling MSI so we use INTx as before.
Quoted 7 lines
Fixes 306c54d0edb6 ("usb: hcd: Try MSI interrupts on PCI devices")Link https://lore.kernel.org/all/PxIByDyBRcsbpcmVhGSNDFAoUcMmb78ctXCkw6fbpx25TGlCHvA6SJjjFkNr1FfQZMntYPTNyvEnblxzAZ8a6jP9ddLpKeCN6Chi_2FuexU=@protonmail.com/ open hereReported-by Mick Lorain <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>
Unless there's objection, I plan to include this in the v5.18 pull request in the next few days.
It was in the 20220322 linux-next tree:
https://lore.kernel.org/linux-next/[email protected]/
Quoted 30 lines
--- drivers/pci/quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/pci/quirks.c +12
-0@@ -1811,6 +1811,18 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_EESSC , quirk_alder_ioapic);#endif +static void quirk_no_msi (struct pci_dev *dev) +{ +pci_info (dev,"avoiding MSI to work around a hardware defect\n" ); + dev->no_msi =1 ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4386 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4387 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4388 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4389 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438a , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438b , quirk_no_msi); +static void quirk_pcie_mch (struct pci_dev *pdev) { pdev->no_msi =1 ;Signature · 1 line
2.25.1
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting
PCI_COMMAND_INTX_DISABLE,MSI doesn't work either.
I think this is not correct.
Quoted 11 lines
Quoted 11 lines
The PCI/PCIe
specs do not require software to setPCI_COMMAND_INTX_DISABLEwhen enabling MSI, but Linux has done that for many years.Mick reported that
306c54d0edb6("usb: hcd: Try MSI interrupts on PCI devices") broke these devices. Prior to306c54d0edb6, they used INTx. Starting with306c54d0edb6, they use MSI, and and the fact that Linux setsPCI_COMMAND_INTX_DISABLEmeans both INTx and MSI are disabled on these devices.Avoid this SB600 defect by disabling MSI so we use INTx as before.
And this is kinda too conservative approach.
Quoted 7 lines
Quoted 7 lines
Fixes 306c54d0edb6 ("usb: hcd: Try MSI interrupts on PCI devices")Link https://lore.kernel.org/all/PxIByDyBRcsbpcmVhGSNDFAoUcMmb78ctXCkw6fbpx25TGlCHvA6SJjjFkNr1FfQZMntYPTNyvEnblxzAZ8a6jP9ddLpKeCN6Chi_2FuexU=@protonmail.com/ open hereReported-by Mick Lorain <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>
And it hasn't been tested by the reporter.
Quoted 2 lines
Unless there's objection, I plan to include this in the v5.18 pull request in the next few days.
You are the maintainer here and it's your choice. I'm not going to stop you.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting
PCI_COMMAND_INTX_DISABLE,MSI doesn't work either.
I think this is not correct.
I'd like to make it correct. What would make this better? I was trying to say the same as your original commit log:
ATI PCIe-USB adapter advertises MSI, but it doesn't work if INTx is disabled.
Bjorn
Quoted 5 lines · Bjorn Helgaas
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Bjorn Helgaas
Quoted 2 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting
PCI_COMMAND_INTX_DISABLE,MSI doesn't work either.
I think this is not correct.
I'd like to make it correct. What would make this better?
MSI with the quirk (not in this patch) is working and has been tested. That said, the part that I commented on is confusing and states the opposite. I would change the patch if you ask me how to improve it,
Quoted 5 lines
I was
trying to say the same as your original commit log:ATI PCIe-USB adapter advertises MSI, but it doesn't work if INTx is disabled.
I'm not a native speaker, maybe I was wrong in formulating that MSI enabling needs a quirk.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by settingPCI_COMMAND_INTX_DISABLE,MSI doesn't work either.
I think this is not correct.
I think it was perfectly correct until you added a couple of newlines in the middle of the sentence, then took it out of context. :)
"If INTX is disabled, MSI doesn't work either".
But really, in that case surely the solution is *not* to disable INTX for this device. Then MSI will work, right?
Quoted 12 lines · David Woodhouse
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by settingPCI_COMMAND_INTX_DISABLE,MSI doesn't work either.
I think this is not correct.
Quoted 7 lines
I think it was perfectly correct until you added a couple of newlines in the middle of the sentence, then took it out of context. :)
"If INTX is disabled, MSI doesn't work either".
But really, in that case surely the solution is *not* to disable INTX for this device. Then MSI will work, right?
That's what Andy's original patch [1] does, and MSI *does* work if we skip disabling INTx.
I'm hesitant [2] about that approach because it creates two classes of devices using MSI (most have INTx disabled but a few do not), which makes it harder to reason about them. For example, there are non-MSI paths that read or set the "disable INTx" bit, so we have to consider:
- will readers be surprised if a device using MSI has INTx enabled?
- will writers care disabling INTx disables *all* interrupts, not just INTx?
So skipping the INTx disable certainly works most of the time and *likely* works all the time, but there are cases that could be problems and we don't have a compelling reason to use MSI on these devices.
[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/20220318210947.GA845994@bhelgaas
Quoted 7 lines · David Woodhouse
Quoted 6 lines · Andy Shevchenko
Quoted 4 lines · Bjorn Helgaas
Quoted 3 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by settingPCI_COMMAND_INTX_DISABLE,
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
MSI doesn't work either.
I think this is not correct.
I think it was perfectly correct until you added a couple of newlines in the middle of the sentence, then took it out of context. :)
"If INTX is disabled, MSI doesn't work either".
Ah, I stand corrected. Thanks for the English lesson!
Quoted 2 lines
But really, in that case surely the solution is *not* to disable INTX for this device. Then MSI will work, right?
That was my intention, but Bjorn has concerns.
Signature · 2 lines
With Best Regards, Andy Shevchenko