linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powercap: intel_rapl: Fix CONFIG_IOSF_MBI dependency
@ 2023-06-06 14:00 Zhang Rui
  2023-06-06 15:45 ` kernel test robot
  2023-06-06 16:17 ` kernel test robot
  0 siblings, 2 replies; 10+ messages in thread
From: Zhang Rui @ 2023-06-06 14:00 UTC (permalink / raw)
  To: linux-pm, rafael.j.wysocki, daniel.lezcano; +Cc: linux-kernel, arnd

After commit 3382388d7148 ("intel_rapl: abstract RAPL common code"),
accessing to IOSF_MBI interface is done in the RAPL common code.

Thus it is the CONFIG_INTEL_RAPL_CORE that has dependency of
CONFIG_IOSF_MBI, while CONFIG_INTEL_RAPL_MSR does not.

This problem was not exposed previously because all the previous RAPL
common code users, aka, the RAPL MSR and MMIO I/F drivers, have
CONFIG_IOSF_MBI selected.

Fix the CONFIG_IOSF_MBI dependency in RAPL code. This also fixes a build
time failure when the RAPL TPMI I/F driver is introduced without
selecting CONFIG_IOSF_MBI.

x86_64-linux-ld: vmlinux.o: in function `set_floor_freq_atom':
intel_rapl_common.c:(.text+0x2dac9b8): undefined reference to `iosf_mbi_write'
x86_64-linux-ld: intel_rapl_common.c:(.text+0x2daca66): undefined reference to `iosf_mbi_read'

Reference to iosf_mbi.h is also removed from the RAPL MSR I/F driver.

Fixes: 3382388d7148 ("intel_rapl: abstract RAPL common code")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/all/20230601213246.3271412-1-arnd@kernel.org
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/powercap/Kconfig          | 4 +++-
 drivers/powercap/intel_rapl_msr.c | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/powercap/Kconfig b/drivers/powercap/Kconfig
index 90d33cd1b670..b063f7511773 100644
--- a/drivers/powercap/Kconfig
+++ b/drivers/powercap/Kconfig
@@ -18,10 +18,12 @@ if POWERCAP
 # Client driver configurations go here.
 config INTEL_RAPL_CORE
 	tristate
+	depends on PCI
+	select IOSF_MBI
 
 config INTEL_RAPL
 	tristate "Intel RAPL Support via MSR Interface"
-	depends on X86 && IOSF_MBI
+	depends on X86 && PCI
 	select INTEL_RAPL_CORE
 	help
 	  This enables support for the Intel Running Average Power Limit (RAPL)
diff --git a/drivers/powercap/intel_rapl_msr.c b/drivers/powercap/intel_rapl_msr.c
index a27673706c3d..be118d46f32e 100644
--- a/drivers/powercap/intel_rapl_msr.c
+++ b/drivers/powercap/intel_rapl_msr.c
@@ -22,7 +22,6 @@
 #include <linux/processor.h>
 #include <linux/platform_device.h>
 
-#include <asm/iosf_mbi.h>
 #include <asm/cpu_device_id.h>
 #include <asm/intel-family.h>
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] powercap: intel_rapl: fix CONFIG_IOSF_MBI dependency
@ 2023-06-01 21:32 Arnd Bergmann
  2023-06-02  8:04 ` Zhang, Rui
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2023-06-01 21:32 UTC (permalink / raw)
  To: Rafael J. Wysocki, Zhang Rui
  Cc: Arnd Bergmann, Lukasz Luba, Cristian Marussi, Sudeep Holla,
	linux-pm, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When the intel_rapl driver is built-in, but iosf_mbi is a loadable module,
the kernel fails to link:

x86_64-linux-ld: vmlinux.o: in function `set_floor_freq_atom':
intel_rapl_common.c:(.text+0x2dac9b8): undefined reference to `iosf_mbi_write'
x86_64-linux-ld: intel_rapl_common.c:(.text+0x2daca66): undefined reference to `iosf_mbi_read'

The driver can work with iosf_mbi completely disabled, so add a dependency
that still allows this configuration, but otherwise forces it to not be
built-in when iosf_mbi is a loadable module.

Fixes: 9eef7f9da928c ("powercap: intel_rapl: Introduce RAPL TPMI interface driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/powercap/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/powercap/Kconfig b/drivers/powercap/Kconfig
index e71399804c143..21ad50b22d6b9 100644
--- a/drivers/powercap/Kconfig
+++ b/drivers/powercap/Kconfig
@@ -36,6 +36,7 @@ config INTEL_RAPL
 config INTEL_RAPL_TPMI
 	tristate "Intel RAPL Support via TPMI Interface"
 	depends on X86
+	depends on IOSF_MBI || IOSF_MBI=n
 	depends on INTEL_TPMI
 	select INTEL_RAPL_CORE
 	help
-- 
2.39.2


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

end of thread, other threads:[~2023-06-12 17:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06 14:00 [PATCH] powercap: intel_rapl: Fix CONFIG_IOSF_MBI dependency Zhang Rui
2023-06-06 15:45 ` kernel test robot
2023-06-07  2:22   ` Zhang, Rui
2023-06-12 17:50     ` Rafael J. Wysocki
2023-06-06 16:17 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-06-01 21:32 [PATCH] powercap: intel_rapl: fix " Arnd Bergmann
2023-06-02  8:04 ` Zhang, Rui
2023-06-02  9:11   ` Arnd Bergmann
2023-06-02 16:55     ` Rafael J. Wysocki
2023-06-06 12:41       ` Zhang, Rui

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