mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
thunderbolt: Changes for v7.1 merge window
This includes following USB4/Thunderbolt changes for the v7.1 merge window: - Disable CL-states for Titan Ridge based devices with older firmware. - MAINTAINER update. - Simplify allocation of various structures with kzalloc_flex(). All these have been in linux-next with no reported issues. -----BEGIN PGP SIGNATURE----- iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmnYkaogHG1pa2Eud2Vz dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKB7+hAAgNXfntNbInBx /NskRWDMjDr7QZR8/XlCsK0Iqecoux5wnM/kwI6hLIrmG4T17pZkl39dABJ+nik/ w/Z2XQZFV/AUAV3Yqg9G+TC8+mvYnRVxHZTkk6/16S5rTTqO95TVkO2Un4EYAqFO OiZCKxM6PYlJTm7fSHOU9sYsMKBZUCxRESKavUp/aZWt9y5KEQJb3VRruN7cMI3O cVNBEUoyODuGhomn70dett7ToEMPqJemvnzHTIVgyhZsIX1+V/+QhOi1MFTNpq55 TRtGL7toRFxYqv8KfX3IEG3gbrbixBI4vs2w22WD0qCW4WS+3D4E0ANObI08zrub XIKuUuTQC0LSQRqICbm0piNTxKI3tPzn/iHCVGH3A4t3G7xkL8PFKZV/rha7/NvQ mEgpce4h9JCwFrncDunn12Rwi7cbcgE9sJijzzC0e73vFmA2pT/Xp2I/l9rTMDpj 8glRJesbxB/89b37Szn5Y9c8gYtusvw4VI0TumgvGZb0HKQrjkVdoXwEY14QTNzG Nqd6NBf7/LzAvf6/kWgccmHxJjUL150fJO7IFmYw+tbl1VAdbAcs73J4HqjjwQ7x TH3MR7mo7mEUh7EcLKLEMeKkkDS0OkJGUwfiOqEblTGyF9/qpkEXa7hkdOxENtgI XzSv/Br+QbfSSsvZgEppekISQLNrZXY= =lBqS -----END PGP SIGNATURE----- Merge tag 'thunderbolt-for-v7.1-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v7.1 merge window This includes following USB4/Thunderbolt changes for the v7.1 merge window: - Disable CL-states for Titan Ridge based devices with older firmware. - MAINTAINER update. - Simplify allocation of various structures with kzalloc_flex(). All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v7.1-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: tunnel: Simplify allocation thunderbolt: Use kzalloc_flex() for struct tb_path allocation thunderbolt: dma_port: kmalloc_array + kzalloc to flex MAINTAINERS: Remove bouncing maintainer, Mika takes over DMA test driver thunderbolt: Disable CLx on Titan Ridge-based devices with old firmware thunderbolt: Read router NVM version before applying quirks
This commit is contained in:
commit
cd1be4b2c6
|
|
@ -26310,7 +26310,7 @@ F: drivers/media/i2c/thp7312.c
|
|||
F: include/uapi/linux/thp7312.h
|
||||
|
||||
THUNDERBOLT DMA TRAFFIC TEST DRIVER
|
||||
M: Isaac Hazan <isaac.hazan@intel.com>
|
||||
M: Mika Westerberg <westeri@kernel.org>
|
||||
L: linux-usb@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/thunderbolt/dma_test.c
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct tb_dma_port {
|
|||
struct tb_switch *sw;
|
||||
u8 port;
|
||||
u32 base;
|
||||
u8 *buf;
|
||||
u8 buf[];
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -209,16 +209,10 @@ struct tb_dma_port *dma_port_alloc(struct tb_switch *sw)
|
|||
if (port < 0)
|
||||
return NULL;
|
||||
|
||||
dma = kzalloc_obj(*dma);
|
||||
dma = kzalloc_flex(*dma, buf, MAIL_DATA_DWORDS);
|
||||
if (!dma)
|
||||
return NULL;
|
||||
|
||||
dma->buf = kmalloc_array(MAIL_DATA_DWORDS, sizeof(u32), GFP_KERNEL);
|
||||
if (!dma->buf) {
|
||||
kfree(dma);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dma->sw = sw;
|
||||
dma->port = port;
|
||||
dma->base = DMA_PORT_CAP;
|
||||
|
|
@ -232,10 +226,7 @@ struct tb_dma_port *dma_port_alloc(struct tb_switch *sw)
|
|||
*/
|
||||
void dma_port_free(struct tb_dma_port *dma)
|
||||
{
|
||||
if (dma) {
|
||||
kfree(dma->buf);
|
||||
kfree(dma);
|
||||
}
|
||||
kfree(dma);
|
||||
}
|
||||
|
||||
static int dma_port_wait_for_completion(struct tb_dma_port *dma,
|
||||
|
|
|
|||
|
|
@ -150,22 +150,17 @@ struct tb_path *tb_path_discover(struct tb_port *src, int src_hopid,
|
|||
num_hops++;
|
||||
}
|
||||
|
||||
path = kzalloc_obj(*path);
|
||||
path = kzalloc_flex(*path, hops, num_hops);
|
||||
if (!path)
|
||||
return NULL;
|
||||
|
||||
path->path_length = num_hops;
|
||||
|
||||
path->name = name;
|
||||
path->tb = src->sw->tb;
|
||||
path->path_length = num_hops;
|
||||
path->activated = true;
|
||||
path->alloc_hopid = alloc_hopid;
|
||||
|
||||
path->hops = kzalloc_objs(*path->hops, num_hops);
|
||||
if (!path->hops) {
|
||||
kfree(path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tb_dbg(path->tb, "discovering %s path starting from %llx:%u\n",
|
||||
path->name, tb_route(src->sw), src->port);
|
||||
|
||||
|
|
@ -245,10 +240,6 @@ struct tb_path *tb_path_alloc(struct tb *tb, struct tb_port *src, int src_hopid,
|
|||
size_t num_hops;
|
||||
int i, ret;
|
||||
|
||||
path = kzalloc_obj(*path);
|
||||
if (!path)
|
||||
return NULL;
|
||||
|
||||
first_port = last_port = NULL;
|
||||
i = 0;
|
||||
tb_for_each_port_on_path(src, dst, in_port) {
|
||||
|
|
@ -259,20 +250,17 @@ struct tb_path *tb_path_alloc(struct tb *tb, struct tb_port *src, int src_hopid,
|
|||
}
|
||||
|
||||
/* Check that src and dst are reachable */
|
||||
if (first_port != src || last_port != dst) {
|
||||
kfree(path);
|
||||
if (first_port != src || last_port != dst)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Each hop takes two ports */
|
||||
num_hops = i / 2;
|
||||
|
||||
path->hops = kzalloc_objs(*path->hops, num_hops);
|
||||
if (!path->hops) {
|
||||
kfree(path);
|
||||
path = kzalloc_flex(*path, hops, num_hops);
|
||||
if (!path)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
path->path_length = num_hops;
|
||||
path->alloc_hopid = true;
|
||||
|
||||
in_hopid = src_hopid;
|
||||
|
|
@ -339,7 +327,6 @@ struct tb_path *tb_path_alloc(struct tb *tb, struct tb_port *src, int src_hopid,
|
|||
}
|
||||
|
||||
path->tb = tb;
|
||||
path->path_length = num_hops;
|
||||
path->name = name;
|
||||
|
||||
return path;
|
||||
|
|
@ -372,7 +359,6 @@ void tb_path_free(struct tb_path *path)
|
|||
}
|
||||
}
|
||||
|
||||
kfree(path->hops);
|
||||
kfree(path);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ static void quirk_dp_credit_allocation(struct tb_switch *sw)
|
|||
|
||||
static void quirk_clx_disable(struct tb_switch *sw)
|
||||
{
|
||||
if (tb_switch_is_titan_ridge(sw) && sw->nvm && sw->nvm->major >= 0x65)
|
||||
return;
|
||||
|
||||
sw->quirks |= QUIRK_NO_CLX;
|
||||
tb_sw_dbg(sw, "disabling CL states\n");
|
||||
}
|
||||
|
|
@ -61,6 +64,10 @@ static const struct tb_quirk tb_quirks[] = {
|
|||
/* Dell WD19TB supports self-authentication on unplug */
|
||||
{ 0x0000, 0x0000, 0x00d4, 0xb070, quirk_force_power_link },
|
||||
{ 0x0000, 0x0000, 0x00d4, 0xb071, quirk_force_power_link },
|
||||
|
||||
/* Intel Titan Ridge CLx is unstable on early firmware versions */
|
||||
{ 0x8086, PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE, 0x0000, 0x0000,
|
||||
quirk_clx_disable },
|
||||
/*
|
||||
* Intel Goshen Ridge NVM 27 and before report wrong number of
|
||||
* DP buffers.
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ static int nvm_write(void *priv, unsigned int offset, void *val, size_t bytes)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int tb_switch_nvm_add(struct tb_switch *sw)
|
||||
static int tb_switch_nvm_init(struct tb_switch *sw)
|
||||
{
|
||||
struct tb_nvm *nvm;
|
||||
int ret;
|
||||
|
|
@ -365,6 +365,26 @@ static int tb_switch_nvm_add(struct tb_switch *sw)
|
|||
if (ret)
|
||||
goto err_nvm;
|
||||
|
||||
sw->nvm = nvm;
|
||||
return 0;
|
||||
|
||||
err_nvm:
|
||||
tb_sw_dbg(sw, "NVM upgrade disabled\n");
|
||||
sw->no_nvm_upgrade = true;
|
||||
if (!IS_ERR(nvm))
|
||||
tb_nvm_free(nvm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tb_switch_nvm_add(struct tb_switch *sw)
|
||||
{
|
||||
struct tb_nvm *nvm = sw->nvm;
|
||||
int ret;
|
||||
|
||||
if (!nvm)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* If the switch is in safe-mode the only accessible portion of
|
||||
* the NVM is the non-active one where userspace is expected to
|
||||
|
|
@ -383,14 +403,12 @@ static int tb_switch_nvm_add(struct tb_switch *sw)
|
|||
goto err_nvm;
|
||||
}
|
||||
|
||||
sw->nvm = nvm;
|
||||
return 0;
|
||||
|
||||
err_nvm:
|
||||
tb_sw_dbg(sw, "NVM upgrade disabled\n");
|
||||
sw->no_nvm_upgrade = true;
|
||||
if (!IS_ERR(nvm))
|
||||
tb_nvm_free(nvm);
|
||||
tb_nvm_free(nvm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -3311,6 +3329,10 @@ int tb_switch_add(struct tb_switch *sw)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = tb_switch_nvm_init(sw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!sw->safe_mode) {
|
||||
tb_switch_credits_init(sw);
|
||||
|
||||
|
|
|
|||
|
|
@ -419,9 +419,9 @@ enum tb_path_port {
|
|||
* @activated: Is the path active
|
||||
* @clear_fc: Clear all flow control from the path config space entries
|
||||
* when deactivating this path
|
||||
* @hops: Path hops
|
||||
* @path_length: How many hops the path uses
|
||||
* @alloc_hopid: Does this path consume port HopID
|
||||
* @hops: Path hops
|
||||
*
|
||||
* A path consists of a number of hops (see &struct tb_path_hop). To
|
||||
* establish a PCIe tunnel two paths have to be created between the two
|
||||
|
|
@ -440,9 +440,10 @@ struct tb_path {
|
|||
bool drop_packages;
|
||||
bool activated;
|
||||
bool clear_fc;
|
||||
struct tb_path_hop *hops;
|
||||
int path_length;
|
||||
bool alloc_hopid;
|
||||
|
||||
struct tb_path_hop hops[] __counted_by(path_length);
|
||||
};
|
||||
|
||||
/* HopIDs 0-7 are reserved by the Thunderbolt protocol */
|
||||
|
|
|
|||
|
|
@ -180,19 +180,14 @@ static struct tb_tunnel *tb_tunnel_alloc(struct tb *tb, size_t npaths,
|
|||
{
|
||||
struct tb_tunnel *tunnel;
|
||||
|
||||
tunnel = kzalloc_obj(*tunnel);
|
||||
tunnel = kzalloc_flex(*tunnel, paths, npaths);
|
||||
if (!tunnel)
|
||||
return NULL;
|
||||
|
||||
tunnel->paths = kzalloc_objs(tunnel->paths[0], npaths);
|
||||
if (!tunnel->paths) {
|
||||
kfree(tunnel);
|
||||
return NULL;
|
||||
}
|
||||
tunnel->npaths = npaths;
|
||||
|
||||
INIT_LIST_HEAD(&tunnel->list);
|
||||
tunnel->tb = tb;
|
||||
tunnel->npaths = npaths;
|
||||
tunnel->type = type;
|
||||
kref_init(&tunnel->kref);
|
||||
|
||||
|
|
@ -219,7 +214,6 @@ static void tb_tunnel_destroy(struct kref *kref)
|
|||
tb_path_free(tunnel->paths[i]);
|
||||
}
|
||||
|
||||
kfree(tunnel->paths);
|
||||
kfree(tunnel);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ enum tb_tunnel_state {
|
|||
* @src_port: Source port of the tunnel
|
||||
* @dst_port: Destination port of the tunnel. For discovered incomplete
|
||||
* tunnels may be %NULL or null adapter port instead.
|
||||
* @paths: All paths required by the tunnel
|
||||
* @npaths: Number of paths in @paths
|
||||
* @pre_activate: Optional tunnel specific initialization called before
|
||||
* activation. Can touch hardware.
|
||||
|
|
@ -69,13 +68,13 @@ enum tb_tunnel_state {
|
|||
* @dprx_work: Worker that is scheduled to poll completion of DPRX capabilities read
|
||||
* @callback: Optional callback called when DP tunnel is fully activated
|
||||
* @callback_data: Optional data for @callback
|
||||
* @paths: All paths required by the tunnel
|
||||
*/
|
||||
struct tb_tunnel {
|
||||
struct kref kref;
|
||||
struct tb *tb;
|
||||
struct tb_port *src_port;
|
||||
struct tb_port *dst_port;
|
||||
struct tb_path **paths;
|
||||
size_t npaths;
|
||||
int (*pre_activate)(struct tb_tunnel *tunnel);
|
||||
int (*activate)(struct tb_tunnel *tunnel, bool activate);
|
||||
|
|
@ -107,6 +106,8 @@ struct tb_tunnel {
|
|||
struct delayed_work dprx_work;
|
||||
void (*callback)(struct tb_tunnel *tunnel, void *data);
|
||||
void *callback_data;
|
||||
|
||||
struct tb_path *paths[] __counted_by(npaths);
|
||||
};
|
||||
|
||||
struct tb_tunnel *tb_tunnel_discover_pci(struct tb *tb, struct tb_port *down,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user