2019-09-11 22:34:33

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 0/4] Cleanup arm64 driver dependencies

I was using initcall_debugging on a QCOM platform and ran across a bunch of
driver initcalls that are enabled even if their SoC support is disabled.

Here are some fixups for a subset of them.

Amit Kucheria (4):
arm64: Kconfig: Fix XGENE driver dependencies
arm64: Kconfig: Fix BRCMSTB driver dependencies
arm64: Kconfig: Fix VEXPRESS driver dependencies
arm64: Kconfig: Fix EXYNOS driver dependencies

arch/arm64/Kconfig.platforms | 3 +++
drivers/bus/Kconfig | 3 ++-
drivers/clk/Kconfig | 3 ++-
drivers/clk/versatile/Kconfig | 4 ++--
drivers/gpio/Kconfig | 1 +
drivers/pci/controller/Kconfig | 1 +
drivers/phy/Kconfig | 1 +
drivers/power/reset/Kconfig | 3 ++-
drivers/regulator/Kconfig | 1 +
drivers/soc/bcm/Kconfig | 1 +
10 files changed, 16 insertions(+), 5 deletions(-)

--
2.17.1


2019-09-11 22:34:55

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 3/4] arm64: Kconfig: Fix VEXPRESS driver dependencies

Push various VEXPRESS drivers behind ARCH_VEXPRESS dependency so that it
doesn't get enabled by default on other platforms.

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/bus/Kconfig | 2 +-
drivers/clk/versatile/Kconfig | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index d80e8d70bf10..b2b1beee9953 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -166,7 +166,7 @@ config UNIPHIER_SYSTEM_BUS

config VEXPRESS_CONFIG
bool "Versatile Express configuration bus"
- default y if ARCH_VEXPRESS
+ depends on ARCH_VEXPRESS
depends on ARM || ARM64
depends on OF
select REGMAP
diff --git a/drivers/clk/versatile/Kconfig b/drivers/clk/versatile/Kconfig
index ac766855ba16..826750292c1e 100644
--- a/drivers/clk/versatile/Kconfig
+++ b/drivers/clk/versatile/Kconfig
@@ -5,8 +5,8 @@ config ICST
config COMMON_CLK_VERSATILE
bool "Clock driver for ARM Reference designs"
depends on ARCH_INTEGRATOR || ARCH_REALVIEW || \
- ARCH_VERSATILE || ARCH_VEXPRESS || ARM64 || \
- COMPILE_TEST
+ ARCH_VERSATILE || ARCH_VEXPRESS || COMPILE_TEST
+ depends on ARM64
select REGMAP_MMIO
---help---
Supports clocking on ARM Reference designs:
--
2.17.1

2019-09-11 22:34:58

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 4/4] arm64: Kconfig: Fix EXYNOS driver dependencies

Push various EXYNOS drivers behind ARCH_EXYNOS dependency so that it
doesn't get enabled by default on other platforms.

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/clk/Kconfig | 1 +
drivers/regulator/Kconfig | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 9b2790d3f18a..bdf164a7a7c5 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -194,6 +194,7 @@ config COMMON_CLK_ASPEED

config COMMON_CLK_S2MPS11
tristate "Clock driver for S2MPS1X/S5M8767 MFD"
+ depends on ARCH_EXYNOS
depends on MFD_SEC_CORE || COMPILE_TEST
---help---
This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index b57093d7c01f..a4c4f01343fd 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -797,6 +797,7 @@ config REGULATOR_S2MPA01

config REGULATOR_S2MPS11
tristate "Samsung S2MPS11/13/14/15/S2MPU02 voltage regulator"
+ depends on ARCH_EXYNOS
depends on MFD_SEC_CORE
help
This driver supports a Samsung S2MPS11/13/14/15/S2MPU02 voltage
--
2.17.1

2019-09-11 23:39:40

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 1/4] arm64: Kconfig: Fix XGENE driver dependencies

Push various XGENE drivers behind ARCH_XGENE dependency so that it
doesn't get enabled by default on other platforms.

Signed-off-by: Amit Kucheria <[email protected]>
---
arch/arm64/Kconfig.platforms | 3 +++
drivers/clk/Kconfig | 2 +-
drivers/gpio/Kconfig | 1 +
drivers/pci/controller/Kconfig | 1 +
drivers/phy/Kconfig | 1 +
drivers/power/reset/Kconfig | 2 +-
6 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 4778c775de1b..cdf4e452e34c 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -281,6 +281,9 @@ config ARCH_VULCAN

config ARCH_XGENE
bool "AppliedMicro X-Gene SOC Family"
+ select COMMON_CLK_XGENE
+ select PCI_XGENE
+ select GPIO_XGENE
help
This enables support for AppliedMicro X-Gene SOC Family

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 801fa1cd0321..9b2790d3f18a 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -225,7 +225,7 @@ config CLK_QORIQ

config COMMON_CLK_XGENE
bool "Clock driver for APM XGene SoC"
- default ARCH_XGENE
+ depends on ARCH_XGENE
depends on ARM64 || COMPILE_TEST
---help---
Sypport for the APM X-Gene SoC reference, PLL, and device clocks.
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index bb13c266c329..072c749c5c1f 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -580,6 +580,7 @@ config GPIO_VX855

config GPIO_XGENE
bool "APM X-Gene GPIO controller support"
+ depends on ARCH_XGENE
depends on ARM64 && OF_GPIO
help
This driver is to support the GPIO block within the APM X-Gene SoC
diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index fe9f9f13ce11..44699f45784f 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -112,6 +112,7 @@ config PCIE_XILINX
config PCI_XGENE
bool "X-Gene PCIe controller"
depends on ARM64 || COMPILE_TEST
+ depends on ARCH_XGENE
depends on OF || (ACPI && PCI_QUIRKS)
help
Say Y here if you want internal PCI support on APM X-Gene SoC.
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 0263db2ac874..7c5eefecdabd 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -44,6 +44,7 @@ config PHY_PISTACHIO_USB

config PHY_XGENE
tristate "APM X-Gene 15Gbps PHY support"
+ depends on ARCH_XGENE
depends on HAS_IOMEM && OF && (ARM64 || COMPILE_TEST)
select GENERIC_PHY
help
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index a564237278ff..651b763f80cd 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -181,7 +181,7 @@ config POWER_RESET_VEXPRESS

config POWER_RESET_XGENE
bool "APM SoC X-Gene reset driver"
- depends on ARM64
+ depends on ARCH_XGENE && ARM64
help
Reboot support for the APM SoC X-Gene Eval boards.

--
2.17.1

2019-09-11 23:39:52

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 2/4] arm64: Kconfig: Fix BRCMSTB driver dependencies

Push various BRCMSTB drivers behind ARCH_BRCMSTB dependency so that it
doesn't get enabled by default on other platforms.

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/bus/Kconfig | 1 +
drivers/power/reset/Kconfig | 1 +
drivers/soc/bcm/Kconfig | 1 +
3 files changed, 3 insertions(+)

diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 1851112ccc29..d80e8d70bf10 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -22,6 +22,7 @@ config ARM_CCI400_PORT_CTRL

config BRCMSTB_GISB_ARB
bool "Broadcom STB GISB bus arbiter"
+ depends on ARCH_BRCMSTB
depends on ARM || ARM64 || MIPS
default ARCH_BRCMSTB || BMIPS_GENERIC
help
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 651b763f80cd..6f0b1ed1a05a 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -59,6 +59,7 @@ config POWER_RESET_BRCMKONA

config POWER_RESET_BRCMSTB
bool "Broadcom STB reset driver"
+ depends on ARCH_BRCMSTB
depends on ARM || ARM64 || MIPS || COMPILE_TEST
depends on MFD_SYSCON
default ARCH_BRCMSTB || BMIPS_GENERIC
diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig
index 648e32693b7e..5a8ff33241ae 100644
--- a/drivers/soc/bcm/Kconfig
+++ b/drivers/soc/bcm/Kconfig
@@ -24,6 +24,7 @@ config RASPBERRYPI_POWER

config SOC_BRCMSTB
bool "Broadcom STB SoC drivers"
+ depends on ARCH_BRCMSTB
depends on ARM || ARM64 || BMIPS_GENERIC || COMPILE_TEST
select SOC_BUS
help
--
2.17.1

2019-09-12 01:07:37

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/4] arm64: Kconfig: Fix XGENE driver dependencies

Quoting Amit Kucheria (2019-09-11 15:18:45)
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 801fa1cd0321..9b2790d3f18a 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -225,7 +225,7 @@ config CLK_QORIQ
>
> config COMMON_CLK_XGENE
> bool "Clock driver for APM XGene SoC"
> - default ARCH_XGENE
> + depends on ARCH_XGENE
> depends on ARM64 || COMPILE_TEST

Is ARCH_XGENE supported outside of ARM64? I'd expect to see something
more like depends on ARCH_XGENE || COMPILE_TEST and default ARCH_XGENE
so that if the config is supported it becomes the default. Or at least
depends on ARCH_XGENE && ARM64 || COMPILE_TEST

> ---help---
> Sypport for the APM X-Gene SoC reference, PLL, and device clocks.

2019-09-12 09:19:57

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 3/4] arm64: Kconfig: Fix VEXPRESS driver dependencies

On Thu, Sep 12, 2019 at 12:19 AM Amit Kucheria <[email protected]> wrote:
>
> Push various VEXPRESS drivers behind ARCH_VEXPRESS dependency so that it
> doesn't get enabled by default on other platforms.
>
> Signed-off-by: Amit Kucheria <[email protected]>
> ---
> drivers/bus/Kconfig | 2 +-
> drivers/clk/versatile/Kconfig | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
> index d80e8d70bf10..b2b1beee9953 100644
> --- a/drivers/bus/Kconfig
> +++ b/drivers/bus/Kconfig
> @@ -166,7 +166,7 @@ config UNIPHIER_SYSTEM_BUS
>
> config VEXPRESS_CONFIG
> bool "Versatile Express configuration bus"
> - default y if ARCH_VEXPRESS
> + depends on ARCH_VEXPRESS
> depends on ARM || ARM64
> depends on OF

Removing the 'default y' breaks existing defconfig files,

Adding the 'depends on ARCH_VEXPRESS' unnecessarily limits
compile-testing. I'd rather extend it to other architectures than
limit it to builds that have vexpress enabled.

> diff --git a/drivers/clk/versatile/Kconfig b/drivers/clk/versatile/Kconfig
> index ac766855ba16..826750292c1e 100644
> --- a/drivers/clk/versatile/Kconfig
> +++ b/drivers/clk/versatile/Kconfig
> @@ -5,8 +5,8 @@ config ICST
> config COMMON_CLK_VERSATILE
> bool "Clock driver for ARM Reference designs"
> depends on ARCH_INTEGRATOR || ARCH_REALVIEW || \
> - ARCH_VERSATILE || ARCH_VEXPRESS || ARM64 || \
> - COMPILE_TEST
> + ARCH_VERSATILE || ARCH_VEXPRESS || COMPILE_TEST
> + depends on ARM64

It's definitely wrong to limit this to 64 bit.

Arnd

2019-09-12 09:21:45

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 4/4] arm64: Kconfig: Fix EXYNOS driver dependencies

On Thu, Sep 12, 2019 at 12:19 AM Amit Kucheria <[email protected]> wrote:

> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 9b2790d3f18a..bdf164a7a7c5 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -194,6 +194,7 @@ config COMMON_CLK_ASPEED
>
> config COMMON_CLK_S2MPS11
> tristate "Clock driver for S2MPS1X/S5M8767 MFD"
> + depends on ARCH_EXYNOS
> depends on MFD_SEC_CORE || COMPILE_TEST
> ---help---
> This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator

This breaks compile-testing on non-ARM targets.

> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> index b57093d7c01f..a4c4f01343fd 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -797,6 +797,7 @@ config REGULATOR_S2MPA01
>
> config REGULATOR_S2MPS11
> tristate "Samsung S2MPS11/13/14/15/S2MPU02 voltage regulator"
> + depends on ARCH_EXYNOS
> depends on MFD_SEC_CORE
> help
> This driver supports a Samsung S2MPS11/13/14/15/S2MPU02 voltage

Same here. What you could do instead is add

depends on ARCH_EXYNOS || COMPILE_TEST

to MFD_SEC_CORE, this would then propagate to these
two drivers as well.

Arnd

2019-09-12 09:23:56

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 2/4] arm64: Kconfig: Fix BRCMSTB driver dependencies

On Thu, Sep 12, 2019 at 12:19 AM Amit Kucheria <[email protected]> wrote:
> diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
> index 1851112ccc29..d80e8d70bf10 100644
> --- a/drivers/bus/Kconfig
> +++ b/drivers/bus/Kconfig
> @@ -22,6 +22,7 @@ config ARM_CCI400_PORT_CTRL
>
> config BRCMSTB_GISB_ARB
> bool "Broadcom STB GISB bus arbiter"
> + depends on ARCH_BRCMSTB
> depends on ARM || ARM64 || MIPS
> default ARCH_BRCMSTB || BMIPS_GENERIC
> help

This breaks MIPS configurations that need this driver, and
it breask compile-testing on non-ARM/MIPS targets.

> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index 651b763f80cd..6f0b1ed1a05a 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -59,6 +59,7 @@ config POWER_RESET_BRCMKONA
>
> config POWER_RESET_BRCMSTB
> bool "Broadcom STB reset driver"
> + depends on ARCH_BRCMSTB
> depends on ARM || ARM64 || MIPS || COMPILE_TEST
> depends on MFD_SYSCON
> default ARCH_BRCMSTB || BMIPS_GENERIC

Same here and below.

> diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig
> index 648e32693b7e..5a8ff33241ae 100644
> --- a/drivers/soc/bcm/Kconfig
> +++ b/drivers/soc/bcm/Kconfig
> @@ -24,6 +24,7 @@ config RASPBERRYPI_POWER
>
> config SOC_BRCMSTB
> bool "Broadcom STB SoC drivers"
> + depends on ARCH_BRCMSTB
> depends on ARM || ARM64 || BMIPS_GENERIC || COMPILE_TEST
> select SOC_BUS
> help

Arnd

2019-09-12 09:34:59

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 4/4] arm64: Kconfig: Fix EXYNOS driver dependencies

On Thu, Sep 12, 2019 at 03:48:48AM +0530, Amit Kucheria wrote:

> Push various EXYNOS drivers behind ARCH_EXYNOS dependency so that it
> doesn't get enabled by default on other platforms.

> config REGULATOR_S2MPS11
> tristate "Samsung S2MPS11/13/14/15/S2MPU02 voltage regulator"
> + depends on ARCH_EXYNOS
> depends on MFD_SEC_CORE
> help
> This driver supports a Samsung S2MPS11/13/14/15/S2MPU02 voltage

This doesn't match the changelog at all. This driver is not
enabled by default since it's just a normal tristate, they are
disabled by default. As far as I can see all this change will
do is reduce our build test coverage by adding an artificial
dependency without an || COMPILE_TEST.


Attachments:
(No filename) (721.00 B)
signature.asc (499.00 B)
Download all attachments

2019-09-12 09:49:55

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/4] Cleanup arm64 driver dependencies

On Thu, Sep 12, 2019 at 03:48:44AM +0530, Amit Kucheria wrote:

> I was using initcall_debugging on a QCOM platform and ran across a bunch of
> driver initcalls that are enabled even if their SoC support is disabled.

What exactly is the problem you're trying to fix here? For the
drivers I looked at these were bog standard register the driver
with the subsystem type initcalls on optional drivers so not
doing anything particularly disruptive or anything like that.
For any given system that's going to be an issue for the
overwhelming majority of drivers on the tree, including those
that aren't associated with any particular architecture.


Attachments:
(No filename) (657.00 B)
signature.asc (499.00 B)
Download all attachments

2019-09-12 09:52:42

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH 0/4] Cleanup arm64 driver dependencies

Hi Arnd,

On Thu, Sep 12, 2019 at 2:59 PM Arnd Bergmann <[email protected]> wrote:
>
> On Thu, Sep 12, 2019 at 12:18 AM Amit Kucheria <[email protected]> wrote:
> >
> > I was using initcall_debugging on a QCOM platform and ran across a bunch of
> > driver initcalls that are enabled even if their SoC support is disabled.
> >
> > Here are some fixups for a subset of them.
>
> The idea seems reasonable, disabling a platform may just turn off
> all the drivers that are not useful elsewhere, but there are mistakes
> in a lot of your changes, so I'm certainly not applying these for 5.4.

OK, thanks for confirming that you have no objections to such changes, per-se.

I'll spend some more time ensuring COMPILE_TEST coverage for these
cleanups. I only focused on quickly cleaning up my initcall_debug
output for now.

> Generally speaking, the way that works best is
>
> config SUBSYS_DRIVER_FOO
> tristate "SUBSYS support for FOO platform"
> depends on ARCH_FOO || COMPILE_TEST
> depends on SUBSYS
> default "m" if ARCH_FOO
>
> This means it's enabled as a loadable module by default (use
> default "y" instead where necessary) as long as the platform
> is enabled, but an x86 allmodconfig build also includes it
> because of COMPILE_TEST, while any configuration without
> ARCH_FOO that is not compile-testing cannot enable it.

How would you like to handle defconfigs which list a driver
explicitly? Should we add ARCH_FOO to those defconfigs or remove
DRIVER_FOO from them?

Regards,
Amit

2019-09-12 10:05:35

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/4] Cleanup arm64 driver dependencies

On Thu, Sep 12, 2019 at 11:29:00AM +0200, Arnd Bergmann wrote:

> Generally speaking, the way that works best is

> config SUBSYS_DRIVER_FOO
> tristate "SUBSYS support for FOO platform"
> depends on ARCH_FOO || COMPILE_TEST
> depends on SUBSYS
> default "m" if ARCH_FOO

> This means it's enabled as a loadable module by default (use
> default "y" instead where necessary) as long as the platform
> is enabled, but an x86 allmodconfig build also includes it
> because of COMPILE_TEST, while any configuration without
> ARCH_FOO that is not compile-testing cannot enable it.

Indeed, though we shouldn't be adding any default m/y to things
that don't already default on.


Attachments:
(No filename) (716.00 B)
signature.asc (499.00 B)
Download all attachments

2019-09-12 10:07:29

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH 0/4] Cleanup arm64 driver dependencies

On Thu, Sep 12, 2019 at 3:17 PM Mark Brown <[email protected]> wrote:
>
> On Thu, Sep 12, 2019 at 03:48:44AM +0530, Amit Kucheria wrote:
>
> > I was using initcall_debugging on a QCOM platform and ran across a bunch of
> > driver initcalls that are enabled even if their SoC support is disabled.
>
> What exactly is the problem you're trying to fix here? For the
> drivers I looked at these were bog standard register the driver
> with the subsystem type initcalls on optional drivers so not
> doing anything particularly disruptive or anything like that.

I was trying to prune the defconfig only to drivers that make sense on
the SoC. e.g. Why should I see a brcmstb_soc_device_early_init() call
on a QCOM system when I've disabled ARCH_BRCMSTB?

I came across this while trying to figure out how to make thermal and
cpufreq frameworks initialise as early as possible.

> For any given system that's going to be an issue for the
> overwhelming majority of drivers on the tree, including those
> that aren't associated with any particular architecture.

Indeed. From a quick check, MFD and GPIO has a bunch of 'generic'
drivers that aren't SoC-specific. I'm sure there are several such
drivers in regulator framework too. They don't need to be 'fixed'.

I was just trying to ring-fence obvious SoC-specific drivers behind a
ARCH_FOO dependency since they seemed like low-hanging fruit. Let me
know if it isn't a good use of everyone's time.

Regards,
Amit

2019-09-12 10:56:12

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/4] Cleanup arm64 driver dependencies

On Thu, Sep 12, 2019 at 03:33:20PM +0530, Amit Kucheria wrote:
> On Thu, Sep 12, 2019 at 3:17 PM Mark Brown <[email protected]> wrote:

> > > I was using initcall_debugging on a QCOM platform and ran across a bunch of
> > > driver initcalls that are enabled even if their SoC support is disabled.

> > What exactly is the problem you're trying to fix here? For the
> > drivers I looked at these were bog standard register the driver
> > with the subsystem type initcalls on optional drivers so not
> > doing anything particularly disruptive or anything like that.

> I was trying to prune the defconfig only to drivers that make sense on
> the SoC. e.g. Why should I see a brcmstb_soc_device_early_init() call
> on a QCOM system when I've disabled ARCH_BRCMSTB?

So this is really just the standard make Kconfig easier to use by
filtering out noise thing. It'd be clearer if you said that in
the changelog, and like the review comments have been saying you
need to leave in an || COMPILE_TEST in there otherwise it's
actively harmful.

> I came across this while trying to figure out how to make thermal and
> cpufreq frameworks initialise as early as possible.

AFAICT you'd also have been happy if you just built these drivers
modular?


Attachments:
(No filename) (1.24 kB)
signature.asc (499.00 B)
Download all attachments

2019-09-12 16:46:54

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 0/4] Cleanup arm64 driver dependencies

On Thu, Sep 12, 2019 at 12:18 AM Amit Kucheria <[email protected]> wrote:
>
> I was using initcall_debugging on a QCOM platform and ran across a bunch of
> driver initcalls that are enabled even if their SoC support is disabled.
>
> Here are some fixups for a subset of them.

The idea seems reasonable, disabling a platform may just turn off
all the drivers that are not useful elsewhere, but there are mistakes
in a lot of your changes, so I'm certainly not applying these for 5.4.

Generally speaking, the way that works best is

config SUBSYS_DRIVER_FOO
tristate "SUBSYS support for FOO platform"
depends on ARCH_FOO || COMPILE_TEST
depends on SUBSYS
default "m" if ARCH_FOO

This means it's enabled as a loadable module by default (use
default "y" instead where necessary) as long as the platform
is enabled, but an x86 allmodconfig build also includes it
because of COMPILE_TEST, while any configuration without
ARCH_FOO that is not compile-testing cannot enable it.

Arnd

2019-09-12 16:58:45

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 1/4] arm64: Kconfig: Fix XGENE driver dependencies

On Thu, Sep 12, 2019 at 12:19 AM Amit Kucheria <[email protected]> wrote:
>
> Push various XGENE drivers behind ARCH_XGENE dependency so that it
> doesn't get enabled by default on other platforms.
>
> Signed-off-by: Amit Kucheria <[email protected]>
> ---
> arch/arm64/Kconfig.platforms | 3 +++
> drivers/clk/Kconfig | 2 +-
> drivers/gpio/Kconfig | 1 +
> drivers/pci/controller/Kconfig | 1 +
> drivers/phy/Kconfig | 1 +
> drivers/power/reset/Kconfig | 2 +-
> 6 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
> index 4778c775de1b..cdf4e452e34c 100644
> --- a/arch/arm64/Kconfig.platforms
> +++ b/arch/arm64/Kconfig.platforms
> @@ -281,6 +281,9 @@ config ARCH_VULCAN
>
> config ARCH_XGENE
> bool "AppliedMicro X-Gene SOC Family"
> + select COMMON_CLK_XGENE
> + select PCI_XGENE
> + select GPIO_XGENE
> help
> This enables support for AppliedMicro X-Gene SOC Family

I'd rather not 'select' drivers that might be optional, the 'default y'
should be sufficient as long as it's in theory possible to have
them disabled or as loadable modules.

> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 801fa1cd0321..9b2790d3f18a 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -225,7 +225,7 @@ config CLK_QORIQ
>
> config COMMON_CLK_XGENE
> bool "Clock driver for APM XGene SoC"
> - default ARCH_XGENE
> + depends on ARCH_XGENE
> depends on ARM64 || COMPILE_TEST
> ---help---
> Sypport for the APM X-Gene SoC reference, PLL, and device clocks.

This breaks compile-testing, and existing defconfigs
that don't list the driver.

Arnd

2019-09-13 11:20:01

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH 3/4] arm64: Kconfig: Fix VEXPRESS driver dependencies

On Thu, Sep 12, 2019 at 03:48:47AM +0530, Amit Kucheria wrote:
> Push various VEXPRESS drivers behind ARCH_VEXPRESS dependency so that it
> doesn't get enabled by default on other platforms.
>

I couldn't understand the motivation for these changes from the cover letter.

> Signed-off-by: Amit Kucheria <[email protected]>
> ---
> drivers/bus/Kconfig | 2 +-
> drivers/clk/versatile/Kconfig | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
> index d80e8d70bf10..b2b1beee9953 100644
> --- a/drivers/bus/Kconfig
> +++ b/drivers/bus/Kconfig
> @@ -166,7 +166,7 @@ config UNIPHIER_SYSTEM_BUS
>
> config VEXPRESS_CONFIG
> bool "Versatile Express configuration bus"
> - default y if ARCH_VEXPRESS
> + depends on ARCH_VEXPRESS
> depends on ARM || ARM64
> depends on OF
> select REGMAP
> diff --git a/drivers/clk/versatile/Kconfig b/drivers/clk/versatile/Kconfig
> index ac766855ba16..826750292c1e 100644
> --- a/drivers/clk/versatile/Kconfig
> +++ b/drivers/clk/versatile/Kconfig
> @@ -5,8 +5,8 @@ config ICST
> config COMMON_CLK_VERSATILE
> bool "Clock driver for ARM Reference designs"
> depends on ARCH_INTEGRATOR || ARCH_REALVIEW || \
> - ARCH_VERSATILE || ARCH_VEXPRESS || ARM64 || \
> - COMPILE_TEST
> + ARCH_VERSATILE || ARCH_VEXPRESS || COMPILE_TEST
> + depends on ARM64

This will break 32-bit platforms.

--
Regards,
Sudeep

2019-09-22 19:05:27

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH 3/4] arm64: Kconfig: Fix VEXPRESS driver dependencies

On Fri, Sep 13, 2019 at 3:12 AM Sudeep Holla <[email protected]> wrote:
>
> On Thu, Sep 12, 2019 at 03:48:47AM +0530, Amit Kucheria wrote:
> > Push various VEXPRESS drivers behind ARCH_VEXPRESS dependency so that it
> > doesn't get enabled by default on other platforms.
> >
>
> I couldn't understand the motivation for these changes from the cover letter.

Yes, the cover letter for this series needs to be a lot better. Sorry.
In summary, I found a bunch of drivers in defconfig that were getting
called in early_initcall and core_initcall even when the platform or
COMPILE_TEST was not enabled. So I was just trying to ring fence some
of those drivers as a proof of concept to see if these changes were
acceptable upstream.

Let me try again with a better cover letter and using the pattern Arnd
suggested elsewhere.

> > Signed-off-by: Amit Kucheria <[email protected]>
> > ---
> > drivers/bus/Kconfig | 2 +-
> > drivers/clk/versatile/Kconfig | 4 ++--
> > 2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
> > index d80e8d70bf10..b2b1beee9953 100644
> > --- a/drivers/bus/Kconfig
> > +++ b/drivers/bus/Kconfig
> > @@ -166,7 +166,7 @@ config UNIPHIER_SYSTEM_BUS
> >
> > config VEXPRESS_CONFIG
> > bool "Versatile Express configuration bus"
> > - default y if ARCH_VEXPRESS
> > + depends on ARCH_VEXPRESS
> > depends on ARM || ARM64
> > depends on OF
> > select REGMAP
> > diff --git a/drivers/clk/versatile/Kconfig b/drivers/clk/versatile/Kconfig
> > index ac766855ba16..826750292c1e 100644
> > --- a/drivers/clk/versatile/Kconfig
> > +++ b/drivers/clk/versatile/Kconfig
> > @@ -5,8 +5,8 @@ config ICST
> > config COMMON_CLK_VERSATILE
> > bool "Clock driver for ARM Reference designs"
> > depends on ARCH_INTEGRATOR || ARCH_REALVIEW || \
> > - ARCH_VERSATILE || ARCH_VEXPRESS || ARM64 || \
> > - COMPILE_TEST
> > + ARCH_VERSATILE || ARCH_VEXPRESS || COMPILE_TEST
> > + depends on ARM64
>
> This will break 32-bit platforms.
>
> --
> Regards,
> Sudeep