* [PATCH v2 0/3] SST improvements with TPMI
@ 2024-05-31 8:35 Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 1/3] platform/x86: ISST: Add model specific loading for common module Srinivas Pandruvada
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2024-05-31 8:35 UTC (permalink / raw)
To: hdegoede, ilpo.jarvinen
Cc: platform-driver-x86, linux-kernel, andriy.shevchenko, rui.zhang,
Srinivas Pandruvada
These are some improvements to SST with TPMI, which makes sure that SST
is not available when all model specific parts are not ready and prevent
legacy SST driver to load on some platforms.
V2
Split V1 patch 1/2 to two patches
Use new family model check macros
Srinivas Pandruvada (3):
platform/x86: ISST: Add model specific loading for common module
platform/x86: ISST: Avoid some SkyLake server models
platform/x86: ISST: Use only TPMI interface when present
.../intel/speed_select_if/isst_if_common.c | 75 ++++++++++++-------
.../intel/speed_select_if/isst_if_common.h | 3 +
.../intel/speed_select_if/isst_if_mbox_msr.c | 2 -
3 files changed, 52 insertions(+), 28 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] platform/x86: ISST: Add model specific loading for common module
2024-05-31 8:35 [PATCH v2 0/3] SST improvements with TPMI Srinivas Pandruvada
@ 2024-05-31 8:35 ` Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 2/3] platform/x86: ISST: Avoid some SkyLake server models Srinivas Pandruvada
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2024-05-31 8:35 UTC (permalink / raw)
To: hdegoede, ilpo.jarvinen
Cc: platform-driver-x86, linux-kernel, andriy.shevchenko, rui.zhang,
Srinivas Pandruvada
SST common module is loaded when model specific or TPMI SST driver
registers for services. There are model specific features used in SST
common modules which are checked with a CPU model list. So, this module
is model specific.
There are some use cases where loading the common module independently
only on the supported CPU models helps. The first use case is for
preventing SST TPMI module loading if the model specific features are
not implemented. The second use case for presenting information to
user space when SST is used in OOB (Out of Band) mode.
1.
With TPMI, SST interface is architectural. This means that no need to add
new PCI device IDs for new CPU models. This means that there can be lag
in adding CPU models for the model specific features in the common
module. For example, before adding CPU model to GRANITERAPIDS_D to
hpm_cpu_ids[], SST is still functional for some features and but will
get/set wrong data for features like SST-CP. This is because IOCTL
ISST_IF_GET_PHY_ID, will not give correct mapping for newer CPU models.
So adding explicit model check during load time will prevent such cases.
For unsupported CPU models, common driver will fail to load and hence
dependent modules will not be loaded.
2.
When the SST TPMI features are controlled by some OOB agent (not from OS
interface), even if the CPU model is supported, there will be no user
space interface available for tools as SST TPMI modules will not
be loaded. User space interface is registered when TPMI modules call
isst_if_cdev_register(). Even in this case user space orchestrator
software needs to get power domain information to schedule workload and
get/set turbo ratio limits. This information is exposed by the common
module using IOCTLs ISST_IF_GET_PHY_ID and ISST_IF_MSR_COMMAND
respectively. Since the user space MSR access can be locked, direct MSR
access from the user space is not an option using /dev/cpu/*/msr.
Converge all the existing model checks to one common place and
use driver data to differentiate. On successful model check
call isst_misc_reg().
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
---
v2:
Split the MSR check for Skylake-X to new patch as suggested by Ilpo.
Using new family model check macros.
Note:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy's Reviewed-by was for one version before Rafael and Rui's
comments were addressed. So didn't add it before "---".
We can add it if there is no issue from Andy.
Also incorporated changes suggested by "Wysocki, Rafael J"
<rafael.j.wysocki@intel.com>.
We have all the models supported till date are already in 6.9
kernel. So this is more for future proofing for the first use case.
.../intel/speed_select_if/isst_if_common.c | 63 +++++++++++--------
1 file changed, 37 insertions(+), 26 deletions(-)
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
index 713c0d1fa85f..47f5f26e6c20 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
@@ -718,14 +718,6 @@ static struct miscdevice isst_if_char_driver = {
.fops = &isst_if_char_driver_ops,
};
-static const struct x86_cpu_id hpm_cpu_ids[] = {
- X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_D, NULL),
- X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_X, NULL),
- X86_MATCH_INTEL_FAM6_MODEL(ATOM_CRESTMONT, NULL),
- X86_MATCH_INTEL_FAM6_MODEL(ATOM_CRESTMONT_X, NULL),
- {}
-};
-
static int isst_misc_reg(void)
{
mutex_lock(&punit_misc_dev_reg_lock);
@@ -733,12 +725,6 @@ static int isst_misc_reg(void)
goto unlock_exit;
if (!misc_usage_count) {
- const struct x86_cpu_id *id;
-
- id = x86_match_cpu(hpm_cpu_ids);
- if (id)
- isst_hpm_support = true;
-
misc_device_ret = isst_if_cpu_info_init();
if (misc_device_ret)
goto unlock_exit;
@@ -786,8 +772,6 @@ static void isst_misc_unreg(void)
*/
int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
{
- int ret;
-
if (device_type >= ISST_IF_DEV_MAX)
return -EINVAL;
@@ -805,15 +789,6 @@ int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
punit_callbacks[device_type].registered = 1;
mutex_unlock(&punit_misc_dev_open_lock);
- ret = isst_misc_reg();
- if (ret) {
- /*
- * No need of mutex as the misc device register failed
- * as no one can open device yet. Hence no contention.
- */
- punit_callbacks[device_type].registered = 0;
- return ret;
- }
return 0;
}
EXPORT_SYMBOL_GPL(isst_if_cdev_register);
@@ -829,7 +804,6 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register);
*/
void isst_if_cdev_unregister(int device_type)
{
- isst_misc_unreg();
mutex_lock(&punit_misc_dev_open_lock);
punit_callbacks[device_type].def_ioctl = NULL;
punit_callbacks[device_type].registered = 0;
@@ -839,5 +813,42 @@ void isst_if_cdev_unregister(int device_type)
}
EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);
+#define SST_HPM_SUPPORTED 0x01
+
+static const struct x86_cpu_id isst_cpu_ids[] = {
+ X86_MATCH_VFM(INTEL_ATOM_CRESTMONT, SST_HPM_SUPPORTED),
+ X86_MATCH_VFM(INTEL_ATOM_CRESTMONT_X, SST_HPM_SUPPORTED),
+ X86_MATCH_VFM(INTEL_EMERALDRAPIDS_X, 0),
+ X86_MATCH_VFM(INTEL_GRANITERAPIDS_D, SST_HPM_SUPPORTED),
+ X86_MATCH_VFM(INTEL_GRANITERAPIDS_X, SST_HPM_SUPPORTED),
+ X86_MATCH_VFM(INTEL_ICELAKE_D, 0),
+ X86_MATCH_VFM(INTEL_ICELAKE_X, 0),
+ X86_MATCH_VFM(INTEL_SAPPHIRERAPIDS_X, 0),
+ X86_MATCH_VFM(INTEL_SKYLAKE_X, 0),
+ {}
+};
+MODULE_DEVICE_TABLE(x86cpu, isst_cpu_ids);
+
+static int __init isst_if_common_init(void)
+{
+ const struct x86_cpu_id *id;
+
+ id = x86_match_cpu(isst_cpu_ids);
+ if (!id)
+ return -ENODEV;
+
+ if (id->driver_data == SST_HPM_SUPPORTED)
+ isst_hpm_support = true;
+
+ return isst_misc_reg();
+}
+module_init(isst_if_common_init)
+
+static void __exit isst_if_common_exit(void)
+{
+ isst_misc_unreg();
+}
+module_exit(isst_if_common_exit)
+
MODULE_DESCRIPTION("ISST common interface module");
MODULE_LICENSE("GPL v2");
--
2.40.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] platform/x86: ISST: Avoid some SkyLake server models
2024-05-31 8:35 [PATCH v2 0/3] SST improvements with TPMI Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 1/3] platform/x86: ISST: Add model specific loading for common module Srinivas Pandruvada
@ 2024-05-31 8:35 ` Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 3/3] platform/x86: ISST: Use only TPMI interface when present Srinivas Pandruvada
2024-05-31 13:45 ` [PATCH v2 0/3] SST improvements with TPMI Ilpo Järvinen
3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2024-05-31 8:35 UTC (permalink / raw)
To: hdegoede, ilpo.jarvinen
Cc: platform-driver-x86, linux-kernel, andriy.shevchenko, rui.zhang,
Srinivas Pandruvada
Some SkyLake server variants don't support any SST functionality. No use
of providing any SST related interfaces on them.
All supported SkyLake servers provide mailbox interface via MSR. So check
for the presence of MSR 0xB0 and 0xB1. If not present don't load common
module.
Move defines for MSR_OS_MAILBOX_INTERFACE and MSR_OS_MAILBOX_DATA to
common header file to avoid duplicating them.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
New patch, split from v1 1/2
The mbox MSR defines are moved to common header file to avoid duplicates
.../x86/intel/speed_select_if/isst_if_common.c | 13 +++++++++++--
.../x86/intel/speed_select_if/isst_if_common.h | 3 +++
.../x86/intel/speed_select_if/isst_if_mbox_msr.c | 2 --
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
index 47f5f26e6c20..7ea058571ab5 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
@@ -814,6 +814,7 @@ void isst_if_cdev_unregister(int device_type)
EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);
#define SST_HPM_SUPPORTED 0x01
+#define SST_MBOX_SUPPORTED 0x02
static const struct x86_cpu_id isst_cpu_ids[] = {
X86_MATCH_VFM(INTEL_ATOM_CRESTMONT, SST_HPM_SUPPORTED),
@@ -824,7 +825,7 @@ static const struct x86_cpu_id isst_cpu_ids[] = {
X86_MATCH_VFM(INTEL_ICELAKE_D, 0),
X86_MATCH_VFM(INTEL_ICELAKE_X, 0),
X86_MATCH_VFM(INTEL_SAPPHIRERAPIDS_X, 0),
- X86_MATCH_VFM(INTEL_SKYLAKE_X, 0),
+ X86_MATCH_VFM(INTEL_SKYLAKE_X, SST_MBOX_SUPPORTED),
{}
};
MODULE_DEVICE_TABLE(x86cpu, isst_cpu_ids);
@@ -837,8 +838,16 @@ static int __init isst_if_common_init(void)
if (!id)
return -ENODEV;
- if (id->driver_data == SST_HPM_SUPPORTED)
+ if (id->driver_data == SST_HPM_SUPPORTED) {
isst_hpm_support = true;
+ } else if (id->driver_data == SST_MBOX_SUPPORTED) {
+ u64 data;
+
+ /* Can fail only on some Skylake-X generations */
+ if (rdmsrl_safe(MSR_OS_MAILBOX_INTERFACE, &data) ||
+ rdmsrl_safe(MSR_OS_MAILBOX_DATA, &data))
+ return -ENODEV;
+ }
return isst_misc_reg();
}
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.h b/drivers/platform/x86/intel/speed_select_if/isst_if_common.h
index 1004f2c9cca8..378055fe1d16 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.h
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.h
@@ -16,6 +16,9 @@
#define PCI_DEVICE_ID_INTEL_RAPL_PRIO_DEVID_1 0x3251
#define PCI_DEVICE_ID_INTEL_CFG_MBOX_DEVID_1 0x3259
+#define MSR_OS_MAILBOX_INTERFACE 0xB0
+#define MSR_OS_MAILBOX_DATA 0xB1
+
/*
* Validate maximum commands in a single request.
* This is enough to handle command to every core in one ioctl, or all
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c
index 1b6eab071068..48b608eaca5f 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c
@@ -21,8 +21,6 @@
#include "isst_if_common.h"
-#define MSR_OS_MAILBOX_INTERFACE 0xB0
-#define MSR_OS_MAILBOX_DATA 0xB1
#define MSR_OS_MAILBOX_BUSY_BIT 31
/*
--
2.40.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] platform/x86: ISST: Use only TPMI interface when present
2024-05-31 8:35 [PATCH v2 0/3] SST improvements with TPMI Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 1/3] platform/x86: ISST: Add model specific loading for common module Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 2/3] platform/x86: ISST: Avoid some SkyLake server models Srinivas Pandruvada
@ 2024-05-31 8:35 ` Srinivas Pandruvada
2024-05-31 13:45 ` [PATCH v2 0/3] SST improvements with TPMI Ilpo Järvinen
3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2024-05-31 8:35 UTC (permalink / raw)
To: hdegoede, ilpo.jarvinen
Cc: platform-driver-x86, linux-kernel, andriy.shevchenko, rui.zhang,
Srinivas Pandruvada
When the TPMI interface is present, use this interface instead of legacy.
On some systems legacy IO device is also present. Using both interfaces
together is confusing and may set the hardware in inconsistent state.
When TPMI interface is present, don't load legacy drivers.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
Previously 2/2, now 3/3
No change except reviewed-by Ilpo.
drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
index 7ea058571ab5..10e21563fa46 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
@@ -775,6 +775,9 @@ int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
if (device_type >= ISST_IF_DEV_MAX)
return -EINVAL;
+ if (device_type < ISST_IF_DEV_TPMI && isst_hpm_support)
+ return -ENODEV;
+
mutex_lock(&punit_misc_dev_open_lock);
/* Device is already open, we don't want to add new callbacks */
if (misc_device_open) {
--
2.40.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/3] SST improvements with TPMI
2024-05-31 8:35 [PATCH v2 0/3] SST improvements with TPMI Srinivas Pandruvada
` (2 preceding siblings ...)
2024-05-31 8:35 ` [PATCH v2 3/3] platform/x86: ISST: Use only TPMI interface when present Srinivas Pandruvada
@ 2024-05-31 13:45 ` Ilpo Järvinen
3 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2024-05-31 13:45 UTC (permalink / raw)
To: hdegoede, Srinivas Pandruvada
Cc: platform-driver-x86, linux-kernel, andriy.shevchenko, rui.zhang
On Fri, 31 May 2024 01:35:45 -0700, Srinivas Pandruvada wrote:
> These are some improvements to SST with TPMI, which makes sure that SST
> is not available when all model specific parts are not ready and prevent
> legacy SST driver to load on some platforms.
>
> V2
> Split V1 patch 1/2 to two patches
> Use new family model check macros
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/3] platform/x86: ISST: Add model specific loading for common module
commit: 1630dc626c87b300627fe7591f4f63f8f136f935
[2/3] platform/x86: ISST: Avoid some SkyLake server models
commit: 3ea025fb4b5f1a0b66df25eba50b2a1071f01080
[3/3] platform/x86: ISST: Use only TPMI interface when present
commit: 2f9514f005530502452c34295e77bdfb395b5bc6
--
i.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-31 13:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-31 8:35 [PATCH v2 0/3] SST improvements with TPMI Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 1/3] platform/x86: ISST: Add model specific loading for common module Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 2/3] platform/x86: ISST: Avoid some SkyLake server models Srinivas Pandruvada
2024-05-31 8:35 ` [PATCH v2 3/3] platform/x86: ISST: Use only TPMI interface when present Srinivas Pandruvada
2024-05-31 13:45 ` [PATCH v2 0/3] SST improvements with TPMI Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®