From: Gil Fine <gil.fine@linux.intel.com>
To: mika.westerberg@linux.intel.com
Cc: gil.fine@intel.com, gil.fine@linux.intel.com, stable@vger.kernel.org
Subject: [PATCH v2 2/3] thunderbolt: Fix DMA credit limit to use host router value
Date: Thu, 17 Sep 2026 01:57:54 +0300 [thread overview]
Message-ID: <20260916225755.45127-2-gil.fine@linux.intel.com> (raw)
In-Reply-To: <20260916225755.45127-1-gil.fine@linux.intel.com>
Currently, when allocating credits for a DMA tunnel, we reserve credits
based on the baMaxHI parameter taken from the router that owns the
ingress adapter of the current hop.
In a host-to-host topology with a hub in the middle:
[Host1] <-> [Hub] <-> [Host2]
this incorrectly uses the hub's value instead of the host router's.
The DMA engine limit is defined by the host router baMaxHI.
Fix this by alway use the baMaxHI of the host router instead.
Fixes: 6ed541c53edc ("thunderbolt: Allocate credits according to router preferences")
Cc: stable@vger.kernel.org
Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Assisted-by: LLM
---
drivers/thunderbolt/tunnel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index 7a033df7f916..0625b1ff3820 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -175,7 +175,8 @@ static unsigned int tb_available_credits(const struct tb_port *port,
pcie = tb_acpi_may_tunnel_pcie() ? sw->max_pcie_credits : 0;
if (tb_acpi_is_xdomain_allowed()) {
- spare = min_not_zero(sw->max_dma_credits, dma_credits);
+ spare = min_not_zero(sw->tb->root_switch->max_dma_credits,
+ dma_credits);
/* Add some credits for potential second DMA tunnel */
spare += TB_MIN_DMA_CREDITS;
} else {
--
2.43.0
next prev parent reply other threads:[~2026-09-16 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 22:57 [PATCH v2 1/3] thunderbolt: Do not set up a DisplayPort tunnel when credits are insufficient Gil Fine
2026-09-16 22:57 ` Gil Fine [this message]
2026-09-17 6:19 ` [PATCH v2 2/3] thunderbolt: Fix DMA credit limit to use host router value Mika Westerberg
2026-09-16 22:57 ` [PATCH v2 3/3] thunderbolt: Fix credits reservation logic for DisplayPort tunnels Gil Fine
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=20260916225755.45127-2-gil.fine@linux.intel.com \
--to=gil.fine@linux.intel.com \
--cc=gil.fine@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=stable@vger.kernel.org \
/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