Linux USB
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>,
	Lukas Wunner <lukas@wunner.de>,
	Andreas Noever <andreas.noever@gmail.com>,
	Gil Fine <gil.fine@linux.intel.com>,
	Rene Sapiens <rene.sapiens@linux.intel.com>,
	Pooja Katiyar <pooja.katiyar@intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH 00/18] thunderbolt: Add support for shared buffering
Date: Thu, 19 Nov 2026 18:12:14 +0100	[thread overview]
Message-ID: <20261119171232.1616316-1-mika.westerberg@linux.intel.com> (raw)

Hi all,

Currently all DMA tunnels (over XDomain) use dedicated flow control meaning
that each consumes fixed amount of buffers from a router ingress adapter.
This becomes problematic if the DMA tunnel is routed through a device
router because that may involve other tunnels like native ones that take
away their share of buffers. The current scheme is such that we allocate
full credits for USB3/PCIe, some for DMA and the rest goes for DisplayPort.
On Intel hardware this means the first DMA tunnel gets full buffers and the
second one gets one and after that we run out.

This series reworks the credit allocation so that there is still reserve
but a smaller one. For DP we allocate as much as there are DP INs on in the
host router, then minimum for USB3/PCIe/DMA. Everything else goes to common
pool that is first come first served.

Then we add support for shared buffering and lastly enable them for DMA
tunnels over intra-domain links. This allows more DMA tunnels to share a
link. The inter-domain link stays using the dedicated flow control.

The other patches before the credit work are needed because they fix a long
standing issue around suspend to disk. The topology is now reset on restore
so DP resources the restore kernel left behind are no longer leaked. That
would otherwise affect the credits too.

Gil Fine (2):
  thunderbolt: Add support for shared flow control
  thunderbolt: Use restricted shared flow control for DMA tunnels on intra-domain links

Mika Westerberg (Intel) (16):
  thunderbolt: Avoid leaking of DMA tunnel after XDomain removal
  thunderbolt: Tear down DMA tunnels on every XDomain removal
  thunderbolt: Delay re-pairing DP IN/OUT if DPRX negotiation fails
  thunderbolt: Call DP tunnel activation callback with tb->lock held
  thunderbolt: Re-apply Alpine/Titan Ridge flow on resume
  thunderbolt: Return -ESHUTDOWN when control channel is not running
  thunderbolt: Add usb4_port_hotplug_disable()
  thunderbolt: Move tb_plug_events_active() before tb_switch_reset_host()
  thunderbolt: Add tb_port_state_is_up()
  thunderbolt: Split host router port reset into a separate function
  thunderbolt: Reset topology after suspend-to-disk
  thunderbolt: Drop tunnel discovery without HopID allocation
  thunderbolt: Always take domain lock when tb_tunnel_put() is called
  thunderbolt: Assign domain to the routers in KUnit tests
  thunderbolt: Rework tunnel credit allocation
  thunderbolt: Add KUnit tests for shared buffering

 drivers/thunderbolt/Makefile  |    2 +-
 drivers/thunderbolt/credits.c |  685 ++++++++++++++++++++
 drivers/thunderbolt/ctl.c     |    4 +-
 drivers/thunderbolt/debugfs.c |   43 ++
 drivers/thunderbolt/domain.c  |    5 +-
 drivers/thunderbolt/nhi.c     |   17 +-
 drivers/thunderbolt/path.c    |  101 +--
 drivers/thunderbolt/switch.c  |  374 ++++++++---
 drivers/thunderbolt/tb.c      |  201 +++---
 drivers/thunderbolt/tb.h      |  200 ++++--
 drivers/thunderbolt/tb_regs.h |    2 +
 drivers/thunderbolt/test.c    | 1106 +++++++++++++++++++++++++++++++--
 drivers/thunderbolt/tunnel.c  |  495 +++++----------
 drivers/thunderbolt/tunnel.h  |    7 +-
 drivers/thunderbolt/usb4.c    |   28 +-
 15 files changed, 2601 insertions(+), 669 deletions(-)
 create mode 100644 drivers/thunderbolt/credits.c

-- 
2.50.1


             reply	other threads:[~2026-11-19 17:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:12 Mika Westerberg [this message]
2026-11-19 17:12 ` [PATCH 01/18] thunderbolt: Avoid leaking of DMA tunnel after XDomain removal Mika Westerberg
2026-11-19 17:32   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 02/18] thunderbolt: Tear down DMA tunnels on every " Mika Westerberg
2026-11-19 17:34   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 03/18] thunderbolt: Delay re-pairing DP IN/OUT if DPRX negotiation fails Mika Westerberg
2026-11-19 17:26   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 04/18] thunderbolt: Call DP tunnel activation callback with tb->lock held Mika Westerberg
2026-11-19 17:28   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 05/18] thunderbolt: Re-apply Alpine/Titan Ridge flow on resume Mika Westerberg
2026-11-19 17:35   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 06/18] thunderbolt: Return -ESHUTDOWN when control channel is not running Mika Westerberg
2026-11-19 17:25   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 07/18] thunderbolt: Add usb4_port_hotplug_disable() Mika Westerberg
2026-11-19 17:22   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 08/18] thunderbolt: Move tb_plug_events_active() before tb_switch_reset_host() Mika Westerberg
2026-11-19 17:25   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 09/18] thunderbolt: Add tb_port_state_is_up() Mika Westerberg
2026-11-19 17:22   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 10/18] thunderbolt: Split host router port reset into a separate function Mika Westerberg
2026-11-19 17:22   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 11/18] thunderbolt: Reset topology after suspend-to-disk Mika Westerberg
2026-11-19 17:44   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 12/18] thunderbolt: Drop tunnel discovery without HopID allocation Mika Westerberg
2026-11-19 17:26   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 13/18] thunderbolt: Always take domain lock when tb_tunnel_put() is called Mika Westerberg
2026-11-19 17:34   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 14/18] thunderbolt: Assign domain to the routers in KUnit tests Mika Westerberg
2026-11-19 17:26   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 15/18] thunderbolt: Rework tunnel credit allocation Mika Westerberg
2026-11-19 17:43   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 16/18] thunderbolt: Add support for shared flow control Mika Westerberg
2026-11-19 17:34   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 17/18] thunderbolt: Use restricted shared flow control for DMA tunnels on intra-domain links Mika Westerberg
2026-11-19 17:32   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 18/18] thunderbolt: Add KUnit tests for shared buffering Mika Westerberg
2026-11-19 17:28   ` sashiko-bot

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=20261119171232.1616316-1-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=gil.fine@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=pooja.katiyar@intel.com \
    --cc=rene.sapiens@linux.intel.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