Skip to content

Commit d9ea0a3

Browse files
sumachidanandnchatrad
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 f34b98f commit d9ea0a3

File tree

1 file changed

+43
-7
lines changed

1 file changed

+43
-7
lines changed

amd_hsmp.c

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

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

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

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

0 commit comments

Comments
 (0)