]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86/amd/hsmp: Make amd_hsmp and hsmp_acpi as mutually exclusive drivers
authorSuma Hegde <suma.hegde@amd.com>
Fri, 25 Apr 2025 10:23:57 +0000 (10:23 +0000)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 29 Apr 2025 15:03:13 +0000 (18:03 +0300)
amd_hsmp and hsmp_acpi are intended to be mutually exclusive drivers and
amd_hsmp is for legacy platforms. To achieve this, it is essential to
check for the presence of the ACPI device in plat.c. If the hsmp ACPI
device entry is found, allow the hsmp_acpi driver to manage the hsmp
and return an error from plat.c.

Additionally, rename the driver from amd_hsmp to hsmp_acpi to prevent
"Driver 'amd_hsmp' is already registered, aborting..." error in case
both drivers are loaded simultaneously.

Also, support both platform device based and ACPI based probing for
family 0x1A models 0x00 to 0x0F, implement only ACPI based probing
for family 0x1A, models 0x10 to 0x1F. Return false from
legacy_hsmp_support() for this platform.
This aligns with the condition check in is_f1a_m0h().

Link: https://lore.kernel.org/platform-driver-x86/aALZxvHWmphNL1wa@gourry-fedora-PF4VCD3F/
Fixes: 7d3135d16356 ("platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers")
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Co-developed-by: Gregory Price <gourry@gourry.net>
Signed-off-by: Gregory Price <gourry@gourry.net>
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Link: https://lore.kernel.org/r/20250425102357.266790-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>
drivers/platform/x86/amd/hsmp/acpi.c
drivers/platform/x86/amd/hsmp/hsmp.h
drivers/platform/x86/amd/hsmp/plat.c

index c1eccb3c80c5c99394a207c6896e72f7c6d14944..eaae044e4f824c475cda6e8bf7c9202d3ac5355f 100644 (file)
@@ -27,9 +27,8 @@
 
 #include "hsmp.h"
 
-#define DRIVER_NAME            "amd_hsmp"
+#define DRIVER_NAME            "hsmp_acpi"
 #define DRIVER_VERSION         "2.3"
-#define ACPI_HSMP_DEVICE_HID   "AMDI0097"
 
 /* These are the strings specified in ACPI table */
 #define MSG_IDOFF_STR          "MsgIdOffset"
index af8b21f821d668e43bf6cbfa18ec8409fb9267d5..d58d4f0c20d55265e78d1cdfcf41365d70938ce9 100644 (file)
@@ -23,6 +23,7 @@
 
 #define HSMP_CDEV_NAME         "hsmp_cdev"
 #define HSMP_DEVNODE_NAME      "hsmp"
+#define ACPI_HSMP_DEVICE_HID    "AMDI0097"
 
 struct hsmp_mbaddr_info {
        u32 base_addr;
index b9782a078dbd2fc67e1ad61ff9085a6da49dd7b9..81931e808bbc812fcde5cee5489d6c117dcc2859 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <asm/amd_hsmp.h>
 
+#include <linux/acpi.h>
 #include <linux/build_bug.h>
 #include <linux/device.h>
 #include <linux/module.h>
@@ -266,7 +267,7 @@ static bool legacy_hsmp_support(void)
                }
        case 0x1A:
                switch (boot_cpu_data.x86_model) {
-               case 0x00 ... 0x1F:
+               case 0x00 ... 0x0F:
                        return true;
                default:
                        return false;
@@ -288,6 +289,9 @@ static int __init hsmp_plt_init(void)
                return ret;
        }
 
+       if (acpi_dev_present(ACPI_HSMP_DEVICE_HID, NULL, -1))
+               return -ENODEV;
+
        hsmp_pdev = get_hsmp_pdev();
        if (!hsmp_pdev)
                return -ENOMEM;