From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Lukas Wunner <lukas@wunner.de>,
Andreas Noever <andreas.noever@gmail.com>,
Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 9/9] thunderbolt: Add support for USB4STREAM
Date: Tue, 28 Apr 2026 14:03:14 +0200 [thread overview]
Message-ID: <20260428120314.GR557136@black.igk.intel.com> (raw)
In-Reply-To: <2026042848-cubical-penalize-807c@gregkh>
On Tue, Apr 28, 2026 at 05:57:37AM -0600, Greg KH wrote:
> On Tue, Apr 28, 2026 at 09:22:09AM +0200, Mika Westerberg wrote:
> > Introduce USB4STREAM protocol and Linux implementation. This allows two
> > (or more) hosts to transfer data directly over Thunderbolt/USB4 cable
> > through a character device without need to go through the network stack.
> >
> > Any application that supports read(2) and write(2) in some form should
> > be able to use the device without changes. The data is sent out to the
> > other side over a tunnel inside Thunderbolt/USB4 fabric. The character
> > device is called /dev/tbstreamX where X is the minor number starting
> > from 0.
> >
> > All stream devices need to be configured first. This is done through
> > ConfigFS interface. There can be multiple streams at the same time (this
> > depends on number of DMA rings and available HopIDs) and a single stream
> > supports traffic in both directions. For example there could be an
> > application that uses one stream as control channel and another one as
> > bi-directional data channel.
> >
> > A real use-case for this is to take a backup as a part of recovery
> > initramfs tooling (no need to setup networking or have ssh or similar
> > tooling as part of the initramfs). Say we want to backup the disk of
> > host1 to host2. First Thunderbolt/USB4 cable is connected between the
> > hosts (there can be devices in the middle too) then the receiving side
> > configures the stream:
> >
> > host2 # mkdir /sys/kernel/config/thunderbolt/stream/0-1.0
> > host2 # mkdir /sys/kernel/config/thunderbolt/stream/0-1.0/backup
> > host2 # echo -1 > /sys/kernel/config/thunderbolt/stream/0-1.0/backup/in_hopid
> > host2 # echo -1 > /sys/kernel/config/thunderbolt/stream/0-1.0/backup/out_hopid
> >
> > We use automatic HopID allocation (writing -1 to HopIDs) for simplicity.
> > >From this point forward the /dev/tbstream0 can be used pretty much as
> > regular file:
> >
> > host2 # dd if=/dev/tbstream0 of=/tmp/host1.nvme0n1.backup-$(date +%F) bs=256k
> >
> > The host that is being backed up then configures the stream accordingly:
> >
> > host1 # mkdir /sys/kernel/config/thunderbolt/stream/0-503.0
> > host1 # mkdir /sys/kernel/config/thunderbolt/stream/0-503.0/backup
> >
> > Here we take advantage of the fact that host2 also announces the active
> > streams through XDomain properties so the name "backup" gives us the
> > HopIDs. It is also possible to configure them manually in the same way
> > we did for host2.
> >
> > Then it is just a matter of copying the data over:
> >
> > host1 # dd if=/dev/nvme0n1 of=/dev/tbstream0 bs=256k
> >
> > Similarly it is possible to transfer parts of the filesystem. For
> > example copy contents of mydir over to the host2:
> >
> > host2 # gunzip < /dev/tbstream0 | tar xf -
> > host1 # tar cf - mydir | gzip > /dev/tbstream0
> >
> > Other end of the spectrum use-case is "borrowing" laptop (host1) camera
> > to desktop (host2):
> >
> > host2 # gst-launch-1.0 filesrc location=/dev/tbstream0 ! jpegdec ! videoconvert ! \
> > autovideosink
> >
> > host1 # gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080 ! \
> > jpegenc quality=90 ! filesink location=/dev/tbstream0
> >
> > Once the streams are no longer needed they can be removed:
> >
> > host1 # cd /sys/kernel/config/thunderbolt/stream/
> > host1 # rmdir -p 0-503.0/backup
> >
> > host2 # cd /sys/kernel/config/thunderbolt/stream
> > host2 # rmdir -p 0-1.0/backup
>
> Very cool, but shouldn't the above be in some documentation somewhere so
> that people know how to use it?
Sure, I can add it part of the Documentation/admin-guide/thunderbolt.rs for
example.
> And why do you need a whole major for this, why not just use a misc
> device that it dynamically created for every new dev?
We do use this:
ret = alloc_chrdev_region(&tbstream_devt, 0, TBSTREAM_DEV_MINORS,
"tbstream");
that should be dynamically allocated, no?
next prev parent reply other threads:[~2026-04-28 12:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 7:22 [PATCH 0/9] thunderbolt: Introduce USB4STREAM Mika Westerberg
2026-04-28 7:22 ` [PATCH 1/9] thunderbolt: Add tb_property_merge_dir() Mika Westerberg
2026-04-28 7:22 ` [PATCH 2/9] thunderbolt: Add KUnit test for tb_property_merge_dir() Mika Westerberg
2026-04-28 7:22 ` [PATCH 3/9] thunderbolt: Allow service drivers to specify their own properties Mika Westerberg
2026-04-28 7:22 ` [PATCH 4/9] thunderbolt / net: Move ring_frame_size() to thunderbolt.h Mika Westerberg
2026-04-28 7:22 ` [PATCH 5/9] thunderbolt / net: Let the service drivers configure interrupt throttling Mika Westerberg
2026-04-28 14:59 ` Andrew Lunn
2026-04-28 7:22 ` [PATCH 6/9] thunderbolt: Add helper to figure size of the ring Mika Westerberg
2026-04-28 7:22 ` [PATCH 7/9] thunderbolt: Add tb_ring_flush() Mika Westerberg
2026-04-28 7:22 ` [PATCH 8/9] thunderbolt: Add support for ConfigFS Mika Westerberg
2026-04-28 7:22 ` [PATCH 9/9] thunderbolt: Add support for USB4STREAM Mika Westerberg
2026-04-28 11:57 ` Greg KH
2026-04-28 12:03 ` Mika Westerberg [this message]
2026-04-28 13:54 ` Greg KH
2026-04-28 14:11 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260428120314.GR557136@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=alan.borzeszkowski@linux.intel.com \
--cc=andreas.noever@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox