Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2025 14:35:11 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>, dev-commits-src-main <dev-commits-src-main@freebsd.org>
Cc:        "obiwac@freebsd.org" <obiwac@FreeBSD.org>
Subject:   Re: git: 2ed9833791f2 - main - thunderbolt: Import USB4 code
Message-ID:  <A8882E84-C89D-4C3E-8D6E-58B3A099E89F@yahoo.com>
References:  <A8882E84-C89D-4C3E-8D6E-58B3A099E89F.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net> wrote on
Date: Mon, 06 Oct 2025 16:16:02 UTC :

> On Sat, 27 Sep 2025, Aymeric Wibo wrote:
>=20
> > The branch main has been updated by obiwac:
> >
> > URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D2ed9833791f28e14843ac813f90cb030=
e45948dc
> >
> > commit 2ed9833791f28e14843ac813f90cb030e45948dc
> > Author: Aymeric Wibo <obiwac@FreeBSD.org>
> > AuthorDate: 2025-09-27 11:50:43 +0000
> > Commit: Aymeric Wibo <obiwac@FreeBSD.org>
> > CommitDate: 2025-09-27 17:13:13 +0000
> >
> > thunderbolt: Import USB4 code
> >
> > Add initial USB4 code written by Scott Long and originally passed on =
to
> > HPS (source: https://github.com/hselasky/usb4), minus the ICM code =
and
> > with some small fixes.
> >
> > For context, older TB chips implemented the connection manager in
> > firmware (ICM) instead of in the OS (HCM), but maintaining the ICM =
code
> > would be a huge burden for not many chips.

I'll note that ACPI 6.4 appears to have a way for the
OS to indicate that it it wants to do its own handling
of connection management, even for when ICM is available.
So to say that ICM use will not be supported need not
be an indication of if the context will have its own
support of connection management in the OS. (I seem to
remember seeing _OSC notation in the context I was
reading. I also think that I remember: Query Flag being 0
and Native USB4 Support being 1 for the call in something
I was reading.)

I've always found figuring out the binding of loose
wording relative to support for optional USB4 things
difficult to well identify any detailed meaning in
the USB4 specification(s) (V1 and/or V2). USB4 does not
require hosts to have Thunderbolt 3 interoperability:
such is optional. (Note is about intent for the future
for FreeBSD. The lack of existing support seems clear.)

> I cannot find a better reference currently to reply to.
>=20
> This seems to be one of the ICM cases given the warning?
>=20
> [44.426631] nhi0: <Thunderbolt 3 NHI (Alpine Ridge LP 2C)> mem =
0xda000000-0xda03ffff,0xda040000-0xda040fff at device 0.0 on pci5
> [44.426653] nhi0: Cannot find Upstream Facing Port
> [44.426668] nhi0: attempting to allocate 16 MSI-X vectors (16 =
supported)
> [44.426677] msi: routing MSI-X IRQ 146 to local APIC 0 vector 56
> [44.426685] msi: routing MSI-X IRQ 147 to local APIC 2 vector 54
> [44.426693] msi: routing MSI-X IRQ 148 to local APIC 4 vector 54
> [44.426700] msi: routing MSI-X IRQ 149 to local APIC 6 vector 56
> [44.426708] msi: routing MSI-X IRQ 150 to local APIC 0 vector 57
> [44.426716] msi: routing MSI-X IRQ 151 to local APIC 2 vector 55
> [44.426724] msi: routing MSI-X IRQ 152 to local APIC 4 vector 55
> [44.426731] msi: routing MSI-X IRQ 153 to local APIC 6 vector 57
> [44.426739] msi: routing MSI-X IRQ 154 to local APIC 0 vector 58
> [44.426747] msi: routing MSI-X IRQ 155 to local APIC 2 vector 56
> [44.426755] msi: routing MSI-X IRQ 156 to local APIC 4 vector 56
> [44.426762] msi: routing MSI-X IRQ 157 to local APIC 6 vector 58
> [44.426770] msi: routing MSI-X IRQ 158 to local APIC 0 vector 59
> [44.426778] msi: routing MSI-X IRQ 159 to local APIC 2 vector 57
> [44.426786] msi: routing MSI-X IRQ 160 to local APIC 4 vector 57
> [44.426793] msi: routing MSI-X IRQ 161 to local APIC 6 vector 59
> [44.426798] nhi0: using IRQs 146-161 for MSI-X
> [44.426976] nhi0: WARN: device uses an internal connection manager

"has a"? "allows use of its"?

> [46.426984] nhi0: tb_router_attach_root() error. The driver should be =
loaded at boot
> [46.427115] device_attach: nhi0 attach returned 60
> ..
> [46.431111] acpi_wmi0: <ACPI-WMI mapping> on acpi0
> [46.431148] nhi_wmi0: <Thunderbolt WMI Endpoint> on acpi_wmi0
>=20
>=20
> Rather than going through all the resource allocations, can we (if =
detected to be not supported) just barf and exit or remove the device =
IDs and not probe at all to avoid all the delay on boot?
>=20
> That said, the check in nhi_attach can never work as nothing seems to =
ever set NHI_CAP_ICM?
>=20
> So the warning presumably comes from nhi_init() which happens at the =
end of nhi_attach() but it doesn't actually do anything about it and =
lets it run into follow-up problems?
>=20
> Maybe the warning should say something about "ICM device. Will never =
be supported on FreeBSD" or the like?

May well be true but it seems that disabling ICM and having
support without using the ICM is a technical possibility.

> Another thing that I found non-intuitive for an "nhi" driver was the =
check:
> if (resource_disabled("tb", 0))
>=20
>=20
> I understand it's not your code, but I hope we can improve this case a =
bit given the decision?



Side note for reference:

I took a stab at finding and listing some required vs. optional
USB4 functionality for USB4 Hosts, mostly based on USB4 V2
criteria in the V2 specification. What I managed to identify in
my one pass at finding such was:


Required for USB4 Host (by contrast to the later optional list):

) Host router
) USB 2.0 Host
) Enhanced SuperSpeed Host (with 1+ USB3 Gen X Ports)

) A DisplayPort Source
) DisplayPort Alt Mode on all Downstream Facing Ports

) USB3 Gen X tunneling
) DisplayPort Tunneling (DP 2.1 for V2)
) Host to Host tunneling

) Gen 2 speed (10 Gbps per Lane) [Router Assemblies]

) Contain and support 1+ DisplayPort IN Adapters [Host Router]

) NVM DROM Read Router Operation [Standalone Add In Card Host Router]


