usb: xhci: dbc: add support for Intel xHCI dbc quirk
Quoted 8 lines · Lu Baolu
On Intel platform, if the debug target is connected with debug host, enabling DCE bit in command register leads to a hung bus state. In the hung state, the host system will not see a port connected status bit set. Hence debug target fails to be probed.
The state could be resolved by performing a port reset to the debug port from the host xHCI. This patch introduces this work around.
Is it correct to call this a "hung bus state"? Wouldn't calling it "hung port state" more appropriate?
I have observed this DCE-enable-related hung port state, but the reason seemed to be different in my case:
Citing a note (sic!) from The Holy XHCI Spec, section 7.6.4.1:
Quoted 4 lines
If a Debug Host attempts to attach to a Debug Target before the DCE flag is set, both ends of the link shall transition to the Inactive state.
So a Debug Host should periodically issue a Warm Reset
to ports that are Inactive to enable a connection to the DbC of the Debug Target.
Indeed, the inactive state is what I have observed (PLS field of port register PORTSC) when the DCE bit is set to 1 with the cable already plugged in.
Now, according to my interpretation of The Hole USB 3.1 spec, section 7.5.2, which says:
Quoted 4 lines
eSS.Inactive is a state where a link has failed Enhanced SuperSpeed operation. A downstream port can only exit from this state when directed, or upon detection of an absence of a far-end receiver termination (R RX-DC ) specified in Table 6-21, or upon a Warm Reset.
It follows, that since hosts without DBC cannot listen to upstream requests, the debug target-originated port reset requests (both hot and warm) will be ignored by the debug host.
This is the essence of the "hung port state" that I was able to observe.
Note, that this roadblock doesn't appear if you attach the cable /after/ enabling the DCE bit, or, alternatively, if the host has DBC.
And indeed, your quirk will work in the latter case, since the debug host hub will be able to see the upstream reset request.
Signature · 2 lines
with best regards, Dmitry Malkin
Quoted 8 lines · Lu Baolu
On Intel platform, if the debug target is connected with debug host, enabling DCE bit in command register leads to a hung bus state. In the hung state, the host system will not see a port connected status bit set. Hence debug target fails to be probed.
The state could be resolved by performing a port reset to the debug port from the host xHCI. This patch introduces this work around.
Is it correct to call this a "hung bus state"? Wouldn't calling it "hung port state" more appropriate?
I have observed this DCE-enable-related hung port state, but the reason seemed to be different in my case:
Citing a note (sic!) from The Holy XHCI Spec, section 7.6.4.1:
Quoted 4 lines
If a Debug Host attempts to attach to a Debug Target before the DCE flag is set, both ends of the link shall transition to the Inactive state.
So a Debug Host should periodically issue a Warm Reset
to ports that are Inactive to enable a connection to the DbC of the Debug Target.
Indeed, the inactive state is what I have observed (PLS field of port register PORTSC) when the DCE bit is set to 1 with the cable already plugged in.
Now, according to my interpretation of The Hole USB 3.1 spec, section 7.5.2, which says:
Quoted 4 lines
eSS.Inactive is a state where a link has failed Enhanced SuperSpeed operation. A downstream port can only exit from this state when directed, or upon detection of an absence of a far-end receiver termination (R RX-DC ) specified in Table 6-21, or upon a Warm Reset.
It follows, that since hosts without DBC cannot listen to upstream requests, the debug target-originated port reset requests (both hot and warm) will be ignored by the debug host.
This is the essence of the "hung port state" that I was able to observe.
Note, that this roadblock doesn't appear if you attach the cable /after/ enabling the DCE bit, or, alternatively, if the host has DBC.
And indeed, your quirk will work in the latter case, since the debug host hub will be able to see the upstream reset request.
--
with best regards,
Dmitry Malkin
Hi,
Quoted 11 lines · Dmitry Malkin
Quoted 8 lines · Lu Baolu
On Intel platform, if the debug target is connected with debug host, enabling DCE bit in command register leads to a hung bus state. In the hung state, the host system will not see a port connected status bit set. Hence debug target fails to be probed.
The state could be resolved by performing a port reset to the debug port from the host xHCI. This patch introduces this work around.
Is it correct to call this a "hung bus state"? Wouldn't calling it "hung port state" more appropriate?
Yes, "hung port state" is more appropriate.
Quoted 9 lines
I have observed this DCE-enable-related hung port state, but the reason seemed to be different in my case:
Citing a note (sic!) from The Holy XHCI Spec, section 7.6.4.1:
Quoted 4 lines
If a Debug Host attempts to attach to a Debug Target before the DCE flag is set, both ends of the link shall transition to the Inactive state.
So a Debug Host should periodically issue a Warm Reset
to ports that are Inactive to enable a connection to the DbC of the Debug Target.
Exactly. A formal workaround is to periodically issue Warm Resets to ports from debug host.
Quoted 5 lines
Indeed, the inactive state is what I have observed (PLS field of port register PORTSC) when the DCE bit is set to 1 with the cable already plugged in.
Now, according to my interpretation of The Hole USB 3.1 spec, section 7.5.2, which says:
Quoted 7 lines
Quoted 4 lines
eSS.Inactive is a state where a link has failed Enhanced SuperSpeed operation. A downstream port can only exit from this state when directed, or upon detection of an absence of a far-end receiver termination (R RX-DC ) specified in Table 6-21, or upon a Warm Reset.
It follows, that since hosts without DBC cannot listen to upstream requests, the debug target-originated port reset requests (both hot and warm) will be ignored by the debug host.
As above, a formal workaround is to issue Warm Reset periodically from debug host, but that could cause much complexity. My quirk is to issue port reset just *before* setting DCE bit. This quirk seems to work on several platforms. (My debug host doesn't have DBC.)
Quoted 4 lines
This is the essence of the "hung port state" that I was able to observe.
Note, that this roadblock doesn't appear if you attach the cable /after/ enabling the DCE bit,
Yes.
Quoted 1 line
or, alternatively, if the host has DBC.
Really? I haven't tried it yet.
Quoted 3 lines
And indeed, your quirk will work in the latter case, since the debug host hub will be able to see the upstream reset request.
This quirk works as well if debug host doesn't have DBC. I didn't try a DBC-capable debug host yet.
Quoted 4 lines
--
with best regards,
Dmitry Malkin
Thank you.
-Baolu
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · Lu Baolu
This quirk works as well if debug host doesn't have DBC. I didn't try a DBC-capable debug host yet.
Hi,
I went through it again, with your v3 patch series on top of vanilla v4.3.0.
Two targets, one host, all with Intel chipset (XHCI device 0:14.0 with VID:8086). Targets DIDs are 9c31 (8-series chipset) and 9d2f (100-series chipset). Host DID is 8c31 (8-series).
I can only further confirm my previous observations. The host cannot see the target (there is no debug device) at all, until I manually re-plug a debug cable. Cable plugged in, prior to starting the target.
I think that trying a Hot Reset for all disconnected USB 3.0 ports on the debug target *just before* setting DCE bit is inherently racy.
What if the number of disconnected ports changes or if someone will insert a print statement or refactors your code?
Also sending TS2 to the debug host port will either:
- get dropped by its hub as unsupported upstream request, or
- get ignored due to SS.Inactive port state
Could you explain what exactly you workaround does at the low level?
--
with best regards,
Dmitry Malkin
Hi,
Quoted 7 lines · Dmitry Malkin
Quoted 2 lines · Lu Baolu
This quirk works as well if debug host doesn't have DBC. I didn't try a DBC-capable debug host yet.
Hi,
I went through it again, with your v3 patch series on top of vanilla v4.3.0.
Quoted 7 lines
Two targets, one host, all with Intel chipset (XHCI device 0:14.0 with VID:8086). Targets DIDs are 9c31 (8-series chipset) and 9d2f (100-series chipset). Host DID is 8c31 (8-series).
I can only further confirm my previous observations. The host cannot see the target (there is no debug device) at all, until I manually re-plug a debug cable. Cable plugged in, prior to starting the target.
Thank you for your time.
Are you using a "USB3 debugging cable"? The internal wiring of the debug cable is crossed over.
Quoted 5 lines
I think that trying a Hot Reset for all disconnected USB 3.0 ports on the debug target *just before* setting DCE bit is inherently racy.
What if the number of disconnected ports changes or if someone will insert a print statement or refactors your code?
That might be problematic. I will put a comment there.
Quoted 6 lines
Also sending TS2 to the debug host port will either:
- get dropped by its hub as unsupported upstream request, or
- get ignored due to SS.Inactive port stateCould you explain what exactly you workaround does at the low level?
What I though was that reset USB 3.0 ports on debug target before setting DCE bit will cause debug host to warm reset the port for enumeration purpose and then setting the DCE bit will take effect.
This just works on my development machine, not only connecting debug target to root port of host, but also under external hubs. I realized that this quirk isn't a universal solution and it might not work with some silicons. But I thought it shouldn't do any harmless. In bad case, users could plug out and plug in the debug cable, or reset the port through the sysfs node for workaround. If this is acceptable, I will add this in the user guide and increase the timeout value in code.
Thanks,
-Baolu
Quoted 9 lines
--
with best regards,
Dmitry Malkin
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html