2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 08:44:14 +08:00

thunderbolt: Changes for v6.6 merge window

This includes following Thunderbolt/USB4 changes for the v6.6 merge
 window:
 
   - Replace broken mailing list address in the ABI document
   - Small improvements.
 
 All these have been in linux-next with no reported issues.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmTkfGsgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBDZhAAi7BjitUFsFOv
 6VsNuhztPaO5GKqlDwBfIST2/k6qzdPJSBMwr6biMLcloNkehyRlRPSPgHPEjbv/
 lqF7BkUpg7Ghw164VBq0nU1WKq6u/+HvoZL5Tkacz87ObWyfX7s/BfeOm1nW7++t
 kROG39ZZhLKG1RASqWRJsu3eSZIpbSXD2c7ErnuNRNobPqrx3ts1gS0FBiZwZfG6
 96lG1cSNlujjQFreKIikz/CIgpgCFkdcw5cEieHY13wSNU90gMEcZ1PEKz48eMMI
 E70RrfwEQd8f+M239JLSmer2Kh1dx90RJ8GJKsS4UyxBn07r7FXoBeo3DMaNLKB0
 PIMW5G5dsRJr7tqpOSJIHpprmAMlOL4xMBQ+XlsJiSPYCC+xeFPxVyIqdLdCpxjF
 NWSJExiSDgFkOPJQltu91egFWWQBXXugGxbxkFvQsqwF0JU6oD5XIESVK5Lq3SvT
 xOQdpMQFVXOQCqYTZ2Xc2K/bAO/EYbJVLoRbSBGcwXHyiHe3Vyc4agcCPrxDqbU1
 SxD1GgTU0ooHdkikbIeGEj5VUsMRRNSJVxvUXGZlhh0GCy/c/KYOur2AG9vIwi3T
 RYtik2MY2mtT+wTE1Kb8gmPv4xtog6LpNfEINF+bBat7rUCKO5KlUnLcVJbVmTW4
 lQhBqTv2W9Aki36iewRVPAjZ/7kZMUY=
 =US+s
 -----END PGP SIGNATURE-----

Merge tag 'thunderbolt-for-v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next

Mika writes:

thunderbolt: Changes for v6.6 merge window

This includes following Thunderbolt/USB4 changes for the v6.6 merge
window:

  - Replace broken mailing list address in the ABI document
  - Small improvements.

All these have been in linux-next with no reported issues.

* tag 'thunderbolt-for-v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
  Documentation/ABI: thunderbolt: Replace 01.org in contact
  thunderbolt: Check Intel vendor ID in tb_switch_get_generation()
  thunderbolt: Log a warning if device links are not found
  thunderbolt: Set variable tmu_params storage class specifier to static
This commit is contained in:
Greg Kroah-Hartman 2023-08-22 14:22:35 +02:00
commit 7ccecc84ef
6 changed files with 89 additions and 70 deletions

View File

