Skip to content

Commit 77f1972

Browse files
sumachidanandjwrdegoede
authored andcommitted
platform/x86/amd/hsmp: Check HSMP support on AMD family of processors
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 <[email protected]> Reviewed-by: Naveen Krishna Chatradhi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 306aec7 commit 77f1972

File tree

1 file changed

+43
-7
lines changed
  • drivers/platform/x86/amd

1 file changed

+43
-7
lines changed

drivers/platform/x86/amd/hsmp.c

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -907,16 +907,44 @@ static int hsmp_plat_dev_register(void)
907907
return ret;
908908
}
909909

910+
/*
911+
* This check is only needed for backward compatibility of previous platforms.
912+
* All new platforms are expected to support ACPI based probing.
913+
*/
914+
static bool legacy_hsmp_support(void)
915+
{
916+
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
917+
return false;
918+
919+
switch (boot_cpu_data.x86) {
920+
case 0x19:
921+
switch (boot_cpu_data.x86_model) {
922+
case 0x00 ... 0x1F:
923+
case 0x30 ... 0x3F:
924+
case 0x90 ... 0x9F:
925+
case 0xA0 ... 0xAF:
926+
return true;
927+
default:
928+
return false;
929+
}
930+
case 0x1A:
931+
switch (boot_cpu_data.x86_model) {
932+
case 0x00 ... 0x1F:
933+
return true;
934+
default:
935+
return false;
936+
}
937+
default:
938+
return false;
939+
}
940+
941+
return false;
942+
}
943+
910944
static int __init hsmp_plt_init(void)
911945
{
912946
int ret = -ENODEV;
913947

914-
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD || boot_cpu_data.x86 < 0x19) {
915-
pr_err("HSMP is not supported on Family:%x model:%x\n",
916-
boot_cpu_data.x86, boot_cpu_data.x86_model);
917-
return ret;
918-
}
919-
920948
/*
921949
* amd_nb_num() returns number of SMN/DF interfaces present in the system
922950
* if we have N SMN/DF interfaces that ideally means N sockets
@@ -930,7 +958,15 @@ static int __init hsmp_plt_init(void)
930958
return ret;
931959

932960
if (!plat_dev.is_acpi_device) {
933-
ret = hsmp_plat_dev_register();
961+
if (legacy_hsmp_support()) {
962+
/* Not ACPI device, but supports HSMP, register a plat_dev */
963+
ret = hsmp_plat_dev_register();
964+
} else {
965+
/* Not ACPI, Does not support HSMP */
966+
pr_info("HSMP is not supported on Family:%x model:%x\n",
967+
boot_cpu_data.x86, boot_cpu_data.x86_model);
968+
ret = -ENODEV;
969+
}
934970
if (ret)
935971
platform_driver_unregister(&amd_hsmp_driver);
936972
}

0 commit comments

Comments
 (0)