diff mbox series

[V1] PCI: tegra194: Add support for PCIe RC & EP in Tegra234 Platforms

Message ID 20250128044244.2766334-1-vidyas@nvidia.com (mailing list archive)
State New
Delegated to: Krzysztof WilczyƄski
Headers show
Series [V1] PCI: tegra194: Add support for PCIe RC & EP in Tegra234 Platforms | expand

Commit Message

Vidya Sagar Jan. 28, 2025, 4:42 a.m. UTC
Add PCIe RC & EP support for Tegra234 Platforms.

Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
---
 drivers/pci/controller/dwc/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Niklas Cassel Jan. 28, 2025, 12:04 p.m. UTC | #1
Hello Vidya,

On Tue, Jan 28, 2025 at 10:12:44AM +0530, Vidya Sagar wrote:
> Add PCIe RC & EP support for Tegra234 Platforms.

The commit log does leave quite a few questions unanswered.

Since you are just updating the Kconfig and nothing else:
Does the DT binding already have support for the Tegra234 SoC?
Does the driver already have support for the Tegra234 SoC?

Looking at the DT binding and driver, the answer to both questions
is yes. (This should have been in the commit message IMO.)


But that leads me to the question, since there is support for Tegra234
SoC in the driver, does this means that this fixes a regression, e.g.
the Kconfig ARCH_TEGRA_234_SOC was added after the driver support in
this driver was added. In this case, you should have a Fixes: tag that
points to the commit that added ARCH_TEGRA_234_SOC.

Or has the the driver support for Tegra234 been "dead-code" since it
was originally added? (Because without this patch, no one can have
tested it, at least not without COMPILE_TEST.)
In this case, you should add:
Fixes: a54e19073718 ("PCI: tegra194: Add Tegra234 PCIe support")


Kind regards,
Niklas
manivannan.sadhasivam@linaro.org Feb. 3, 2025, 4:59 p.m. UTC | #2
On Tue, Jan 28, 2025 at 01:04:32PM +0100, Niklas Cassel wrote:
> Hello Vidya,
> 
> On Tue, Jan 28, 2025 at 10:12:44AM +0530, Vidya Sagar wrote:
> > Add PCIe RC & EP support for Tegra234 Platforms.
> 
> The commit log does leave quite a few questions unanswered.
> 
> Since you are just updating the Kconfig and nothing else:
> Does the DT binding already have support for the Tegra234 SoC?
> Does the driver already have support for the Tegra234 SoC?
> 
> Looking at the DT binding and driver, the answer to both questions
> is yes. (This should have been in the commit message IMO.)
> 
> 
> But that leads me to the question, since there is support for Tegra234
> SoC in the driver, does this means that this fixes a regression, e.g.
> the Kconfig ARCH_TEGRA_234_SOC was added after the driver support in
> this driver was added. In this case, you should have a Fixes: tag that
> points to the commit that added ARCH_TEGRA_234_SOC.
> 
> Or has the the driver support for Tegra234 been "dead-code" since it
> was originally added? (Because without this patch, no one can have
> tested it, at least not without COMPILE_TEST.)
> In this case, you should add:
> Fixes: a54e19073718 ("PCI: tegra194: Add Tegra234 PCIe support")
> 

TBH, I don't like muddling with Kconfig like this. Ideally, the driver should
just depend on ARCH_TEGRA || COMPILE_TEST and the driver should be selected by
the relevant defconfig.

And this is what all other rest of the platforms are doing. Why should Nvidia be
different? It makes me feel that this Kconfig dependency is used as a workaround
for defconfig updates.

- Mani
Thierry Reding Feb. 4, 2025, 5:12 p.m. UTC | #3
On Tue, Jan 28, 2025 at 01:04:32PM +0100, Niklas Cassel wrote:
> Hello Vidya,
> 
> On Tue, Jan 28, 2025 at 10:12:44AM +0530, Vidya Sagar wrote:
> > Add PCIe RC & EP support for Tegra234 Platforms.
> 
> The commit log does leave quite a few questions unanswered.
> 
> Since you are just updating the Kconfig and nothing else:
> Does the DT binding already have support for the Tegra234 SoC?
> Does the driver already have support for the Tegra234 SoC?
> 
> Looking at the DT binding and driver, the answer to both questions
> is yes. (This should have been in the commit message IMO.)
> 
> 
> But that leads me to the question, since there is support for Tegra234
> SoC in the driver, does this means that this fixes a regression, e.g.
> the Kconfig ARCH_TEGRA_234_SOC was added after the driver support in
> this driver was added. In this case, you should have a Fixes: tag that
> points to the commit that added ARCH_TEGRA_234_SOC.
> 
> Or has the the driver support for Tegra234 been "dead-code" since it
> was originally added? (Because without this patch, no one can have
> tested it, at least not without COMPILE_TEST.)
> In this case, you should add:
> Fixes: a54e19073718 ("PCI: tegra194: Add Tegra234 PCIe support")

