Unverified Commit bde430fb authored by Suma Hegde's avatar Suma Hegde Committed by Ilpo Järvinen
Browse files

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: default avatarNaveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Signed-off-by: default avatarSuma Hegde <suma.hegde@amd.com>
Link: https://lore.kernel.org/r/20250709105413.2487851-1-suma.hegde@amd.com


Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 428f6f3a
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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;
+22 −6
Original line number Diff line number Diff line
@@ -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)