Skip to content

Commit ef351f8

Browse files
committed
Merge tag 'thunderbolt-for-v6.18-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next
Mika writes: thunderbolt: Changes for v6.18 merge window This includes following USB4/Thunderbolt changes for the v6.18 merge window: - HMAC hashing improvements - Switch to use Linux Foundation IDs for XDomain discovery - Use is_pciehp instead of is_hotplug_bridge - Fixes for various kernel-doc issues - Fix use-after-free in DP tunneling error path. I'm sending the UAF fix with this pull request because it came quite late and I would like to give it some exposure before it lands the mainline. All these except the UAF fix have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.18-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (33 commits) thunderbolt: Fix use-after-free in tb_dp_dprx_work thunderbolt: Update thunderbolt.h header file thunderbolt: Update xdomain.c function documentation thunderbolt: Update usb4_port.c function documentation thunderbolt: Update usb4.c function documentation thunderbolt: Update tunnel.h function documentation thunderbolt: Update tunnel.c function documentation thunderbolt: Update tmu.c function documentation thunderbolt: Add missing documentation in tb.h thunderbolt: Update tb.h function documentation thunderbolt: Update tb.c function documentation thunderbolt: Update switch.c function documentation thunderbolt: Update retimer.c function documentation thunderbolt: Update property.c function documentation thunderbolt: Update path.c function documentation thunderbolt: Update nvm.c function documentation thunderbolt: Add missing documentation in nhi_regs.h ring_desc structure thunderbolt: Update nhi.c function documentation thunderbolt: Update lc.c function documentation thunderbolt: Update eeprom.c function documentation ...
2 parents a4e1436 + 67600cc commit ef351f8

File tree

30 files changed

+782
-403
lines changed

30 files changed

+782
-403
lines changed

CREDITS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,11 @@ S: Reading
18901890
S: RG6 2NU
18911891
S: United Kingdom
18921892

1893+
N: Michael Jamet
1894+
1895+
D: Thunderbolt/USB4 driver maintainer
1896+
D: Thunderbolt/USB4 networking driver maintainer
1897+
18931898
N: Dave Jeffery
18941899
18951900
D: SCSI hacks and IBM ServeRAID RAID driver maintenance

MAINTAINERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25138,7 +25138,6 @@ F: drivers/thunderbolt/dma_test.c
2513825138

2513925139
THUNDERBOLT DRIVER
2514025140
M: Andreas Noever <[email protected]>
25141-
M: Michael Jamet <[email protected]>
2514225141
M: Mika Westerberg <[email protected]>
2514325142
M: Yehezkel Bernat <[email protected]>
2514425143
@@ -25149,7 +25148,6 @@ F: drivers/thunderbolt/
2514925148
F: include/linux/thunderbolt.h
2515025149

2515125150
THUNDERBOLT NETWORK DRIVER
25152-
M: Michael Jamet <[email protected]>
2515325151
M: Mika Westerberg <[email protected]>
2515425152
M: Yehezkel Bernat <[email protected]>
2515525153

