From: Suma Hegde <suma.hegde@amd.com>
To: <platform-driver-x86@vger.kernel.org>
Cc: <ilpo.jarvinen@linux.intel.com>, <hdegoede@redhat.com>,
Suma Hegde <suma.hegde@amd.com>,
Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Subject: [PATCH 1/3] platform/x86/amd/hsmp: Check HSMP support on AMD family of processors
Date: Tue, 23 Apr 2024 09:14:32 +0000 [thread overview]
Message-ID: <20240423091434.2063246-2-suma.hegde@amd.com> (raw)
In-Reply-To: <20240423091434.2063246-1-suma.hegde@amd.com>
HSMP interface is supported only on few x86 processors from AMD.
Accessing HSMP registers on rest of the platforms might cause
unexpected behaviour. So add a check.
Also unavailability of this interface on rest of the processors
is not an error. Hence, use pr_info() instead of the pr_err() to
log the message.
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
---
drivers/platform/x86/amd/hsmp.c | 54 ++++++++++++++++++++++++++++-----
1 file changed, 47 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c
index 1927be901108..807a5066dacc 100644
--- a/drivers/platform/x86/amd/hsmp.c
+++ b/drivers/platform/x86/amd/hsmp.c
@@ -907,16 +907,48 @@ static int hsmp_plat_dev_register(void)
return ret;
}
+/*
+ * This check is only needed for backward compatibility of previous platforms.
+ * All new platforms are expected to support ACPI based probing.
+ */
+static bool is_hsmp_supported(void)
+{
+ bool ret = true;
+
+ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
+ return false;
+
+ switch (boot_cpu_data.x86) {
+ case 0x19:
+ switch (boot_cpu_data.x86_model) {
+ case 0x00 ... 0x1F:
+ case 0x30 ... 0x3F:
+ case 0x90 ... 0x9F:
+ case 0xA0 ... 0xAF:
+ break;
+ default:
+ ret = false;
+ }
+ break;
+ case 0x1A:
+ switch (boot_cpu_data.x86_model) {
+ case 0x00 ... 0x1F:
+ break;
+ default:
+ ret = false;
+ }
+ break;
+ default:
+ ret = false;
+ }
+
+ return ret;
+}
+
static int __init hsmp_plt_init(void)
{
int ret = -ENODEV;
- if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD || boot_cpu_data.x86 < 0x19) {
- pr_err("HSMP is not supported on Family:%x model:%x\n",
- boot_cpu_data.x86, boot_cpu_data.x86_model);
- return ret;
- }
-
/*
* amd_nb_num() returns number of SMN/DF interfaces present in the system
* if we have N SMN/DF interfaces that ideally means N sockets
@@ -930,7 +962,15 @@ static int __init hsmp_plt_init(void)
return ret;
if (!plat_dev.is_acpi_device) {
- ret = hsmp_plat_dev_register();
+ if (is_hsmp_supported()) {
+ /* Not ACPI device, but supports HSMP, register a plat_dev */
+ ret = hsmp_plat_dev_register();
+ } else {
+ /* Not ACPI, Does not support HSMP */
+ pr_info("HSMP is not supported on Family:%x model:%x\n",
+ boot_cpu_data.x86, boot_cpu_data.x86_model);
+ ret = -ENODEV;
+ }
if (ret)
platform_driver_unregister(&amd_hsmp_driver);
}
--
2.25.1
next prev parent reply other threads:[~2024-04-23 9:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 9:14 [PATCH 0/3] platform/x86/amd/hsmp: ACPI, Non-ACPI code split and other misc changes Suma Hegde
2024-04-23 9:14 ` Suma Hegde [this message]
2024-04-23 17:11 ` [PATCH 1/3] platform/x86/amd/hsmp: Check HSMP support on AMD family of processors Mario Limonciello
2024-04-25 10:03 ` Hegde, Suma
2024-04-23 9:14 ` [PATCH 2/3] platform/x86/amd/hsmp: Split the ACPI and non-ACPI code Suma Hegde
2024-04-23 17:13 ` Mario Limonciello
2024-04-23 9:14 ` [PATCH 3/3] platform/x86/amd/hsmp: Make HSMP as default m Suma Hegde
2024-04-23 17:17 ` Mario Limonciello
2024-04-25 6:59 ` Hegde, Suma
2024-04-23 17:07 ` [PATCH 0/3] platform/x86/amd/hsmp: ACPI, Non-ACPI code split and other misc changes Mario Limonciello
2024-04-29 8:50 ` Hans de Goede
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=20240423091434.2063246-2-suma.hegde@amd.com \
--to=suma.hegde@amd.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).