platform/x86/amd/hsmp: Enhance the print messages to prevent confusion

When the HSMP ACPI device is present, loading the amd_hsmp.ko
module incorrectly displays the message "HSMP is not supported on
Family:%x model:%x\n" despite being supported by the hsmp_acpi.ko
module, leading to confusion.

To address this issue, relocate the acpi_dev_present() check to the
beginning of the hsmp_plt_init() and revise the print message to
better reflect the current support status.

Additionally, add more error messages in the error paths and debug
messages to indicate successful probing for both hsmp_acpi.ko
and amd_hsmp.ko modules.

Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Link: https://lore.kernel.org/r/20250709105413.2487851-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
Suma Hegde 2025-07-09 10:54:13 +00:00 committed by Ilpo Järvinen
parent 428f6f3a56
commit bde430fb66
No known key found for this signature in database
GPG Key ID: 59AC4F6153E5CE31
2 changed files with 29 additions and 8 deletions

View File

@ -587,8 +587,10 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
if (!hsmp_pdev->is_probed) {
hsmp_pdev->num_sockets = amd_num_nodes();
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES)
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES) {
dev_err(&pdev->dev, "Wrong number of sockets\n");
return -ENODEV;
}
hsmp_pdev->sock = devm_kcalloc(&pdev->dev, hsmp_pdev->num_sockets,
sizeof(*hsmp_pdev->sock),
@ -605,9 +607,12 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
if (!hsmp_pdev->is_probed) {
ret = hsmp_misc_register(&pdev->dev);
if (ret)
if (ret) {
dev_err(&pdev->dev, "Failed to register misc device\n");
return ret;
}
hsmp_pdev->is_probed = true;
dev_dbg(&pdev->dev, "AMD HSMP ACPI is probed successfully\n");
}
return 0;

View File

@ -14,6 +14,8 @@
#include <linux/acpi.h>
#include <linux/build_bug.h>
#include <linux/device.h>
#include <linux/dev_printk.h>
#include <linux/kconfig.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
@ -215,7 +217,14 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev)
return ret;
}
return hsmp_misc_register(&pdev->dev);
ret = hsmp_misc_register(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register misc device\n");
return ret;
}
dev_dbg(&pdev->dev, "AMD HSMP is probed successfully\n");
return 0;
}
static void hsmp_pltdrv_remove(struct platform_device *pdev)
@ -287,15 +296,20 @@ static int __init hsmp_plt_init(void)
{
int ret = -ENODEV;
if (acpi_dev_present(ACPI_HSMP_DEVICE_HID, NULL, -1)) {
if (IS_ENABLED(CONFIG_AMD_HSMP_ACPI))
pr_debug("HSMP is supported through ACPI on this platform, please use hsmp_acpi.ko\n");
else
pr_info("HSMP is supported through ACPI on this platform, please enable AMD_HSMP_ACPI config\n");
return -ENODEV;
}
if (!legacy_hsmp_support()) {
pr_info("HSMP is not supported on Family:%x model:%x\n",
pr_info("HSMP interface is either disabled or not supported on family:%x model:%x\n",
boot_cpu_data.x86, boot_cpu_data.x86_model);
return ret;
}
if (acpi_dev_present(ACPI_HSMP_DEVICE_HID, NULL, -1))
return -ENODEV;
hsmp_pdev = get_hsmp_pdev();
if (!hsmp_pdev)
return -ENOMEM;
@ -305,8 +319,10 @@ static int __init hsmp_plt_init(void)
* if we have N SMN/DF interfaces that ideally means N sockets
*/
hsmp_pdev->num_sockets = amd_num_nodes();
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES)
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES) {
pr_err("Wrong number of sockets\n");
return ret;
}
ret = platform_driver_register(&amd_hsmp_driver);
if (ret)