Commit 46b494f2 authored by Mika Westerberg's avatar Mika Westerberg

thunderbolt: Add support for maxhopid XDomain property

USB4 inter-domain spec mandates that the compatible hosts expose a new
property "maxhopid" that tells the connection manager on the other side
what is the maximum supported input HopID over the connection. Since
this is depend on the lane adapter the cable is connected it needs to be
filled in dynamically.

For this reason we take a copy of the global properties and fill then
for each XDomain connection upon first connect, and then keep updating
it if the generation changes as services are being added/removed. We
also take advantage of this copy to fill in the hostname.

We also expose this maxhopid as an attribute under each XDomain device.

While there drop kernel-doc entry for property_lock which seems to be
left there when the structure was originally introduced.
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 7d3084c0
...@@ -134,6 +134,13 @@ Contact: thunderbolt-software@lists.01.org ...@@ -134,6 +134,13 @@ Contact: thunderbolt-software@lists.01.org
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.
What: /sys/bus/thunderbolt/devices/.../maxhopid
Date: Jul 2021
KernelVersion: 5.13
Contact: Mika Westerberg <mika.westerberg@linux.intel.com>
Description: Only set for XDomains. The maximum HopID the other host
supports as its input HopID.
What: /sys/bus/thunderbolt/devices/.../rx_speed What: /sys/bus/thunderbolt/devices/.../rx_speed
Date: Jan 2020 Date: Jan 2020
KernelVersion: 5.5 KernelVersion: 5.5
......
This diff is collapsed.
...@@ -180,6 +180,8 @@ void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir); ...@@ -180,6 +180,8 @@ void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir);
* @route: Route string the other domain can be reached * @route: Route string the other domain can be reached
* @vendor: Vendor ID of the remote domain * @vendor: Vendor ID of the remote domain
* @device: Device ID of the demote domain * @device: Device ID of the demote domain
* @local_max_hopid: Maximum input HopID of this host
* @remote_max_hopid: Maximum input HopID of the remote host
* @lock: Lock to serialize access to the following fields of this structure * @lock: Lock to serialize access to the following fields of this structure
* @vendor_name: Name of the vendor (or %NULL if not known) * @vendor_name: Name of the vendor (or %NULL if not known)
* @device_name: Name of the device (or %NULL if not known) * @device_name: Name of the device (or %NULL if not known)
...@@ -193,9 +195,11 @@ void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir); ...@@ -193,9 +195,11 @@ void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir);
* @receive_path: HopID which we expect the remote end to transmit * @receive_path: HopID which we expect the remote end to transmit
* @receive_ring: Local ring (hop) where incoming packets arrive * @receive_ring: Local ring (hop) where incoming packets arrive
* @service_ids: Used to generate IDs for the services * @service_ids: Used to generate IDs for the services
* @properties: Properties exported by the remote domain * @local_property_block: Local block of properties
* @property_block_gen: Generation of @properties * @local_property_block_gen: Generation of @local_property_block
* @properties_lock: Lock protecting @properties. * @local_property_block_len: Length of the @local_property_block in dwords
* @remote_properties: Properties exported by the remote domain
* @remote_property_block_gen: Generation of @remote_properties
* @get_uuid_work: Work used to retrieve @remote_uuid * @get_uuid_work: Work used to retrieve @remote_uuid
* @uuid_retries: Number of times left @remote_uuid is requested before * @uuid_retries: Number of times left @remote_uuid is requested before
* giving up * giving up
...@@ -225,6 +229,8 @@ struct tb_xdomain { ...@@ -225,6 +229,8 @@ struct tb_xdomain {
u64 route; u64 route;
u16 vendor; u16 vendor;
u16 device; u16 device;
unsigned int local_max_hopid;
unsigned int remote_max_hopid;
struct mutex lock; struct mutex lock;
const char *vendor_name; const char *vendor_name;
const char *device_name; const char *device_name;
...@@ -237,8 +243,11 @@ struct tb_xdomain { ...@@ -237,8 +243,11 @@ struct tb_xdomain {
u16 receive_path; u16 receive_path;
u16 receive_ring; u16 receive_ring;
struct ida service_ids; struct ida service_ids;
struct tb_property_dir *properties; u32 *local_property_block;
u32 property_block_gen; u32 local_property_block_gen;
u32 local_property_block_len;
struct tb_property_dir *remote_properties;
u32 remote_property_block_gen;
struct delayed_work get_uuid_work; struct delayed_work get_uuid_work;
int uuid_retries; int uuid_retries;
struct delayed_work get_properties_work; struct delayed_work get_properties_work;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment