thunderbolt: Fix resume quirk for Falcon Ridge 4C.
Subsystems (2)
Andreas Noever
maintainerPATCH 1/2 thunderbolt: Fix resume quirk for Falcon Ridge 4C.
The quirk 'quirk_apple_wait_for_thunderbolt' did not fire on Falcon Ridge 4C controllers with subdevice/subvendor set to zero. This lead to lost pci devices on system resume.
Older thunderbolt controllers (pre Falcon Ridge) used the same device id for bridges and for the controller. On Apple hardware the subvendor- & subdevice-ids were set for the controller, but not for bridges. So that is what was used to differentiate between the two. Starting with Falcon Ridge bridges and controllers received different device ids. Additionally on some MacBookPro models (but not all) the subvendor/subdevice was zeroed.
Starting with a42fb351c (thunderbolt: Allow loading of module on recent Apple MacBooks with thunderbolt 2 controller) the thunderbolt driver binds to all Falcon Ridge 4C controllers (irregardless of subvendor/subdevice). The corresponding quirk was not updated.
This commit changes the quirk to check the device class instead of its subvendor-/subdeviceids. This works for all generations of Thunderbolt controllers.
--- drivers/pci/quirks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pci/quirks.c +1 -2
@@ -3326,8 +3326,7 @@ static void quirk_apple_wait_for_thunderbolt(struct pci_dev *dev) || (nhi->device != PCI_DEVICE_ID_INTEL_LIGHT_RIDGE && nhi->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C && nhi->device != PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI) - || nhi->subsystem_vendor != 0x2222 - || nhi->subsystem_device != 0x1111) + || nhi->class != PCI_CLASS_SYSTEM_OTHER << 8) goto out;dev_info (&dev->dev,"quirk: waiting for thunderbolt to reestablish PCI tunnels...\n" );device_pm_wait_for_dev (&dev->dev, &nhi->dev);
Signature · 1 line
2.9.0
Andreas Noever
maintainerPATCH 2/2 thunderbolt: Add support for INTEL_FALCON_RIDGE_2C controller.
From: Xavier Gnata <[email protected]>
From: Xavier Gnata <[email protected]>
Add support to INTEL_FALCON_RIDGE_2C controller and corresponding quirk to support suspend/resume.
Tested against 4.7 master on a MacBook Air 11" 2015.
--- drivers/pci/quirks.c | 4 ++++ drivers/thunderbolt/nhi.c | 6 ++++++ 2 files changed, 10 insertions(+)
Rebased version of Xavier's patch.
Xavier, could you verify that this still works on your system?
Thanks,
Andreas
drivers/pci/quirks.c +4 -0
@@ -3325,6 +3325,7 @@ static void quirk_apple_wait_for_thunderbolt(struct pci_dev *dev)if (nhi->vendor !=PCI_VENDOR_ID_INTEL || (nhi->device !=PCI_DEVICE_ID_INTEL_LIGHT_RIDGE && nhi->device !=PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C && + nhi->device !=PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI && nhi->device !=PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI ) || nhi->class !=PCI_CLASS_SYSTEM_OTHER <<8 ) goto out;
@@ -3341,6 +3342,9 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C , quirk_apple_wait_for_thunderbolt);DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_INTEL , +PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE , + quirk_apple_wait_for_thunderbolt); +DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE , quirk_apple_wait_for_thunderbolt);#endif
drivers/thunderbolt/nhi.c +6 -0
@@ -651,6 +651,12 @@ static struct pci_device_id nhi_ids[] = { { .class = PCI_CLASS_SYSTEM_OTHER << 8, .class_mask = ~0, .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, + }, + { + .class = PCI_CLASS_SYSTEM_OTHER << 8, .class_mask = ~0, + .vendor = PCI_VENDOR_ID_INTEL, .device = PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, },
Signature · 1 line
2.9.0
Andreas Noever
maintainerRe: [PATCH 2/2] thunderbolt: Add support for INTEL_FALCON_RIDGE_2C controller.
In reply to a message not in the archiveQuoted 18 lines · Xavier Gnata
Quoted 15 lines · Andreas Noever
From: Xavier Gnata <[email protected]>
From: Xavier Gnata <[email protected]>
Add support to
INTEL_FALCON_RIDGE_2Ccontroller and corresponding quirk to support suspend/resume.
Tested against 4.7 master on a MacBook Air 11" 2015.Signed-off-by Andreas Noever <[email protected]>--- drivers/pci/quirks.c | 4 ++++ drivers/thunderbolt/nhi.c | 6 ++++++ 2 files changed, 10 insertions(+)
Quoted 8 lines
Quoted 4 lines
Rebased version of Xavier's patch.
Xavier, could you verify that this still works on your system?
It does work on my system.
Thanks,
Xavier
Cool.
Greg, can we still get these into the current merge window?
Andreas
Quoted 49 lines
Quoted 48 lines
Thanks,
Andreasdrivers/pci/quirks.c +0
-0@@ -3325,6 +3325,7 @@ static void quirk_apple_wait_for_thunderbolt(struct pci_dev *dev) if (nhi->vendor != PCI_VENDOR_ID_INTEL || (nhi->device != PCI_DEVICE_ID_INTEL_LIGHT_RIDGE && nhi->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C&&
+nhi->device!=PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI&&nhi->device != PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI) || nhi->class != PCI_CLASS_SYSTEM_OTHER << 8) goto out;drivers/pci/quirks.c +3
-0@@ -3341,6 +3342,9 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C , quirk_apple_wait_for_thunderbolt);DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_INTEL , +PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE , + quirk_apple_wait_for_thunderbolt); +DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE , quirk_apple_wait_for_thunderbolt);#endif drivers/thunderbolt/nhi.c +6
-0@@ -651,6 +651,12 @@ static struct pci_device_id nhi_ids[] = { { .class = PCI_CLASS_SYSTEM_OTHER << 8, .class_mask = ~0, .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, + }, + { + .class = PCI_CLASS_SYSTEM_OTHER << 8, .class_mask = ~0, + .vendor = PCI_VENDOR_ID_INTEL, .device = PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, },
Re: [PATCH 2/2] thunderbolt: Add support for INTEL_FALCON_RIDGE_2C controller.
Quoted 23 lines · Andreas Noever
Quoted 22 lines · Xavier Gnata
Quoted 19 lines · Andreas Noever
From: Xavier Gnata <[email protected]>
From: Xavier Gnata <[email protected]>
Add support to
INTEL_FALCON_RIDGE_2Ccontroller and corresponding quirk to support suspend/resume.
Tested against 4.7 master on a MacBook Air 11" 2015.Signed-off-by Andreas Noever <[email protected]>--- drivers/pci/quirks.c | 4 ++++ drivers/thunderbolt/nhi.c | 6 ++++++ 2 files changed, 10 insertions(+)Rebased version of Xavier's patch.
Xavier, could you verify that this still works on your system?
Quoted 8 lines
Quoted 4 lines
It does work on my system.
Thanks,
XavierCool.
Greg, can we still get these into the current merge window?
Hah, no, trees closed a week or so ago. This is all for 4.9, sorry. My trees will open up after 4.8-rc1 is out and I'll start working on reviewing patches then.
thanks,
greg k-h
Quoted 17 lines · Andreas Noever
The quirk '
quirk_apple_wait_for_thunderbolt' did not fire on Falcon Ridge 4C controllers with subdevice/subvendor set to zero. This lead to lost pci devices on system resume.Older thunderbolt controllers (pre Falcon Ridge) used the same device id for bridges and for the controller. On Apple hardware the subvendor- & subdevice-ids were set for the controller, but not for bridges. So that is what was used to differentiate between the two. Starting with Falcon Ridge bridges and controllers received different device ids. Additionally on some MacBookPro models (but not all) the subvendor/subdevice was zeroed.
Starting with
a42fb351c(thunderbolt: Allow loading of module on recent Apple MacBooks with thunderbolt 2 controller) the thunderbolt driver binds to all Falcon Ridge 4C controllers (irregardless of subvendor/subdevice). The corresponding quirk was not updated.
Quoted 5 lines
This commit changes the quirk to check the device class instead of its subvendor-/subdeviceids. This works for all generations of Thunderbolt controllers.
Signed-off-by Andreas Noever <[email protected]>
FWIW, this is
I also tested it successfully on Light Ridge. I'm sending a follow-up patch separately so that Falcon Ridge chips are no longer declared unsupported.
Thanks,
Lukas
Quoted 20 lines
--- drivers/pci/quirks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/pci/quirks.c +1
-2@@ -3326,8 +3326,7 @@ static void quirk_apple_wait_for_thunderbolt(struct pci_dev *dev) || (nhi->device != PCI_DEVICE_ID_INTEL_LIGHT_RIDGE && nhi->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C && nhi->device != PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI) - || nhi->subsystem_vendor != 0x2222 - || nhi->subsystem_device != 0x1111) + || nhi->class != PCI_CLASS_SYSTEM_OTHER << 8) goto out;dev_info (&dev->dev,"quirk: waiting for thunderbolt to reestablish PCI tunnels...\n" );device_pm_wait_for_dev (&dev->dev, &nhi->dev);Signature · 1 line
2.9.0
PATCH 1/1 thunderbolt: Don't declare Falcon Ridge unsupported
In reply to Andreas NoeverFalcon Ridge 4C has been supported by the driver from the beginning, Falcon Ridge 2C support was just added. Don't irritate users with a warning declaring the opposite.
--- drivers/thunderbolt/switch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/thunderbolt/switch.c +3 -1
@@ -372,7 +372,9 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, u64 route)if (sw->config.device_id !=PCI_DEVICE_ID_INTEL_LIGHT_RIDGE && sw->config.device_id !=PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C && - sw->config.device_id !=PCI_DEVICE_ID_INTEL_PORT_RIDGE ) + sw->config.device_id !=PCI_DEVICE_ID_INTEL_PORT_RIDGE && + sw->config.device_id !=PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE && + sw->config.device_id !=PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE )tb_sw_warn (sw,"unsupported switch device id %#x\n" , sw->config.device_id);
Signature · 1 line
2.8.1
Andreas Noever
maintainerRe: [PATCH] thunderbolt: Don't declare Falcon Ridge unsupported
Quoted 6 lines · Lukas Wunner
Falcon Ridge 4C has been supported by the driver from the beginning, Falcon Ridge 2C support was just added. Don't irritate users with a warning declaring the opposite.
Cc Andreas Noever <[email protected]>Signed-off-by Lukas Wunner <[email protected]>
Quoted 22 lines
--- drivers/thunderbolt/switch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/thunderbolt/switch.c +3
-2@@ -372,7 +372,9 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, u64 route)if (sw->config.device_id !=PCI_DEVICE_ID_INTEL_LIGHT_RIDGE && sw->config.device_id !=PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C && - sw->config.device_id !=PCI_DEVICE_ID_INTEL_PORT_RIDGE ) + sw->config.device_id !=PCI_DEVICE_ID_INTEL_PORT_RIDGE && + sw->config.device_id !=PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE && + sw->config.device_id !=PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE )tb_sw_warn (sw,"unsupported switch device id %#x\n" , sw->config.device_id); --2.8.1