Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1450681 > unrolled thread

[PATCH 1/2] thunderbolt: Fix resume quirk for Falcon Ridge 4C.

Started byAndreas Noever <andreas.noever@gmail.com>
First post2016-07-26 18:50 +0200
Last post2016-08-08 09:30 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] thunderbolt: Fix resume quirk for Falcon Ridge 4C. Andreas Noever <andreas.noever@gmail.com> - 2016-07-26 18:50 +0200
    Re: [PATCH 1/2] thunderbolt: Fix resume quirk for Falcon Ridge 4C. Lukas Wunner <lukas@wunner.de> - 2016-08-03 10:50 +0200
    [PATCH] thunderbolt: Don't declare Falcon Ridge unsupported Lukas Wunner <lukas@wunner.de> - 2016-08-03 10:50 +0200
      Re: [PATCH] thunderbolt: Don't declare Falcon Ridge unsupported Andreas Noever <andreas.noever@gmail.com> - 2016-08-08 09:30 +0200

#1450681 — [PATCH 1/2] thunderbolt: Fix resume quirk for Falcon Ridge 4C.

FromAndreas Noever <andreas.noever@gmail.com>
Date2016-07-26 18:50 +0200
Subject[PATCH 1/2] thunderbolt: Fix resume quirk for Falcon Ridge 4C.
Message-ID<rZdIl-4pd-11@gated-at.bofh.it>
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.

Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
---
 drivers/pci/quirks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index ee72ebe..75b2105 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -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);
-- 
2.9.0

[toc] | [next] | [standalone]


#1455701

FromLukas Wunner <lukas@wunner.de>
Date2016-08-03 10:50 +0200
Message-ID<s202d-eJ-5@gated-at.bofh.it>
In reply to#1450681
On Tue, Jul 26, 2016 at 06:40:37PM +0200, Andreas Noever wrote:
> 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.
> 
> Signed-off-by: Andreas Noever <andreas.noever@gmail.com>

FWIW, this is
Reviewed-by: Lukas Wunner <lukas@wunner.de>

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

> ---
>  drivers/pci/quirks.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index ee72ebe..75b2105 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -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);
> -- 
> 2.9.0

[toc] | [prev] | [next] | [standalone]


#1455703 — [PATCH] thunderbolt: Don't declare Falcon Ridge unsupported

FromLukas Wunner <lukas@wunner.de>
Date2016-08-03 10:50 +0200
Subject[PATCH] thunderbolt: Don't declare Falcon Ridge unsupported
Message-ID<s202d-eJ-15@gated-at.bofh.it>
In reply to#1450681
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 <andreas.noever@gmail.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/thunderbolt/switch.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 1e116f5..9840fde 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -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

[toc] | [prev] | [next] | [standalone]


#1457584 — Re: [PATCH] thunderbolt: Don't declare Falcon Ridge unsupported

FromAndreas Noever <andreas.noever@gmail.com>
Date2016-08-08 09:30 +0200
SubjectRe: [PATCH] thunderbolt: Don't declare Falcon Ridge unsupported
Message-ID<s3Nax-6Lv-1@gated-at.bofh.it>
In reply to#1455703
On Wed, Aug 3, 2016 at 10:44 AM, Lukas Wunner <lukas@wunner.de> wrote:
> 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 <andreas.noever@gmail.com>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>

> ---
>  drivers/thunderbolt/switch.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
> index 1e116f5..9840fde 100644
> --- a/drivers/thunderbolt/switch.c
> +++ b/drivers/thunderbolt/switch.c
> @@ -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
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web