thunderbolt: Check for ring 0 in tb_tunnel_alloc_dma()
Subsystems (3)
PATCH 1/7 thunderbolt: Check for ring 0 in tb_tunnel_alloc_dma()
Ring 0 cannot be used for anything else than control channel messages. For this reason add a check to tb_tunnel_alloc_dma() and fail if someone tries to do that.
--- drivers/thunderbolt/tunnel.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/thunderbolt/tunnel.c +4 -0
@@ -1452,6 +1452,10 @@ struct tb_tunnel *tb_tunnel_alloc_dma(struct tb *tb, struct tb_port *nhi,struct tb_path *path;int credits; +/* Ring 0 is reserved for control channel */ +if (WARN_ON (!receive_ring || !transmit_ring)) +return NULL ; +if (receive_ring >0 ) npaths++;if (transmit_ring >0 )
Signature · 1 line
2.39.2
PATCH 2/7 thunderbolt: Log function name of the called quirk
This is useful when debugging whether a quirk has been matched or not.
--- drivers/thunderbolt/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/thunderbolt/quirks.c +1 -0
@@ -105,6 +105,7 @@ void tb_check_quirks(struct tb_switch *sw)if (q->device && q->device != sw->device)continue ; +tb_sw_dbg (sw,"running %ps\n" , q->hook); q->hook (sw); } }
Signature · 1 line
2.39.2
PATCH 3/7 thunderbolt: Add debug log for link controller power quirk
In reply to Mika WesterbergAdd a debug log to this quirk as well so we can see what quirks have been applied when debugging.
--- drivers/thunderbolt/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/thunderbolt/quirks.c +1 -0
@@ -10,6 +10,7 @@static void quirk_force_power_link (struct tb_switch *sw) { sw->quirks |=QUIRK_FORCE_POWER_LINK_CONTROLLER ; +tb_sw_dbg (sw,"forcing power to link controller\n" ); }static void quirk_dp_credit_allocation (struct tb_switch *sw)
Signature · 1 line
2.39.2
PATCH 4/7 thunderbolt: Allow specifying custom credits for DMA tunnels
In reply to Mika WesterbergThe default ones should be find but this allows the user to tweak the credits to get more performance out of the P2P connection.
--- drivers/thunderbolt/tunnel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/thunderbolt/tunnel.c +9 -4
@@ -41,9 +41,14 @@* Number of credits we try to allocate for each DMA path if not limited * by the host router baMaxHI. */ -#define TB_DMA_CREDITS 14U +#define TB_DMA_CREDITS 14/* Minimum number of credits for DMA path */ -#define TB_MIN_DMA_CREDITS 1U +#define TB_MIN_DMA_CREDITS 1 + +static unsigned int dma_credits =TB_DMA_CREDITS ; +module_param (dma_credits, uint,0444 ); +MODULE_PARM_DESC(dma_credits, "specify custom credits for DMA tunnels (default: " + __MODULE_STRING(TB_DMA_CREDITS) ")");static bool bw_alloc_mode = true;module_param (bw_alloc_mode, bool,0444 );
@@ -95,7 +100,7 @@ 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,TB_DMA_CREDITS ); + spare =min_not_zero (sw->max_dma_credits, dma_credits);/* Add some credits for potential second DMA tunnel */ spare +=TB_MIN_DMA_CREDITS ; }else {
@@ -1472,7 +1477,7 @@ struct tb_tunnel *tb_tunnel_alloc_dma(struct tb *tb, struct tb_port *nhi, tunnel->dst_port = dst; tunnel->deinit = tb_dma_deinit; - credits =min_not_zero (TB_DMA_CREDITS , nhi->sw->max_dma_credits); + credits =min_not_zero (dma_credits, nhi->sw->max_dma_credits);if (receive_ring >0 ) { path = tb_path_alloc(tb, dst, receive_path, nhi, receive_ring, 0,
Signature · 1 line
2.39.2
PATCH 5/7 thunderbolt: Add MODULE_DESCRIPTION
In reply to Mika WesterbergAdd description about the driver to the module. No functional changes.
--- drivers/thunderbolt/nhi.c | 1 + 1 file changed, 1 insertion(+)
drivers/thunderbolt/nhi.c +1 -0
@@ -1464,6 +1464,7 @@ static struct pci_device_id nhi_ids[] = { };MODULE_DEVICE_TABLE (pci, nhi_ids); +MODULE_DESCRIPTION ("Thunderbolt/USB4 core driver" );MODULE_LICENSE ("GPL" );static struct pci_driver nhi_driver = {
Signature · 1 line
2.39.2
PATCH 6/7 thunderbolt: dma_test: Update MODULE_DESCRIPTION
In reply to Mika WesterbergMake the description match the core driver and the networking with Thunderbolt/USB4 prefix. No functional changes.
--- drivers/thunderbolt/dma_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thunderbolt/dma_test.c +1 -1
@@ -756,5 +756,5 @@ module_exit(dma_test_exit);MODULE_AUTHOR ("Isaac Hazan <[email protected]>" );MODULE_AUTHOR ("Mika Westerberg <[email protected]>" ); -MODULE_DESCRIPTION ("DMA traffic test driver" ); +MODULE_DESCRIPTION ("Thunderbolt/USB4 DMA traffic test driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.39.2
PATCH 7/7 thunderbolt: Drop retimer vendor check
In reply to Mika WesterbergThis is not needed anymore as we already handle unknown vendor in NVM functions.
--- drivers/thunderbolt/retimer.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/thunderbolt/retimer.c +0 -6
@@ -341,12 +341,6 @@ static int tb_retimer_add(struct tb_port *port, u8 index, u32 auth_status)return ret; } -if (vendor !=PCI_VENDOR_ID_INTEL && vendor !=0x8087 ) { -tb_port_info (port,"retimer NVM format of vendor %#x is not supported\n" , - vendor); -return -EOPNOTSUPP ; - } -/* * Check that it supports NVM operations. If not then don't add * the device at all.
Signature · 1 line
2.39.2
Quoted 5 lines · Mika Westerberg
Ring 0 cannot be used for anything else than control channel messages. For this reason add a check to
tb_tunnel_alloc_dma()and fail if someone tries to do that.Signed-off-by Mika Westerberg <[email protected]>
All applied to thunderbolt.git/next.