drivers/pci/quirks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3829,7 +3829,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, 0xcf80, quirk_no_pm_reset);
38293829
*/
38303830
static void quirk_thunderbolt_hotplug_msi(struct pci_dev *pdev)
38313831
{
3832-
if (pdev->is_hotplug_bridge &&
3832+
if (pdev->is_pciehp &&
38333833
(pdev->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C ||
38343834
pdev->revision <= 1))
38353835
pdev->no_msi = 1;

drivers/thunderbolt/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ menuconfig USB4
44
depends on PCI
55
select APPLE_PROPERTIES if EFI_STUB && X86
66
select CRC32
7-
select CRYPTO
8-
select CRYPTO_HASH
7+
select CRYPTO_LIB_SHA256
8+
select CRYPTO_LIB_UTILS
99
select NVMEM
1010
help
1111
USB4 and Thunderbolt driver. USB4 is the public specification

drivers/thunderbolt/acpi.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
8686
* @nhi ACPI node. For each reference a device link is added. The link
8787
* is automatically removed by the driver core.
8888
*
89-
* Returns %true if at least one link was created.
89+
* Returns %true if at least one link was created, %false otherwise.
9090
*/
9191
bool tb_acpi_add_links(struct tb_nhi *nhi)
9292
{
@@ -113,8 +113,10 @@ bool tb_acpi_add_links(struct tb_nhi *nhi)
113113
/**
114114
* tb_acpi_is_native() - Did the platform grant native TBT/USB4 control
115115
*
116-
* Returns %true if the platform granted OS native control over
117-
* TBT/USB4. In this case software based connection manager can be used,
116+
* Return: %true if the platform granted OS native control over
117+
* TBT/USB4, %false otherwise.
118+
*
119+
* When returned %true, software based connection manager can be used,
118120
* otherwise there is firmware based connection manager running.
119121
*/
120122
bool tb_acpi_is_native(void)
@@ -126,8 +128,8 @@ bool tb_acpi_is_native(void)
126128
/**
127129
* tb_acpi_may_tunnel_usb3() - Is USB3 tunneling allowed by the platform
128130
*
129-
* When software based connection manager is used, this function
130-
* returns %true if platform allows native USB3 tunneling.
131+
* Return: %true if software based connection manager is used and
132+
* platform allows native USB 3.x tunneling, %false otherwise.
131133
*/
132134
bool tb_acpi_may_tunnel_usb3(void)
133135
{
@@ -139,8 +141,8 @@ bool tb_acpi_may_tunnel_usb3(void)
139141
/**
140142
* tb_acpi_may_tunnel_dp() - Is DisplayPort tunneling allowed by the platform
141143
*
142-
* When software based connection manager is used, this function
143-
* returns %true if platform allows native DP tunneling.
144+
* Return: %true if software based connection manager is used and
145+
* platform allows native DP tunneling, %false otherwise.
144146
*/
145147
bool tb_acpi_may_tunnel_dp(void)
146148
{
@@ -152,8 +154,8 @@ bool tb_acpi_may_tunnel_dp(void)
152154
/**
153155
* tb_acpi_may_tunnel_pcie() - Is PCIe tunneling allowed by the platform
154156
*
155-
* When software based connection manager is used, this function
156-
* returns %true if platform allows native PCIe tunneling.
157+
* Return: %true if software based connection manager is used and
158+
* platform allows native PCIe tunneling, %false otherwise.
157159
*/
158160
bool tb_acpi_may_tunnel_pcie(void)
159161
{
@@ -165,8 +167,8 @@ bool tb_acpi_may_tunnel_pcie(void)
165167
/**
166168
* tb_acpi_is_xdomain_allowed() - Are XDomain connections allowed
167169
*
168-
* When software based connection manager is used, this function
169-
* returns %true if platform allows XDomain connections.
170+
* Return: %true if software based connection manager is used and
171+
* platform allows XDomain tunneling, %false otherwise.
170172
*/
171173
bool tb_acpi_is_xdomain_allowed(void)
172174
{
@@ -256,7 +258,7 @@ static int tb_acpi_retimer_set_power(struct tb_port *port, bool power)
256258
*
257259
* This should only be called if the USB4/TBT link is not up.
258260
*
259-
* Returns %0 on success.
261+
* Return: %0 on success, negative errno otherwise.
260262
*/
261263
int tb_acpi_power_on_retimers(struct tb_port *port)
262264
{
@@ -270,7 +272,7 @@ int tb_acpi_power_on_retimers(struct tb_port *port)
270272
* This is the opposite of tb_acpi_power_on_retimers(). After returning
271273
* successfully the normal operations with the @port can continue.
272274
*
273-
* Returns %0 on success.
275+
* Return: %0 on success, negative errno otherwise.
274276
*/
275277
int tb_acpi_power_off_retimers(struct tb_port *port)
276278
{

drivers/thunderbolt/cap.c

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ static void tb_port_dummy_read(struct tb_port *port)
6464
* @port: Port to find the capability for
6565
* @offset: Previous capability offset (%0 for start)
6666
*
67-
* Returns dword offset of the next capability in port config space
68-
* capability list and returns it. Passing %0 returns the first entry in
69-
* the capability list. If no next capability is found returns %0. In case
70-
* of failure returns negative errno.
67+
* Finds dword offset of the next capability in port config space
68+
* capability list. When passed %0 in @offset parameter, first entry
69+
* will be returned, if it exists.
70+
*
71+
* Return:
72+
* * Double word offset of the first or next capability - On success.
73+
* * %0 - If no next capability is found.
74+
* * Negative errno - Another error occurred.
7175
*/
7276
int tb_port_next_cap(struct tb_port *port, unsigned int offset)
7377
{
@@ -112,9 +116,10 @@ static int __tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap)
112116
* @port: Port to find the capability for
113117
* @cap: Capability to look
114118
*
115-
* Returns offset to start of capability or %-ENOENT if no such
116-
* capability was found. Negative errno is returned if there was an
117-
* error.
119+
* Return:
120+
* * Offset to the start of capability - On success.
121+
* * %-ENOENT - If no such capability was found.
122+
* * Negative errno - Another error occurred.
118123
*/
119124
int tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap)
120125
{
@@ -137,10 +142,14 @@ int tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap)
137142
* @sw: Switch to find the capability for
138143
* @offset: Previous capability offset (%0 for start)
139144
*
140-
* Finds dword offset of the next capability in router config space
141-
* capability list and returns it. Passing %0 returns the first entry in
142-
* the capability list. If no next capability is found returns %0. In case
143-
* of failure returns negative errno.
145+
* Finds dword offset of the next capability in port config space
146+
* capability list. When passed %0 in @offset parameter, first entry
147+
* will be returned, if it exists.
148+
*
149+
* Return:
150+
* * Double word offset of the first or next capability - On success.
151+
* * %0 - If no next capability is found.
152+
* * Negative errno - Another error occurred.
144153
*/
145154
int tb_switch_next_cap(struct tb_switch *sw, unsigned int offset)
146155
{
@@ -181,9 +190,10 @@ int tb_switch_next_cap(struct tb_switch *sw, unsigned int offset)
181190
* @sw: Switch to find the capability for
182191
* @cap: Capability to look
183192
*
184-
* Returns offset to start of capability or %-ENOENT if no such
185-
* capability was found. Negative errno is returned if there was an
186-
* error.
193+
* Return:
194+
* * Offset to the start of capability - On success.
195+
* * %-ENOENT - If no such capability was found.
196+
* * Negative errno - Another error occurred.
187197
*/
188198
int tb_switch_find_cap(struct tb_switch *sw, enum tb_switch_cap cap)
189199
{
@@ -213,10 +223,13 @@ int tb_switch_find_cap(struct tb_switch *sw, enum tb_switch_cap cap)
213223
* @sw: Switch to find the capability for
214224
* @vsec: Vendor specific capability to look
215225
*
216-
* Functions enumerates vendor specific capabilities (VSEC) of a switch
217-
* and returns offset when capability matching @vsec is found. If no
218-
* such capability is found returns %-ENOENT. In case of error returns
219-
* negative errno.
226+
* This function enumerates vendor specific capabilities (VSEC) of a
227+
* switch and returns offset when capability matching @vsec is found.
228+
*
229+
* Return:
230+
* * Offset of capability - On success.
231+
* * %-ENOENT - If capability was not found.
232+
* * Negative errno - Another error occurred.
220233
*/
221234
int tb_switch_find_vse_cap(struct tb_switch *sw, enum tb_switch_vse_cap vsec)
222235
{

drivers/thunderbolt/clx.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ static int tb_port_clx(struct tb_port *port)
167167
* @port: USB4 port to check
168168
* @clx: Mask of CL states to check
169169
*
170-
* Returns true if any of the given CL states is enabled for @port.
170+
* Return: %true if any of the given CL states is enabled for @port,
171+
* %false otherwise.
171172
*/
172173
bool tb_port_clx_is_enabled(struct tb_port *port, unsigned int clx)
173174
{
@@ -177,6 +178,8 @@ bool tb_port_clx_is_enabled(struct tb_port *port, unsigned int clx)
177178
/**
178179
* tb_switch_clx_is_supported() - Is CLx supported on this type of router
179180
* @sw: The router to check CLx support for
181+
*
182+
* Return: %true if CLx is supported, %false otherwise.
180183
*/
181184
static bool tb_switch_clx_is_supported(const struct tb_switch *sw)
182185
{
@@ -203,7 +206,7 @@ static bool tb_switch_clx_is_supported(const struct tb_switch *sw)
203206
* Can be called for any router. Initializes the current CL state by
204207
* reading it from the hardware.
205208
*
206-
* Returns %0 in case of success and negative errno in case of failure.
209+
* Return: %0 on success, negative errno otherwise.
207210
*/
208211
int tb_switch_clx_init(struct tb_switch *sw)
209212
{
@@ -313,7 +316,7 @@ static bool validate_mask(unsigned int clx)
313316
* is not inter-domain link. The complete set of conditions is described in CM
314317
* Guide 1.0 section 8.1.
315318
*
316-
* Returns %0 on success or an error code on failure.
319+
* Return: %0 on success, negative errno otherwise.
317320
*/
318321
int tb_switch_clx_enable(struct tb_switch *sw, unsigned int clx)
319322
{
@@ -390,8 +393,7 @@ int tb_switch_clx_enable(struct tb_switch *sw, unsigned int clx)
390393
* Disables all CL states of the given router. Can be called on any
391394
* router and if the states were not enabled already does nothing.
392395
*
393-
* Returns the CL states that were disabled or negative errno in case of
394-
* failure.
396+
* Return: CL states that were disabled or negative errno otherwise.
395397
*/
396398
int tb_switch_clx_disable(struct tb_switch *sw)
397399
{

drivers/thunderbolt/ctl.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ static DEFINE_MUTEX(tb_cfg_request_lock);
8282
*
8383
* This is refcounted object so when you are done with this, call
8484
* tb_cfg_request_put() to it.
85+
*
86+
* Return: &struct tb_cfg_request on success, %NULL otherwise.
8587
*/
8688
struct tb_cfg_request *tb_cfg_request_alloc(void)
8789
{
@@ -359,7 +361,7 @@ static void tb_ctl_tx_callback(struct tb_ring *ring, struct ring_frame *frame,
359361
*
360362
* len must be a multiple of four.
361363
*
362-
* Return: Returns 0 on success or an error code on failure.
364+
* Return: %0 on success, negative errno otherwise.
363365
*/
364366
static int tb_ctl_tx(struct tb_ctl *ctl, const void *data, size_t len,
365367
enum tb_cfg_pkg_type type)
@@ -539,6 +541,8 @@ static void tb_cfg_request_work(struct work_struct *work)
539541
*
540542
* This queues @req on the given control channel without waiting for it
541543
* to complete. When the request completes @callback is called.
544+
*
545+
* Return: %0 on success, negative errno otherwise.
542546
*/
543547
int tb_cfg_request(struct tb_ctl *ctl, struct tb_cfg_request *req,
544548
void (*callback)(void *), void *callback_data)
@@ -605,6 +609,9 @@ static void tb_cfg_request_complete(void *data)
605609
* triggers the request is canceled before function returns. Note the
606610
* caller needs to make sure only one message for given switch is active
607611
* at a time.
612+
*
613+
* Return: &struct tb_cfg_result with non-zero @err field if error
614+
* has occurred.
608615
*/
609616
struct tb_cfg_result tb_cfg_request_sync(struct tb_ctl *ctl,
610617
struct tb_cfg_request *req,
@@ -641,7 +648,7 @@ struct tb_cfg_result tb_cfg_request_sync(struct tb_ctl *ctl,
641648
*
642649
* cb will be invoked once for every hot plug event.
643650
*
644-
* Return: Returns a pointer on success or NULL on failure.
651+
* Return: Pointer to &struct tb_ctl, %NULL on failure.
645652
*/
646653
struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, int index, int timeout_msec,
647654
event_cb cb, void *cb_data)
@@ -764,8 +771,9 @@ void tb_ctl_stop(struct tb_ctl *ctl)
764771
* @route: Router that originated the event
765772
* @error: Pointer to the notification package
766773
*
767-
* Call this as response for non-plug notification to ack it. Returns
768-
* %0 on success or an error code on failure.
774+
* Call this as a response for non-plug notification to ack it.
775+
*
776+
* Return: %0 on success, negative errno otherwise.
769777
*/
770778
int tb_cfg_ack_notification(struct tb_ctl *ctl, u64 route,
771779
const struct cfg_error_pkg *error)
@@ -827,8 +835,9 @@ int tb_cfg_ack_notification(struct tb_ctl *ctl, u64 route,
827835
* @port: Port where the hot plug/unplug happened
828836
* @unplug: Ack hot plug or unplug
829837
*
830-
* Call this as response for hot plug/unplug event to ack it.
831-
* Returns %0 on success or an error code on failure.
838+
* Call this as a response for hot plug/unplug event to ack it.
839+
*
840+
* Return: %0 on success, negative errno otherwise.
832841
*/
833842
int tb_cfg_ack_plug(struct tb_ctl *ctl, u64 route, u32 port, bool unplug)
834843
{
@@ -895,6 +904,9 @@ static bool tb_cfg_copy(struct tb_cfg_request *req, const struct ctl_pkg *pkg)
895904
* If the switch at route is incorrectly configured then we will not receive a
896905
* reply (even though the switch will reset). The caller should check for
897906
* -ETIMEDOUT and attempt to reconfigure the switch.
907+
*
908+
* Return: &struct tb_cfg_result with non-zero @err field if error
909+
* has occurred.
898910
*/
899911
struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route)
900912
{
@@ -937,6 +949,9 @@ struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route)
937949
* @timeout_msec: Timeout in ms how long to wait for the response
938950
*
939951
* Reads from router config space without translating the possible error.
952+
*
953+
* Return: &struct tb_cfg_result with non-zero @err field if error
954+
* has occurred.
940955
*/
941956
struct tb_cfg_result tb_cfg_read_raw(struct tb_ctl *ctl, void *buffer,
942957
u64 route, u32 port, enum tb_cfg_space space,
@@ -1008,6 +1023,9 @@ struct tb_cfg_result tb_cfg_read_raw(struct tb_ctl *ctl, void *buffer,
10081023
* @timeout_msec: Timeout in ms how long to wait for the response
10091024
*
10101025
* Writes to router config space without translating the possible error.
1026+
*
1027+
* Return: &struct tb_cfg_result with non-zero @err field if error
1028+
* has occurred.
10111029
*/
10121030
struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, const void *buffer,
10131031
u64 route, u32 port, enum tb_cfg_space space,
@@ -1150,8 +1168,7 @@ int tb_cfg_write(struct tb_ctl *ctl, const void *buffer, u64 route, u32 port,
11501168
* Reads the first dword from the switches TB_CFG_SWITCH config area and
11511169
* returns the port number from which the reply originated.
11521170
*
1153-
* Return: Returns the upstream port number on success or an error code on
1154-
* failure.
1171+
* Return: Upstream port number on success or negative error code on failure.
11551172
*/
11561173
int tb_cfg_get_upstream_port(struct tb_ctl *ctl, u64 route)
11571174
{

drivers/thunderbolt/ctl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct ctl_pkg {
5454
* @kref: Reference count
5555
* @ctl: Pointer to the control channel structure. Only set when the
5656
* request is queued.
57+
* @request: Request is stored here
5758
* @request_size: Size of the request packet (in bytes)
5859
* @request_type: Type of the request packet
5960
* @response: Response is stored here

drivers/thunderbolt/debugfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/debugfs.h>
1313
#include <linux/delay.h>
1414
#include <linux/pm_runtime.h>
15+
#include <linux/string_choices.h>
1516
#include <linux/uaccess.h>
1617

1718
#include "tb.h"
@@ -691,7 +692,7 @@ static int margining_caps_show(struct seq_file *s, void *not_used)
691692
seq_printf(s, "0x%08x\n", margining->caps[i]);
692693

693694
seq_printf(s, "# software margining: %s\n",
694-
supports_software(margining) ? "yes" : "no");
695+
str_yes_no(supports_software(margining)));
695696
if (supports_hardware(margining)) {
696697
seq_puts(s, "# hardware margining: yes\n");
697698
seq_puts(s, "# minimum BER level contour: ");

0 commit comments

Comments
 (0)