Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH v3 0/4] PCI: tegra: Allow building as a module
@ 2025-05-02 19:00 Aaron Kling via B4 Relay
  2025-05-02 19:00 ` [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-02 19:00 UTC (permalink / raw)
  To: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Thierry Reding,
	Jonathan Hunter, Rafael J. Wysocki, Daniel Lezcano
  Cc: linux-kernel, linux-pci, linux-tegra, linux-pm, Aaron Kling

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
Changes in v3:
- Add patch to drop remove callback, per request
- Link to v2: https://lore.kernel.org/r/20250428-pci-tegra-module-v2-0-c11a4b912446@gmail.com

Changes in v2:
- Add patch to export tegra_cpuidle_pcie_irqs_in_use as required when
  building pci-tegra as a module for arm
- Drop module exit to prevent module unloading, as requested
- Link to v1: https://lore.kernel.org/r/20250420-pci-tegra-module-v1-0-c0a1f831354a@gmail.com

---
Aaron Kling (4):
      irqdomain: Export irq_domain_free_irqs
      cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use
      PCI: tegra: Allow building as a module
      PCI: tegra: Drop unused remove callback

 drivers/cpuidle/cpuidle-tegra.c    |  1 +
 drivers/pci/controller/Kconfig     |  2 +-
 drivers/pci/controller/pci-tegra.c | 24 ++++++------------------
 kernel/irq/irqdomain.c             |  1 +
 4 files changed, 9 insertions(+), 19 deletions(-)
---
base-commit: 18352e73612d60b81790d2437845276ae499b64a
change-id: 20250313-pci-tegra-module-7cbd1c5e70af

Best regards,
-- 
Aaron Kling <webgeek1234@gmail.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs
  2025-05-02 19:00 [PATCH v3 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
@ 2025-05-02 19:00 ` Aaron Kling via B4 Relay
  2025-05-05 13:14   ` Thomas Gleixner
  2025-05-02 19:00 ` [PATCH v3 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use Aaron Kling via B4 Relay
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-02 19:00 UTC (permalink / raw)
  To: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Thierry Reding,
	Jonathan Hunter, Rafael J. Wysocki, Daniel Lezcano
  Cc: linux-kernel, linux-pci, linux-tegra, linux-pm, Aaron Kling

From: Aaron Kling <webgeek1234@gmail.com>

Add export for irq_domain_free_irqs() so that we can allow drivers like
the pci-tegra driver to be loadable as a module.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
 kernel/irq/irqdomain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index ec6d8e72d980f604ded2bfa2143420e0e0095920..36cd79a8a2ce960b07b03c40067343ec8f632452 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1890,6 +1890,7 @@ void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs)
 	irq_domain_free_irq_data(virq, nr_irqs);
 	irq_free_descs(virq, nr_irqs);
 }
+EXPORT_SYMBOL_GPL(irq_domain_free_irqs);
 
 static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq)
 {

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use
  2025-05-02 19:00 [PATCH v3 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
  2025-05-02 19:00 ` [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
@ 2025-05-02 19:00 ` Aaron Kling via B4 Relay
  2025-05-02 19:00 ` [PATCH v3 3/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
  2025-05-02 19:00 ` [PATCH v3 4/4] PCI: tegra: Drop unused remove callback Aaron Kling via B4 Relay
  3 siblings, 0 replies; 7+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-02 19:00 UTC (permalink / raw)
  To: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Thierry Reding,
	Jonathan Hunter, Rafael J. Wysocki, Daniel Lezcano
  Cc: linux-kernel, linux-pci, linux-tegra, linux-pm, Aaron Kling

From: Aaron Kling <webgeek1234@gmail.com>

Add export for tegra_cpuidle_pcie_irqs_in_use() so that we can allow
drivers like the pci-tegra driver to be loadable as a module.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
 drivers/cpuidle/cpuidle-tegra.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
index b203a93deac5f378572be90e22c73e7417adb99e..aca907a62bb5de4ee4c71c1900eacedd4b90bc0a 100644
--- a/drivers/cpuidle/cpuidle-tegra.c
+++ b/drivers/cpuidle/cpuidle-tegra.c
@@ -336,6 +336,7 @@ void tegra_cpuidle_pcie_irqs_in_use(void)
 	pr_info("disabling CC6 state, since PCIe IRQs are in use\n");
 	tegra_cpuidle_disable_state(TEGRA_CC6);
 }
+EXPORT_SYMBOL_GPL(tegra_cpuidle_pcie_irqs_in_use);
 
 static void tegra_cpuidle_setup_tegra114_c7_state(void)
 {

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 3/4] PCI: tegra: Allow building as a module
  2025-05-02 19:00 [PATCH v3 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
  2025-05-02 19:00 ` [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
  2025-05-02 19:00 ` [PATCH v3 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use Aaron Kling via B4 Relay
@ 2025-05-02 19:00 ` Aaron Kling via B4 Relay
  2025-05-02 19:00 ` [PATCH v3 4/4] PCI: tegra: Drop unused remove callback Aaron Kling via B4 Relay
  3 siblings, 0 replies; 7+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-02 19:00 UTC (permalink / raw)
  To: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Thierry Reding,
	Jonathan Hunter, Rafael J. Wysocki, Daniel Lezcano
  Cc: linux-kernel, linux-pci, linux-tegra, linux-pm, Aaron Kling

From: Aaron Kling <webgeek1234@gmail.com>

This changes the module macro back to builtin, which does not define an
exit function. This will prevent the module from being unloaded. There
are concerns with modules not cleaning up IRQs on unload, thus this
needs specifically disallowed.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
 drivers/pci/controller/Kconfig     | 2 +-
 drivers/pci/controller/pci-tegra.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index 9800b768105402d6dd1ba4b134c2ec23da6e4201..a9164dd2eccaead5ae9348c24a5ad75fcb40f507 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -224,7 +224,7 @@ config PCI_HYPERV_INTERFACE
 	  driver.
 
 config PCI_TEGRA
-	bool "NVIDIA Tegra PCIe controller"
+	tristate "NVIDIA Tegra PCIe controller"
 	depends on ARCH_TEGRA || COMPILE_TEST
 	depends on PCI_MSI
 	help
diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index b3cdbc5927de3742161310610dc5dcb836f5dd69..1539d172d708c11c3d085721ab9416be3dea6b12 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -2802,4 +2802,7 @@ static struct platform_driver tegra_pcie_driver = {
 	.probe = tegra_pcie_probe,
 	.remove = tegra_pcie_remove,
 };
-module_platform_driver(tegra_pcie_driver);
+builtin_platform_driver(tegra_pcie_driver);
+MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
+MODULE_DESCRIPTION("NVIDIA PCI host controller driver");
+MODULE_LICENSE("GPL");

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 4/4] PCI: tegra: Drop unused remove callback
  2025-05-02 19:00 [PATCH v3 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
                   ` (2 preceding siblings ...)
  2025-05-02 19:00 ` [PATCH v3 3/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
@ 2025-05-02 19:00 ` Aaron Kling via B4 Relay
  3 siblings, 0 replies; 7+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-02 19:00 UTC (permalink / raw)
  To: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Thierry Reding,
	Jonathan Hunter, Rafael J. Wysocki, Daniel Lezcano
  Cc: linux-kernel, linux-pci, linux-tegra, linux-pm, Aaron Kling

From: Aaron Kling <webgeek1234@gmail.com>

Debugfs cleanup is moved to a new shutdown callback to ensure the
debugfs nodes are properly cleaned up on shutdown and reboot.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
 drivers/pci/controller/pci-tegra.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index 1539d172d708c11c3d085721ab9416be3dea6b12..cc9ca4305ea2072b7395ee1f1e979c24fdea3433 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -2674,27 +2674,12 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 	return err;
 }
 
-static void tegra_pcie_remove(struct platform_device *pdev)
+static void tegra_pcie_shutdown(struct platform_device *pdev)
 {
 	struct tegra_pcie *pcie = platform_get_drvdata(pdev);
-	struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
-	struct tegra_pcie_port *port, *tmp;
 
 	if (IS_ENABLED(CONFIG_DEBUG_FS))
 		tegra_pcie_debugfs_exit(pcie);
-
-	pci_stop_root_bus(host->bus);
-	pci_remove_root_bus(host->bus);
-	pm_runtime_put_sync(pcie->dev);
-	pm_runtime_disable(pcie->dev);
-
-	if (IS_ENABLED(CONFIG_PCI_MSI))
-		tegra_pcie_msi_teardown(pcie);
-
-	tegra_pcie_put_resources(pcie);
-
-	list_for_each_entry_safe(port, tmp, &pcie->ports, list)
-		tegra_pcie_port_free(port);
 }
 
 static int tegra_pcie_pm_suspend(struct device *dev)
@@ -2800,7 +2785,7 @@ static struct platform_driver tegra_pcie_driver = {
 		.pm = &tegra_pcie_pm_ops,
 	},
 	.probe = tegra_pcie_probe,
-	.remove = tegra_pcie_remove,
+	.shutdown = tegra_pcie_shutdown,
 };
 builtin_platform_driver(tegra_pcie_driver);
 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs
  2025-05-02 19:00 ` [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
@ 2025-05-05 13:14   ` Thomas Gleixner
  2025-05-05 14:49     ` Aaron Kling
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2025-05-05 13:14 UTC (permalink / raw)
  To: Aaron Kling via B4 Relay, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Thierry Reding, Jonathan Hunter, Rafael J. Wysocki,
	Daniel Lezcano
  Cc: linux-kernel, linux-pci, linux-tegra, linux-pm, Aaron Kling

On Fri, May 02 2025 at 14:00, Aaron Kling via wrote:

> From: Aaron Kling <webgeek1234@gmail.com>
>
> Add export for irq_domain_free_irqs() so that we can allow drivers like
> the pci-tegra driver to be loadable as a module.
>
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>

  https://lore.kernel.org/all/877c33qxss.ffs@tglx

Is it that hard to address review comments?

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs
  2025-05-05 13:14   ` Thomas Gleixner
@ 2025-05-05 14:49     ` Aaron Kling
  0 siblings, 0 replies; 7+ messages in thread
From: Aaron Kling @ 2025-05-05 14:49 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Aaron Kling via B4 Relay, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Thierry Reding, Jonathan Hunter, Rafael J. Wysocki,
	Daniel Lezcano, linux-kernel, linux-pci, linux-tegra, linux-pm

On Mon, May 5, 2025 at 8:14 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> On Fri, May 02 2025 at 14:00, Aaron Kling via wrote:
>
> > From: Aaron Kling <webgeek1234@gmail.com>
> >
> > Add export for irq_domain_free_irqs() so that we can allow drivers like
> > the pci-tegra driver to be loadable as a module.
> >
> > Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
>
>   https://lore.kernel.org/all/877c33qxss.ffs@tglx
>
> Is it that hard to address review comments?

Sorry, this review comment completely slipped my mind when I went to
work on the others for this series. Will fix.

Sincerely,
Aaron Kling

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-05-05 14:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 19:00 [PATCH v3 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
2025-05-02 19:00 ` [PATCH v3 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
2025-05-05 13:14   ` Thomas Gleixner
2025-05-05 14:49     ` Aaron Kling
2025-05-02 19:00 ` [PATCH v3 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use Aaron Kling via B4 Relay
2025-05-02 19:00 ` [PATCH v3 3/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
2025-05-02 19:00 ` [PATCH v3 4/4] PCI: tegra: Drop unused remove callback Aaron Kling via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox