From: Raju Rangoju <Raju.Rangoju@amd.com>
To: <linux-usb@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <andreas.noever@gmail.com>, <michael.jamet@intel.com>,
<westeri@kernel.org>, <YehezkelShB@gmail.com>,
<bhelgaas@google.com>, <Sanath.S@amd.com>,
Raju Rangoju <Raju.Rangoju@amd.com>
Subject: [PATCH 1/3] thunderbolt: Dynamically populate vendor properties for XDomain
Date: Tue, 22 Jul 2025 23:20:24 +0530 [thread overview]
Message-ID: <20250722175026.1994846-2-Raju.Rangoju@amd.com> (raw)
In-Reply-To: <20250722175026.1994846-1-Raju.Rangoju@amd.com>
Currently, the XDomain driver hardcodes the vendor information
properties, but there are multiple vendors that need to be
supported. Remove the hardcoded properties and fill it
dynamically in the update_property_block.
Co-developed-by: Sanath S <Sanath.S@amd.com>
Signed-off-by: Sanath S <Sanath.S@amd.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
drivers/thunderbolt/xdomain.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
index b0630e6d9472..749faa7c487f 100644
--- a/drivers/thunderbolt/xdomain.c
+++ b/drivers/thunderbolt/xdomain.c
@@ -653,6 +653,8 @@ static void update_property_block(struct tb_xdomain *xd)
*/
if (!xd->local_property_block ||
xd->local_property_block_gen < xdomain_property_block_gen) {
+ struct tb_switch *sw = tb_xdomain_parent(xd);
+ struct pci_dev *pdev = sw->tb->nhi->pdev;
struct tb_property_dir *dir;
int ret, block_len;
u32 *block;
@@ -664,7 +666,21 @@ static void update_property_block(struct tb_xdomain *xd)
}
/* Fill in non-static properties now */
+ tb_property_add_immediate(dir, "vendorid", pdev->vendor);
+ switch (pdev->vendor) {
+ case PCI_VENDOR_ID_INTEL:
+ tb_property_add_text(dir, "vendorid", "Intel Corp.");
+ break;
+ case PCI_VENDOR_ID_AMD:
+ tb_property_add_text(dir, "vendorid", "AMD");
+ break;
+ default:
+ tb_property_add_text(dir, "vendorid", "Unknown Vendor");
+ break;
+ }
+ tb_property_add_immediate(dir, "deviceid", sw->config.device_id);
tb_property_add_text(dir, "deviceid", utsname()->nodename);
+ tb_property_add_immediate(dir, "devicerv", sw->config.revision);
tb_property_add_immediate(dir, "maxhopid", xd->local_max_hopid);
ret = tb_property_format_dir(dir, NULL, 0);
@@ -2555,18 +2571,9 @@ int tb_xdomain_init(void)
return -ENOMEM;
/*
- * Initialize standard set of properties without any service
- * directories. Those will be added by service drivers
- * themselves when they are loaded.
- *
- * Rest of the properties are filled dynamically based on these
- * when the P2P connection is made.
+ * All the properties are filled dynamically when the
+ * P2P connection is made.
*/
- tb_property_add_immediate(xdomain_property_dir, "vendorid",
- PCI_VENDOR_ID_INTEL);
- tb_property_add_text(xdomain_property_dir, "vendorid", "Intel Corp.");
- tb_property_add_immediate(xdomain_property_dir, "deviceid", 0x1);
- tb_property_add_immediate(xdomain_property_dir, "devicerv", 0x80000100);
xdomain_property_block_gen = get_random_u32();
return 0;
--
2.34.1
next prev parent reply other threads:[~2025-07-22 17:50 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 17:50 [PATCH 0/3] thunderbolt: Update XDomain vendor properties dynamically Raju Rangoju
2025-07-22 17:50 ` Raju Rangoju [this message]
2025-07-22 17:50 ` [PATCH 2/3] PCI: Add PCI vendor ID for ASMedia USB4 devices Raju Rangoju
2025-07-22 19:14 ` Bjorn Helgaas
2025-07-23 10:16 ` Rangoju, Raju
2025-07-22 17:50 ` [PATCH 3/3] thunderbolt: Add vendor ASMedia in update_property_block for XDomain Raju Rangoju
2025-07-28 6:47 ` [PATCH 0/3] thunderbolt: Update XDomain vendor properties dynamically Mika Westerberg
2025-08-06 6:16 ` Rangoju, Raju
2025-08-06 8:51 ` Mika Westerberg
2025-08-06 14:06 ` Mario Limonciello
2025-08-06 15:00 ` Mika Westerberg
2025-08-06 15:05 ` Mario Limonciello
2025-08-06 16:58 ` Greg KH
2025-08-07 5:15 ` Mika Westerberg
2025-08-07 16:02 ` Greg KH
2025-08-07 16:07 ` Mario Limonciello
2025-08-08 4:45 ` Mika Westerberg
2025-08-08 9:02 ` Greg KH
2025-08-08 9:13 ` Mika Westerberg
2025-08-08 15:13 ` Greg KH
2025-08-11 4:53 ` Mika Westerberg
2025-08-11 5:25 ` Mika Westerberg
2025-08-13 15:26 ` Greg KH
2025-08-11 5:28 ` Greg KH
2025-08-11 7:02 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250722175026.1994846-2-Raju.Rangoju@amd.com \
--to=raju.rangoju@amd.com \
--cc=Sanath.S@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=westeri@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®