* [PATCH v2 0/3] PCI: ultrarisc: Add DP1000 PCIe clock support
@ 2026-07-06 9:58 Jia Wang via B4 Relay
2026-07-06 9:58 ` [PATCH v2 1/3] dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks Jia Wang via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jia Wang via B4 Relay @ 2026-07-06 9:58 UTC (permalink / raw)
To: Xincheng Zhang, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-pci, devicetree, linux-kernel, Jia Wang,
Krzysztof Kozlowski, Conor Dooley
Add clock handling for the UltraRISC DP1000 DesignWare PCIe host
controller.
The DP1000 PCIe controller depends on three input clocks: core, dbi, and
aux. The driver accesses DBI registers during host initialization, so the
clocks must be enabled before the controller registers are touched.
This series documents the required clocks in the device tree binding,
enables the core, dbi, and aux clocks before DesignWare host
initialization, and keeps them managed across probe failure, detach, and
system suspend/resume. It also switches the driver to
module_platform_driver() so the existing tristate Kconfig option builds
correctly as a module.
Testing:
- Build and module build tested with ARCH=riscv.
- Boot tested on UltraRISC DP1000.
- Validated the PCIe binding with dt_binding_check and dtbs_check.
Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
---
Changes in v2:
- Add Fixes and Acked-by tags to the binding patch.
- Add a Fixes tag to the driver clock handling patch.
- Fix the suspend/resume clock handling so clocks are disabled only after a
successful suspend and kept enabled on resume failure.
- Add a module build fix by switching to module_platform_driver().
- Link to v1: https://patch.msgid.link/20260629-ultrarisc-pci-clk-v1-0-5ea3308fdab3@ultrarisc.com
To: Xincheng Zhang <zhangxincheng@ultrarisc.com>
To: Jia Wang <wangjia@ultrarisc.com>
To: Lorenzo Pieralisi <lpieralisi@kernel.org>
To: Krzysztof Wilczyński <kwilczynski@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Cc: linux-pci@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Jia Wang (3):
dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks
PCI: ultrarisc: get and enable DP1000 PCIe clocks
PCI: ultrarisc: allow DP1000 driver to build as module
.../bindings/pci/ultrarisc,dp1000-pcie.yaml | 16 +++++
drivers/pci/controller/dwc/pcie-ultrarisc.c | 70 +++++++++++++++++++---
2 files changed, 79 insertions(+), 7 deletions(-)
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260617-ultrarisc-pci-clk-ac19047af1ea
Best regards,
--
Jia Wang <wangjia@ultrarisc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/3] dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks
2026-07-06 9:58 [PATCH v2 0/3] PCI: ultrarisc: Add DP1000 PCIe clock support Jia Wang via B4 Relay
@ 2026-07-06 9:58 ` Jia Wang via B4 Relay
2026-07-06 10:05 ` sashiko-bot
2026-07-06 9:58 ` [PATCH v2 2/3] PCI: ultrarisc: get and enable " Jia Wang via B4 Relay
2026-07-06 9:58 ` [PATCH v2 3/3] PCI: ultrarisc: allow DP1000 driver to build as module Jia Wang via B4 Relay
2 siblings, 1 reply; 8+ messages in thread
From: Jia Wang via B4 Relay @ 2026-07-06 9:58 UTC (permalink / raw)
To: Xincheng Zhang, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-pci, devicetree, linux-kernel, Jia Wang,
Krzysztof Kozlowski, Conor Dooley
From: Jia Wang <wangjia@ultrarisc.com>
Require the DP1000 PCIe controller nodes to provide clocks and
clock-names, using the standard DesignWare clock names "core",
"dbi", and "aux".
Fixes: d9ff07f45955 ("dt-bindings: PCI: Add UltraRISC DP1000 PCIe controller")
Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
.../devicetree/bindings/pci/ultrarisc,dp1000-pcie.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/ultrarisc,dp1000-pcie.yaml b/Documentation/devicetree/bindings/pci/ultrarisc,dp1000-pcie.yaml
index 512b935bf5d1..d9d1488e915a 100644
--- a/Documentation/devicetree/bindings/pci/ultrarisc,dp1000-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/ultrarisc,dp1000-pcie.yaml
@@ -43,6 +43,18 @@ properties:
- description: Legacy INTC interrupt
- description: Legacy INTD interrupt
+ clocks:
+ items:
+ - description: PCIe core clock
+ - description: Data Bus Interface (DBI) clock
+ - description: Auxiliary clock
+
+ clock-names:
+ items:
+ - const: core
+ - const: dbi
+ - const: aux
+
interrupt-names:
items:
- const: msi
@@ -55,6 +67,8 @@ required:
- compatible
- reg
- reg-names
+ - clocks
+ - clock-names
- interrupts
- interrupt-names
@@ -71,6 +85,8 @@ examples:
reg = <0x0 0x21000000 0x0 0x01000000>,
<0x0 0x4fff0000 0x0 0x00010000>;
reg-names = "dbi", "config";
+ clocks = <&clkc 9>, <&clkc 7>, <&clkc 10>;
+ clock-names = "core", "dbi", "aux";
ranges = <0x81000000 0x0 0x4fbf0000 0x0 0x4fbf0000 0x0 0x00400000>,
<0x82000000 0x0 0x40000000 0x0 0x40000000 0x0 0x0fbf0000>,
<0xc3000000 0x40 0x00000000 0x40 0x00000000 0xd 0x00000000>;
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] PCI: ultrarisc: get and enable DP1000 PCIe clocks
2026-07-06 9:58 [PATCH v2 0/3] PCI: ultrarisc: Add DP1000 PCIe clock support Jia Wang via B4 Relay
2026-07-06 9:58 ` [PATCH v2 1/3] dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks Jia Wang via B4 Relay
@ 2026-07-06 9:58 ` Jia Wang via B4 Relay
2026-07-06 10:11 ` sashiko-bot
2026-07-06 9:58 ` [PATCH v2 3/3] PCI: ultrarisc: allow DP1000 driver to build as module Jia Wang via B4 Relay
2 siblings, 1 reply; 8+ messages in thread
From: Jia Wang via B4 Relay @ 2026-07-06 9:58 UTC (permalink / raw)
To: Xincheng Zhang, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-pci, devicetree, linux-kernel, Jia Wang,
Krzysztof Kozlowski
From: Jia Wang <wangjia@ultrarisc.com>
Add the required core, dbi, and aux clocks for the DP1000 PCIe
controller and enable them before initializing the DesignWare host.
Also manage the clocks across system suspend and resume.
Fixes: 5fc35740c3b3 ("PCI: ultrarisc: Add UltraRISC DP1000 PCIe Root Complex driver")
Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
---
drivers/pci/controller/dwc/pcie-ultrarisc.c | 68 ++++++++++++++++++++++++++---
1 file changed, 62 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-ultrarisc.c b/drivers/pci/controller/dwc/pcie-ultrarisc.c
index 6ee661ceff67..6ed244770d53 100644
--- a/drivers/pci/controller/dwc/pcie-ultrarisc.c
+++ b/drivers/pci/controller/dwc/pcie-ultrarisc.c
@@ -5,6 +5,7 @@
* Copyright (C) 2026 UltraRISC Technology (Shanghai) Co., Ltd.
*/
+#include <linux/clk.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_device.h>
@@ -23,6 +24,11 @@
#define ULTRARISC_PCIE_COMP_TIMEOUT_65_210MS 0x6
+struct ultrarisc_pcie {
+ struct dw_pcie pci;
+ struct clk_bulk_data clks[3];
+};
+
static struct pci_ops ultrarisc_pci_ops = {
.map_bus = dw_pcie_own_conf_map_bus,
.read = pci_generic_config_read32,
@@ -98,17 +104,46 @@ static const struct dw_pcie_ops dw_pcie_ops = {
.start_link = ultrarisc_pcie_start_link,
};
+static void ultrarisc_pcie_disable_clks(void *data)
+{
+ struct ultrarisc_pcie *ultra = data;
+
+ clk_bulk_disable_unprepare(ARRAY_SIZE(ultra->clks), ultra->clks);
+}
+
+static int ultrarisc_pcie_init_clks(struct ultrarisc_pcie *ultra)
+{
+ struct device *dev = ultra->pci.dev;
+ int ret;
+
+ ultra->clks[0].id = "core";
+ ultra->clks[1].id = "dbi";
+ ultra->clks[2].id = "aux";
+
+ ret = devm_clk_bulk_get(dev, ARRAY_SIZE(ultra->clks), ultra->clks);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get clocks\n");
+
+ ret = clk_bulk_prepare_enable(ARRAY_SIZE(ultra->clks), ultra->clks);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to enable clocks\n");
+
+ return devm_add_action_or_reset(dev, ultrarisc_pcie_disable_clks, ultra);
+}
+
static int ultrarisc_pcie_probe(struct platform_device *pdev)
{
+ struct ultrarisc_pcie *ultra;
struct device *dev = &pdev->dev;
struct dw_pcie_rp *pp;
struct dw_pcie *pci;
int ret;
- pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
- if (!pci)
+ ultra = devm_kzalloc(dev, sizeof(*ultra), GFP_KERNEL);
+ if (!ultra)
return -ENOMEM;
+ pci = &ultra->pci;
pci->dev = dev;
pci->ops = &dw_pcie_ops;
@@ -117,7 +152,11 @@ static int ultrarisc_pcie_probe(struct platform_device *pdev)
pp = &pci->pp;
- platform_set_drvdata(pdev, pci);
+ platform_set_drvdata(pdev, ultra);
+
+ ret = ultrarisc_pcie_init_clks(ultra);
+ if (ret)
+ return ret;
pp->num_vectors = MAX_MSI_IRQS;
/* No L2/L3 Ready indication is available on this platform */
@@ -135,14 +174,31 @@ static int ultrarisc_pcie_probe(struct platform_device *pdev)
static int ultrarisc_pcie_suspend_noirq(struct device *dev)
{
- struct dw_pcie *pci = dev_get_drvdata(dev);
+ struct ultrarisc_pcie *ultra = dev_get_drvdata(dev);
+ struct dw_pcie *pci = &ultra->pci;
+ int ret;
+
+ ret = dw_pcie_suspend_noirq(pci);
+ if (ret)
+ return ret;
+
+ if (pci->suspended)
+ clk_bulk_disable_unprepare(ARRAY_SIZE(ultra->clks), ultra->clks);
- return dw_pcie_suspend_noirq(pci);
+ return 0;
}
static int ultrarisc_pcie_resume_noirq(struct device *dev)
{
- struct dw_pcie *pci = dev_get_drvdata(dev);
+ struct ultrarisc_pcie *ultra = dev_get_drvdata(dev);
+ struct dw_pcie *pci = &ultra->pci;
+ int ret;
+
+ if (pci->suspended) {
+ ret = clk_bulk_prepare_enable(ARRAY_SIZE(ultra->clks), ultra->clks);
+ if (ret)
+ return ret;
+ }
return dw_pcie_resume_noirq(pci);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] PCI: ultrarisc: allow DP1000 driver to build as module
2026-07-06 9:58 [PATCH v2 0/3] PCI: ultrarisc: Add DP1000 PCIe clock support Jia Wang via B4 Relay
2026-07-06 9:58 ` [PATCH v2 1/3] dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks Jia Wang via B4 Relay
2026-07-06 9:58 ` [PATCH v2 2/3] PCI: ultrarisc: get and enable " Jia Wang via B4 Relay
@ 2026-07-06 9:58 ` Jia Wang via B4 Relay
2026-07-06 10:07 ` sashiko-bot
2 siblings, 1 reply; 8+ messages in thread
From: Jia Wang via B4 Relay @ 2026-07-06 9:58 UTC (permalink / raw)
To: Xincheng Zhang, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-pci, devicetree, linux-kernel, Jia Wang,
Krzysztof Kozlowski
From: Jia Wang <wangjia@ultrarisc.com>
CONFIG_PCIE_ULTRARISC is a tristate option, so the driver can be selected
as a module when COMPILE_TEST or platform configuration allows it. Using
builtin_platform_driver() leaves the module build without the module
init/exit plumbing and causes modpost failures for the generated .ko.
Use module_platform_driver() so the driver works for both module and
built-in builds while keeping the existing tristate Kconfig entry.
Fixes: 5fc35740c3b3 ("PCI: ultrarisc: Add UltraRISC DP1000 PCIe Root Complex driver")
Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
---
drivers/pci/controller/dwc/pcie-ultrarisc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-ultrarisc.c b/drivers/pci/controller/dwc/pcie-ultrarisc.c
index 6ed244770d53..5d226e529b77 100644
--- a/drivers/pci/controller/dwc/pcie-ultrarisc.c
+++ b/drivers/pci/controller/dwc/pcie-ultrarisc.c
@@ -225,7 +225,7 @@ static struct platform_driver ultrarisc_pcie_driver = {
},
.probe = ultrarisc_pcie_probe,
};
-builtin_platform_driver(ultrarisc_pcie_driver);
+module_platform_driver(ultrarisc_pcie_driver);
MODULE_DESCRIPTION("UltraRISC DP1000 DWC PCIe host controller");
MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks
2026-07-06 9:58 ` [PATCH v2 1/3] dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks Jia Wang via B4 Relay
@ 2026-07-06 10:05 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-07-06 10:05 UTC (permalink / raw)
To: Jia Wang; +Cc: conor+dt, linux-pci, robh, devicetree
> From: Jia Wang <wangjia@ultrarisc.com>
>
> Require the DP1000 PCIe controller nodes to provide clocks and
> clock-names, using the standard DesignWare clock names "core",
> "dbi", and "aux".
>
> Fixes: d9ff07f45955 ("dt-bindings: PCI: Add UltraRISC DP1000 PCIe controller")
> Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706-ultrarisc-pci-clk-v2-0-2f3fb6fba66b@ultrarisc.com?part=1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] PCI: ultrarisc: allow DP1000 driver to build as module
2026-07-06 9:58 ` [PATCH v2 3/3] PCI: ultrarisc: allow DP1000 driver to build as module Jia Wang via B4 Relay
@ 2026-07-06 10:07 ` sashiko-bot
2026-07-07 2:48 ` Jia Wang
0 siblings, 1 reply; 8+ messages in thread
From: sashiko-bot @ 2026-07-06 10:07 UTC (permalink / raw)
To: Jia Wang; +Cc: linux-pci, conor+dt, robh, devicetree
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing `.remove` callback leaves the PCI root bus registered, causing a use-after-free on module unload.
--
commit 14ef8e08324f6393567996c3e1dc0b2cadbcfc0a
Author: Jia Wang <wangjia@ultrarisc.com>
PCI: ultrarisc: allow DP1000 driver to build as module
This commit changes the driver registration from builtin_platform_driver()
to module_platform_driver(). This allows the driver to be built and
dynamically loaded or unloaded as a kernel module.
> diff --git a/drivers/pci/controller/dwc/pcie-ultrarisc.c b/drivers/pci/controller/dwc/pcie-ultrarisc.c
> --- a/drivers/pci/controller/dwc/pcie-ultrarisc.c
> +++ b/drivers/pci/controller/dwc/pcie-ultrarisc.c
> @@ -225,7 +225,7 @@ static struct platform_driver ultrarisc_pcie_driver = {
> },
> .probe = ultrarisc_pcie_probe,
> };
> -builtin_platform_driver(ultrarisc_pcie_driver);
> +module_platform_driver(ultrarisc_pcie_driver);
[Severity: High]
By switching to module_platform_driver(), this driver can now be unloaded
dynamically. However, since ultrarisc_pcie_driver lacks a .remove callback,
will unloading the module leave the active PCI root bus, IRQ domains, and
child devices registered?
If devres automatically frees the struct ultrarisc_pcie memory and unmaps
MMIO registers on module unload while the PCI subsystem still retains
pointers to them, could this result in a use-after-free and kernel panic
during subsequent PCI config space accesses?
>
> MODULE_DESCRIPTION("UltraRISC DP1000 DWC PCIe host controller");
> MODULE_LICENSE("GPL");
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706-ultrarisc-pci-clk-v2-0-2f3fb6fba66b@ultrarisc.com?part=3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/3] PCI: ultrarisc: get and enable DP1000 PCIe clocks
2026-07-06 9:58 ` [PATCH v2 2/3] PCI: ultrarisc: get and enable " Jia Wang via B4 Relay
@ 2026-07-06 10:11 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-07-06 10:11 UTC (permalink / raw)
To: Jia Wang; +Cc: linux-pci, conor+dt, devicetree, robh
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional register access in suspend after a prior resume failure causes kernel panic.
--
commit 91b0a79d0e5b5b1e0d3c9731fd011273f668f0a9
Author: Jia Wang <wangjia@ultrarisc.com>
PCI: ultrarisc: get and enable DP1000 PCIe clocks
Add the required core, dbi, and aux clocks for the DP1000 PCIe
controller and enable them before initializing the DesignWare host.
Also manage the clocks across system suspend and resume.
> diff --git a/drivers/pci/controller/dwc/pcie-ultrarisc.c b/drivers/pci/controller/dwc/pcie-ultrarisc.c
> index 6ee661ceff67a..6ed244770d538 100644
> --- a/drivers/pci/controller/dwc/pcie-ultrarisc.c
> +++ b/drivers/pci/controller/dwc/pcie-ultrarisc.c
[ ... ]
> @@ -135,14 +174,31 @@ static int ultrarisc_pcie_probe(struct platform_device *pdev)
>
> static int ultrarisc_pcie_suspend_noirq(struct device *dev)
> {
> - struct dw_pcie *pci = dev_get_drvdata(dev);
> + struct ultrarisc_pcie *ultra = dev_get_drvdata(dev);
> + struct dw_pcie *pci = &ultra->pci;
> + int ret;
> +
> + ret = dw_pcie_suspend_noirq(pci);
[Severity: High]
What happens here if a previous resume attempt failed to enable the clocks?
Looking at ultrarisc_pcie_resume_noirq() below, if clk_bulk_prepare_enable()
fails, the function returns an error while the clocks remain disabled and
pci->suspended remains true.
If the system then undergoes another suspend cycle, this function will call
dw_pcie_suspend_noirq(), which accesses hardware registers via
dw_pcie_link_up().
Since the clocks are disabled, could this register access cause a bus error
and subsequent kernel panic?
Should we check if the device is already suspended (or if the clocks are
already off) before calling dw_pcie_suspend_noirq()?
> + if (ret)
> + return ret;
> +
> + if (pci->suspended)
> + clk_bulk_disable_unprepare(ARRAY_SIZE(ultra->clks), ultra->clks);
>
> - return dw_pcie_suspend_noirq(pci);
> + return 0;
> }
>
> static int ultrarisc_pcie_resume_noirq(struct device *dev)
> {
> - struct dw_pcie *pci = dev_get_drvdata(dev);
> + struct ultrarisc_pcie *ultra = dev_get_drvdata(dev);
> + struct dw_pcie *pci = &ultra->pci;
> + int ret;
> +
> + if (pci->suspended) {
> + ret = clk_bulk_prepare_enable(ARRAY_SIZE(ultra->clks), ultra->clks);
> + if (ret)
> + return ret;
> + }
>
> return dw_pcie_resume_noirq(pci);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706-ultrarisc-pci-clk-v2-0-2f3fb6fba66b@ultrarisc.com?part=2
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] PCI: ultrarisc: allow DP1000 driver to build as module
2026-07-06 10:07 ` sashiko-bot
@ 2026-07-07 2:48 ` Jia Wang
0 siblings, 0 replies; 8+ messages in thread
From: Jia Wang @ 2026-07-07 2:48 UTC (permalink / raw)
To: sashiko-reviews; +Cc: Jia Wang, linux-pci, conor+dt, robh, devicetree
On 2026-07-06 10:07 +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Missing `.remove` callback leaves the PCI root bus registered, causing a use-after-free on module unload.
> --
>
> commit 14ef8e08324f6393567996c3e1dc0b2cadbcfc0a
> Author: Jia Wang <wangjia@ultrarisc.com>
>
> PCI: ultrarisc: allow DP1000 driver to build as module
>
> This commit changes the driver registration from builtin_platform_driver()
> to module_platform_driver(). This allows the driver to be built and
> dynamically loaded or unloaded as a kernel module.
>
> > diff --git a/drivers/pci/controller/dwc/pcie-ultrarisc.c b/drivers/pci/controller/dwc/pcie-ultrarisc.c
> > --- a/drivers/pci/controller/dwc/pcie-ultrarisc.c
> > +++ b/drivers/pci/controller/dwc/pcie-ultrarisc.c
> > @@ -225,7 +225,7 @@ static struct platform_driver ultrarisc_pcie_driver = {
> > },
> > .probe = ultrarisc_pcie_probe,
> > };
> > -builtin_platform_driver(ultrarisc_pcie_driver);
> > +module_platform_driver(ultrarisc_pcie_driver);
>
> [Severity: High]
> By switching to module_platform_driver(), this driver can now be unloaded
> dynamically. However, since ultrarisc_pcie_driver lacks a .remove callback,
> will unloading the module leave the active PCI root bus, IRQ domains, and
> child devices registered?
>
> If devres automatically frees the struct ultrarisc_pcie memory and unmaps
> MMIO registers on module unload while the PCI subsystem still retains
> pointers to them, could this result in a use-after-free and kernel panic
> during subsequent PCI config space accesses?
>
Thanks for pointing this out.
The driver does support `CONFIG_PCIE_ULTRARISC=m`, so it should provide a
proper teardown path for module unload. I'll add a `.remove()` callback in
the next version to clean up the PCI host resources accordingly.
> >
> > MODULE_DESCRIPTION("UltraRISC DP1000 DWC PCIe host controller");
> > MODULE_LICENSE("GPL");
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260706-ultrarisc-pci-clk-v2-0-2f3fb6fba66b@ultrarisc.com?part=3
>
Best regards,
Jia Wang
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-07-07 2:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 9:58 [PATCH v2 0/3] PCI: ultrarisc: Add DP1000 PCIe clock support Jia Wang via B4 Relay
2026-07-06 9:58 ` [PATCH v2 1/3] dt-bindings: pci: ultrarisc: add required DP1000 PCIe clocks Jia Wang via B4 Relay
2026-07-06 10:05 ` sashiko-bot
2026-07-06 9:58 ` [PATCH v2 2/3] PCI: ultrarisc: get and enable " Jia Wang via B4 Relay
2026-07-06 10:11 ` sashiko-bot
2026-07-06 9:58 ` [PATCH v2 3/3] PCI: ultrarisc: allow DP1000 driver to build as module Jia Wang via B4 Relay
2026-07-06 10:07 ` sashiko-bot
2026-07-07 2:48 ` Jia Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox