Re: [PATCH RFC] thunderbolt: Skip reading Rsvd SB registers on older-gen hardware
From: Konrad Dybcio
Date: Mon Apr 13 2026 - 08:15:37 EST
On 4/13/26 1:53 PM, Mika Westerberg wrote:
> On Mon, Apr 13, 2026 at 01:43:49PM +0200, Konrad Dybcio wrote:
>> On 4/13/26 1:40 PM, Mika Westerberg wrote:
>>> On Mon, Apr 13, 2026 at 12:54:41PM +0200, Konrad Dybcio wrote:
>>>> From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>>>>
>>>> The Linux TBT subsystem supports hardware aligned with the latest
>>>> USB4 v2.0 specification. In some places though, it assumes registers
>>>> only defined in that specification version (previously marked as
>>>> Reserved) are always accessible.
>>>>
>>>> Every version of the spec states:
>>>>
>>>> """
>>>> Unless specified otherwise, the Connection Manager shall not write a
>>>> register with a value that is marked as “Rsvd”. Writing a register with
>>>> a value that is marked as “Rsvd” results in undefined behavior.
>>>> """
>>>>
>>>> The effective list of SB registers that need this guarding currently
>>>> exclusively contains ones that aren't used outside the debugfs dump
>>>> logic, so just add the required checks there.
>>>>
>>>> Fixes: 54e418106c76 ("thunderbolt: Add debugfs interface")
>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>>>> ---
>>>> drivers/thunderbolt/debugfs.c | 20 ++++++++++++--------
>>>> drivers/thunderbolt/retimer.c | 11 ++++++++++-
>>>> drivers/thunderbolt/sb_regs.h | 11 ++++++-----
>>>> drivers/thunderbolt/tb.h | 2 ++
>>>> 4 files changed, 30 insertions(+), 14 deletions(-)
>>>
>>> This is alternative for the v2 patch you sent earlier, right? I prefer that
>>> one over this.
>>
>> I think they're complementary. This patch ensures compliance with the
>> quoted part of the spec, while the other one improves the UX and aids
>> debugging.
>
> This adds a lot of code for just debugfs access so I think we are better
> without.
Just the other one works too, then.
Konrad