From: "Zhang, Rui" <rui.zhang@intel.com>
To: "arnd@kernel.org" <arnd@kernel.org>,
"rafael@kernel.org" <rafael@kernel.org>
Cc: "sudeep.holla@arm.com" <sudeep.holla@arm.com>,
"lukasz.luba@arm.com" <lukasz.luba@arm.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"cristian.marussi@arm.com" <cristian.marussi@arm.com>,
"arnd@arndb.de" <arnd@arndb.de>
Subject: Re: [PATCH] powercap: intel_rapl: fix CONFIG_IOSF_MBI dependency
Date: Fri, 2 Jun 2023 08:04:08 +0000 [thread overview]
Message-ID: <ee67348af01d729a959563f5cb2ecab7534f2e53.camel@intel.com> (raw)
In-Reply-To: <20230601213246.3271412-1-arnd@kernel.org>
Hi, Arnd,
On Thu, 2023-06-01 at 23:32 +0200, Arnd Bergmann wrote:
> 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'
>
IMO, it is the intel_rapl_common.c that calls IOSF APIs without
specifying the dependency. Thus it should be fixed by something like
below,
From 28de4c7d3d4f9fed75a7ecdcf5eea5b89ed77bab Mon Sep 17 00:00:00 2001
From: Zhang Rui <rui.zhang@intel.com>
Date: Fri, 2 Jun 2023 09:02:15 +0800
Subject: [PATCH] powercap/intel_rapl: Fix CONFIG_IOSF_MBI dependency
After commit 3382388d7148 ("intel_rapl: abstract RAPL common code"),
accessing to IOSF 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'
Fixes: 3382388d7148 ("intel_rapl: abstract RAPL common code")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/powercap/Kconfig | 3 ++-
drivers/powercap/intel_rapl_msr.c | 1 -
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/powercap/Kconfig b/drivers/powercap/Kconfig
index e71399804c14..adefdd8a4e12 100644
--- a/drivers/powercap/Kconfig
+++ b/drivers/powercap/Kconfig
@@ -18,10 +18,11 @@ if POWERCAP
# Client driver configurations go here.
config INTEL_RAPL_CORE
tristate
+ select IOSF_MBI
config INTEL_RAPL
tristate "Intel RAPL Support via MSR Interface"
- depends on X86 && IOSF_MBI
+ depends on X86
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 cff5c6e8d570..b536144726f9 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.25.1
> 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.
On the other side, I agree with you that the TPMI driver should work
with iosf_mbi completely disabled.
A cleaner way to do this is to move the rapl_defaults setting (even the
rapl_primitive_info setting) from intel_rapl_common.c to the I/F
drivers, as this is really interface specific.
Maybe we can use the above patch as a quick fix, and remove the
IOSF_MBI dependency from RAPL common code as a long term solution?
thanks,
rui
next prev parent reply other threads:[~2023-06-02 8:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 21:32 [PATCH] powercap: intel_rapl: fix CONFIG_IOSF_MBI dependency Arnd Bergmann
2023-06-02 8:04 ` Zhang, Rui [this message]
2023-06-02 9:11 ` Arnd Bergmann
2023-06-02 16:55 ` Rafael J. Wysocki
2023-06-06 12:41 ` Zhang, Rui
-- strict thread matches above, loose matches on Subject: below --
2023-06-06 14:00 [PATCH] powercap: intel_rapl: Fix " 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee67348af01d729a959563f5cb2ecab7534f2e53.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=cristian.marussi@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox