linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] PCI: tegra: Allow building as a module
@ 2025-05-05 14:58 Aaron Kling via B4 Relay
  2025-05-05 14:58 ` [PATCH v4 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-05 14:58 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 v4:
- Updated commit messages for patches 1 and 2, per review
- Link to v3: https://lore.kernel.org/r/20250502-pci-tegra-module-v3-0-556a49732d70@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] 12+ messages in thread

* [PATCH v4 1/4] irqdomain: Export irq_domain_free_irqs
  2025-05-05 14:58 [PATCH v4 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
@ 2025-05-05 14:58 ` Aaron Kling via B4 Relay
  2025-05-05 22:33   ` Thomas Gleixner
  2025-05-05 14:58 ` [PATCH v4 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use Aaron Kling via B4 Relay
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-05 14:58 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 drivers like pci-tegra can
be loaded as a module.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
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] 12+ messages in thread

* [PATCH v4 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use
  2025-05-05 14:58 [PATCH v4 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
  2025-05-05 14:58 ` [PATCH v4 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
@ 2025-05-05 14:58 ` Aaron Kling via B4 Relay
  2025-05-05 14:59 ` [PATCH v4 3/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
  2025-05-05 14:59 ` [PATCH v4 4/4] PCI: tegra: Drop unused remove callback Aaron Kling via B4 Relay
  3 siblings, 0 replies; 12+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-05 14:58 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 drivers like
pci-tegra can be loaded 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] 12+ messages in thread

* [PATCH v4 3/4] PCI: tegra: Allow building as a module
  2025-05-05 14:58 [PATCH v4 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
  2025-05-05 14:58 ` [PATCH v4 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
  2025-05-05 14:58 ` [PATCH v4 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use Aaron Kling via B4 Relay
@ 2025-05-05 14:59 ` Aaron Kling via B4 Relay
  2025-05-05 14:59 ` [PATCH v4 4/4] PCI: tegra: Drop unused remove callback Aaron Kling via B4 Relay
  3 siblings, 0 replies; 12+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-05 14:59 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] 12+ messages in thread

* [PATCH v4 4/4] PCI: tegra: Drop unused remove callback
  2025-05-05 14:58 [PATCH v4 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
                   ` (2 preceding siblings ...)
  2025-05-05 14:59 ` [PATCH v4 3/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
@ 2025-05-05 14:59 ` Aaron Kling via B4 Relay
  2025-05-05 16:31   ` Manivannan Sadhasivam
  3 siblings, 1 reply; 12+ messages in thread
From: Aaron Kling via B4 Relay @ 2025-05-05 14:59 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] 12+ messages in thread

* Re: [PATCH v4 4/4] PCI: tegra: Drop unused remove callback
  2025-05-05 14:59 ` [PATCH v4 4/4] PCI: tegra: Drop unused remove callback Aaron Kling via B4 Relay
@ 2025-05-05 16:31   ` Manivannan Sadhasivam
  2025-05-05 16:43     ` Aaron Kling
  0 siblings, 1 reply; 12+ messages in thread
From: Manivannan Sadhasivam @ 2025-05-05 16:31 UTC (permalink / raw)
  To: webgeek1234
  Cc: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Rob Herring, Bjorn Helgaas, Thierry Reding, Jonathan Hunter,
	Rafael J. Wysocki, Daniel Lezcano, linux-kernel, linux-pci,
	linux-tegra, linux-pm

On Mon, May 05, 2025 at 09:59:01AM -0500, Aaron Kling via B4 Relay wrote:
> 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.
> 

Both are separate changes. You should remove the .remove() callback in the
previous patch itself and add .shutdown() callback in this patch.

And the shutdown callback should quiesce the device by putting it in L2/L3 state
and turn off the supplies. It is not intended to perform resource cleanup.

- Mani

> 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	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 4/4] PCI: tegra: Drop unused remove callback
  2025-05-05 16:31   ` Manivannan Sadhasivam
@ 2025-05-05 16:43     ` Aaron Kling
  2025-05-05 16:48       ` Manivannan Sadhasivam
  0 siblings, 1 reply; 12+ messages in thread
From: Aaron Kling @ 2025-05-05 16:43 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	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 11:32 AM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>
> On Mon, May 05, 2025 at 09:59:01AM -0500, Aaron Kling via B4 Relay wrote:
> > 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.
> >
>
> Both are separate changes. You should remove the .remove() callback in the
> previous patch itself and add .shutdown() callback in this patch.
>
> And the shutdown callback should quiesce the device by putting it in L2/L3 state
> and turn off the supplies. It is not intended to perform resource cleanup.

Then where would resource cleanup go?

Sincerely,
Aaron Kling

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

* Re: [PATCH v4 4/4] PCI: tegra: Drop unused remove callback
  2025-05-05 16:43     ` Aaron Kling
@ 2025-05-05 16:48       ` Manivannan Sadhasivam
  2025-05-05 16:59         ` Aaron Kling
  0 siblings, 1 reply; 12+ messages in thread
From: Manivannan Sadhasivam @ 2025-05-05 16:48 UTC (permalink / raw)
  To: Aaron Kling
  Cc: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Rob Herring, Bjorn Helgaas, Thierry Reding, Jonathan Hunter,
	Rafael J. Wysocki, Daniel Lezcano, linux-kernel, linux-pci,
	linux-tegra, linux-pm

On Mon, May 05, 2025 at 11:43:26AM -0500, Aaron Kling wrote:
> On Mon, May 5, 2025 at 11:32 AM Manivannan Sadhasivam
> <manivannan.sadhasivam@linaro.org> wrote:
> >
> > On Mon, May 05, 2025 at 09:59:01AM -0500, Aaron Kling via B4 Relay wrote:
> > > 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.
> > >
> >
> > Both are separate changes. You should remove the .remove() callback in the
> > previous patch itself and add .shutdown() callback in this patch.
> >
> > And the shutdown callback should quiesce the device by putting it in L2/L3 state
> > and turn off the supplies. It is not intended to perform resource cleanup.
> 
> Then where would resource cleanup go?
> 

.remove(), but it is not useful here since the driver is not getting removed.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH v4 4/4] PCI: tegra: Drop unused remove callback
  2025-05-05 16:48       ` Manivannan Sadhasivam
@ 2025-05-05 16:59         ` Aaron Kling
  2025-05-10  6:24           ` Manivannan Sadhasivam
  0 siblings, 1 reply; 12+ messages in thread
From: Aaron Kling @ 2025-05-05 16:59 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	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 11:48 AM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>
> On Mon, May 05, 2025 at 11:43:26AM -0500, Aaron Kling wrote:
> > On Mon, May 5, 2025 at 11:32 AM Manivannan Sadhasivam
> > <manivannan.sadhasivam@linaro.org> wrote:
> > >
> > > On Mon, May 05, 2025 at 09:59:01AM -0500, Aaron Kling via B4 Relay wrote:
> > > > 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.
> > > >
> > >
> > > Both are separate changes. You should remove the .remove() callback in the
> > > previous patch itself and add .shutdown() callback in this patch.
> > >
> > > And the shutdown callback should quiesce the device by putting it in L2/L3 state
> > > and turn off the supplies. It is not intended to perform resource cleanup.
> >
> > Then where would resource cleanup go?
> >
>
> .remove(), but it is not useful here since the driver is not getting removed.

I may be misunderstanding how stuff works, but don't those resources
still need cleaned up on shutdown/reboot even if the driver can't be
unloaded? I recall seeing shutdown errors in the past when higher
level debugfs nodes tried to clean themselves up, but bad drivers had
left their nodes behind.

In any case, do you want me to just not add .shutdown() at all, or try
to set the proper power state? Prior to the half-baked attempt to make
this driver a loadable module several years ago, there was no such
cleanup.

Sincerely,
Aaron Kling

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

* Re: [PATCH v4 1/4] irqdomain: Export irq_domain_free_irqs
  2025-05-05 14:58 ` [PATCH v4 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
@ 2025-05-05 22:33   ` Thomas Gleixner
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Gleixner @ 2025-05-05 22:33 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 Mon, May 05 2025 at 09:58, Aaron Kling via wrote:
> From: Aaron Kling <webgeek1234@gmail.com>
>
> Add export for irq_domain_free_irqs() so that drivers like pci-tegra can
> be loaded as a module.
>
> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

Seriously?

Did you actually sit down for a couple of seconds to read and understand what I
asked you to do in that initial review and then again:

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

I appreciate your dedication to get this sorted, but please take your
time to read more than just the _two_ lines which you think to be
relevant.

Please don't come back and waste your breath on telling me you are so
sorry as last time:

    https://lore.kernel.org/all/CALHNRZ_ctL1fJGO5752B6XEEXHwRe-a-Ofv+_=qtdq1WWXLLjw@mail.gmail.com

Just get your act together and do it right.

Thanks,

        tglx

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

* Re: [PATCH v4 4/4] PCI: tegra: Drop unused remove callback
  2025-05-05 16:59         ` Aaron Kling
@ 2025-05-10  6:24           ` Manivannan Sadhasivam
  2025-05-11 14:53             ` Aaron Kling
  0 siblings, 1 reply; 12+ messages in thread
From: Manivannan Sadhasivam @ 2025-05-10  6:24 UTC (permalink / raw)
  To: Aaron Kling
  Cc: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Rob Herring, Bjorn Helgaas, Thierry Reding, Jonathan Hunter,
	Rafael J. Wysocki, Daniel Lezcano, linux-kernel, linux-pci,
	linux-tegra, linux-pm

On Mon, May 05, 2025 at 11:59:27AM -0500, Aaron Kling wrote:
> On Mon, May 5, 2025 at 11:48 AM Manivannan Sadhasivam
> <manivannan.sadhasivam@linaro.org> wrote:
> >
> > On Mon, May 05, 2025 at 11:43:26AM -0500, Aaron Kling wrote:
> > > On Mon, May 5, 2025 at 11:32 AM Manivannan Sadhasivam
> > > <manivannan.sadhasivam@linaro.org> wrote:
> > > >
> > > > On Mon, May 05, 2025 at 09:59:01AM -0500, Aaron Kling via B4 Relay wrote:
> > > > > 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.
> > > > >
> > > >
> > > > Both are separate changes. You should remove the .remove() callback in the
> > > > previous patch itself and add .shutdown() callback in this patch.
> > > >
> > > > And the shutdown callback should quiesce the device by putting it in L2/L3 state
> > > > and turn off the supplies. It is not intended to perform resource cleanup.
> > >
> > > Then where would resource cleanup go?
> > >
> >
> > .remove(), but it is not useful here since the driver is not getting removed.
> 
> I may be misunderstanding how stuff works, but don't those resources
> still need cleaned up on shutdown/reboot even if the driver can't be
> unloaded? I recall seeing shutdown errors in the past when higher
> level debugfs nodes tried to clean themselves up, but bad drivers had
> left their nodes behind.
> 

Each callback has its own purpose. The cleanup is only performed by the
.remove() callback, but it will only get called when the driver gets removed.

> In any case, do you want me to just not add .shutdown() at all, or try
> to set the proper power state? Prior to the half-baked attempt to make
> this driver a loadable module several years ago, there was no such
> cleanup.
> 

As a first step, you can ignore .shutdown() callback and just remove the
.remove(). Shutdown callback implementation should follow the steps I mentioned
above, so it can be done later.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH v4 4/4] PCI: tegra: Drop unused remove callback
  2025-05-10  6:24           ` Manivannan Sadhasivam
@ 2025-05-11 14:53             ` Aaron Kling
  0 siblings, 0 replies; 12+ messages in thread
From: Aaron Kling @ 2025-05-11 14:53 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Thomas Gleixner, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Rob Herring, Bjorn Helgaas, Thierry Reding, Jonathan Hunter,
	Rafael J. Wysocki, Daniel Lezcano, linux-kernel, linux-pci,
	linux-tegra, linux-pm

On Sat, May 10, 2025 at 1:24 AM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>
> On Mon, May 05, 2025 at 11:59:27AM -0500, Aaron Kling wrote:
> > On Mon, May 5, 2025 at 11:48 AM Manivannan Sadhasivam
> > <manivannan.sadhasivam@linaro.org> wrote:
> > >
> > > On Mon, May 05, 2025 at 11:43:26AM -0500, Aaron Kling wrote:
> > > > On Mon, May 5, 2025 at 11:32 AM Manivannan Sadhasivam
> > > > <manivannan.sadhasivam@linaro.org> wrote:
> > > > >
> > > > > On Mon, May 05, 2025 at 09:59:01AM -0500, Aaron Kling via B4 Relay wrote:
> > > > > > 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.
> > > > > >
> > > > >
> > > > > Both are separate changes. You should remove the .remove() callback in the
> > > > > previous patch itself and add .shutdown() callback in this patch.
> > > > >
> > > > > And the shutdown callback should quiesce the device by putting it in L2/L3 state
> > > > > and turn off the supplies. It is not intended to perform resource cleanup.
> > > >
> > > > Then where would resource cleanup go?
> > > >
> > >
> > > .remove(), but it is not useful here since the driver is not getting removed.
> >
> > I may be misunderstanding how stuff works, but don't those resources
> > still need cleaned up on shutdown/reboot even if the driver can't be
> > unloaded? I recall seeing shutdown errors in the past when higher
> > level debugfs nodes tried to clean themselves up, but bad drivers had
> > left their nodes behind.
> >
>
> Each callback has its own purpose. The cleanup is only performed by the
> .remove() callback, but it will only get called when the driver gets removed.
>
> > In any case, do you want me to just not add .shutdown() at all, or try
> > to set the proper power state? Prior to the half-baked attempt to make
> > this driver a loadable module several years ago, there was no such
> > cleanup.
> >
>
> As a first step, you can ignore .shutdown() callback and just remove the
> .remove(). Shutdown callback implementation should follow the steps I mentioned
> above, so it can be done later.

This has already been done in v6 [0].

Sincerely,
Aaron

[0]  https://lore.kernel.org/r/20250507-pci-tegra-module-v6-0-5fe363eaa302@gmail.com

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

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

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-05 14:58 [PATCH v4 0/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
2025-05-05 14:58 ` [PATCH v4 1/4] irqdomain: Export irq_domain_free_irqs Aaron Kling via B4 Relay
2025-05-05 22:33   ` Thomas Gleixner
2025-05-05 14:58 ` [PATCH v4 2/4] cpuidle: tegra: Export tegra_cpuidle_pcie_irqs_in_use Aaron Kling via B4 Relay
2025-05-05 14:59 ` [PATCH v4 3/4] PCI: tegra: Allow building as a module Aaron Kling via B4 Relay
2025-05-05 14:59 ` [PATCH v4 4/4] PCI: tegra: Drop unused remove callback Aaron Kling via B4 Relay
2025-05-05 16:31   ` Manivannan Sadhasivam
2025-05-05 16:43     ` Aaron Kling
2025-05-05 16:48       ` Manivannan Sadhasivam
2025-05-05 16:59         ` Aaron Kling
2025-05-10  6:24           ` Manivannan Sadhasivam
2025-05-11 14:53             ` Aaron Kling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).