* [PATCH v2] rtl_pci: add support for Realtek management device
@ 2026-03-03 6:18 javen
2026-03-03 6:55 ` Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: javen @ 2026-03-03 6:18 UTC (permalink / raw)
To: arnd, gregkh; +Cc: linux-kernel, Javen Xu
From: Javen Xu <javen_xu@realsil.com.cn>
This is not the standard ethernet driver. It specially handles the
management function.
I tried to submitted to linux/net-next before, but they said these class
didn't belong there. So I came here, and I'm wondering if these unknown
classes used for management functions should be submitted here.
Thanks,
Javen Xu
Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>
---
v2: Drop unused linux/version.h include as noticed by 0day bot.
---
drivers/misc/Kconfig | 12 +++++++
drivers/misc/Makefile | 1 +
drivers/misc/rtl_pci.c | 77 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 90 insertions(+)
create mode 100644 drivers/misc/rtl_pci.c
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 5cc79d1517af..e3c572bd1e34 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -643,6 +643,18 @@ config MCHP_LAN966X_PCI
- lan966x-miim (MDIO_MSCC_MIIM)
- lan966x-switch (LAN966X_SWITCH)
+config RTL_PCI
+ tristate "Realtek Management Interface Support"
+ depends on PCI
+ help
+ This enables support for the Realtek nic PCIe Management device.
+
+ Please note that this is NOT the standard Ethernet driver for network
+ traffic. It specifically handles the management function.
+
+ To compile this driver as a module, choose M here: the module
+ will be called rtl_pci.o.
+
source "drivers/misc/c2port/Kconfig"
source "drivers/misc/eeprom/Kconfig"
source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b32a2597d246..b937a25707c8 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -75,3 +75,4 @@ obj-$(CONFIG_MCHP_LAN966X_PCI) += lan966x-pci.o
obj-y += keba/
obj-y += amd-sbi/
obj-$(CONFIG_MISC_RP1) += rp1/
+obj-$(CONFIG_RTL_PCI) += rtl_pci.o
diff --git a/drivers/misc/rtl_pci.c b/drivers/misc/rtl_pci.c
new file mode 100644
index 000000000000..64db86ecc08d
--- /dev/null
+++ b/drivers/misc/rtl_pci.c
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * This module handles PCI endpoint functions exposed by Realtek
+ * management controllers (e.g. RTL8111x series). It manages device
+ * probing for virtual devices.
+ *
+ * Copyright(c) 2026 Realtek Semiconductor Corp.
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+
+#define PCI_DEVICE_ID_REALTEK_PTOU 0x8164
+#define PCI_DEVICE_ID_REALTEK_COM1 0x816a
+#define PCI_DEVICE_ID_REALTEK_COM2 0x816b
+#define PCI_DEVICE_ID_REALTEK_IPMI 0x816c
+#define PCI_DEVICE_ID_REALTEK_BMC 0x816e
+#define PCI_DEVICE_ID_REALTEK_PCIBR 0x9151
+
+static struct pci_device_id rtl_pci_tbl[] = {
+ { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PTOU), },
+ { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_COM1), },
+ { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_COM2), },
+ { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_IPMI), },
+ { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_BMC), },
+ { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PCIBR), .class_mask = 0xff00 },
+ { }
+};
+
+MODULE_DEVICE_TABLE(pci, rtl_pci_tbl);
+
+static int rtl_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ int rc;
+
+ /* enable device (incl. PCI PM wakeup and hotplug setup) */
+ rc = pcim_enable_device(pdev);
+ if (rc < 0)
+ return dev_err_probe(&pdev->dev, rc, "enable failure\n");
+
+ dev_info(&pdev->dev, "enable device\n");
+
+ return rc;
+}
+
+static void rtl_remove(struct pci_dev *pdev) {}
+
+static int rtl_pm_suspend(struct device *device)
+{
+ return 0;
+}
+
+static int rtl_pm_resume(struct device *device)
+{
+ return 0;
+}
+
+static const struct dev_pm_ops rtl_pm_ops = {
+ SYSTEM_SLEEP_PM_OPS(rtl_pm_suspend, rtl_pm_resume)
+};
+
+static struct pci_driver rtl_pci_driver = {
+ .name = "rtl_pci",
+ .id_table = rtl_pci_tbl,
+ .probe = rtl_probe,
+ .remove = rtl_remove,
+#ifdef CONFIG_PM
+ .driver.pm = pm_ptr(&rtl_pm_ops),
+#endif
+};
+
+module_pci_driver(rtl_pci_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("RealTek pci driver");
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rtl_pci: add support for Realtek management device
2026-03-03 6:18 [PATCH v2] rtl_pci: add support for Realtek management device javen
@ 2026-03-03 6:55 ` Arnd Bergmann
2026-03-05 11:58 ` kernel test robot
2026-03-06 9:05 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-03-03 6:55 UTC (permalink / raw)
To: javen, Greg Kroah-Hartman; +Cc: linux-kernel
On Tue, Mar 3, 2026, at 07:18, javen wrote:
> From: Javen Xu <javen_xu@realsil.com.cn>
>
> This is not the standard ethernet driver. It specially handles the
> management function.
>
> I tried to submitted to linux/net-next before, but they said these class
> didn't belong there. So I came here, and I'm wondering if these unknown
> classes used for management functions should be submitted here.
It depends on what the driver ends up doing. The driver you posted
here does not appear to actually do anything, so it's hard to tell.
> +/*
> + * This module handles PCI endpoint functions exposed by Realtek
> + * management controllers (e.g. RTL8111x series). It manages device
> + * probing for virtual devices.
> + *
> + * Copyright(c) 2026 Realtek Semiconductor Corp.
> + */
RTL8111x seems to refer to Ethernet controllers.
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/init.h>
> +
> +#define PCI_DEVICE_ID_REALTEK_PTOU 0x8164
> +#define PCI_DEVICE_ID_REALTEK_COM1 0x816a
> +#define PCI_DEVICE_ID_REALTEK_COM2 0x816b
> +#define PCI_DEVICE_ID_REALTEK_IPMI 0x816c
> +#define PCI_DEVICE_ID_REALTEK_BMC 0x816e
> +#define PCI_DEVICE_ID_REALTEK_PCIBR 0x9151
The naming here suggests that these would be some type of
PC southbridge chip, not an ethernet controller, and that
they are likely devices that would each need an actual driver
to communicate with the device.
> +static int rtl_probe(struct pci_dev *pdev,
> + const struct pci_device_id *ent)
> +{
> + int rc;
> +
> + /* enable device (incl. PCI PM wakeup and hotplug setup) */
> + rc = pcim_enable_device(pdev);
> + if (rc < 0)
> + return dev_err_probe(&pdev->dev, rc, "enable failure\n");
> +
> + dev_info(&pdev->dev, "enable device\n");
> +
> + return rc;
> +}
> +
> +static void rtl_remove(struct pci_dev *pdev) {}
This seems to be the only part of the driver that does anything:
you enable the device, but then ignore it afterwards, which seems
pointless when reading the driver.
Please make sure that there is enough context here that a reader
can understand why this is done. Are you planning to add actual
functionality later, are you just working around some unusual
requirements of the hardware, or are you trying to prevent
the devices from being bound to another driver?
> +static int rtl_pm_suspend(struct device *device)
> +{
> + return 0;
> +}
> +
> +static int rtl_pm_resume(struct device *device)
> +{
> + return 0;
> +}
> +
> +static const struct dev_pm_ops rtl_pm_ops = {
> + SYSTEM_SLEEP_PM_OPS(rtl_pm_suspend, rtl_pm_resume)
> +};
These also do nothing and can likely be left out.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rtl_pci: add support for Realtek management device
2026-03-03 6:18 [PATCH v2] rtl_pci: add support for Realtek management device javen
2026-03-03 6:55 ` Arnd Bergmann
@ 2026-03-05 11:58 ` kernel test robot
2026-03-06 9:05 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-05 11:58 UTC (permalink / raw)
To: javen, arnd, gregkh; +Cc: oe-kbuild-all, linux-kernel, Javen Xu
Hi javen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus soc/for-next linus/master v7.0-rc2 next-20260304]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/javen/rtl_pci-add-support-for-Realtek-management-device/20260303-142108
base: char-misc/char-misc-testing
patch link: https://lore.kernel.org/r/20260303061841.1431-1-javen_xu%40realsil.com.cn
patch subject: [PATCH v2] rtl_pci: add support for Realtek management device
config: csky-allmodconfig (https://download.01.org/0day-ci/archive/20260305/202603051934.PPZGZ5mA-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603051934.PPZGZ5mA-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603051934.PPZGZ5mA-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/misc/rtl_pci.c:27:76: warning: initialized field overwritten [-Woverride-init]
27 | { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PCIBR), .class_mask = 0xff00 },
| ^~~~~~
drivers/misc/rtl_pci.c:27:76: note: (near initialization for 'rtl_pci_tbl[5].class_mask')
>> drivers/misc/rtl_pci.c:60:32: warning: 'rtl_pm_ops' defined but not used [-Wunused-const-variable=]
60 | static const struct dev_pm_ops rtl_pm_ops = {
| ^~~~~~~~~~
vim +/rtl_pm_ops +60 drivers/misc/rtl_pci.c
59
> 60 static const struct dev_pm_ops rtl_pm_ops = {
61 SYSTEM_SLEEP_PM_OPS(rtl_pm_suspend, rtl_pm_resume)
62 };
63
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rtl_pci: add support for Realtek management device
2026-03-03 6:18 [PATCH v2] rtl_pci: add support for Realtek management device javen
2026-03-03 6:55 ` Arnd Bergmann
2026-03-05 11:58 ` kernel test robot
@ 2026-03-06 9:05 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-06 9:05 UTC (permalink / raw)
To: javen, arnd, gregkh; +Cc: llvm, oe-kbuild-all, linux-kernel, Javen Xu
Hi javen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus soc/for-next linus/master v7.0-rc2 next-20260304]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/javen/rtl_pci-add-support-for-Realtek-management-device/20260303-142108
base: char-misc/char-misc-testing
patch link: https://lore.kernel.org/r/20260303061841.1431-1-javen_xu%40realsil.com.cn
patch subject: [PATCH v2] rtl_pci: add support for Realtek management device
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260306/202603061745.9efKfvTe-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260306/202603061745.9efKfvTe-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603061745.9efKfvTe-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/misc/rtl_pci.c:27:69: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
27 | { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PCIBR), .class_mask = 0xff00 },
| ^~~~~~
drivers/misc/rtl_pci.c:27:4: note: previous initialization is here
27 | { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PCIBR), .class_mask = 0xff00 },
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/pci.h:1123:55: note: expanded from macro 'PCI_VDEVICE'
1123 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
| ^
>> drivers/misc/rtl_pci.c:60:32: warning: unused variable 'rtl_pm_ops' [-Wunused-const-variable]
60 | static const struct dev_pm_ops rtl_pm_ops = {
| ^~~~~~~~~~
2 warnings generated.
vim +/rtl_pm_ops +60 drivers/misc/rtl_pci.c
20
21 static struct pci_device_id rtl_pci_tbl[] = {
22 { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PTOU), },
23 { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_COM1), },
24 { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_COM2), },
25 { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_IPMI), },
26 { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_BMC), },
> 27 { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PCIBR), .class_mask = 0xff00 },
28 { }
29 };
30
31 MODULE_DEVICE_TABLE(pci, rtl_pci_tbl);
32
33 static int rtl_probe(struct pci_dev *pdev,
34 const struct pci_device_id *ent)
35 {
36 int rc;
37
38 /* enable device (incl. PCI PM wakeup and hotplug setup) */
39 rc = pcim_enable_device(pdev);
40 if (rc < 0)
41 return dev_err_probe(&pdev->dev, rc, "enable failure\n");
42
43 dev_info(&pdev->dev, "enable device\n");
44
45 return rc;
46 }
47
48 static void rtl_remove(struct pci_dev *pdev) {}
49
50 static int rtl_pm_suspend(struct device *device)
51 {
52 return 0;
53 }
54
55 static int rtl_pm_resume(struct device *device)
56 {
57 return 0;
58 }
59
> 60 static const struct dev_pm_ops rtl_pm_ops = {
61 SYSTEM_SLEEP_PM_OPS(rtl_pm_suspend, rtl_pm_resume)
62 };
63
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-06 9:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 6:18 [PATCH v2] rtl_pci: add support for Realtek management device javen
2026-03-03 6:55 ` Arnd Bergmann
2026-03-05 11:58 ` kernel test robot
2026-03-06 9:05 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox