aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
authorMark Brown <broonie@kernel.org>2026-05-29 23:00:29 +0100
committerMark Brown <broonie@kernel.org>2026-05-29 23:00:29 +0100
commit9bc5df932dde692c37a2ad7d1801c9b65d0ddbb5 (patch)
tree62b96f13021d05d5a8a00d2fdee62be091a84db8 /Documentation
parent9394de50f7ac760fe5ae2eea0fa184185f2cdc3a (diff)
parent2c5d2d3c3f70cde2565d7b279b544893a2035842 (diff)
downloadlinux-next-history-9bc5df932dde692c37a2ad7d1801c9b65d0ddbb5.tar.gz
Merge branch 'next' of https://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git
# Conflicts: # drivers/thunderbolt/property.c
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/configfs-thunderbolt_stream83
-rw-r--r--Documentation/admin-guide/thunderbolt.rst61
2 files changed, 144 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/configfs-thunderbolt_stream b/Documentation/ABI/testing/configfs-thunderbolt_stream
new file mode 100644
index 0000000000000..7abc6b73a1e4c
--- /dev/null
+++ b/Documentation/ABI/testing/configfs-thunderbolt_stream
@@ -0,0 +1,83 @@
+What: /sys/kernel/config/thunderbolt/stream/<xdomain>.<service>
+Date: Sep 2026
+KernelVersion: v7.2
+Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
+Description:
+ Configuration group for a stream Thunderbolt/USB4
+ service. It is possible to create groups even if there
+ is no connection yet to the other host. Once a
+ connection established and there is stream service on
+ the remote side that matches, this configuration is
+ applied to it.
+
+ To find the service name you can run tblist from tbtools [1]:
+
+ # tblist -A
+ ...
+ Domain 0 Route 3 Index 0: stream
+
+ [1] https://github.com/intel/tbtools
+
+What: /sys/kernel/config/thunderbolt/stream/<xdomain>.<service>/$name
+Date: Sep 2026
+KernelVersion: v7.2
+Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
+Description:
+ Creates new stream with $name and fills it with the
+ default values. If there is an advertised remote stream
+ with the same name, uses its values as the default.
+
+What: /sys/kernel/config/thunderbolt/stream/<xdomain>.<service>/$name/index
+Date: Sep 2026
+KernelVersion: v7.2
+Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
+Description:
+ This matches the X in /dev/tbstreamX and allows userspace
+ to map the configfs directory to the corresponding character
+ device.
+
+What: /sys/kernel/config/thunderbolt/stream/<xdomain>.<service>/$name/in_hopid
+Date: Sep 2026
+KernelVersion: v7.2
+Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
+Description:
+ In HopID used with the read path of the tunnel. Available HopIDs
+ for tunneling start from 8. You can pass also -1 for automatic
+ allocation. The allocated value can be read here. Writing 0 will
+ de-allocate if the stream is not in use.
+
+ To figure out the maximum HopID you can run tbget from
+ tbtools for the lane adapter. For example below we check
+ for lane adapter number 1 (first USB4 port):
+
+ # tbget -r 0 -a 1 -D ADP_CS_5.Max\ Input\ HopID
+ 19
+
+ This allows to use anything between 8 and 19 inclusive.
+
+What: /sys/kernel/config/thunderbolt/stream/<xdomain>.<service>/$name/out_hopid
+Date: Sep 2026
+KernelVersion: v7.2
+Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
+Description:
+ Out HopID used with the write path of the tunnel. Available HopIDs
+ for tunneling start from 8. You can pass also -1 for automatic
+ allocation. The allocated value can be read here. Writing 0 will
+ de-allocate if the stream is not in use. See @in_hopid
+ for how to figure out the maximum HopID.
+
+What: /sys/kernel/config/thunderbolt/stream/<xdomain>.<service>/$name/ring_size
+Date: Sep 2026
+KernelVersion: v7.2
+Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
+Description:
+ Size of the TX/RX rings. Can be adjusted between 32 and
+ 4096. The default is 256.
+
+What: /sys/kernel/config/thunderbolt/stream/<xdomain>.<service>/$name/throttling
+Date: Sep 2026
+KernelVersion: v7.2
+Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
+Description:
+ Interrupt throttling rate in ns. Lower values can give
+ better latency. The default is 8192 ns.
diff --git a/Documentation/admin-guide/thunderbolt.rst b/Documentation/admin-guide/thunderbolt.rst
index 89df26553aa03..91a6cb1099889 100644
--- a/Documentation/admin-guide/thunderbolt.rst
+++ b/Documentation/admin-guide/thunderbolt.rst
@@ -373,6 +373,67 @@ port which are named like ``thunderbolt0`` and so on. From this point
you can either use standard userspace tools like ``ip`` to
configure the interface or let your GUI handle it automatically.
+Streaming data directly over Thunderbolt cable
+----------------------------------------------
+In addition to Thunderbolt networking (aka. USB4NET) Linux supports
+streaming data directly over a cable as well (aka. USB4STREAM). This is
+possible through ``thunderbolt-stream`` driver.
+
+Similarly to ``thunderbolt-net`` you load the driver first on one end::
+
+ host1 # modprobe thunderbolt-stream
+
+Then you configure it via ``ConfigFS``::
+
+ host1 # cd /sys/kernel/config/thunderbolt/stream
+ host1 # mkdir -p 0-1.0/data
+ host1 # cd 0-1.0
+ host1 # echo -1 > data/in_hopid
+ host1 # echo -1 > data/out_hopid
+
+This information is automatically announced to the other side via
+XDomain properties so if you have cable connected the other side knows
+that there is a stream named ``data`` available and can configure it for
+you automatically::
+
+ host2 # cd /sys/kernel/config/thunderbolt/stream
+ host2 # mkdir -p 0-3.0/data
+
+Here we used auto-configuration but you can configure it manually too.
+In that case you need to fill ``in_hopid`` and ``out_hopid`` accordingly.
+If you set them to ``-1`` the next available HopID is used which is
+typically what we want.
+
+Once they are configured you can use ``/dev/tbstreamX`` on both sides to
+transfer data::
+
+ host2 # cat /dev/tbstream0
+ host1 # dmesg > /dev/tbstream0
+
+Once you are done with the stream you can remove them::
+
+ host2 # cd /sys/kernel/config/thunderbolt/stream
+ host2 # rmdir -p 0-1.0/data
+ host1 # cd /sys/kernel/config/thunderbolt/stream
+ host1 # rmdir -p 0-3.0/data
+
+Since streams are essentially files you can use any existing application
+that supports ``read(2)`` and ``write(2)`` in some form.
+
+It is possible to have more than one stream and you can have both stream
+and ``thunderbolt-net`` in use simultaneously. For example we can create
+two streams with name ``control`` and ``data`` like this::
+
+ host1 # cd /sys/kernel/config/thunderbolt/stream
+ host1 # mkdir 0-1.0
+ host1 # cd 0-1.0
+ host1 # mkdir control
+ host1 # mkdir data
+
+Then you have ``/dev/tbstream0`` for ``control`` and ``/dev/tbstream1``
+for ``data``. Before you can use them you need to configure them as
+shown above for the one stream case.
+
Forcing power
-------------
Many OEMs include a method that can be used to force the power of a