All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: Thunderbolt hotplug not working on MacMini7,1
       [not found] <CADN=WdrsLoertuPi0Tabb6dmdRAj0d200q=5awq-xL9yE8W=hw@mail.gmail.com>
@ 2015-04-22  4:05 ` Adam Goode
  2015-04-23  2:56   ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-22  4:05 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

(resending in plain text)
(please CC me on replies, I am not on LKML)

Hi,

I have a new Mac Mini (MacMini7,1). This model supports hotplugging of
Thunderbolt on Windows 8 and above. Unfortunately hotplug does not
seem to be working for me under Linux. I get the default behavior of
devices only working if plugged in during boot.

Also, the changes made to support Darwin for _OSI seems to make it
impossible to override. This makes it hard to test if the ACPI support
for Windows 2012 will just work on Linux. I have not built a kernel
yet with Darwin _OSI patched out.

Any ideas? I think there are 2 ways forward:

1. Fix the thunderbolt code to work with this new Mac.
2. Limit the Darwin _OSI response to a whitelisted set of Mac
machines. It seems like new Macs going forward may work best with the
standard Windows 2012 response. I don't know if this method would have
advantages over #1. The obvious change might be chained hotplugging
support. I don't have a chained device to test.


For further reference:
https://bugzilla.kernel.org/show_bug.cgi?id=96981



Thanks,

Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-22  4:05 ` Fwd: Thunderbolt hotplug not working on MacMini7,1 Adam Goode
@ 2015-04-23  2:56   ` Adam Goode
  2015-04-23  7:24     ` Greg KH
  2015-04-23 10:08     ` Andreas Noever
  0 siblings, 2 replies; 18+ messages in thread
From: Adam Goode @ 2015-04-23  2:56 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Wed, Apr 22, 2015 at 12:05 AM, Adam Goode <adam@spicenitz.org> wrote:
> (resending in plain text)
> (please CC me on replies, I am not on LKML)
>
> Hi,
>
> I have a new Mac Mini (MacMini7,1). This model supports hotplugging of
> Thunderbolt on Windows 8 and above. Unfortunately hotplug does not
> seem to be working for me under Linux. I get the default behavior of
> devices only working if plugged in during boot.
>
> Also, the changes made to support Darwin for _OSI seems to make it
> impossible to override. This makes it hard to test if the ACPI support
> for Windows 2012 will just work on Linux. I have not built a kernel
> yet with Darwin _OSI patched out.
>
> Any ideas? I think there are 2 ways forward:
>
> 1. Fix the thunderbolt code to work with this new Mac.
> 2. Limit the Darwin _OSI response to a whitelisted set of Mac
> machines. It seems like new Macs going forward may work best with the
> standard Windows 2012 response. I don't know if this method would have
> advantages over #1. The obvious change might be chained hotplugging
> support. I don't have a chained device to test.
>

I have fixed the issue on my machine. On the Mac Mini, the 0x156c
device has no subvendor or subdevice. When I added the new id to
nhi_ids, everything worked without changing anything else in the
kernel. This is in the _OSI("Darwin").

Perhaps the driver is overmatching on subvendor/subdevice. Is it
necessary to do so on some models?

Can PCI_ANY_ID just be used for subvendor/subdevice?


Thanks,

Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23  2:56   ` Adam Goode
@ 2015-04-23  7:24     ` Greg KH
  2015-04-23 10:08     ` Andreas Noever
  1 sibling, 0 replies; 18+ messages in thread
From: Greg KH @ 2015-04-23  7:24 UTC (permalink / raw)
  To: Adam Goode; +Cc: Andreas Noever, linux-kernel, Matthew Garrett

On Wed, Apr 22, 2015 at 10:56:45PM -0400, Adam Goode wrote:
> On Wed, Apr 22, 2015 at 12:05 AM, Adam Goode <adam@spicenitz.org> wrote:
> > (resending in plain text)
> > (please CC me on replies, I am not on LKML)
> >
> > Hi,
> >
> > I have a new Mac Mini (MacMini7,1). This model supports hotplugging of
> > Thunderbolt on Windows 8 and above. Unfortunately hotplug does not
> > seem to be working for me under Linux. I get the default behavior of
> > devices only working if plugged in during boot.
> >
> > Also, the changes made to support Darwin for _OSI seems to make it
> > impossible to override. This makes it hard to test if the ACPI support
> > for Windows 2012 will just work on Linux. I have not built a kernel
> > yet with Darwin _OSI patched out.
> >
> > Any ideas? I think there are 2 ways forward:
> >
> > 1. Fix the thunderbolt code to work with this new Mac.
> > 2. Limit the Darwin _OSI response to a whitelisted set of Mac
> > machines. It seems like new Macs going forward may work best with the
> > standard Windows 2012 response. I don't know if this method would have
> > advantages over #1. The obvious change might be chained hotplugging
> > support. I don't have a chained device to test.
> >
> 
> I have fixed the issue on my machine. On the Mac Mini, the 0x156c
> device has no subvendor or subdevice. When I added the new id to
> nhi_ids, everything worked without changing anything else in the
> kernel. This is in the _OSI("Darwin").
> 
> Perhaps the driver is overmatching on subvendor/subdevice. Is it
> necessary to do so on some models?

Looks like it.

Can you send a patch showing the change you made to get this to work?

thanks,

greg k-h

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23  2:56   ` Adam Goode
  2015-04-23  7:24     ` Greg KH
@ 2015-04-23 10:08     ` Andreas Noever
  2015-04-23 13:28       ` Adam Goode
  2015-04-23 18:12       ` Matthew Garrett
  1 sibling, 2 replies; 18+ messages in thread
From: Andreas Noever @ 2015-04-23 10:08 UTC (permalink / raw)
  To: Adam Goode; +Cc: linux-kernel, Matthew Garrett

Hi Adam,

On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
controller both use 0x1547 and are only differentiated by
subvendor/subdevice.

0x156c is the 4 channel TB2 controller and was originally added by
Matthew. Judging from his patch it looks like the subvendor/subdevice
is set on his system:
http://patchwork.ozlabs.org/patch/354626/

But it also indicates that the bridges already use different ids. If
that is the case then we can drop the subvendor/subdevice for 0x156c.
Matthew can you confirm that on your system 0x156c is used only for
the controller?

Adam, could you check that suspend/resume works properly? Also your
bugzilla report suggest that hotplug might now work without the
driver. Could you try to revert the _OSI check (and disable the
driver) and check whether everything "just works"?

Andreas

On Thu, Apr 23, 2015 at 4:56 AM, Adam Goode <adam@spicenitz.org> wrote:
> On Wed, Apr 22, 2015 at 12:05 AM, Adam Goode <adam@spicenitz.org> wrote:
>> (resending in plain text)
>> (please CC me on replies, I am not on LKML)
>>
>> Hi,
>>
>> I have a new Mac Mini (MacMini7,1). This model supports hotplugging of
>> Thunderbolt on Windows 8 and above. Unfortunately hotplug does not
>> seem to be working for me under Linux. I get the default behavior of
>> devices only working if plugged in during boot.
>>
>> Also, the changes made to support Darwin for _OSI seems to make it
>> impossible to override. This makes it hard to test if the ACPI support
>> for Windows 2012 will just work on Linux. I have not built a kernel
>> yet with Darwin _OSI patched out.
>>
>> Any ideas? I think there are 2 ways forward:
>>
>> 1. Fix the thunderbolt code to work with this new Mac.
>> 2. Limit the Darwin _OSI response to a whitelisted set of Mac
>> machines. It seems like new Macs going forward may work best with the
>> standard Windows 2012 response. I don't know if this method would have
>> advantages over #1. The obvious change might be chained hotplugging
>> support. I don't have a chained device to test.
>>
>
> I have fixed the issue on my machine. On the Mac Mini, the 0x156c
> device has no subvendor or subdevice. When I added the new id to
> nhi_ids, everything worked without changing anything else in the
> kernel. This is in the _OSI("Darwin").
>
> Perhaps the driver is overmatching on subvendor/subdevice. Is it
> necessary to do so on some models?
>
> Can PCI_ANY_ID just be used for subvendor/subdevice?
>
>
> Thanks,
>
> Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23 10:08     ` Andreas Noever
@ 2015-04-23 13:28       ` Adam Goode
  2015-04-23 15:10         ` Adam Goode
  2015-04-23 18:12       ` Matthew Garrett
  1 sibling, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-23 13:28 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
<andreas.noever@gmail.com> wrote:
> Hi Adam,
>
> On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
> controller both use 0x1547 and are only differentiated by
> subvendor/subdevice.
>
> 0x156c is the 4 channel TB2 controller and was originally added by
> Matthew. Judging from his patch it looks like the subvendor/subdevice
> is set on his system:
> http://patchwork.ozlabs.org/patch/354626/
>
> But it also indicates that the bridges already use different ids. If
> that is the case then we can drop the subvendor/subdevice for 0x156c.
> Matthew can you confirm that on your system 0x156c is used only for
> the controller?
>
> Adam, could you check that suspend/resume works properly? Also your
> bugzilla report suggest that hotplug might now work without the
> driver. Could you try to revert the _OSI check (and disable the
> driver) and check whether everything "just works"?
>

In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
back from suspend.

I have to rebuild the kernel and remove Darwin again, but I will test
suspend/resume in "Windows 2012" mode later.

>From previous testing, hotplug doesn't automatically work in "Windows
2012" mode. It exhibits the standard no-driver behavior where devices
are not detected after boot. But even in "Windows 2012" mode I still
do get the 0x156c device, which I think used to be hidden if !Darwin.

More testing coming...


Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23 13:28       ` Adam Goode
@ 2015-04-23 15:10         ` Adam Goode
  2015-04-23 16:12           ` Andreas Noever
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-23 15:10 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>
> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
> <andreas.noever@gmail.com> wrote:
> > Hi Adam,
> >
> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
> > controller both use 0x1547 and are only differentiated by
> > subvendor/subdevice.
> >
> > 0x156c is the 4 channel TB2 controller and was originally added by
> > Matthew. Judging from his patch it looks like the subvendor/subdevice
> > is set on his system:
> > http://patchwork.ozlabs.org/patch/354626/
> >
> > But it also indicates that the bridges already use different ids. If
> > that is the case then we can drop the subvendor/subdevice for 0x156c.
> > Matthew can you confirm that on your system 0x156c is used only for
> > the controller?
> >
> > Adam, could you check that suspend/resume works properly? Also your
> > bugzilla report suggest that hotplug might now work without the
> > driver. Could you try to revert the _OSI check (and disable the
> > driver) and check whether everything "just works"?
> >
>
> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
> back from suspend.
>
> I have to rebuild the kernel and remove Darwin again, but I will test
> suspend/resume in "Windows 2012" mode later.
>
> From previous testing, hotplug doesn't automatically work in "Windows
> 2012" mode. It exhibits the standard no-driver behavior where devices
> are not detected after boot. But even in "Windows 2012" mode I still
> do get the 0x156c device, which I think used to be hidden if !Darwin.
>
> More testing coming...
>

