All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chunfeng Yun" <chunfeng.yun@mediatek.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v4 09/14] thunderbolt: Make PCIe NHI support opt-in
Date: Sat, 05 Dec 2026 08:58:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-251330@kernel.org> (raw)
In-Reply-To: <20261205083342.4009278-10-chunfeng.yun@mediatek.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] thunderbolt: moving PCI IDs to thunderbolt_pci breaks blacklist
  and initramfs
- [Medium] thunderbolt: moving icm.o to thunderbolt_pci renames
  start_icm parameter
- [Low] thunderbolt: missing linux/export.h in four files adding
  EXPORT_SYMBOL_GPL()
--

commit e026bb092855a37bc1fed58283abd5123fa15e50
Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

thunderbolt: Make PCIe NHI support opt-in

This commit decouples the PCIe NHI and ICM drivers from the Thunderbolt/USB4
core module into a separate thunderbolt_pci module under CONFIG_USB4_PCI,
and exports the core symbols needed by separate host controller drivers.

> diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile
> index beb054c3126b1..a563bf2b03455 100644
> --- a/drivers/thunderbolt/Makefile
> +++ b/drivers/thunderbolt/Makefile
> @@ -1,10 +1,13 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  ccflags-y := -I$(src)
>  obj-${CONFIG_USB4} := thunderbolt.o
> -thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o pci.o path.o tunnel.o eeprom.o
> -thunderbolt-objs += domain.o dma_port.o icm.o property.o xdomain.o lc.o tmu.o usb4.o
> +thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel.o eeprom.o
> +thunderbolt-objs += domain.o dma_port.o property.o xdomain.o lc.o tmu.o usb4.o
>  thunderbolt-objs += usb4_port.o nvm.o retimer.o quirks.o clx.o
>  
> +obj-${CONFIG_USB4_PCI} += thunderbolt_pci.o
> +thunderbolt_pci-y := pci.o icm.o
> +
>  thunderbolt-${CONFIG_ACPI} += acpi.o
>  thunderbolt-$(CONFIG_DEBUG_FS) += debugfs.o
>  thunderbolt-$(CONFIG_USB4_CONFIGFS) += configfs.o

[Severity: Medium]
Does moving icm.o into thunderbolt_pci rename the existing start_icm module
parameter?

icm.c defines module_param(start_icm, bool, 0444), previously exposed as
thunderbolt.start_icm.  With the new module name, thunderbolt.start_icm=1
on the kernel command line is silently ignored, and "options thunderbolt
start_icm=1" in /etc/modprobe.d/ causes modprobe thunderbolt to fail.

> diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
> index 965988b18608f..96717a0a94b13 100644
> --- a/drivers/thunderbolt/ctl.c
> +++ b/drivers/thunderbolt/ctl.c
> @@ -9,7 +9,6 @@
>  #include <linux/crc32.h>
>  #include <linux/delay.h>
>  #include <linux/slab.h>
> -#include <linux/pci.h>
>  #include <linux/dmapool.h>
>  #include <linux/workqueue.h>
>  
> @@ -96,6 +95,7 @@ struct tb_cfg_request *tb_cfg_request_alloc(void)
>  
>  	return req;
>  }
> +EXPORT_SYMBOL_GPL(tb_cfg_request_alloc);

[Severity: Low]
Should this file include <linux/export.h> for EXPORT_SYMBOL_GPL()?

ctl.c, domain.c, switch.c, and tunnel.c all newly add EXPORT_SYMBOL_GPL()
without directly including <linux/export.h>, which triggers W=2 build
warnings from scripts/misc-check.

[ ... ]

> diff --git a/drivers/thunderbolt/pci.c b/drivers/thunderbolt/pci.c
> index a7c92083f820b..850c301bc87cb 100644
> --- a/drivers/thunderbolt/pci.c
> +++ b/drivers/thunderbolt/pci.c
> @@ -690,7 +690,7 @@ static struct pci_device_id nhi_ids[] = {
>  };
>  
>  MODULE_DEVICE_TABLE(pci, nhi_ids);
> -MODULE_DESCRIPTION("Thunderbolt/USB4 core driver");
> +MODULE_DESCRIPTION("PCIe-attached Thunderbolt/USB4 host interface driver");
>  MODULE_LICENSE("GPL");

[Severity: High]
Does moving MODULE_DEVICE_TABLE(pci, nhi_ids) to thunderbolt_pci break
existing module blacklists and initramfs configurations?

kmod blacklist rules only suppress modalias matching for the named module,
not loading it as a symbol dependency.  On systems with "blacklist
thunderbolt" in /etc/modprobe.d/ (for DMA attack mitigation), udev will now
match PCIe NHI devices against thunderbolt_pci and load both modules anyway.

In addition, initramfs setups or scripts that explicitly include or modprobe
thunderbolt will no longer pull in thunderbolt_pci, leaving PCIe controllers
unbound.  Keeping the PCIe driver named thunderbolt and naming the extracted
core module thunderbolt_core would preserve existing configurations.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205083342.4009278-1-chunfeng.yun@mediatek.com?part=9

  reply	other threads:[~2026-12-05  8:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  8:33 [PATCH v4 00/14] thunderbolt: Add platform NHI driver and modularize PCIe NHI Chunfeng Yun
2026-12-05  8:33 ` [PATCH v4 01/14] thunderbolt: Fix error handling and unwind paths in nhi_probe() Chunfeng Yun
2026-12-05  8:50   ` sashiko-bot
2026-12-05  8:33 ` [PATCH v4 02/14] thunderbolt: Prefix NHI core symbols with tb_ and tb_ring_ Chunfeng Yun
2026-12-05  8:33 ` [PATCH v4 03/14] thunderbolt: Internalize non-MSI-X interrupt request and work in NHI core Chunfeng Yun
2026-12-05  8:51   ` sashiko-bot
2026-12-05  8:33 ` [PATCH v4 04/14] thunderbolt: Encapsulate router device type checks in switch.c Chunfeng Yun
2026-12-05  8:41   ` sashiko-bot
2026-12-05  8:33 ` [PATCH v4 05/14] thunderbolt: Move rpm_complete bus walk to domain.c Chunfeng Yun
2026-12-05  8:50   ` sashiko-bot
2026-12-05  8:33 ` [PATCH v4 06/14] thunderbolt: Consolidate domain and NHI teardown into tb_nhi_remove() Chunfeng Yun
2026-12-05  8:50   ` sashiko-bot
2026-12-05  8:33 ` [PATCH v4 07/14] thunderbolt: Move ICM mailbox functions to icm.c Chunfeng Yun
2026-12-05  8:33 ` [PATCH v4 08/14] thunderbolt: Decouple ICM probe from NHI core via .select_cm hook Chunfeng Yun
2026-12-05  8:33 ` [PATCH v4 09/14] thunderbolt: Make PCIe NHI support opt-in Chunfeng Yun
2026-12-05  8:58   ` sashiko-bot [this message]
2026-12-05  8:33 ` [PATCH v4 10/14] thunderbolt: Make nhi->ops optional Chunfeng Yun
2026-12-05  8:33 ` [PATCH v4 11/14] thunderbolt: Add platform NHI driver Chunfeng Yun
2026-12-05  8:56   ` sashiko-bot
2026-12-05  8:33 ` [PATCH v4 12/14] thunderbolt: Increase the lane adapter link-up timeout value Chunfeng Yun
2026-12-05  8:33 ` [PATCH v4 13/14] thunderbolt: Decouple the waiting time of TB_PORT_UNPLUGGED and TB_PORT_UP Chunfeng Yun
2026-12-05  8:56   ` sashiko-bot
2026-12-05  8:33 ` [PATCH v4 14/14] thunderbolt: Drop WARN_ON() in tb_disconnect_pci() Chunfeng Yun
2026-12-05  8:55   ` sashiko-bot
2026-12-05  8:58 ` [PATCH v4 00/14] thunderbolt: Add platform NHI driver and modularize PCIe NHI sashiko-bot

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=sashiko-outbox-251330@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chunfeng.yun@mediatek.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.