Typically we build the default configuration with some custom options
(like everyone else, I assume) and usually in those configurations both
Tegra194 and Tegra234 support will be enabled, so the code ends up
enabled in most cases. I guess the commit message doesn't do a very good
job of making this clear. Really what this commit does is enable the PCI
controller driver for Tegra234-only configurations (i.e. no other Tegra
generations are built-in).

Not sure about the Fixes: tag since this is fairly harmless. Worst case
you'll need to enable Tegra194 support along with Tegra234 in order to
be able to enable this driver, but that's almost always the case anyway.

Thierry
Thierry Reding Feb. 4, 2025, 5:19 p.m. UTC | #4
On Mon, Feb 03, 2025 at 10:29:32PM +0530, Manivannan Sadhasivam wrote:
> On Tue, Jan 28, 2025 at 01:04:32PM +0100, Niklas Cassel wrote:
> > Hello Vidya,
> > 
> > On Tue, Jan 28, 2025 at 10:12:44AM +0530, Vidya Sagar wrote:
> > > Add PCIe RC & EP support for Tegra234 Platforms.
> > 
> > The commit log does leave quite a few questions unanswered.
> > 
> > Since you are just updating the Kconfig and nothing else:
> > Does the DT binding already have support for the Tegra234 SoC?
> > Does the driver already have support for the Tegra234 SoC?
> > 
> > Looking at the DT binding and driver, the answer to both questions
> > is yes. (This should have been in the commit message IMO.)
> > 
> > 
> > But that leads me to the question, since there is support for Tegra234
> > SoC in the driver, does this means that this fixes a regression, e.g.
> > the Kconfig ARCH_TEGRA_234_SOC was added after the driver support in
> > this driver was added. In this case, you should have a Fixes: tag that
> > points to the commit that added ARCH_TEGRA_234_SOC.
> > 
> > Or has the the driver support for Tegra234 been "dead-code" since it
> > was originally added? (Because without this patch, no one can have
> > tested it, at least not without COMPILE_TEST.)
> > In this case, you should add:
> > Fixes: a54e19073718 ("PCI: tegra194: Add Tegra234 PCIe support")
> > 
> 
> TBH, I don't like muddling with Kconfig like this. Ideally, the driver should
> just depend on ARCH_TEGRA || COMPILE_TEST and the driver should be selected by
> the relevant defconfig.

ARCH_TEGRA is a symbol that exists both on 32-bit and 64-bit ARM. This
driver is completely useless on 32-bit ARM and only used on a very small
subset of 64-bit ARM devices. It doesn't make sense to be able to enable
this if you want to build a kernel for say Tegra210.

The relevant defconfig in this case would be the arm64 defconfig, which
isn't very authoritative.

> And this is what all other rest of the platforms are doing. Why should Nvidia be
> different? It makes me feel that this Kconfig dependency is used as a workaround
> for defconfig updates.

Well, it's certainly not used as a workaround for defconfig updates
because the change itself doesn't enable this symbol. You'd still need a
defconfig change to do that.

Also, we do this primarily because we've always done things this way on
Tegra. As I said, for a lot of drivers it doesn't make sense to include
them in a 32-bit build or 64-bit build because the hardware simply
doesn't exist. Having per-SoC generation Kconfig symbols allows this to
be modelled more accurately and if desired to build compact images.

Thierry
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig
index b6d6778b0698..6dd232cf8064 100644
--- a/drivers/pci/controller/dwc/Kconfig
+++ b/drivers/pci/controller/dwc/Kconfig
@@ -205,7 +205,7 @@  config PCIE_TEGRA194
 
 config PCIE_TEGRA194_HOST
 	tristate "NVIDIA Tegra194 (and later) PCIe controller (host mode)"
-	depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
+	depends on ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC || COMPILE_TEST
 	depends on PCI_MSI
 	select PCIE_DW_HOST
 	select PHY_TEGRA194_P2U
@@ -220,7 +220,7 @@  config PCIE_TEGRA194_HOST
 
 config PCIE_TEGRA194_EP
 	tristate "NVIDIA Tegra194 (and later) PCIe controller (endpoint mode)"
-	depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
+	depends on ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC || COMPILE_TEST
 	depends on PCI_ENDPOINT
 	select PCIE_DW_EP
 	select PHY_TEGRA194_P2U