Skip to contentSkip to conversation

cpufreq: Enable COMPILE_TEST on Arm drivers

PATCH Applied Rob Herring (Arm) 4 participants 11 messages Aug 6, 2024 – Aug 8, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover cpufreq: Enable COMPILE_TEST on Arm drivers

This series enables building CPUFreq Arm based drivers on multiple architectures when COMPILE_TEST is enabled.

The drivers for x86 and powerpc appear to be dependent on the respective arch code, so those can't be similarly enabled for COMPILE_TEST.

I've built this on arm32, arm64, powerpc, and x86 allmodconfig. It's been built by 0-day and I fixed a couple of issues from that. I imagine a few more might crop up when this is added to linux-next.

---
Rob Herring (Arm) (6):
cpufreq: qcom: Add explicit io.h include for readl/writel_relaxed
cpufreq: omap: Drop asm includes
cpufreq: armada-8k: Avoid excessive stack usage
opp: ti: Drop unnecessary of_match_ptr()
cpufreq: Enable COMPILE_TEST on Arm drivers
cpufreq: Drop CONFIG_ARM and CONFIG_ARM64 dependency on Arm drivers

 drivers/cpufreq/Kconfig             |  2 --
 drivers/cpufreq/Kconfig.arm         | 50 ++++++++++++++++++++++---------------
 drivers/cpufreq/armada-8k-cpufreq.c |  2 +-
 drivers/cpufreq/omap-cpufreq.c      |  3 ---
 drivers/cpufreq/qcom-cpufreq-hw.c   |  1 +
 drivers/opp/ti-opp-supply.c         |  2 +-
 6 files changed, 33 insertions(+), 27 deletions(-)

---
base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b
change-id: 20240805-dt-api-cleanups-d63eb4f53423

Best regards,

Signature · 1 line
Rob Herring (Arm) <[email protected]>
#1 lore raw

PATCH 1/6 cpufreq: qcom: Add explicit io.h include for readl/writel_relaxed

The qcom-cpufreq-hw driver is relying on an implicit include of io.h which doesn't get included on some architectures.

---
 drivers/cpufreq/qcom-cpufreq-hw.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/qcom-cpufreq-hw.c +1 -0
index 370fe6a0104b..900d6844c43d 100644
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/interconnect.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/6 cpufreq: omap: Drop asm includes

In reply to Rob Herring (Arm)

The omap driver doesn't actually need asm/smp_plat.h, so drop it. asm/cpu.h is not needed either as linux/cpu.h is already included.

---
 drivers/cpufreq/omap-cpufreq.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/cpufreq/omap-cpufreq.c +0 -3
index 3458d5cc9b7f..de8be0a8932d 100644
@@ -28,9 +28,6 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 
-#include <asm/smp_plat.h>
-#include <asm/cpu.h>
-
 /* OPP tolerance in percentage */
 #define	OPP_TOLERANCE	4
 
Signature · 1 line
2.43.0
Acked-by on v1 2/6
#3 lore raw

Re: [PATCH 2/6] cpufreq: omap: Drop asm includes

Quoted 4 lines · Rob Herring (Arm)

The omap driver doesn't actually need asm/smp_plat.h, so drop it. asm/cpu.h is not needed either as linux/cpu.h is already included.

Quoted 21 lines
---
 drivers/cpufreq/omap-cpufreq.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/cpufreq/omap-cpufreq.c +0 -3
index 3458d5cc9b7f..de8be0a8932d 100644
@@ -28,9 +28,6 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 
-#include <asm/smp_plat.h>
-#include <asm/cpu.h>
-
 /* OPP tolerance in percentage */
 #define	OPP_TOLERANCE	4
 
Signature · 2 lines
-- 
2.43.0
Reviewed-by
#4 lore raw

Re: [PATCH 2/6] cpufreq: omap: Drop asm includes

Quoted 8 lines · Kevin Hilman
Quoted 4 lines · Rob Herring (Arm)

The omap driver doesn't actually need asm/smp_plat.h, so drop it. asm/cpu.h is not needed either as linux/cpu.h is already included.

Quoted 23 lines
Quoted 22 lines
---
 drivers/cpufreq/omap-cpufreq.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/cpufreq/omap-cpufreq.c +0 -3
index 3458d5cc9b7f..de8be0a8932d 100644
@@ -28,9 +28,6 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 
-#include <asm/smp_plat.h>
-#include <asm/cpu.h>
-
 /* OPP tolerance in percentage */
 #define	OPP_TOLERANCE	4
 
Signature · 2 lines
-- 
2.43.0
Signature · 2 lines
Best regards,
Dhruva
#5 lore raw

PATCH 3/6 cpufreq: armada-8k: Avoid excessive stack usage

In reply to Rob Herring (Arm)

In some build configurations (e.g. x86 allmodconfig), 2 cpu_mask variables exceeds the max stack frame size:

drivers/cpufreq/armada-8k-cpufreq.c:203:1: error: the frame size of 2128 bytes is larger than 2048 bytes

Fix it by making "cpus" static which is fine given that module init is only called once.

---
 drivers/cpufreq/armada-8k-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/armada-8k-cpufreq.c +1 -1
index ce5a5641b6dd..7a979db81f09 100644
@@ -132,7 +132,7 @@ static int __init armada_8k_cpufreq_init(void)
 	int ret = 0, opps_index = 0, cpu, nb_cpus;
 	struct freq_table *freq_tables;
 	struct device_node *node;
-	struct cpumask cpus;
+	static struct cpumask cpus;
 
 	node = of_find_matching_node_and_match(NULL, armada_8k_cpufreq_of_match,
 					       NULL);
Signature · 1 line
2.43.0
#6 lore raw

PATCH 4/6 opp: ti: Drop unnecessary of_match_ptr()

In reply to Rob Herring (Arm)

of_match_ptr() is not necessary as the driver is always enabled for DT.

---
 drivers/opp/ti-opp-supply.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/ti-opp-supply.c +1 -1
index ec0056a4bb13..5f0fb3ea385b 100644
@@ -405,7 +405,7 @@ static struct platform_driver ti_opp_supply_driver = {
 	.probe = ti_opp_supply_probe,
 	.driver = {
 		   .name = "ti_opp_supply",
-		   .of_match_table = of_match_ptr(ti_opp_supply_of_match),
+		   .of_match_table = ti_opp_supply_of_match,
 		   },
 };
 module_platform_driver(ti_opp_supply_driver);
Signature · 1 line
2.43.0
Reviewed-by on v1 4/6
#7 lore raw

Re: [PATCH 4/6] opp: ti: Drop unnecessary of_match_ptr()

Quoted 12 lines · Rob Herring (Arm)

of_match_ptr() is not necessary as the driver is always enabled for DT.

---
 drivers/opp/ti-opp-supply.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/ti-opp-supply.c +0 -0
index ec0056a4bb13..5f0fb3ea385b 100644

drivers/opp/ti-opp-supply.c static struct platform_driver ti_opp_supply_driver = { · line 408

Quoted 5 lines
drivers/opp/ti-opp-supply.c +1 -1
@@ -405,7 +405,7 @@ static struct platform_driver ti_opp_supply_driver = {
 	.probe = ti_opp_supply_probe,
 	.driver = {
 		   .name = "ti_opp_supply",
-		   .of_match_table = of_match_ptr(ti_opp_supply_of_match),
+		   .of_match_table = ti_opp_supply_of_match,
Signature · 2 lines
Best regards,
Dhruva
#8 lore raw

PATCH 5/6 cpufreq: Enable COMPILE_TEST on Arm drivers

In reply to Rob Herring (Arm)

COMPILE_TEST is useful for build testing without requiring a specific architecture's compiler. Enable it for most of the Arm CPUFreq drivers.

As Kconfig.arm is only included on ARM and ARM64, COMPILE_TEST is only enabled for those architectures until that is dropped.

---
 drivers/cpufreq/Kconfig.arm | 50 +++++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 20 deletions(-)
drivers/cpufreq/Kconfig.arm +30 -20
index 96b404ce829f..5f7e13e60c80 100644
@@ -5,7 +5,7 @@
 
 config ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM
 	tristate "Allwinner nvmem based SUN50I CPUFreq driver"
-	depends on ARCH_SUNXI
+	depends on ARCH_SUNXI || COMPILE_TEST
 	depends on NVMEM_SUNXI_SID
 	select PM_OPP
 	help
@@ -26,15 +26,17 @@ config ARM_APPLE_SOC_CPUFREQ
 
 config ARM_ARMADA_37XX_CPUFREQ
 	tristate "Armada 37xx CPUFreq support"
-	depends on ARCH_MVEBU && CPUFREQ_DT
+	depends on ARCH_MVEBU || COMPILE_TEST
+	depends on CPUFREQ_DT
 	help
 	  This adds the CPUFreq driver support for Marvell Armada 37xx SoCs.
 	  The Armada 37xx PMU supports 4 frequency and VDD levels.
 
 config ARM_ARMADA_8K_CPUFREQ
 	tristate "Armada 8K CPUFreq driver"
-	depends on ARCH_MVEBU && CPUFREQ_DT
-	select ARMADA_AP_CPU_CLK
+	depends on ARCH_MVEBU || COMPILE_TEST
+	depends on CPUFREQ_DT
+	select ARMADA_AP_CPU_CLK if COMMON_CLK
 	help
 	  This enables the CPUFreq driver support for Marvell
 	  Armada8k SOCs.
@@ -56,7 +58,7 @@ config ARM_SCPI_CPUFREQ
 config ARM_VEXPRESS_SPC_CPUFREQ
 	tristate "Versatile Express SPC based CPUfreq driver"
 	depends on ARM_CPU_TOPOLOGY && HAVE_CLK
-	depends on ARCH_VEXPRESS_SPC
+	depends on ARCH_VEXPRESS_SPC || COMPILE_TEST
 	select PM_OPP
 	help
 	  This add the CPUfreq driver support for Versatile Express
@@ -75,7 +77,8 @@ config ARM_BRCMSTB_AVS_CPUFREQ
 
 config ARM_HIGHBANK_CPUFREQ
 	tristate "Calxeda Highbank-based"
-	depends on ARCH_HIGHBANK && CPUFREQ_DT && REGULATOR
+	depends on ARCH_HIGHBANK || COMPILE_TEST
+	depends on CPUFREQ_DT && REGULATOR && PL320_MBOX
 	default m
 	help
 	  This adds the CPUFreq driver for Calxeda Highbank SoC
@@ -96,7 +99,8 @@ config ARM_IMX6Q_CPUFREQ
 
 config ARM_IMX_CPUFREQ_DT
 	tristate "Freescale i.MX8M cpufreq support"
-	depends on ARCH_MXC && CPUFREQ_DT
+	depends on CPUFREQ_DT
+	depends on ARCH_MXC || COMPILE_TEST
 	help
 	  This adds cpufreq driver support for Freescale i.MX7/i.MX8M
 	  series SoCs, based on cpufreq-dt.
@@ -111,7 +115,8 @@ config ARM_KIRKWOOD_CPUFREQ
 
 config ARM_MEDIATEK_CPUFREQ
 	tristate "CPU Frequency scaling support for MediaTek SoCs"
-	depends on ARCH_MEDIATEK && REGULATOR
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	depends on REGULATOR
 	select PM_OPP
 	help
 	  This adds the CPUFreq driver support for MediaTek SoCs.
@@ -130,12 +135,12 @@ config ARM_MEDIATEK_CPUFREQ_HW
 
 config ARM_OMAP2PLUS_CPUFREQ
 	bool "TI OMAP2+"
-	depends on ARCH_OMAP2PLUS
+	depends on ARCH_OMAP2PLUS || COMPILE_TEST
 	default ARCH_OMAP2PLUS
 
 config ARM_QCOM_CPUFREQ_NVMEM
 	tristate "Qualcomm nvmem based CPUFreq"
-	depends on ARCH_QCOM
+	depends on ARCH_QCOM || COMPILE_TEST
 	depends on NVMEM_QCOM_QFPROM
 	depends on QCOM_SMEM
 	select PM_OPP
@@ -166,7 +171,7 @@ config ARM_RASPBERRYPI_CPUFREQ
 
 config ARM_S3C64XX_CPUFREQ
 	bool "Samsung S3C64XX"
-	depends on CPU_S3C6410
+	depends on CPU_S3C6410 || COMPILE_TEST
 	default y
 	help
 	  This adds the CPUFreq driver for Samsung S3C6410 SoC.
@@ -175,7 +180,7 @@ config ARM_S3C64XX_CPUFREQ
 
 config ARM_S5PV210_CPUFREQ
 	bool "Samsung S5PV210 and S5PC110"
-	depends on CPU_S5PV210
+	depends on CPU_S5PV210 || COMPILE_TEST
 	default y
 	help
 	  This adds the CPUFreq driver for Samsung S5PV210 and
@@ -199,14 +204,15 @@ config ARM_SCMI_CPUFREQ
 
 config ARM_SPEAR_CPUFREQ
 	bool "SPEAr CPUFreq support"
-	depends on PLAT_SPEAR
+	depends on PLAT_SPEAR || COMPILE_TEST
 	default y
 	help
 	  This adds the CPUFreq driver support for SPEAr SOCs.
 
 config ARM_STI_CPUFREQ
 	tristate "STi CPUFreq support"
-	depends on CPUFREQ_DT && SOC_STIH407
+	depends on CPUFREQ_DT
+	depends on SOC_STIH407 || COMPILE_TEST
 	help
 	  This driver uses the generic OPP framework to match the running
 	  platform with a predefined set of suitable values.  If not provided
@@ -216,34 +222,38 @@ config ARM_STI_CPUFREQ
 
 config ARM_TEGRA20_CPUFREQ
 	tristate "Tegra20/30 CPUFreq support"
-	depends on ARCH_TEGRA && CPUFREQ_DT
+	depends on ARCH_TEGRA || COMPILE_TEST
+	depends on CPUFREQ_DT
 	default y
 	help
 	  This adds the CPUFreq driver support for Tegra20/30 SOCs.
 
 config ARM_TEGRA124_CPUFREQ
 	bool "Tegra124 CPUFreq support"
-	depends on ARCH_TEGRA && CPUFREQ_DT
+	depends on ARCH_TEGRA || COMPILE_TEST
+	depends on CPUFREQ_DT
 	default y
 	help
 	  This adds the CPUFreq driver support for Tegra124 SOCs.
 
 config ARM_TEGRA186_CPUFREQ
 	tristate "Tegra186 CPUFreq support"
-	depends on ARCH_TEGRA && TEGRA_BPMP
+	depends on ARCH_TEGRA || COMPILE_TEST
+	depends on TEGRA_BPMP
 	help
 	  This adds the CPUFreq driver support for Tegra186 SOCs.
 
 config ARM_TEGRA194_CPUFREQ
 	tristate "Tegra194 CPUFreq support"
-	depends on ARCH_TEGRA_194_SOC && TEGRA_BPMP
+	depends on ARCH_TEGRA_194_SOC || (64BIT && COMPILE_TEST)
+	depends on TEGRA_BPMP
 	default y
 	help
 	  This adds CPU frequency driver support for Tegra194 SOCs.
 
 config ARM_TI_CPUFREQ
 	bool "Texas Instruments CPUFreq support"
-	depends on ARCH_OMAP2PLUS || ARCH_K3
+	depends on ARCH_OMAP2PLUS || ARCH_K3 || COMPILE_TEST
 	default y
 	help
 	  This driver enables valid OPPs on the running platform based on
@@ -255,7 +265,7 @@ config ARM_TI_CPUFREQ
 
 config ARM_PXA2xx_CPUFREQ
 	tristate "Intel PXA2xx CPUfreq driver"
-	depends on PXA27x || PXA25x
+	depends on PXA27x || PXA25x || COMPILE_TEST
 	help
 	  This add the CPUFreq driver support for Intel PXA2xx SOCs.
 
Signature · 1 line
2.43.0
#9 lore raw

PATCH 6/6 cpufreq: Drop CONFIG_ARM and CONFIG_ARM64 dependency on Arm drivers

In reply to Rob Herring (Arm)

The CONFIG_ARM and CONFIG_ARM64 dependency is redundant as all the drivers have necessary sub-arch dependency and don't depend on the architecture support.

---
 drivers/cpufreq/Kconfig | 2 --
 1 file changed, 2 deletions(-)
drivers/cpufreq/Kconfig +0 -2
index 10cda6f2fe1d..2561b215432a 100644
@@ -231,9 +231,7 @@ if X86
 source "drivers/cpufreq/Kconfig.x86"
 endif
 
-if ARM || ARM64
 source "drivers/cpufreq/Kconfig.arm"
-endif
 
 if PPC32 || PPC64
 source "drivers/cpufreq/Kconfig.powerpc"
Signature · 1 line
2.43.0
maintainer Applied
#10 lore raw
In reply to Rob Herring (Arm)
Quoted 12 lines · Rob Herring (Arm)

This series enables building CPUFreq Arm based drivers on multiple architectures when COMPILE_TEST is enabled.

The drivers for x86 and powerpc appear to be dependent on the respective arch code, so those can't be similarly enabled for COMPILE_TEST.

I've built this on arm32, arm64, powerpc, and x86 allmodconfig. It's been built by 0-day and I fixed a couple of issues from that. I imagine a few more might crop up when this is added to linux-next.

Quoted 8 lines

---
Rob Herring (Arm) (6):
cpufreq: qcom: Add explicit io.h include for readl/writel_relaxed
cpufreq: omap: Drop asm includes
cpufreq: armada-8k: Avoid excessive stack usage
opp: ti: Drop unnecessary of_match_ptr()
cpufreq: Enable COMPILE_TEST on Arm drivers
cpufreq: Drop CONFIG_ARM and CONFIG_ARM64 dependency on Arm drivers

Applied. Thanks.

Signature · 1 line
viresh