Skip to content

Commit 0581d38

Browse files
sumachidanandij-intel
authored andcommitted
platform/x86/amd/hsmp: Make amd_hsmp and hsmp_acpi as mutually exclusive drivers
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: 7d3135d ("platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers") Reviewed-by: Naveen Krishna Chatradhi <[email protected]> Co-developed-by: Gregory Price <[email protected]> Signed-off-by: Gregory Price <[email protected]> Signed-off-by: Suma Hegde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 8e81b9c commit 0581d38

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727

2828
#include "hsmp.h"
2929

30-
#define DRIVER_NAME "amd_hsmp"
30+
#define DRIVER_NAME "hsmp_acpi"
3131
#define DRIVER_VERSION "2.3"
32-
#define ACPI_HSMP_DEVICE_HID "AMDI0097"
3332

3433
/* These are the strings specified in ACPI table */
3534
#define MSG_IDOFF_STR "MsgIdOffset"

drivers/platform/x86/amd/hsmp/hsmp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#define HSMP_CDEV_NAME "hsmp_cdev"
2525
#define HSMP_DEVNODE_NAME "hsmp"
26+
#define ACPI_HSMP_DEVICE_HID "AMDI0097"
2627

2728
struct hsmp_mbaddr_info {
2829
u32 base_addr;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <asm/amd_hsmp.h>
1313

14+
#include <linux/acpi.h>
1415
#include <linux/build_bug.h>
1516
#include <linux/device.h>
1617
#include <linux/module.h>
@@ -266,7 +267,7 @@ static bool legacy_hsmp_support(void)
266267
}
267268
case 0x1A:
268269
switch (boot_cpu_data.x86_model) {
269-
case 0x00 ... 0x1F:
270+
case 0x00 ... 0x0F:
270271
return true;
271272
default:
272273
return false;
@@ -288,6 +289,9 @@ static int __init hsmp_plt_init(void)
288289
return ret;
289290
}
290291

292+
if (acpi_dev_present(ACPI_HSMP_DEVICE_HID, NULL, -1))
293+
return -ENODEV;
294+
291295
hsmp_pdev = get_hsmp_pdev();
292296
if (!hsmp_pdev)
293297
return -ENOMEM;

0 commit comments

Comments
 (0)