@ -1,7 +1,7 @@
What: /sys/bus/thunderbolt/devices/.../domainX/boot_acl What: /sys/bus/thunderbolt/devices/.../domainX/boot_acl
Date: Jun 2018 Date: Jun 2018
KernelVersion: 4.17 KernelVersion: 4.17
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: Holds a comma separated list of device unique_ids that Description: Holds a comma separated list of device unique_ids that
are allowed to be connected automatically during system are allowed to be connected automatically during system
startup (e.g boot devices). The list always contains startup (e.g boot devices). The list always contains
@ -33,7 +33,7 @@ Description: This attribute tells whether the system supports
What: /sys/bus/thunderbolt/devices/.../domainX/iommu_dma_protection What: /sys/bus/thunderbolt/devices/.../domainX/iommu_dma_protection
Date: Mar 2019 Date: Mar 2019
KernelVersion: 4.21 KernelVersion: 4.21
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute tells whether the system uses IOMMU Description: This attribute tells whether the system uses IOMMU
for DMA protection. Value of 1 means IOMMU is used 0 means for DMA protection. Value of 1 means IOMMU is used 0 means
it is not (DMA protection is solely based on Thunderbolt it is not (DMA protection is solely based on Thunderbolt
@ -42,7 +42,7 @@ Description: This attribute tells whether the system uses IOMMU
What: /sys/bus/thunderbolt/devices/.../domainX/security What: /sys/bus/thunderbolt/devices/.../domainX/security
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute holds current Thunderbolt security level Description: This attribute holds current Thunderbolt security level
set by the system BIOS. Possible values are: set by the system BIOS. Possible values are:
@ -64,7 +64,7 @@ Description: This attribute holds current Thunderbolt security level
What: /sys/bus/thunderbolt/devices/.../authorized What: /sys/bus/thunderbolt/devices/.../authorized
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute is used to authorize Thunderbolt devices Description: This attribute is used to authorize Thunderbolt devices
after they have been connected. If the device is not after they have been connected. If the device is not
authorized, no PCIe devices are available to the system. authorized, no PCIe devices are available to the system.
@ -98,7 +98,7 @@ Description: This attribute is used to authorize Thunderbolt devices
What: /sys/bus/thunderbolt/devices/.../boot What: /sys/bus/thunderbolt/devices/.../boot
Date: Jun 2018 Date: Jun 2018
KernelVersion: 4.17 KernelVersion: 4.17
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute contains 1 if Thunderbolt device was already Description: This attribute contains 1 if Thunderbolt device was already
authorized on boot and 0 otherwise. authorized on boot and 0 otherwise.
@ -113,7 +113,7 @@ Description: This attribute contains the generation of the Thunderbolt
What: /sys/bus/thunderbolt/devices/.../key What: /sys/bus/thunderbolt/devices/.../key
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: When a devices supports Thunderbolt secure connect it will Description: When a devices supports Thunderbolt secure connect it will
have this attribute. Writing 32 byte hex string changes have this attribute. Writing 32 byte hex string changes
authorization to use the secure connection method instead. authorization to use the secure connection method instead.
@ -123,14 +123,14 @@ Description: When a devices supports Thunderbolt secure connect it will
What: /sys/bus/thunderbolt/devices/.../device What: /sys/bus/thunderbolt/devices/.../device
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute contains id of this device extracted from Description: This attribute contains id of this device extracted from
the device DROM. the device DROM.
What: /sys/bus/thunderbolt/devices/.../device_name What: /sys/bus/thunderbolt/devices/.../device_name
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute contains name of this device extracted from Description: This attribute contains name of this device extracted from
the device DROM. the device DROM.
@ -172,21 +172,21 @@ Description: This attribute reports number of TX lanes the device is
What: /sys/bus/thunderbolt/devices/.../vendor What: /sys/bus/thunderbolt/devices/.../vendor
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute contains vendor id of this device extracted Description: This attribute contains vendor id of this device extracted
from the device DROM. from the device DROM.
What: /sys/bus/thunderbolt/devices/.../vendor_name What: /sys/bus/thunderbolt/devices/.../vendor_name
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute contains vendor name of this device extracted Description: This attribute contains vendor name of this device extracted
from the device DROM. from the device DROM.
What: /sys/bus/thunderbolt/devices/.../unique_id What: /sys/bus/thunderbolt/devices/.../unique_id
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This attribute contains unique_id string of this device. Description: This attribute contains unique_id string of this device.
This is either read from hardware registers (UUID on This is either read from hardware registers (UUID on
newer hardware) or based on UID from the device DROM. newer hardware) or based on UID from the device DROM.
@ -195,7 +195,7 @@ Description: This attribute contains unique_id string of this device.
What: /sys/bus/thunderbolt/devices/.../nvm_version What: /sys/bus/thunderbolt/devices/.../nvm_version
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: If the device has upgradeable firmware the version Description: If the device has upgradeable firmware the version
number is available here. Format: %x.%x, major.minor. number is available here. Format: %x.%x, major.minor.
If the device is in safe mode reading the file returns If the device is in safe mode reading the file returns
@ -204,7 +204,7 @@ Description: If the device has upgradeable firmware the version
What: /sys/bus/thunderbolt/devices/.../nvm_authenticate What: /sys/bus/thunderbolt/devices/.../nvm_authenticate
Date: Sep 2017 Date: Sep 2017
KernelVersion: 4.13 KernelVersion: 4.13
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: When new NVM image is written to the non-active NVM Description: When new NVM image is written to the non-active NVM
area (through non_activeX NVMem device), the area (through non_activeX NVMem device), the
authentication procedure is started by writing to authentication procedure is started by writing to
@ -246,7 +246,7 @@ Description: For supported devices, automatically authenticate the new Thunderbo
What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/key What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/key
Date: Jan 2018 Date: Jan 2018
KernelVersion: 4.15 KernelVersion: 4.15
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This contains name of the property directory the XDomain Description: This contains name of the property directory the XDomain
service exposes. This entry describes the protocol in service exposes. This entry describes the protocol in
question. Following directories are already reserved by question. Following directories are already reserved by
@ -261,35 +261,35 @@ Description: This contains name of the property directory the XDomain
What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/modalias What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/modalias
Date: Jan 2018 Date: Jan 2018
KernelVersion: 4.15 KernelVersion: 4.15
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: Stores the same MODALIAS value emitted by uevent for Description: Stores the same MODALIAS value emitted by uevent for
the XDomain service. Format: tbtsvc:kSpNvNrN the XDomain service. Format: tbtsvc:kSpNvNrN
What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcid What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcid
Date: Jan 2018 Date: Jan 2018
KernelVersion: 4.15 KernelVersion: 4.15
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This contains XDomain protocol identifier the XDomain Description: This contains XDomain protocol identifier the XDomain
service supports. service supports.
What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcvers What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcvers
Date: Jan 2018 Date: Jan 2018
KernelVersion: 4.15 KernelVersion: 4.15
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This contains XDomain protocol version the XDomain Description: This contains XDomain protocol version the XDomain
service supports. service supports.
What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcrevs What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcrevs
Date: Jan 2018 Date: Jan 2018
KernelVersion: 4.15 KernelVersion: 4.15
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This contains XDomain software version the XDomain Description: This contains XDomain software version the XDomain
service supports. service supports.
What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcstns What: /sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcstns
Date: Jan 2018 Date: Jan 2018
KernelVersion: 4.15 KernelVersion: 4.15
Contact: thunderbolt-software@lists.01.org Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: This contains XDomain service specific settings as Description: This contains XDomain service specific settings as
bitmask. Format: %x bitmask. Format: %x

View File

@ -12,7 +12,7 @@
#include "tb.h" #include "tb.h"
static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data, static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
void **return_value) void **ret)
{ {
struct acpi_device *adev = acpi_fetch_acpi_dev(handle); struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode;
@ -84,6 +84,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
if (link) { if (link) {
dev_dbg(&nhi->pdev->dev, "created link from %s\n", dev_dbg(&nhi->pdev->dev, "created link from %s\n",
dev_name(&pdev->dev)); dev_name(&pdev->dev));
*(bool *)ret = true;
} else { } else {
dev_warn(&nhi->pdev->dev, "device link creation from %s failed\n", dev_warn(&nhi->pdev->dev, "device link creation from %s failed\n",
dev_name(&pdev->dev)); dev_name(&pdev->dev));
@ -104,22 +105,29 @@ out_put:
* Goes over ACPI namespace finding tunneled ports that reference to * Goes over ACPI namespace finding tunneled ports that reference to
* @nhi ACPI node. For each reference a device link is added. The link * @nhi ACPI node. For each reference a device link is added. The link
* is automatically removed by the driver core. * is automatically removed by the driver core.
*
* Returns %true if at least one link was created.
*/ */
void tb_acpi_add_links(struct tb_nhi *nhi) bool tb_acpi_add_links(struct tb_nhi *nhi)
{ {
acpi_status status; acpi_status status;
bool ret = false;
if (!has_acpi_companion(&nhi->pdev->dev)) if (!has_acpi_companion(&nhi->pdev->dev))
return; return false;
/* /*
* Find all devices that have usb4-host-controller interface * Find all devices that have usb4-host-controller interface
* property that references to this NHI. * property that references to this NHI.
*/ */
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 32, status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 32,
tb_acpi_add_link, NULL, nhi, NULL); tb_acpi_add_link, NULL, nhi, (void **)&ret);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status)) {
dev_warn(&nhi->pdev->dev, "failed to enumerate tunneled ports\n"); dev_warn(&nhi->pdev->dev, "failed to enumerate tunneled ports\n");
return false;
}
return ret;
} }
/** /**

View File

@ -2188,6 +2188,10 @@ struct device_type tb_switch_type = {
static int tb_switch_get_generation(struct tb_switch *sw) static int tb_switch_get_generation(struct tb_switch *sw)
{ {
if (tb_switch_is_usb4(sw))
return 4;
if (sw->config.vendor_id == PCI_VENDOR_ID_INTEL) {
switch (sw->config.device_id) { switch (sw->config.device_id) {
case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE: case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE:
case PCI_DEVICE_ID_INTEL_EAGLE_RIDGE: case PCI_DEVICE_ID_INTEL_EAGLE_RIDGE:
@ -2215,20 +2219,17 @@ static int tb_switch_get_generation(struct tb_switch *sw)
case PCI_DEVICE_ID_INTEL_ICL_NHI0: case PCI_DEVICE_ID_INTEL_ICL_NHI0:
case PCI_DEVICE_ID_INTEL_ICL_NHI1: case PCI_DEVICE_ID_INTEL_ICL_NHI1:
return 3; return 3;
}
default: }
if (tb_switch_is_usb4(sw))
return 4;
/* /*
* For unknown switches assume generation to be 1 to be * For unknown switches assume generation to be 1 to be on the
* on the safe side. * safe side.
*/ */
tb_sw_warn(sw, "unsupported switch device id %#x\n", tb_sw_warn(sw, "unsupported switch device id %#x\n",
sw->config.device_id); sw->config.device_id);
return 1; return 1;
} }
}
static bool tb_switch_exceeds_max_depth(const struct tb_switch *sw, int depth) static bool tb_switch_exceeds_max_depth(const struct tb_switch *sw, int depth)
{ {

View File

@ -2368,12 +2368,13 @@ static const struct tb_cm_ops tb_cm_ops = {
* downstream ports and the NHI so that the device core will make sure * downstream ports and the NHI so that the device core will make sure
* NHI is resumed first before the rest. * NHI is resumed first before the rest.
*/ */
static void tb_apple_add_links(struct tb_nhi *nhi) static bool tb_apple_add_links(struct tb_nhi *nhi)
{ {
struct pci_dev *upstream, *pdev; struct pci_dev *upstream, *pdev;
bool ret;
if (!x86_apple_machine) if (!x86_apple_machine)
return; return false;
switch (nhi->pdev->device) { switch (nhi->pdev->device) {
case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE: case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE:
@ -2382,26 +2383,27 @@ static void tb_apple_add_links(struct tb_nhi *nhi)
case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI:
break; break;
default: default:
return; return false;
} }
upstream = pci_upstream_bridge(nhi->pdev); upstream = pci_upstream_bridge(nhi->pdev);
while (upstream) { while (upstream) {
if (!pci_is_pcie(upstream)) if (!pci_is_pcie(upstream))
return; return false;
if (pci_pcie_type(upstream) == PCI_EXP_TYPE_UPSTREAM) if (pci_pcie_type(upstream) == PCI_EXP_TYPE_UPSTREAM)
break; break;
upstream = pci_upstream_bridge(upstream); upstream = pci_upstream_bridge(upstream);
} }
if (!upstream) if (!upstream)
return; return false;
/* /*
* For each hotplug downstream port, create add device link * For each hotplug downstream port, create add device link
* back to NHI so that PCIe tunnels can be re-established after * back to NHI so that PCIe tunnels can be re-established after
* sleep. * sleep.
*/ */
ret = false;
for_each_pci_bridge(pdev, upstream->subordinate) { for_each_pci_bridge(pdev, upstream->subordinate) {
const struct device_link *link; const struct device_link *link;
@ -2417,11 +2419,14 @@ static void tb_apple_add_links(struct tb_nhi *nhi)
if (link) { if (link) {
dev_dbg(&nhi->pdev->dev, "created link from %s\n", dev_dbg(&nhi->pdev->dev, "created link from %s\n",
dev_name(&pdev->dev)); dev_name(&pdev->dev));
ret = true;
} else { } else {
dev_warn(&nhi->pdev->dev, "device link creation from %s failed\n", dev_warn(&nhi->pdev->dev, "device link creation from %s failed\n",
dev_name(&pdev->dev)); dev_name(&pdev->dev));
} }
} }
return ret;
} }
struct tb *tb_probe(struct tb_nhi *nhi) struct tb *tb_probe(struct tb_nhi *nhi)
@ -2448,8 +2453,13 @@ struct tb *tb_probe(struct tb_nhi *nhi)
tb_dbg(tb, "using software connection manager\n"); tb_dbg(tb, "using software connection manager\n");
tb_apple_add_links(nhi); /*
tb_acpi_add_links(nhi); * Device links are needed to make sure we establish tunnels
* before the PCIe/USB stack is resumed so complain here if we
* found them missing.
*/
if (!tb_apple_add_links(nhi) && !tb_acpi_add_links(nhi))
tb_warn(tb, "device links to tunneled native ports are missing!\n");
return tb; return tb;
} }

View File

@ -1333,7 +1333,7 @@ static inline bool usb4_port_device_is_offline(const struct usb4_port *usb4)
void tb_check_quirks(struct tb_switch *sw); void tb_check_quirks(struct tb_switch *sw);
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
void tb_acpi_add_links(struct tb_nhi *nhi); bool tb_acpi_add_links(struct tb_nhi *nhi);
bool tb_acpi_is_native(void); bool tb_acpi_is_native(void);
bool tb_acpi_may_tunnel_usb3(void); bool tb_acpi_may_tunnel_usb3(void);
@ -1346,7 +1346,7 @@ void tb_acpi_exit(void);
int tb_acpi_power_on_retimers(struct tb_port *port); int tb_acpi_power_on_retimers(struct tb_port *port);
int tb_acpi_power_off_retimers(struct tb_port *port); int tb_acpi_power_off_retimers(struct tb_port *port);
#else #else
static inline void tb_acpi_add_links(struct tb_nhi *nhi) { } static inline bool tb_acpi_add_links(struct tb_nhi *nhi) { return false; }
static inline bool tb_acpi_is_native(void) { return true; } static inline bool tb_acpi_is_native(void) { return true; }
static inline bool tb_acpi_may_tunnel_usb3(void) { return true; } static inline bool tb_acpi_may_tunnel_usb3(void) { return true; }

View File

@ -19,7 +19,7 @@ static const unsigned int tmu_rates[] = {
[TB_SWITCH_TMU_MODE_MEDRES_ENHANCED_UNI] = 16, [TB_SWITCH_TMU_MODE_MEDRES_ENHANCED_UNI] = 16,
}; };
const struct { static const struct {
unsigned int freq_meas_window; unsigned int freq_meas_window;
unsigned int avg_const; unsigned int avg_const;
unsigned int delta_avg_const; unsigned int delta_avg_const;