linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3] PCI: tegra: Fix building Tegra194 PCIe driver
@ 2021-05-26 12:33 Jon Hunter
  2021-06-07 15:50 ` Jon Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2021-05-26 12:33 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding, Vidya Sagar,
	Krzysztof Wilczyński
  Cc: linux-pci, linux-tegra, Jon Hunter

Commit 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
errata") caused a few build regressions for the Tegra194 PCIe driver
which are:

1. The Tegra194 PCIe driver can no longer be built as a module. This
   was caused by removing the Makefile entry to build the pcie-tegra.c
   based upon the CONFIG_PCIE_TEGRA194 option. Therefore, restore this
   so that we can build the driver as a module.
2. 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
   errata") added "#ifdef CONFIG_PCIE_TEGRA194" around the native
   driver. But if we set CONFIG_PCIE_TEGRA194=m to build the driver as a
   module, autoconf.h contains "#define CONFIG_PCIE_TEGRA194_MODULE 1"
   (not "#define CONFIG_PCIE_TEGRA194 1"), so the #ifdef excludes the
   driver. Instead, use "IS_ENABLED(CONFIG_PCIE_TEGRA194)", which checks
   for either CONFIG_PCIE_TEGRA194 or CONFIG_PCIE_TEGRA194_MODULE.
3. The below build warnings that are seen with particular kernel
   configurations. Fix these by moving these structure definitions to
   within the necessary guards.

  drivers/pci/controller/dwc/pcie-tegra194.c:259:18: warning:
  	‘event_cntr_data_offset’ defined but not used [-Wunused-const-variable=]
  drivers/pci/controller/dwc/pcie-tegra194.c:250:18: warning:
  	‘event_cntr_ctrl_offset’ defined but not used [-Wunused-const-variable=]
  drivers/pci/controller/dwc/pcie-tegra194.c:243:27: warning:
  	‘pcie_gen_freq’ defined but not used [-Wunused-const-variable=]

Fixes: 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
Changes since V2:
- Update the commit message per Bjorn's feedback
- Moved the structure definitions within the necessary guards as opposed
  to wrapping the existing defintions with the appropriate guards.

Changes since V1:
- Added fixes tag
- Fixed 'defined but not used' compiler warnings

 drivers/pci/controller/dwc/Makefile        |  1 +
 drivers/pci/controller/dwc/pcie-tegra194.c | 51 +++++++++++-----------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile
index eca805c1a023..f0d1e2d8c022 100644
--- a/drivers/pci/controller/dwc/Makefile
+++ b/drivers/pci/controller/dwc/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_PCIE_UNIPHIER_EP) += pcie-uniphier-ep.o
 # depending on whether ACPI, the DT driver, or both are enabled.
 
 obj-$(CONFIG_PCIE_AL) += pcie-al.o
+obj-$(CONFIG_PCIE_TEGRA194) += pcie-tegra194.o
 obj-$(CONFIG_PCI_HISI) += pcie-hisi.o
 
 ifdef CONFIG_ACPI
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index b19775ab134e..9b3758ea1cba 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -240,31 +240,6 @@
 #define EP_STATE_DISABLED	0
 #define EP_STATE_ENABLED	1
 
-static const unsigned int pcie_gen_freq[] = {
-	GEN1_CORE_CLK_FREQ,
-	GEN2_CORE_CLK_FREQ,
-	GEN3_CORE_CLK_FREQ,
-	GEN4_CORE_CLK_FREQ
-};
-
-static const u32 event_cntr_ctrl_offset[] = {
-	0x1d8,
-	0x1a8,
-	0x1a8,
-	0x1a8,
-	0x1c4,
-	0x1d8
-};
-
-static const u32 event_cntr_data_offset[] = {
-	0x1dc,
-	0x1ac,
-	0x1ac,
-	0x1ac,
-	0x1c8,
-	0x1dc
-};
-
 struct tegra_pcie_dw {
 	struct device *dev;
 	struct resource *appl_res;
@@ -409,7 +384,13 @@ const struct pci_ecam_ops tegra194_pcie_ops = {
 };
 #endif /* defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) */
 
-#ifdef CONFIG_PCIE_TEGRA194
+#if IS_ENABLED(CONFIG_PCIE_TEGRA194)
+static const unsigned int pcie_gen_freq[] = {
+	GEN1_CORE_CLK_FREQ,
+	GEN2_CORE_CLK_FREQ,
+	GEN3_CORE_CLK_FREQ,
+	GEN4_CORE_CLK_FREQ
+};
 
 static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci)
 {
@@ -694,6 +675,24 @@ static struct pci_ops tegra_pci_ops = {
 };
 
 #if defined(CONFIG_PCIEASPM)
+static const u32 event_cntr_ctrl_offset[] = {
+	0x1d8,
+	0x1a8,
+	0x1a8,
+	0x1a8,
+	0x1c4,
+	0x1d8
+};
+
+static const u32 event_cntr_data_offset[] = {
+	0x1dc,
+	0x1ac,
+	0x1ac,
+	0x1ac,
+	0x1c8,
+	0x1dc
+};
+
 static void disable_aspm_l11(struct tegra_pcie_dw *pcie)
 {
 	u32 val;
-- 
2.25.1


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

* Re: [PATCH V3] PCI: tegra: Fix building Tegra194 PCIe driver
  2021-05-26 12:33 [PATCH V3] PCI: tegra: Fix building Tegra194 PCIe driver Jon Hunter
@ 2021-06-07 15:50 ` Jon Hunter
  2021-06-07 17:18   ` Bjorn Helgaas
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2021-06-07 15:50 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding, Vidya Sagar,
	Krzysztof Wilczyński
  Cc: linux-pci, linux-tegra

Hi Bjorn, Lorenzo,

On 26/05/2021 13:33, Jon Hunter wrote:
> Commit 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
> errata") caused a few build regressions for the Tegra194 PCIe driver
> which are:
> 
> 1. The Tegra194 PCIe driver can no longer be built as a module. This
>    was caused by removing the Makefile entry to build the pcie-tegra.c
>    based upon the CONFIG_PCIE_TEGRA194 option. Therefore, restore this
>    so that we can build the driver as a module.
> 2. 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
>    errata") added "#ifdef CONFIG_PCIE_TEGRA194" around the native
>    driver. But if we set CONFIG_PCIE_TEGRA194=m to build the driver as a
>    module, autoconf.h contains "#define CONFIG_PCIE_TEGRA194_MODULE 1"
>    (not "#define CONFIG_PCIE_TEGRA194 1"), so the #ifdef excludes the
>    driver. Instead, use "IS_ENABLED(CONFIG_PCIE_TEGRA194)", which checks
>    for either CONFIG_PCIE_TEGRA194 or CONFIG_PCIE_TEGRA194_MODULE.
> 3. The below build warnings that are seen with particular kernel
>    configurations. Fix these by moving these structure definitions to
>    within the necessary guards.
> 
>   drivers/pci/controller/dwc/pcie-tegra194.c:259:18: warning:
>   	‘event_cntr_data_offset’ defined but not used [-Wunused-const-variable=]
>   drivers/pci/controller/dwc/pcie-tegra194.c:250:18: warning:
>   	‘event_cntr_ctrl_offset’ defined but not used [-Wunused-const-variable=]
>   drivers/pci/controller/dwc/pcie-tegra194.c:243:27: warning:
>   	‘pcie_gen_freq’ defined but not used [-Wunused-const-variable=]
> 
> Fixes: 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata")
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>


Any feedback on this? We need this for v5.13.

Thanks!
Jon

-- 
nvpublic

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

* Re: [PATCH V3] PCI: tegra: Fix building Tegra194 PCIe driver
  2021-06-07 15:50 ` Jon Hunter
@ 2021-06-07 17:18   ` Bjorn Helgaas
  2021-06-07 18:19     ` Jon Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2021-06-07 17:18 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding, Vidya Sagar,
	Krzysztof Wilczyński, linux-pci, linux-tegra

On Mon, Jun 07, 2021 at 04:50:34PM +0100, Jon Hunter wrote:
> Hi Bjorn, Lorenzo,
> 
> On 26/05/2021 13:33, Jon Hunter wrote:
> > Commit 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
> > errata") caused a few build regressions for the Tegra194 PCIe driver
> > which are:
> > 
> > 1. The Tegra194 PCIe driver can no longer be built as a module. This
> >    was caused by removing the Makefile entry to build the pcie-tegra.c
> >    based upon the CONFIG_PCIE_TEGRA194 option. Therefore, restore this
> >    so that we can build the driver as a module.
> > 2. 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
> >    errata") added "#ifdef CONFIG_PCIE_TEGRA194" around the native
> >    driver. But if we set CONFIG_PCIE_TEGRA194=m to build the driver as a
> >    module, autoconf.h contains "#define CONFIG_PCIE_TEGRA194_MODULE 1"
> >    (not "#define CONFIG_PCIE_TEGRA194 1"), so the #ifdef excludes the
> >    driver. Instead, use "IS_ENABLED(CONFIG_PCIE_TEGRA194)", which checks
> >    for either CONFIG_PCIE_TEGRA194 or CONFIG_PCIE_TEGRA194_MODULE.
> > 3. The below build warnings that are seen with particular kernel
> >    configurations. Fix these by moving these structure definitions to
> >    within the necessary guards.
> > 
> >   drivers/pci/controller/dwc/pcie-tegra194.c:259:18: warning:
> >   	‘event_cntr_data_offset’ defined but not used [-Wunused-const-variable=]
> >   drivers/pci/controller/dwc/pcie-tegra194.c:250:18: warning:
> >   	‘event_cntr_ctrl_offset’ defined but not used [-Wunused-const-variable=]
> >   drivers/pci/controller/dwc/pcie-tegra194.c:243:27: warning:
> >   	‘pcie_gen_freq’ defined but not used [-Wunused-const-variable=]
> > 
> > Fixes: 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata")
> > Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> 
> 
> Any feedback on this? We need this for v5.13.

Thanks for the reminder, I'll take a look at this.  It looks like we
broke this in v5.13-rc1, so we should fix it before v5.13.

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

* Re: [PATCH V3] PCI: tegra: Fix building Tegra194 PCIe driver
  2021-06-07 17:18   ` Bjorn Helgaas
@ 2021-06-07 18:19     ` Jon Hunter
  0 siblings, 0 replies; 4+ messages in thread
From: Jon Hunter @ 2021-06-07 18:19 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding, Vidya Sagar,
	Krzysztof Wilczyński, linux-pci, linux-tegra


On 07/06/2021 18:18, Bjorn Helgaas wrote:
> On Mon, Jun 07, 2021 at 04:50:34PM +0100, Jon Hunter wrote:
>> Hi Bjorn, Lorenzo,
>>
>> On 26/05/2021 13:33, Jon Hunter wrote:
>>> Commit 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
>>> errata") caused a few build regressions for the Tegra194 PCIe driver
>>> which are:
>>>
>>> 1. The Tegra194 PCIe driver can no longer be built as a module. This
>>>    was caused by removing the Makefile entry to build the pcie-tegra.c
>>>    based upon the CONFIG_PCIE_TEGRA194 option. Therefore, restore this
>>>    so that we can build the driver as a module.
>>> 2. 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM
>>>    errata") added "#ifdef CONFIG_PCIE_TEGRA194" around the native
>>>    driver. But if we set CONFIG_PCIE_TEGRA194=m to build the driver as a
>>>    module, autoconf.h contains "#define CONFIG_PCIE_TEGRA194_MODULE 1"
>>>    (not "#define CONFIG_PCIE_TEGRA194 1"), so the #ifdef excludes the
>>>    driver. Instead, use "IS_ENABLED(CONFIG_PCIE_TEGRA194)", which checks
>>>    for either CONFIG_PCIE_TEGRA194 or CONFIG_PCIE_TEGRA194_MODULE.
>>> 3. The below build warnings that are seen with particular kernel
>>>    configurations. Fix these by moving these structure definitions to
>>>    within the necessary guards.
>>>
>>>   drivers/pci/controller/dwc/pcie-tegra194.c:259:18: warning:
>>>   	‘event_cntr_data_offset’ defined but not used [-Wunused-const-variable=]
>>>   drivers/pci/controller/dwc/pcie-tegra194.c:250:18: warning:
>>>   	‘event_cntr_ctrl_offset’ defined but not used [-Wunused-const-variable=]
>>>   drivers/pci/controller/dwc/pcie-tegra194.c:243:27: warning:
>>>   	‘pcie_gen_freq’ defined but not used [-Wunused-const-variable=]
>>>
>>> Fixes: 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata")
>>> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
>>
>>
>> Any feedback on this? We need this for v5.13.
> 
> Thanks for the reminder, I'll take a look at this.  It looks like we
> broke this in v5.13-rc1, so we should fix it before v5.13.
> 

Thanks. Yes this is needed before v5.13.

Jon

-- 
nvpublic

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

end of thread, other threads:[~2021-06-07 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 12:33 [PATCH V3] PCI: tegra: Fix building Tegra194 PCIe driver Jon Hunter
2021-06-07 15:50 ` Jon Hunter
2021-06-07 17:18   ` Bjorn Helgaas
2021-06-07 18:19     ` Jon Hunter

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).