Optional for USB4 Host:

) optionally support Gen 3 speed (20 Gps per Lane) [Router Assmeblies]

) optionally support 40G USB4 operation (Gen 3) and 80G USB4 operation =
(Gen 4)

) optionally support USB3 Gen T Tunneling

) optionally support 1+ DisplayPort OUT adapters [Host Router]

) optionally support DisplayPort UHBR, 8b/10b MST, Panel Replay =
Optimization, DPTX Discovery, ALPM

) optionally support PCIe Tunneling (via a switch or Root Ports to a =
Root Complex)

) Optionally support PCI Compatible INTx interrupt emulation [PCIe Host =
Router]

) optionally support NVM Set Offset Router Operation [Host Router]

) optionally support NVM Write Router Operation [Host Router]

) optionally support NVM Authenticate Write Router Operation [Host =
Router]

) optionally support NVM Read Router Operation [Host Router]

) optionally support NVM DROM Read Router Operation [Platform Integrated =
Host Router]

) optionally support NVM Get Sector Size Operation [Host Router]

) optionally support interoperability with Thunderbolt 3 (TBT3) products

 Note: Such a product "can operate in a USB4 Fabric that includes
       any combination of the following: A Thunderbolt 3 Router,
       a Thunderbolt 3 Connection Manager, A Thunderbolt 3
       Active Cable".  (Chapter 13 --but it references material
       in other chapters as well.) The wording is more general
       than just "host" products and so is not a direct list
       of just what a host has to support of itself.

 Note: Such support involves Thunderbolt Alt Mode (from USB Type C).

 Note: USB4 V2 Docks and Hubs optionally support TBT3-compatibility on =
their
       upstream facing port. (V1 had Docks being required to have =
support.)

) optionally support interoperability with other USB Type-C Alternate =
Modes
  as defined by the USB Type-C Specification

) optionally support Inter-domain Time Synchronization [Host Router]


Some subset of all this is likely to be developed in some sequence.

I would not claim to have found everything that might be of interest.
Nor do I have a clear understanding of what of this FreeBSD intends
to support (or in what sequence support would gradually appear in).


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A8882E84-C89D-4C3E-8D6E-58B3A099E89F>