I've booted into _OSI(Windows 2012) mode. I am not physically at the
device right now, but here is the current dmesg with 1 thunderbolt
device plugged in:

[   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
[   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
[   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
[   15.580008] thunderbolt 0000:06:00.0: control channel created
[   15.581068] thunderbolt 0000:06:00.0: control channel starting...
[   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
[   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
register 0x38200 bit 0 (0x0 -> 0x1)
[   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
[   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
register 0x38200 bit 12 (0x1 -> 0x1001)
[   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
(depth: 0, up port: 5)
[   15.587526] thunderbolt 0000:06:00.0: old switch config:
[   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
0, TB Version: 2)
[   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
[   15.590557] thunderbolt 0000:06:00.0:   Config:
[   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
[   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
[   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
[   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
[   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
0, TB Version: 1, Type: Port (0x1))
[   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
[   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
[   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
[   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
0, TB Version: 1, Type: Port (0x1))
[   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
[   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
[   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
[   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
0, TB Version: 1, Type: Port (0x1))
[   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
[   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
[   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
[   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
0, TB Version: 1, Type: Port (0x1))
[   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
[   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
[   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
[   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
0, TB Version: 1, Type: Port (0x1))
[   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
[   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
[   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
[   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
0, TB Version: 1, Type: NHI (0x2))
[   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
[   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
[   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
[   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
0, TB Version: 1, Type: PCIe (0x100101))
[   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
[   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
[   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
[   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
0, TB Version: 1, Type: PCIe (0x100101))
[   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
[   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
[   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
[   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
0, TB Version: 1, Type: PCIe (0x100101))
[   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
[   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
[   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
[   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
0, TB Version: 1, Type: PCIe (0x100101))
[   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
[   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
[   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
[   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
(Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
[   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
[   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
[   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
[   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
(Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
[   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
[   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
[   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
[   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
(Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
[   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
[   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
[   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
[   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
[   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)


Is "unsupported switch device id 0x156d" a problem?


Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23 15:10         ` Adam Goode
@ 2015-04-23 16:12           ` Andreas Noever
  2015-04-23 17:15             ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Noever @ 2015-04-23 16:12 UTC (permalink / raw)
  To: Adam Goode; +Cc: linux-kernel, Matthew Garrett

On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>
>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>> <andreas.noever@gmail.com> wrote:
>> > Hi Adam,
>> >
>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>> > controller both use 0x1547 and are only differentiated by
>> > subvendor/subdevice.
>> >
>> > 0x156c is the 4 channel TB2 controller and was originally added by
>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>> > is set on his system:
>> > http://patchwork.ozlabs.org/patch/354626/
>> >
>> > But it also indicates that the bridges already use different ids. If
>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>> > Matthew can you confirm that on your system 0x156c is used only for
>> > the controller?
>> >
>> > Adam, could you check that suspend/resume works properly? Also your
>> > bugzilla report suggest that hotplug might now work without the
>> > driver. Could you try to revert the _OSI check (and disable the
>> > driver) and check whether everything "just works"?
>> >
>>
>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>> back from suspend.
>>
>> I have to rebuild the kernel and remove Darwin again, but I will test
>> suspend/resume in "Windows 2012" mode later.
>>
>> From previous testing, hotplug doesn't automatically work in "Windows
>> 2012" mode. It exhibits the standard no-driver behavior where devices
>> are not detected after boot. But even in "Windows 2012" mode I still
>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>
>> More testing coming...
>>
>
> I've booted into _OSI(Windows 2012) mode. I am not physically at the
> device right now, but here is the current dmesg with 1 thunderbolt
> device plugged in:
>
> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
> [   15.580008] thunderbolt 0000:06:00.0: control channel created
> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
> register 0x38200 bit 0 (0x0 -> 0x1)
> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
> register 0x38200 bit 12 (0x1 -> 0x1001)
> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
> (depth: 0, up port: 5)
> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
> 0, TB Version: 2)
> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
> [   15.590557] thunderbolt 0000:06:00.0:   Config:
> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
> 0, TB Version: 1, Type: Port (0x1))
> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
> 0, TB Version: 1, Type: Port (0x1))
> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
> 0, TB Version: 1, Type: Port (0x1))
> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
> 0, TB Version: 1, Type: Port (0x1))
> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
> 0, TB Version: 1, Type: Port (0x1))
> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
> 0, TB Version: 1, Type: NHI (0x2))
> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
> 0, TB Version: 1, Type: PCIe (0x100101))
> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
> 0, TB Version: 1, Type: PCIe (0x100101))
> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
> 0, TB Version: 1, Type: PCIe (0x100101))
> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
> 0, TB Version: 1, Type: PCIe (0x100101))
> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
Strange... it does not detect the device. Does the TB device show up in lspci?

>
> Is "unsupported switch device id 0x156d" a problem?
No. I should probably remove or downgrade that warning.





>
> Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23 16:12           ` Andreas Noever
@ 2015-04-23 17:15             ` Adam Goode
  2015-04-24  4:50               ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-23 17:15 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Thu, Apr 23, 2015 at 12:12 PM, Andreas Noever
<andreas.noever@gmail.com> wrote:
> On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
>> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>
>>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>>> <andreas.noever@gmail.com> wrote:
>>> > Hi Adam,
>>> >
>>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>>> > controller both use 0x1547 and are only differentiated by
>>> > subvendor/subdevice.
>>> >
>>> > 0x156c is the 4 channel TB2 controller and was originally added by
>>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>>> > is set on his system:
>>> > http://patchwork.ozlabs.org/patch/354626/
>>> >
>>> > But it also indicates that the bridges already use different ids. If
>>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>>> > Matthew can you confirm that on your system 0x156c is used only for
>>> > the controller?
>>> >
>>> > Adam, could you check that suspend/resume works properly? Also your
>>> > bugzilla report suggest that hotplug might now work without the
>>> > driver. Could you try to revert the _OSI check (and disable the
>>> > driver) and check whether everything "just works"?
>>> >
>>>
>>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>>> back from suspend.
>>>
>>> I have to rebuild the kernel and remove Darwin again, but I will test
>>> suspend/resume in "Windows 2012" mode later.
>>>
>>> From previous testing, hotplug doesn't automatically work in "Windows
>>> 2012" mode. It exhibits the standard no-driver behavior where devices
>>> are not detected after boot. But even in "Windows 2012" mode I still
>>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>>
>>> More testing coming...
>>>
>>
>> I've booted into _OSI(Windows 2012) mode. I am not physically at the
>> device right now, but here is the current dmesg with 1 thunderbolt
>> device plugged in:
>>
>> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
>> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
>> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
>> [   15.580008] thunderbolt 0000:06:00.0: control channel created
>> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
>> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
>> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
>> register 0x38200 bit 0 (0x0 -> 0x1)
>> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
>> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
>> register 0x38200 bit 12 (0x1 -> 0x1001)
>> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
>> (depth: 0, up port: 5)
>> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
>> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
>> 0, TB Version: 2)
>> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
>> [   15.590557] thunderbolt 0000:06:00.0:   Config:
>> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
>> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
>> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
>> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
>> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
>> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
>> 0, TB Version: 1, Type: Port (0x1))
>> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
>> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
>> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
>> 0, TB Version: 1, Type: Port (0x1))
>> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
>> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
>> 0, TB Version: 1, Type: Port (0x1))
>> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
>> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
>> 0, TB Version: 1, Type: Port (0x1))
>> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
>> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
>> 0, TB Version: 1, Type: Port (0x1))
>> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
>> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
>> 0, TB Version: 1, Type: NHI (0x2))
>> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
>> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
>> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
>> 0, TB Version: 1, Type: PCIe (0x100101))
>> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
>> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
>> 0, TB Version: 1, Type: PCIe (0x100101))
>> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
>> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
>> 0, TB Version: 1, Type: PCIe (0x100101))
>> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
>> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
>> 0, TB Version: 1, Type: PCIe (0x100101))
>> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
>> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
>> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
>> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
>> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
>> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
>> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
> Strange... it does not detect the device. Does the TB device show up in lspci?
>

This may be my fault. I am not sure if I reconnected the device when I
was debugging. Almost certainly not, actually. I left it while I was
compiling a new kernel and forgot. I'll let you know tonight when I
get back.


Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23 10:08     ` Andreas Noever
  2015-04-23 13:28       ` Adam Goode
@ 2015-04-23 18:12       ` Matthew Garrett
  2015-04-24 11:41         ` Andreas Noever
  1 sibling, 1 reply; 18+ messages in thread
From: Matthew Garrett @ 2015-04-23 18:12 UTC (permalink / raw)
  To: Andreas Noever; +Cc: Adam Goode, linux-kernel

On Thu, Apr 23, 2015 at 12:08:01PM +0200, Andreas Noever wrote:
> Hi Adam,
> 
> On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
> controller both use 0x1547 and are only differentiated by
> subvendor/subdevice.

Do they have the same PCI class?

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23 17:15             ` Adam Goode
@ 2015-04-24  4:50               ` Adam Goode
  2015-04-24 11:46                 ` Andreas Noever
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-24  4:50 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Thu, Apr 23, 2015 at 1:15 PM, Adam Goode <adam@spicenitz.org> wrote:
> On Thu, Apr 23, 2015 at 12:12 PM, Andreas Noever
> <andreas.noever@gmail.com> wrote:
>> On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
>>> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>>
>>>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>>>> <andreas.noever@gmail.com> wrote:
>>>> > Hi Adam,
>>>> >
>>>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>>>> > controller both use 0x1547 and are only differentiated by
>>>> > subvendor/subdevice.
>>>> >
>>>> > 0x156c is the 4 channel TB2 controller and was originally added by
>>>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>>>> > is set on his system:
>>>> > http://patchwork.ozlabs.org/patch/354626/
>>>> >
>>>> > But it also indicates that the bridges already use different ids. If
>>>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>>>> > Matthew can you confirm that on your system 0x156c is used only for
>>>> > the controller?
>>>> >
>>>> > Adam, could you check that suspend/resume works properly? Also your
>>>> > bugzilla report suggest that hotplug might now work without the
>>>> > driver. Could you try to revert the _OSI check (and disable the
>>>> > driver) and check whether everything "just works"?
>>>> >
>>>>
>>>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>>>> back from suspend.
>>>>
>>>> I have to rebuild the kernel and remove Darwin again, but I will test
>>>> suspend/resume in "Windows 2012" mode later.
>>>>
>>>> From previous testing, hotplug doesn't automatically work in "Windows
>>>> 2012" mode. It exhibits the standard no-driver behavior where devices
>>>> are not detected after boot. But even in "Windows 2012" mode I still
>>>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>>>
>>>> More testing coming...
>>>>
>>>
>>> I've booted into _OSI(Windows 2012) mode. I am not physically at the
>>> device right now, but here is the current dmesg with 1 thunderbolt
>>> device plugged in:
>>>
>>> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
>>> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
>>> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
>>> [   15.580008] thunderbolt 0000:06:00.0: control channel created
>>> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
>>> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
>>> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
>>> register 0x38200 bit 0 (0x0 -> 0x1)
>>> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
>>> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
>>> register 0x38200 bit 12 (0x1 -> 0x1001)
>>> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
>>> (depth: 0, up port: 5)
>>> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
>>> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
>>> 0, TB Version: 2)
>>> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
>>> [   15.590557] thunderbolt 0000:06:00.0:   Config:
>>> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
>>> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
>>> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
>>> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
>>> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
>>> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: Port (0x1))
>>> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
>>> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
>>> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: Port (0x1))
>>> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
>>> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: Port (0x1))
>>> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
>>> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: Port (0x1))
>>> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
>>> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: Port (0x1))
>>> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
>>> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: NHI (0x2))
>>> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
>>> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
>>> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
>>> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
>>> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
>>> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
>>> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
>>> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
>>> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
>>> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
>>> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
>>> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
>> Strange... it does not detect the device. Does the TB device show up in lspci?
>>
>
> This may be my fault. I am not sure if I reconnected the device when I
> was debugging. Almost certainly not, actually. I left it while I was
> compiling a new kernel and forgot. I'll let you know tonight when I
> get back.
>
>
> Adam


Yes, definitely was unplugged. Hotplugging seems to work fine in
either "Windows 2012" or "Darwin" mode.

Suspend works, resume brings up video and then invariably freezes (in
either _OSI condition).


Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-23 18:12       ` Matthew Garrett
@ 2015-04-24 11:41         ` Andreas Noever
  0 siblings, 0 replies; 18+ messages in thread
From: Andreas Noever @ 2015-04-24 11:41 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Adam Goode, linux-kernel

On Thu, Apr 23, 2015 at 8:12 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Thu, Apr 23, 2015 at 12:08:01PM +0200, Andreas Noever wrote:
>> Hi Adam,
>>
>> On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>> controller both use 0x1547 and are only differentiated by
>> subvendor/subdevice.
>
> Do they have the same PCI class?
No, 0604 for the bridges and 0880 for the device.

It looks like the only reason that the bridges do not have a
subsystem/subvendor set is because there is no such field in the pci
bridge header. Instead they put 2222:1111 into the SSVID capability:

06:06.0 PCI bridge [0604]: Intel Corporation Unknown device
[8086:1547] (rev 03) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=06, secondary=08, subordinate=08, sec-latency=0
Capabilities: [80] Power Management version 3
Capabilities: [88] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable+
Capabilities: [ac] Subsystem: Unknown device [2222:1111]
Capabilities: [c0] Express Downstream Port (Slot+), MSI 00
Capabilities: [100] #8086

07:00.0 System peripheral [0880]: Intel Corporation Unknown device
[8086:1547] (rev 03)
Subsystem: Unknown device [2222:1111]
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at c1d00000 (32-bit, non-prefetchable)
Memory at c1d40000 (32-bit, non-prefetchable)
Capabilities: [80] Power Management version 3
Capabilities: [88] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable+
Capabilities: [ac] Subsystem: Unknown device [2222:1111]
Capabilities: [c0] Express Endpoint, MSI 00
Capabilities: [a0] MSI-X: Enable- Mask- TabSize=16
Capabilities: [100] #8086

pci_setup_device actually reads this capability and puts it into
dev->subsystem_vendor/device. So we might actually get bound to the
bridges (if the pcieport driver is unavailable). I'll post a patch to
bind to the class code instead. Good idea!

Andreas

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-24  4:50               ` Adam Goode
@ 2015-04-24 11:46                 ` Andreas Noever
  2015-04-24 18:39                   ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Noever @ 2015-04-24 11:46 UTC (permalink / raw)
  To: Adam Goode; +Cc: linux-kernel, Matthew Garrett

On Fri, Apr 24, 2015 at 6:50 AM, Adam Goode <adam@spicenitz.org> wrote:
> On Thu, Apr 23, 2015 at 1:15 PM, Adam Goode <adam@spicenitz.org> wrote:
>> On Thu, Apr 23, 2015 at 12:12 PM, Andreas Noever
>> <andreas.noever@gmail.com> wrote:
>>> On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>
>>>>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>>>>> <andreas.noever@gmail.com> wrote:
>>>>> > Hi Adam,
>>>>> >
>>>>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>>>>> > controller both use 0x1547 and are only differentiated by
>>>>> > subvendor/subdevice.
>>>>> >
>>>>> > 0x156c is the 4 channel TB2 controller and was originally added by
>>>>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>>>>> > is set on his system:
>>>>> > http://patchwork.ozlabs.org/patch/354626/
>>>>> >
>>>>> > But it also indicates that the bridges already use different ids. If
>>>>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>>>>> > Matthew can you confirm that on your system 0x156c is used only for
>>>>> > the controller?
>>>>> >
>>>>> > Adam, could you check that suspend/resume works properly? Also your
>>>>> > bugzilla report suggest that hotplug might now work without the
>>>>> > driver. Could you try to revert the _OSI check (and disable the
>>>>> > driver) and check whether everything "just works"?
>>>>> >
>>>>>
>>>>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>>>>> back from suspend.
>>>>>
>>>>> I have to rebuild the kernel and remove Darwin again, but I will test
>>>>> suspend/resume in "Windows 2012" mode later.
>>>>>
>>>>> From previous testing, hotplug doesn't automatically work in "Windows
>>>>> 2012" mode. It exhibits the standard no-driver behavior where devices
>>>>> are not detected after boot. But even in "Windows 2012" mode I still
>>>>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>>>>
>>>>> More testing coming...
>>>>>
>>>>
>>>> I've booted into _OSI(Windows 2012) mode. I am not physically at the
>>>> device right now, but here is the current dmesg with 1 thunderbolt
>>>> device plugged in:
>>>>
>>>> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
>>>> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
>>>> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
>>>> [   15.580008] thunderbolt 0000:06:00.0: control channel created
>>>> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
>>>> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
>>>> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
>>>> register 0x38200 bit 0 (0x0 -> 0x1)
>>>> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
>>>> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
>>>> register 0x38200 bit 12 (0x1 -> 0x1001)
>>>> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
>>>> (depth: 0, up port: 5)
>>>> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
>>>> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
>>>> 0, TB Version: 2)
>>>> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
>>>> [   15.590557] thunderbolt 0000:06:00.0:   Config:
>>>> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
>>>> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
>>>> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
>>>> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
>>>> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
>>>> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: Port (0x1))
>>>> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
>>>> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
>>>> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: Port (0x1))
>>>> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
>>>> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: Port (0x1))
>>>> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
>>>> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: Port (0x1))
>>>> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
>>>> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: Port (0x1))
>>>> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
>>>> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: NHI (0x2))
>>>> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
>>>> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
>>>> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
>>>> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
>>>> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
>>>> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
>>>> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
>>>> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
>>>> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
>>>> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
>>>> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
>>>> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
>>> Strange... it does not detect the device. Does the TB device show up in lspci?
>>>
>>
>> This may be my fault. I am not sure if I reconnected the device when I
>> was debugging. Almost certainly not, actually. I left it while I was
>> compiling a new kernel and forgot. I'll let you know tonight when I
>> get back.
>>
>>
>> Adam
>
>
> Yes, definitely was unplugged. Hotplugging seems to work fine in
> either "Windows 2012" or "Darwin" mode.
>
> Suspend works, resume brings up video and then invariably freezes (in
> either _OSI condition).
>
>
> Adam

Hm, it seems strange that hotplug would not work without the driver in
win2012 mode. If it works under windows (without additional drivers? -
maybe bootcamp includes a windows TB driver?) then it should also work
for us.

Andreas

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-24 11:46                 ` Andreas Noever
@ 2015-04-24 18:39                   ` Adam Goode
  2015-04-25  4:58                     ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-24 18:39 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Fri, Apr 24, 2015 at 7:46 AM, Andreas Noever
<andreas.noever@gmail.com> wrote:
> On Fri, Apr 24, 2015 at 6:50 AM, Adam Goode <adam@spicenitz.org> wrote:
>> On Thu, Apr 23, 2015 at 1:15 PM, Adam Goode <adam@spicenitz.org> wrote:
>>> On Thu, Apr 23, 2015 at 12:12 PM, Andreas Noever
>>> <andreas.noever@gmail.com> wrote:
>>>> On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>>> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>>
>>>>>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>>>>>> <andreas.noever@gmail.com> wrote:
>>>>>> > Hi Adam,
>>>>>> >
>>>>>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>>>>>> > controller both use 0x1547 and are only differentiated by
>>>>>> > subvendor/subdevice.
>>>>>> >
>>>>>> > 0x156c is the 4 channel TB2 controller and was originally added by
>>>>>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>>>>>> > is set on his system:
>>>>>> > http://patchwork.ozlabs.org/patch/354626/
>>>>>> >
>>>>>> > But it also indicates that the bridges already use different ids. If
>>>>>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>>>>>> > Matthew can you confirm that on your system 0x156c is used only for
>>>>>> > the controller?
>>>>>> >
>>>>>> > Adam, could you check that suspend/resume works properly? Also your
>>>>>> > bugzilla report suggest that hotplug might now work without the
>>>>>> > driver. Could you try to revert the _OSI check (and disable the
>>>>>> > driver) and check whether everything "just works"?
>>>>>> >
>>>>>>
>>>>>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>>>>>> back from suspend.
>>>>>>
>>>>>> I have to rebuild the kernel and remove Darwin again, but I will test
>>>>>> suspend/resume in "Windows 2012" mode later.
>>>>>>
>>>>>> From previous testing, hotplug doesn't automatically work in "Windows
>>>>>> 2012" mode. It exhibits the standard no-driver behavior where devices
>>>>>> are not detected after boot. But even in "Windows 2012" mode I still
>>>>>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>>>>>
>>>>>> More testing coming...
>>>>>>
>>>>>
>>>>> I've booted into _OSI(Windows 2012) mode. I am not physically at the
>>>>> device right now, but here is the current dmesg with 1 thunderbolt
>>>>> device plugged in:
>>>>>
>>>>> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
>>>>> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
>>>>> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
>>>>> [   15.580008] thunderbolt 0000:06:00.0: control channel created
>>>>> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
>>>>> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
>>>>> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>> register 0x38200 bit 0 (0x0 -> 0x1)
>>>>> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
>>>>> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>> register 0x38200 bit 12 (0x1 -> 0x1001)
>>>>> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
>>>>> (depth: 0, up port: 5)
>>>>> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
>>>>> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
>>>>> 0, TB Version: 2)
>>>>> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
>>>>> [   15.590557] thunderbolt 0000:06:00.0:   Config:
>>>>> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
>>>>> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
>>>>> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
>>>>> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
>>>>> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
>>>>> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
>>>>> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
>>>>> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: NHI (0x2))
>>>>> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
>>>>> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
>>>>> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
>>>>> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
>>>> Strange... it does not detect the device. Does the TB device show up in lspci?
>>>>
>>>
>>> This may be my fault. I am not sure if I reconnected the device when I
>>> was debugging. Almost certainly not, actually. I left it while I was
>>> compiling a new kernel and forgot. I'll let you know tonight when I
>>> get back.
>>>
>>>
>>> Adam
>>
>>
>> Yes, definitely was unplugged. Hotplugging seems to work fine in
>> either "Windows 2012" or "Darwin" mode.
>>
>> Suspend works, resume brings up video and then invariably freezes (in
>> either _OSI condition).
>>
>>
>> Adam
>
> Hm, it seems strange that hotplug would not work without the driver in
> win2012 mode. If it works under windows (without additional drivers? -
> maybe bootcamp includes a windows TB driver?) then it should also work
> for us.
>
> Andreas


I am planning to try Windows 8 or 10 on this hardware to see.

I inspected the Boot Camp driver image and did not see and Thunderbolt
drivers. But I will see for sure once I have Windows running.

I did find other Thunderbolt drivers:
https://downloadcenter.intel.com/download/23742/Thunderbolt-Intel-Thunderbolt-driver
If you download and inspect the various .inf files (no need to install
anything), you'll see the PCI matching logic they use.



Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-24 18:39                   ` Adam Goode
@ 2015-04-25  4:58                     ` Adam Goode
  2015-04-26  2:41                       ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-25  4:58 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Fri, Apr 24, 2015 at 2:39 PM, Adam Goode <adam@spicenitz.org> wrote:
> On Fri, Apr 24, 2015 at 7:46 AM, Andreas Noever
> <andreas.noever@gmail.com> wrote:
>> On Fri, Apr 24, 2015 at 6:50 AM, Adam Goode <adam@spicenitz.org> wrote:
>>> On Thu, Apr 23, 2015 at 1:15 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>> On Thu, Apr 23, 2015 at 12:12 PM, Andreas Noever
>>>> <andreas.noever@gmail.com> wrote:
>>>>> On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>>>
>>>>>>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>>>>>>> <andreas.noever@gmail.com> wrote:
>>>>>>> > Hi Adam,
>>>>>>> >
>>>>>>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>>>>>>> > controller both use 0x1547 and are only differentiated by
>>>>>>> > subvendor/subdevice.
>>>>>>> >
>>>>>>> > 0x156c is the 4 channel TB2 controller and was originally added by
>>>>>>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>>>>>>> > is set on his system:
>>>>>>> > http://patchwork.ozlabs.org/patch/354626/
>>>>>>> >
>>>>>>> > But it also indicates that the bridges already use different ids. If
>>>>>>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>>>>>>> > Matthew can you confirm that on your system 0x156c is used only for
>>>>>>> > the controller?
>>>>>>> >
>>>>>>> > Adam, could you check that suspend/resume works properly? Also your
>>>>>>> > bugzilla report suggest that hotplug might now work without the
>>>>>>> > driver. Could you try to revert the _OSI check (and disable the
>>>>>>> > driver) and check whether everything "just works"?
>>>>>>> >
>>>>>>>
>>>>>>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>>>>>>> back from suspend.
>>>>>>>
>>>>>>> I have to rebuild the kernel and remove Darwin again, but I will test
>>>>>>> suspend/resume in "Windows 2012" mode later.
>>>>>>>
>>>>>>> From previous testing, hotplug doesn't automatically work in "Windows
>>>>>>> 2012" mode. It exhibits the standard no-driver behavior where devices
>>>>>>> are not detected after boot. But even in "Windows 2012" mode I still
>>>>>>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>>>>>>
>>>>>>> More testing coming...
>>>>>>>
>>>>>>
>>>>>> I've booted into _OSI(Windows 2012) mode. I am not physically at the
>>>>>> device right now, but here is the current dmesg with 1 thunderbolt
>>>>>> device plugged in:
>>>>>>
>>>>>> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
>>>>>> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
>>>>>> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
>>>>>> [   15.580008] thunderbolt 0000:06:00.0: control channel created
>>>>>> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
>>>>>> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
>>>>>> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>>> register 0x38200 bit 0 (0x0 -> 0x1)
>>>>>> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
>>>>>> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>>> register 0x38200 bit 12 (0x1 -> 0x1001)
>>>>>> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
>>>>>> (depth: 0, up port: 5)
>>>>>> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
>>>>>> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
>>>>>> 0, TB Version: 2)
>>>>>> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
>>>>>> [   15.590557] thunderbolt 0000:06:00.0:   Config:
>>>>>> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
>>>>>> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
>>>>>> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
>>>>>> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
>>>>>> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
>>>>>> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
>>>>>> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
>>>>>> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: NHI (0x2))
>>>>>> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
>>>>>> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
>>>>>> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>>> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>>> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
>>>>>> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
>>>>> Strange... it does not detect the device. Does the TB device show up in lspci?
>>>>>
>>>>
>>>> This may be my fault. I am not sure if I reconnected the device when I
>>>> was debugging. Almost certainly not, actually. I left it while I was
>>>> compiling a new kernel and forgot. I'll let you know tonight when I
>>>> get back.
>>>>
>>>>
>>>> Adam
>>>
>>>
>>> Yes, definitely was unplugged. Hotplugging seems to work fine in
>>> either "Windows 2012" or "Darwin" mode.
>>>
>>> Suspend works, resume brings up video and then invariably freezes (in
>>> either _OSI condition).
>>>
>>>
>>> Adam
>>
>> Hm, it seems strange that hotplug would not work without the driver in
>> win2012 mode. If it works under windows (without additional drivers? -
>> maybe bootcamp includes a windows TB driver?) then it should also work
>> for us.
>>
>> Andreas
>
>
> I am planning to try Windows 8 or 10 on this hardware to see.
>
> I inspected the Boot Camp driver image and did not see and Thunderbolt
> drivers. But I will see for sure once I have Windows running.
>
> I did find other Thunderbolt drivers:
> https://downloadcenter.intel.com/download/23742/Thunderbolt-Intel-Thunderbolt-driver
> If you download and inspect the various .inf files (no need to install
> anything), you'll see the PCI matching logic they use.
>

Windows 10 has functioning hotplug on this hardware without any
Thunderbolt drivers. In fact, the 8086:156c device shows up in the
device manager as a device that Windows can't find the driver for.

So there might be some ACPI or other bug that is keeping this from
working on Linux as transparently as Windows.


Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-25  4:58                     ` Adam Goode
@ 2015-04-26  2:41                       ` Adam Goode
  2015-04-26  3:00                         ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-26  2:41 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Sat, Apr 25, 2015 at 12:58 AM, Adam Goode <adam@spicenitz.org> wrote:
> On Fri, Apr 24, 2015 at 2:39 PM, Adam Goode <adam@spicenitz.org> wrote:
>> On Fri, Apr 24, 2015 at 7:46 AM, Andreas Noever
>> <andreas.noever@gmail.com> wrote:
>>> On Fri, Apr 24, 2015 at 6:50 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>> On Thu, Apr 23, 2015 at 1:15 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>>> On Thu, Apr 23, 2015 at 12:12 PM, Andreas Noever
>>>>> <andreas.noever@gmail.com> wrote:
>>>>>> On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>>> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>>>>
>>>>>>>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>>>>>>>> <andreas.noever@gmail.com> wrote:
>>>>>>>> > Hi Adam,
>>>>>>>> >
>>>>>>>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>>>>>>>> > controller both use 0x1547 and are only differentiated by
>>>>>>>> > subvendor/subdevice.
>>>>>>>> >
>>>>>>>> > 0x156c is the 4 channel TB2 controller and was originally added by
>>>>>>>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>>>>>>>> > is set on his system:
>>>>>>>> > http://patchwork.ozlabs.org/patch/354626/
>>>>>>>> >
>>>>>>>> > But it also indicates that the bridges already use different ids. If
>>>>>>>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>>>>>>>> > Matthew can you confirm that on your system 0x156c is used only for
>>>>>>>> > the controller?
>>>>>>>> >
>>>>>>>> > Adam, could you check that suspend/resume works properly? Also your
>>>>>>>> > bugzilla report suggest that hotplug might now work without the
>>>>>>>> > driver. Could you try to revert the _OSI check (and disable the
>>>>>>>> > driver) and check whether everything "just works"?
>>>>>>>> >
>>>>>>>>
>>>>>>>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>>>>>>>> back from suspend.
>>>>>>>>
>>>>>>>> I have to rebuild the kernel and remove Darwin again, but I will test
>>>>>>>> suspend/resume in "Windows 2012" mode later.
>>>>>>>>
>>>>>>>> From previous testing, hotplug doesn't automatically work in "Windows
>>>>>>>> 2012" mode. It exhibits the standard no-driver behavior where devices
>>>>>>>> are not detected after boot. But even in "Windows 2012" mode I still
>>>>>>>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>>>>>>>
>>>>>>>> More testing coming...
>>>>>>>>
>>>>>>>
>>>>>>> I've booted into _OSI(Windows 2012) mode. I am not physically at the
>>>>>>> device right now, but here is the current dmesg with 1 thunderbolt
>>>>>>> device plugged in:
>>>>>>>
>>>>>>> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
>>>>>>> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
>>>>>>> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
>>>>>>> [   15.580008] thunderbolt 0000:06:00.0: control channel created
>>>>>>> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
>>>>>>> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
>>>>>>> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>>>> register 0x38200 bit 0 (0x0 -> 0x1)
>>>>>>> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
>>>>>>> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>>>> register 0x38200 bit 12 (0x1 -> 0x1001)
>>>>>>> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
>>>>>>> (depth: 0, up port: 5)
>>>>>>> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
>>>>>>> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
>>>>>>> 0, TB Version: 2)
>>>>>>> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
>>>>>>> [   15.590557] thunderbolt 0000:06:00.0:   Config:
>>>>>>> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
>>>>>>> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
>>>>>>> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
>>>>>>> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
>>>>>>> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
>>>>>>> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
>>>>>>> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
>>>>>>> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: NHI (0x2))
>>>>>>> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
>>>>>>> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>>> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
>>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
>>>>>>> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>>> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
>>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>>>> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>>> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>>> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
>>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>>>> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>>> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>>> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
>>>>>>> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
>>>>>> Strange... it does not detect the device. Does the TB device show up in lspci?
>>>>>>
>>>>>
>>>>> This may be my fault. I am not sure if I reconnected the device when I
>>>>> was debugging. Almost certainly not, actually. I left it while I was
>>>>> compiling a new kernel and forgot. I'll let you know tonight when I
>>>>> get back.
>>>>>
>>>>>
>>>>> Adam
>>>>
>>>>
>>>> Yes, definitely was unplugged. Hotplugging seems to work fine in
>>>> either "Windows 2012" or "Darwin" mode.
>>>>
>>>> Suspend works, resume brings up video and then invariably freezes (in
>>>> either _OSI condition).
>>>>
>>>>
>>>> Adam
>>>
>>> Hm, it seems strange that hotplug would not work without the driver in
>>> win2012 mode. If it works under windows (without additional drivers? -
>>> maybe bootcamp includes a windows TB driver?) then it should also work
>>> for us.
>>>
>>> Andreas
>>
>>
>> I am planning to try Windows 8 or 10 on this hardware to see.
>>
>> I inspected the Boot Camp driver image and did not see and Thunderbolt
>> drivers. But I will see for sure once I have Windows running.
>>
>> I did find other Thunderbolt drivers:
>> https://downloadcenter.intel.com/download/23742/Thunderbolt-Intel-Thunderbolt-driver
>> If you download and inspect the various .inf files (no need to install
>> anything), you'll see the PCI matching logic they use.
>>
>
> Windows 10 has functioning hotplug on this hardware without any
> Thunderbolt drivers. In fact, the 8086:156c device shows up in the
> device manager as a device that Windows can't find the driver for.
>
> So there might be some ACPI or other bug that is keeping this from
> working on Linux as transparently as Windows.
>
>
> Adam


Pretty sure it's some ACPI problem. I've always wanted to learn ACPI.

>From the debug output, I know it starts executing these lines in \_SB.PCI0._INI:

            Debug = "OSYS="
            Debug = OSYS /* \OSYS */
            Debug = \_SB.PCI0.LPCB.RTC.ISWI
            If (!OSDW ())
            {
                If ((OSYS >= 0x07DC))
                {
                    Debug = "Save Ridge Config on Boot"
                    R118 = UP18 /* External reference */
                    R119 = UP19 /* External reference */
...

The 3rd Debug line is where it all goes wrong. Pity, since the next
thing it's about to do is set up Thunderbolt:

[    0.125244] ACPI: BIOS _OSI("Darwin") is not supported
[    0.125250] [Firmware Bug]: ACPI: BIOS _OSI(Linux) query ignored
[    0.125251] ACPI: BIOS _OSI("Linux") is not supported
[    0.125257] ACPI: BIOS _OSI("Windows 2009") is supported
[    0.125261]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA90
[    0.125263]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA91
[    0.125274]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 0 Address=0000000088D3AA90
[    0.125276]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 0 Address=0000000088D3AA91
[    0.125288]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA9F
[    0.125298]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D1433C
[    0.125300]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D1433D
[    0.125301]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D1433E
[    0.125303]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D1433F
[    0.125315]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA90
[    0.125317]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA91
[    0.125327] ACPI: BIOS _OSI("Darwin") is not supported
[    0.125332] ACPI: BIOS _OSI("Linux") is not supported
[    0.125337] ACPI: BIOS _OSI("Windows 2009") is supported
[    0.125342]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA90
[    0.125343]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA91
[    0.125349] ACPI: BIOS _OSI("Windows 2012") is supported
[    0.125354]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA90
[    0.125356]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 1 Address=0000000088D3AA91
[    0.125366]  exregion-0321 ex_system_io_space_han: System-IO (width
8) R/W 0 Address=0000000000000B90
[    0.125369]  exregion-0321 ex_system_io_space_han: System-IO (width
8) R/W 1 Address=0000000000000B90
[    0.125376] [ACPI Debug 00110000]  String [0x05] "OSYS="
[    0.125382]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 0 Address=0000000088D3AA90
[    0.125383]  exregion-0206 ex_system_memory_space: System-Memory
(width 8) R/W 0 Address=0000000088D3AA91
[    0.125387] [ACPI Debug 00110000]  Integer 0x00000000000007DC
[    0.125392] ACPI Error: No handler for Region [CMS0]
(ffff8802658a0438) [SystemCMOS] (20150410/evregion-163)
[    0.125395] ACPI Error: Region SystemCMOS (ID=5) has no handler
(20150410/exfldio-297)
[    0.125398] ACPI Error: Method parse/execution failed
[\_SB_.PCI0._INI] (Node ffff8802658ac500), AE_NOT_EXIST
(20150410/psparse-536)
[    0.125403] ACPI Exception: AE_NOT_EXIST, during
\_SB_.PCI0._INI._INI execution (20150410/nsinit-588)

Still debugging...



Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-26  2:41                       ` Adam Goode
@ 2015-04-26  3:00                         ` Adam Goode
  2015-05-04 13:00                           ` Adam Goode
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-04-26  3:00 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

Here's the problem:

[    0.126595] ACPI Error: No handler for Region [CMS0]
(ffff8802658a0438) [SystemCMOS] (20150410/evregion-163)
[    0.126597] ACPI Error: Region SystemCMOS (ID=5) has no handler
(20150410/exfldio-297)
[    0.126600] ACPI Error: Method parse/execution failed
[\_SB_.PCI0._INI] (Node ffff8802658ac500), AE_NOT_EXIST
(20150410/psparse-536)
[    0.126605] ACPI Exception: AE_NOT_EXIST, during
\_SB_.PCI0._INI._INI execution (20150410/nsinit-588)

...

[    0.170603]       bus-0130 bus_get_status        : Device [RTC]
status [0000000f]
[    0.170605] evhandler-0446 ev_install_space_handl: Creating object
on Device ffff8802658a82a8 while installing handler
[    0.170607] evhandler-0482 ev_install_space_handl: Installing
address handler for region SystemCMOS(5) on Device RTC_
ffff8802658a82a8(ffff880264160090)
[    0.170610]  evregion-0506 ev_attach_region      : Adding Region
[CMS0] ffff8802658a0438 to address handler ffff880264160480
[SystemCMOS]


Next step is to figure out how to install the address handler earlier.


Adam


On Sat, Apr 25, 2015 at 10:41 PM, Adam Goode <adam@spicenitz.org> wrote:
> On Sat, Apr 25, 2015 at 12:58 AM, Adam Goode <adam@spicenitz.org> wrote:
>> On Fri, Apr 24, 2015 at 2:39 PM, Adam Goode <adam@spicenitz.org> wrote:
>>> On Fri, Apr 24, 2015 at 7:46 AM, Andreas Noever
>>> <andreas.noever@gmail.com> wrote:
>>>> On Fri, Apr 24, 2015 at 6:50 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>>> On Thu, Apr 23, 2015 at 1:15 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>> On Thu, Apr 23, 2015 at 12:12 PM, Andreas Noever
>>>>>> <andreas.noever@gmail.com> wrote:
>>>>>>> On Thu, Apr 23, 2015 at 5:10 PM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>>>> On Thu, Apr 23, 2015 at 9:28 AM, Adam Goode <adam@spicenitz.org> wrote:
>>>>>>>>>
>>>>>>>>> On Thu, Apr 23, 2015 at 6:08 AM, Andreas Noever
>>>>>>>>> <andreas.noever@gmail.com> wrote:
>>>>>>>>> > Hi Adam,
>>>>>>>>> >
>>>>>>>>> > On my system (MacBookPro10,1 - 4 channel TB1) the bridges and the
>>>>>>>>> > controller both use 0x1547 and are only differentiated by
>>>>>>>>> > subvendor/subdevice.
>>>>>>>>> >
>>>>>>>>> > 0x156c is the 4 channel TB2 controller and was originally added by
>>>>>>>>> > Matthew. Judging from his patch it looks like the subvendor/subdevice
>>>>>>>>> > is set on his system:
>>>>>>>>> > http://patchwork.ozlabs.org/patch/354626/
>>>>>>>>> >
>>>>>>>>> > But it also indicates that the bridges already use different ids. If
>>>>>>>>> > that is the case then we can drop the subvendor/subdevice for 0x156c.
>>>>>>>>> > Matthew can you confirm that on your system 0x156c is used only for
>>>>>>>>> > the controller?
>>>>>>>>> >
>>>>>>>>> > Adam, could you check that suspend/resume works properly? Also your
>>>>>>>>> > bugzilla report suggest that hotplug might now work without the
>>>>>>>>> > driver. Could you try to revert the _OSI check (and disable the
>>>>>>>>> > driver) and check whether everything "just works"?
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>> In _OSI("Darwin") mode, suspend/resume doesn't work. It failed to come
>>>>>>>>> back from suspend.
>>>>>>>>>
>>>>>>>>> I have to rebuild the kernel and remove Darwin again, but I will test
>>>>>>>>> suspend/resume in "Windows 2012" mode later.
>>>>>>>>>
>>>>>>>>> From previous testing, hotplug doesn't automatically work in "Windows
>>>>>>>>> 2012" mode. It exhibits the standard no-driver behavior where devices
>>>>>>>>> are not detected after boot. But even in "Windows 2012" mode I still
>>>>>>>>> do get the 0x156c device, which I think used to be hidden if !Darwin.
>>>>>>>>>
>>>>>>>>> More testing coming...
>>>>>>>>>
>>>>>>>>
>>>>>>>> I've booted into _OSI(Windows 2012) mode. I am not physically at the
>>>>>>>> device right now, but here is the current dmesg with 1 thunderbolt
>>>>>>>> device plugged in:
>>>>>>>>
>>>>>>>> [   15.576766] thunderbolt 0000:06:00.0: NHI initialized, starting thunderbolt
>>>>>>>> [   15.577868] thunderbolt 0000:06:00.0: allocating TX ring 0 of size 10
>>>>>>>> [   15.578939] thunderbolt 0000:06:00.0: allocating RX ring 0 of size 10
>>>>>>>> [   15.580008] thunderbolt 0000:06:00.0: control channel created
>>>>>>>> [   15.581068] thunderbolt 0000:06:00.0: control channel starting...
>>>>>>>> [   15.582122] thunderbolt 0000:06:00.0: starting TX ring 0
>>>>>>>> [   15.583173] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>>>>> register 0x38200 bit 0 (0x0 -> 0x1)
>>>>>>>> [   15.584228] thunderbolt 0000:06:00.0: starting RX ring 0
>>>>>>>> [   15.585281] thunderbolt 0000:06:00.0: enabling interrupt at
>>>>>>>> register 0x38200 bit 12 (0x1 -> 0x1001)
>>>>>>>> [   15.586463] thunderbolt 0000:06:00.0: initializing Switch at 0x0
>>>>>>>> (depth: 0, up port: 5)
>>>>>>>> [   15.587526] thunderbolt 0000:06:00.0: old switch config:
>>>>>>>> [   15.588569] thunderbolt 0000:06:00.0:  Switch: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 2)
>>>>>>>> [   15.589581] thunderbolt 0000:06:00.0:   Max Port Number: 12
>>>>>>>> [   15.590557] thunderbolt 0000:06:00.0:   Config:
>>>>>>>> [   15.591532] thunderbolt 0000:06:00.0:    Upstream Port Number: 5
>>>>>>>> Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
>>>>>>>> [   15.592530] thunderbolt 0000:06:00.0:    unknown1: 0x0 unknown4: 0x0
>>>>>>>> [   15.593530] thunderbolt 0000:06:00.0: 0: unsupported switch device id 0x156d
>>>>>>>> [   15.625612] thunderbolt 0000:06:00.0: 0: uid: 0x1001500947a60
>>>>>>>> [   15.626919] thunderbolt 0000:06:00.0:  Port 0: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>>> [   15.628028] thunderbolt 0000:06:00.0:   Max hop id (in/out): 7/7
>>>>>>>> [   15.629050] thunderbolt 0000:06:00.0:   Max counters: 8
>>>>>>>> [   15.630156] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>>> [   15.631685] thunderbolt 0000:06:00.0:  Port 1: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>>> [   15.632896] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>>> [   15.634000] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>>> [   15.635001] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>>> [   15.636582] thunderbolt 0000:06:00.0:  Port 2: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>>> [   15.637737] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>>> [   15.638862] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>>> [   15.639875] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>>> [   15.641452] thunderbolt 0000:06:00.0:  Port 3: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>>> [   15.642572] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>>> [   15.643702] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>>> [   15.644683] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>>> [   15.646250] thunderbolt 0000:06:00.0:  Port 4: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: Port (0x1))
>>>>>>>> [   15.647285] thunderbolt 0000:06:00.0:   Max hop id (in/out): 15/15
>>>>>>>> [   15.648370] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>>> [   15.649460] thunderbolt 0000:06:00.0:   NFC Credits: 0x3c00000
>>>>>>>> [   15.650539] thunderbolt 0000:06:00.0:  Port 5: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: NHI (0x2))
>>>>>>>> [   15.651517] thunderbolt 0000:06:00.0:   Max hop id (in/out): 11/11
>>>>>>>> [   15.652578] thunderbolt 0000:06:00.0:   Max counters: 16
>>>>>>>> [   15.653553] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>>>> [   15.654712] thunderbolt 0000:06:00.0:  Port 6: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>>> [   15.655667] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>>> [   15.656681] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>>> [   15.657595] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>>> [   15.658696] thunderbolt 0000:06:00.0:  Port 7: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>>> [   15.659614] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>>> [   15.660574] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>>> [   15.661414] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>>> [   15.662444] thunderbolt 0000:06:00.0:  Port 8: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>>> [   15.663289] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>>> [   15.664194] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>>> [   15.664995] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>>> [   15.665982] thunderbolt 0000:06:00.0:  Port 9: 8086:156d (Revision:
>>>>>>>> 0, TB Version: 1, Type: PCIe (0x100101))
>>>>>>>> [   15.666867] thunderbolt 0000:06:00.0:   Max hop id (in/out): 8/8
>>>>>>>> [   15.667701] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>>> [   15.668454] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>>> [   15.669318] thunderbolt 0000:06:00.0:  Port 10: 8086:156d
>>>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
>>>>>>>> [   15.670092] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>>>> [   15.670863] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>>> [   15.671624] thunderbolt 0000:06:00.0:   NFC Credits: 0x700000
>>>>>>>> [   15.672488] thunderbolt 0000:06:00.0:  Port 11: 8086:156d
>>>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>>>>> [   15.673255] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>>>> [   15.674015] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>>> [   15.674758] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>>>> [   15.675617] thunderbolt 0000:06:00.0:  Port 12: 8086:156d
>>>>>>>> (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0101))
>>>>>>>> [   15.676370] thunderbolt 0000:06:00.0:   Max hop id (in/out): 9/9
>>>>>>>> [   15.677115] thunderbolt 0000:06:00.0:   Max counters: 2
>>>>>>>> [   15.677844] thunderbolt 0000:06:00.0:   NFC Credits: 0xf00000
>>>>>>>> [   15.678887] thunderbolt 0000:06:00.0: 0:1: is unplugged (state: 7)
>>>>>>>> [   15.679624] thunderbolt 0000:06:00.0: 0:3: is unplugged (state: 7)
>>>>>>> Strange... it does not detect the device. Does the TB device show up in lspci?
>>>>>>>
>>>>>>
>>>>>> This may be my fault. I am not sure if I reconnected the device when I
>>>>>> was debugging. Almost certainly not, actually. I left it while I was
>>>>>> compiling a new kernel and forgot. I'll let you know tonight when I
>>>>>> get back.
>>>>>>
>>>>>>
>>>>>> Adam
>>>>>
>>>>>
>>>>> Yes, definitely was unplugged. Hotplugging seems to work fine in
>>>>> either "Windows 2012" or "Darwin" mode.
>>>>>
>>>>> Suspend works, resume brings up video and then invariably freezes (in
>>>>> either _OSI condition).
>>>>>
>>>>>
>>>>> Adam
>>>>
>>>> Hm, it seems strange that hotplug would not work without the driver in
>>>> win2012 mode. If it works under windows (without additional drivers? -
>>>> maybe bootcamp includes a windows TB driver?) then it should also work
>>>> for us.
>>>>
>>>> Andreas
>>>
>>>
>>> I am planning to try Windows 8 or 10 on this hardware to see.
>>>
>>> I inspected the Boot Camp driver image and did not see and Thunderbolt
>>> drivers. But I will see for sure once I have Windows running.
>>>
>>> I did find other Thunderbolt drivers:
>>> https://downloadcenter.intel.com/download/23742/Thunderbolt-Intel-Thunderbolt-driver
>>> If you download and inspect the various .inf files (no need to install
>>> anything), you'll see the PCI matching logic they use.
>>>
>>
>> Windows 10 has functioning hotplug on this hardware without any
>> Thunderbolt drivers. In fact, the 8086:156c device shows up in the
>> device manager as a device that Windows can't find the driver for.
>>
>> So there might be some ACPI or other bug that is keeping this from
>> working on Linux as transparently as Windows.
>>
>>
>> Adam
>
>
> Pretty sure it's some ACPI problem. I've always wanted to learn ACPI.
>
> From the debug output, I know it starts executing these lines in \_SB.PCI0._INI:
>
>             Debug = "OSYS="
>             Debug = OSYS /* \OSYS */
>             Debug = \_SB.PCI0.LPCB.RTC.ISWI
>             If (!OSDW ())
>             {
>                 If ((OSYS >= 0x07DC))
>                 {
>                     Debug = "Save Ridge Config on Boot"
>                     R118 = UP18 /* External reference */
>                     R119 = UP19 /* External reference */
> ...
>
> The 3rd Debug line is where it all goes wrong. Pity, since the next
> thing it's about to do is set up Thunderbolt:
>
> [    0.125244] ACPI: BIOS _OSI("Darwin") is not supported
> [    0.125250] [Firmware Bug]: ACPI: BIOS _OSI(Linux) query ignored
> [    0.125251] ACPI: BIOS _OSI("Linux") is not supported
> [    0.125257] ACPI: BIOS _OSI("Windows 2009") is supported
> [    0.125261]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA90
> [    0.125263]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA91
> [    0.125274]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 0 Address=0000000088D3AA90
> [    0.125276]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 0 Address=0000000088D3AA91
> [    0.125288]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA9F
> [    0.125298]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D1433C
> [    0.125300]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D1433D
> [    0.125301]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D1433E
> [    0.125303]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D1433F
> [    0.125315]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA90
> [    0.125317]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA91
> [    0.125327] ACPI: BIOS _OSI("Darwin") is not supported
> [    0.125332] ACPI: BIOS _OSI("Linux") is not supported
> [    0.125337] ACPI: BIOS _OSI("Windows 2009") is supported
> [    0.125342]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA90
> [    0.125343]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA91
> [    0.125349] ACPI: BIOS _OSI("Windows 2012") is supported
> [    0.125354]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA90
> [    0.125356]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 1 Address=0000000088D3AA91
> [    0.125366]  exregion-0321 ex_system_io_space_han: System-IO (width
> 8) R/W 0 Address=0000000000000B90
> [    0.125369]  exregion-0321 ex_system_io_space_han: System-IO (width
> 8) R/W 1 Address=0000000000000B90
> [    0.125376] [ACPI Debug 00110000]  String [0x05] "OSYS="
> [    0.125382]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 0 Address=0000000088D3AA90
> [    0.125383]  exregion-0206 ex_system_memory_space: System-Memory
> (width 8) R/W 0 Address=0000000088D3AA91
> [    0.125387] [ACPI Debug 00110000]  Integer 0x00000000000007DC
> [    0.125392] ACPI Error: No handler for Region [CMS0]
> (ffff8802658a0438) [SystemCMOS] (20150410/evregion-163)
> [    0.125395] ACPI Error: Region SystemCMOS (ID=5) has no handler
> (20150410/exfldio-297)
> [    0.125398] ACPI Error: Method parse/execution failed
> [\_SB_.PCI0._INI] (Node ffff8802658ac500), AE_NOT_EXIST
> (20150410/psparse-536)
> [    0.125403] ACPI Exception: AE_NOT_EXIST, during
> \_SB_.PCI0._INI._INI execution (20150410/nsinit-588)
>
> Still debugging...
>
>
>
> Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-04-26  3:00                         ` Adam Goode
@ 2015-05-04 13:00                           ` Adam Goode
  2015-05-06 10:18                             ` Andreas Noever
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Goode @ 2015-05-04 13:00 UTC (permalink / raw)
  To: Andreas Noever; +Cc: linux-kernel, Matthew Garrett

On Sat, Apr 25, 2015 at 11:00 PM, Adam Goode <adam@spicenitz.org> wrote:
> Here's the problem:
>
> [    0.126595] ACPI Error: No handler for Region [CMS0]
> (ffff8802658a0438) [SystemCMOS] (20150410/evregion-163)
> [    0.126597] ACPI Error: Region SystemCMOS (ID=5) has no handler
> (20150410/exfldio-297)
> [    0.126600] ACPI Error: Method parse/execution failed
> [\_SB_.PCI0._INI] (Node ffff8802658ac500), AE_NOT_EXIST
> (20150410/psparse-536)
> [    0.126605] ACPI Exception: AE_NOT_EXIST, during
> \_SB_.PCI0._INI._INI execution (20150410/nsinit-588)
>
> ...
>
> [    0.170603]       bus-0130 bus_get_status        : Device [RTC]
> status [0000000f]
> [    0.170605] evhandler-0446 ev_install_space_handl: Creating object
> on Device ffff8802658a82a8 while installing handler
> [    0.170607] evhandler-0482 ev_install_space_handl: Installing
> address handler for region SystemCMOS(5) on Device RTC_
> ffff8802658a82a8(ffff880264160090)
> [    0.170610]  evregion-0506 ev_attach_region      : Adding Region
> [CMS0] ffff8802658a0438 to address handler ffff880264160480
> [SystemCMOS]
>
>
> Next step is to figure out how to install the address handler earlier.
>
>

Current status:

I have a patch out to fix the CMOS handler issue:
http://marc.info/?l=linux-acpi&m=143052869625376&w=2

The CMOS handler is called in the Darwin codepath as well, so it's a
useful fix regardless.

When I patched with this support, and booted in non-Darwin mode,
hotplug worked without further Linux driver support (I disabled the
thunderbolt module). Suspend/resume still does not work unless I don't
activate any thunderbolt device at all. This happens regardless of
which OSI mode.

So there is a suspend/resume problem which seems more generic. I am
not sure if I have time to debug this.

One thing that would be useful would be to change the Darwin special
case code to make it configurable on the kernel command line.

Lastly, when ACPI fully initializes the thunderbolt controller, the
Linux thunderbolt module hangs for several seconds upon loading, and
then fails. Which is probably correct, but I don't know if it messes
up any state in the mean time (plus it shouldn't hang). Is there a way
to have the module detect BIOS support and disable itself? Or to
properly do a handover?


Thanks,

Adam

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

* Re: Thunderbolt hotplug not working on MacMini7,1
  2015-05-04 13:00                           ` Adam Goode
@ 2015-05-06 10:18                             ` Andreas Noever
  0 siblings, 0 replies; 18+ messages in thread
From: Andreas Noever @ 2015-05-06 10:18 UTC (permalink / raw)
  To: Adam Goode; +Cc: linux-kernel, Matthew Garrett

On Mon, May 4, 2015 at 3:00 PM, Adam Goode <adam@spicenitz.org> wrote:
> On Sat, Apr 25, 2015 at 11:00 PM, Adam Goode <adam@spicenitz.org> wrote:
>> Here's the problem:
>>
>> [    0.126595] ACPI Error: No handler for Region [CMS0]
>> (ffff8802658a0438) [SystemCMOS] (20150410/evregion-163)
>> [    0.126597] ACPI Error: Region SystemCMOS (ID=5) has no handler
>> (20150410/exfldio-297)
>> [    0.126600] ACPI Error: Method parse/execution failed
>> [\_SB_.PCI0._INI] (Node ffff8802658ac500), AE_NOT_EXIST
>> (20150410/psparse-536)
>> [    0.126605] ACPI Exception: AE_NOT_EXIST, during
>> \_SB_.PCI0._INI._INI execution (20150410/nsinit-588)
>>
>> ...
>>
>> [    0.170603]       bus-0130 bus_get_status        : Device [RTC]
>> status [0000000f]
>> [    0.170605] evhandler-0446 ev_install_space_handl: Creating object
>> on Device ffff8802658a82a8 while installing handler
>> [    0.170607] evhandler-0482 ev_install_space_handl: Installing
>> address handler for region SystemCMOS(5) on Device RTC_
>> ffff8802658a82a8(ffff880264160090)
>> [    0.170610]  evregion-0506 ev_attach_region      : Adding Region
>> [CMS0] ffff8802658a0438 to address handler ffff880264160480
>> [SystemCMOS]
>>
>>
>> Next step is to figure out how to install the address handler earlier.
>>
>>
>
> Current status:
>
> I have a patch out to fix the CMOS handler issue:
> http://marc.info/?l=linux-acpi&m=143052869625376&w=2
>
> The CMOS handler is called in the Darwin codepath as well, so it's a
> useful fix regardless.
>
> When I patched with this support, and booted in non-Darwin mode,
> hotplug worked without further Linux driver support (I disabled the
> thunderbolt module). Suspend/resume still does not work unless I don't
> activate any thunderbolt device at all. This happens regardless of
> which OSI mode.
>
> So there is a suspend/resume problem which seems more generic. I am
> not sure if I have time to debug this.
>
> One thing that would be useful would be to change the Darwin special
> case code to make it configurable on the kernel command line.
>
> Lastly, when ACPI fully initializes the thunderbolt controller, the
> Linux thunderbolt module hangs for several seconds upon loading, and
> then fails. Which is probably correct, but I don't know if it messes
> up any state in the mean time (plus it shouldn't hang). Is there a way
> to have the module detect BIOS support and disable itself? Or to
> properly do a handover?
I have no idea how to do a proper handoff. I guess the easiest way is
to refuse loading the thunderbolt module if the new "no_darwin" acpi
flag is set.

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

end of thread, other threads:[~2015-05-06 10:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CADN=WdrsLoertuPi0Tabb6dmdRAj0d200q=5awq-xL9yE8W=hw@mail.gmail.com>
2015-04-22  4:05 ` Fwd: Thunderbolt hotplug not working on MacMini7,1 Adam Goode
2015-04-23  2:56   ` Adam Goode
2015-04-23  7:24     ` Greg KH
2015-04-23 10:08     ` Andreas Noever
2015-04-23 13:28       ` Adam Goode
2015-04-23 15:10         ` Adam Goode
2015-04-23 16:12           ` Andreas Noever
2015-04-23 17:15             ` Adam Goode
2015-04-24  4:50               ` Adam Goode
2015-04-24 11:46                 ` Andreas Noever
2015-04-24 18:39                   ` Adam Goode
2015-04-25  4:58                     ` Adam Goode
2015-04-26  2:41                       ` Adam Goode
2015-04-26  3:00                         ` Adam Goode
2015-05-04 13:00                           ` Adam Goode
2015-05-06 10:18                             ` Andreas Noever
2015-04-23 18:12       ` Matthew Garrett
2015-04-24 11:41         ` Andreas Noever

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.