Skip to content

Commit bde430f

Browse files
sumachidanandij-intel
authored andcommitted
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>
1 parent 428f6f3 commit bde430f

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

drivers/platform/x86/amd/hsmp/acpi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,10 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
587587

588588
if (!hsmp_pdev->is_probed) {
589589
hsmp_pdev->num_sockets = amd_num_nodes();
590-
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES)
590+
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES) {
591+
dev_err(&pdev->dev, "Wrong number of sockets\n");
591592
return -ENODEV;
593+
}
592594

593595
hsmp_pdev->sock = devm_kcalloc(&pdev->dev, hsmp_pdev->num_sockets,
594596
sizeof(*hsmp_pdev->sock),
@@ -605,9 +607,12 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
605607

606608
if (!hsmp_pdev->is_probed) {
607609
ret = hsmp_misc_register(&pdev->dev);
608-
if (ret)
610+
if (ret) {
611+
dev_err(&pdev->dev, "Failed to register misc device\n");
609612
return ret;
613+
}
610614
hsmp_pdev->is_probed = true;
615+
dev_dbg(&pdev->dev, "AMD HSMP ACPI is probed successfully\n");
611616
}
612617

613618
return 0;

drivers/platform/x86/amd/hsmp/plat.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <linux/acpi.h>
1515
#include <linux/build_bug.h>
1616
#include <linux/device.h>
17+
#include <linux/dev_printk.h>
18+
#include <linux/kconfig.h>
1719
#include <linux/module.h>
1820
#include <linux/pci.h>
1921
#include <linux/platform_device.h>
@@ -215,7 +217,14 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev)
215217
return ret;
216218
}
217219

218-
return hsmp_misc_register(&pdev->dev);
220+
ret = hsmp_misc_register(&pdev->dev);
221+
if (ret) {
222+
dev_err(&pdev->dev, "Failed to register misc device\n");
223+
return ret;
224+
}
225+
226+
dev_dbg(&pdev->dev, "AMD HSMP is probed successfully\n");
227+
return 0;
219228
}
220229

221230
static void hsmp_pltdrv_remove(struct platform_device *pdev)
@@ -287,15 +296,20 @@ static int __init hsmp_plt_init(void)
287296
{
288297
int ret = -ENODEV;
289298

299+
if (acpi_dev_present(ACPI_HSMP_DEVICE_HID, NULL, -1)) {
300+
if (IS_ENABLED(CONFIG_AMD_HSMP_ACPI))
301+
pr_debug("HSMP is supported through ACPI on this platform, please use hsmp_acpi.ko\n");
302+
else
303+
pr_info("HSMP is supported through ACPI on this platform, please enable AMD_HSMP_ACPI config\n");
304+
return -ENODEV;
305+
}
306+
290307
if (!legacy_hsmp_support()) {
291-
pr_info("HSMP is not supported on Family:%x model:%x\n",
308+
pr_info("HSMP interface is either disabled or not supported on family:%x model:%x\n",
292309
boot_cpu_data.x86, boot_cpu_data.x86_model);
293310
return ret;
294311
}
295312

296-
if (acpi_dev_present(ACPI_HSMP_DEVICE_HID, NULL, -1))
297-
return -ENODEV;
298-
299313
hsmp_pdev = get_hsmp_pdev();
300314
if (!hsmp_pdev)
301315
return -ENOMEM;
@@ -305,8 +319,10 @@ static int __init hsmp_plt_init(void)
305319
* if we have N SMN/DF interfaces that ideally means N sockets
306320
*/
307321
hsmp_pdev->num_sockets = amd_num_nodes();
308-
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES)
322+
if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES) {
323+
pr_err("Wrong number of sockets\n");
309324
return ret;
325+
}
310326

311327
ret = platform_driver_register(&amd_hsmp_driver);
312328
if (ret)

0 commit comments

Comments
 (0)