mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, andriy.shevchenko@linux.intel.com,
	rui.zhang@intel.com,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH v2 2/3] platform/x86: ISST: Avoid some SkyLake server models
Date: Fri, 31 May 2024 01:35:47 -0700	[thread overview]
Message-ID: <20240531083554.1313110-3-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20240531083554.1313110-1-srinivas.pandruvada@linux.intel.com>

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


  parent reply	other threads:[~2024-05-31  8:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20240531083554.1313110-3-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rui.zhang@intel.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

all inboxes | Powered by JetHome®