Skip to content

Commit b43ea9a

Browse files
committed
NVIDIA: SAUCE: MEDIATEK: pinctrl: mediatek: Add EINT Driver for CX7 hot plug on DGX Spark
This driver is used to manage PCIe link for NVIDIA ConnectX-7 (CX7) hot-plug/unplug on DGX Spark. We need to disable PCIe link when CX7 cable plug out happens and enable pcie link when CX7 cable plug in happens. This behavior is needed to conserve power when the CX7 cable is unplugged. Otherwise, the CX7 controllers would still consume power and negatively impact the board’s overall power consumption. This driver helps save power when the CX7 cable is absent. The driver detects cable hot‑plug or unplug events, enables or disables the corresponding links, emits udev events, and then the user space triggers removal and rescanning of the PCIe device. It also creates a sysfs entry to emulate cable plug in/out behavior as below: plug in - echo 1 > /sys/devices/platform/MTKP0001:00/cx7_dbg/plugin plug out - echo 0 > /sys/devices/platform/MTKP0001:00/cx7_dbg/plugin We also implement uevent to notify user-space applications when a cable is plugged in or removed. Below are the details of our process: * cable plug-in: Report plug-in uevent (driver) Power on CX7 Enable PCIe link (application) Rescan CX7 devices (application) * cable removal: Report removal uevent (driver) Remove CX7 devices (application) Disable PCIe link (application) Power off CX7 Testing performed includes: 1. Repeated CX7 plug/unplug cycles, verifying that the PCIe link transitions correctly. 2. Ensured no side effects or hangs. 3. Hence, regression risk is considered to be low. 4. It is also being tested by SW QA. Automated testing: We have included the dgx-spark-mlnx-hotplug package in the BaseOS, which provides a standalone userspace script that can be used for automated testing. To validate the driver without manual intervention, run the following: 1. Plug-in: /opt/nvidia/dgx-spark-mlnx-hotplug/mtk-hotplug-handler.sh plug-in 2. Unplug: /opt/nvidia/dgx-spark-mlnx-hotplug/mtk-hotplug-handler.sh removal 3. After each operation, run lspci and verify the results: * When plugged-in: The output should show “Ethernet controller: Mellanox Technologies MT2910 Family [ConnectX-7]” PCIe devices. * When plugged-out: There should be no PCIe device entry with “Ethernet controller: Mellanox Technologies MT2910 Family [ConnectX-7]”. We plan to upstream this driver during the merge window for the next Linux kernel release, expected to open in the January-February 2026 timeframe(anticipated to be kernel 6.20). Necessary support will be provided. Signed-off-by: Vaibhav Vyas <vavyas@nvidia.com> Signed-off-by: Jerry.Guo <jerry.guo@mediatek.com> Signed-off-by: Yenchia Chen <yenchia.chen@mediatek.com> Signed-off-by: Shubhi Garg <shgarg@nvidia.com> Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com> Signed-off-by: Surabhi Chythanya Kumar <schythanyaku@nvidia.com>
1 parent be01c90 commit b43ea9a

File tree

4 files changed

+970
-0
lines changed

4 files changed

+970
-0
lines changed

debian.nvidia-6.14/config/annotations

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ CONFIG_CC_HAS_SIGN_RETURN_ADDRESS policy<{'arm64': '-'}>
224224
CONFIG_CC_VERSION_TEXT policy<{'amd64': '"x86_64-linux-gnu-gcc-13 (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"', 'arm64': '"aarch64-linux-gnu-gcc-13 (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"'}>
225225
CONFIG_CGROUP_RESCTRL policy<{'amd64': '-', 'arm64': '-'}>
226226
CONFIG_CPUFREQ_ARCH_CUR_FREQ policy<{'amd64': 'y'}>
227+
CONFIG_EINT_MTK_HP policy<{'arm64': 'm'}>
227228
CONFIG_DRM_PANIC_SCREEN_QR_CODE policy<{'amd64': '-', 'arm64': '-'}>
228229
CONFIG_EC_HUAWEI_GAOKUN policy<{'arm64': 'n'}>
229230
CONFIG_FTRACE_SORT_STARTUP_TEST policy<{'amd64': 'n', 'arm64': 'n'}>

drivers/pinctrl/mediatek/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ config EINT_MTK
1010
default y if PINCTRL_MTK || PINCTRL_MTK_MOORE
1111
default PINCTRL_MTK_PARIS
1212

13+
config EINT_MTK_HP
14+
tristate "MediaTek HP Driver"
15+
depends on EINT_MTK
16+
help
17+
Say yes here to support NICs cable plug in/out test.
18+
It will disable pcie link when plug out and enable
19+
pcie link after plug in cable.
20+
This is particularly useful for MediaTek MT8901 SoC.
21+
1322
config PINCTRL_MTK
1423
bool
1524
depends on OF

drivers/pinctrl/mediatek/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
# Core
33
obj-$(CONFIG_EINT_MTK) += mtk-eint.o
4+
obj-$(CONFIG_EINT_MTK_HP) += mtk-eint-hotplug.o
45
obj-$(CONFIG_PINCTRL_MTK) += pinctrl-mtk-common.o
56
obj-$(CONFIG_PINCTRL_MTK_V2) += pinctrl-mtk-common-v2.o
67
obj-$(CONFIG_PINCTRL_MTK_MTMIPS) += pinctrl-mtmips.o

0 commit comments

Comments
 (0)