Skip to content

Commit 7a8bdc7

Browse files
committed
Merge tag 'platform-drivers-x86-v6.15-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform drivers fixes from Ilpo Järvinen: - amd/pmc: Use spurious 8042 quirk with MECHREVO Wujie 14XA - amd/pmf: - Ensure Smart PC policies are valid - Fix memory leak when the engine fails to start - amd/hsmp: Make amd_hsmp and hsmp_acpi as mutually exclusive drivers - asus-wmi: Fix wlan_ctrl_by_user detection - thinkpad_acpi: Add support for NEC Lavie X1475JAS * tag 'platform-drivers-x86-v6.15-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: asus-wmi: Fix wlan_ctrl_by_user detection platform/x86/amd/pmc: Declare quirk_spurious_8042 for MECHREVO Wujie 14XA (GX4HRXL) platform/x86: thinkpad_acpi: Support also NEC Lavie X1475JAS platform/x86/amd/hsmp: Make amd_hsmp and hsmp_acpi as mutually exclusive drivers drivers/platform/x86/amd: pmf: Check for invalid Smart PC Policies drivers/platform/x86/amd: pmf: Check for invalid sideloaded Smart PC Policies
2 parents 8b64199 + bfcfe6d commit 7a8bdc7

File tree

7 files changed

+40
-5
lines changed

7 files changed

+40
-5
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;

drivers/platform/x86/amd/pmc/pmc-quirks.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ static const struct dmi_system_id fwbug_list[] = {
217217
DMI_MATCH(DMI_BIOS_VERSION, "03.05"),
218218
}
219219
},
220+
{
221+
.ident = "MECHREVO Wujie 14X (GX4HRXL)",
222+
.driver_data = &quirk_spurious_8042,
223+
.matches = {
224+
DMI_MATCH(DMI_BOARD_NAME, "WUJIE14-GX4HRXL"),
225+
}
226+
},
220227
{}
221228
};
222229

drivers/platform/x86/amd/pmf/tee-if.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
334334
return 0;
335335
}
336336

337+
static inline bool amd_pmf_pb_valid(struct amd_pmf_dev *dev)
338+
{
339+
return memchr_inv(dev->policy_buf, 0xff, dev->policy_sz);
340+
}
341+
337342
#ifdef CONFIG_AMD_PMF_DEBUG
338343
static void amd_pmf_hex_dump_pb(struct amd_pmf_dev *dev)
339344
{
@@ -361,12 +366,22 @@ static ssize_t amd_pmf_get_pb_data(struct file *filp, const char __user *buf,
361366
dev->policy_buf = new_policy_buf;
362367
dev->policy_sz = length;
363368

369+
if (!amd_pmf_pb_valid(dev)) {
370+
ret = -EINVAL;
371+
goto cleanup;
372+
}
373+
364374
amd_pmf_hex_dump_pb(dev);
365375
ret = amd_pmf_start_policy_engine(dev);
366376
if (ret < 0)
367-
return ret;
377+
goto cleanup;
368378

369379
return length;
380+
381+
cleanup:
382+
kfree(dev->policy_buf);
383+
dev->policy_buf = NULL;
384+
return ret;
370385
}
371386

372387
static const struct file_operations pb_fops = {
@@ -528,6 +543,12 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
528543

529544
memcpy_fromio(dev->policy_buf, dev->policy_base, dev->policy_sz);
530545

546+
if (!amd_pmf_pb_valid(dev)) {
547+
dev_info(dev->dev, "No Smart PC policy present\n");
548+
ret = -EINVAL;
549+
goto err_free_policy;
550+
}
551+
531552
amd_pmf_hex_dump_pb(dev);
532553

533554
dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);

drivers/platform/x86/asus-wmi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4779,7 +4779,8 @@ static int asus_wmi_add(struct platform_device *pdev)
47794779
goto fail_leds;
47804780

47814781
asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_WLAN, &result);
4782-
if (result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT))
4782+
if ((result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT)) ==
4783+
(ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT))
47834784
asus->driver->wlan_ctrl_by_user = 1;
47844785

47854786
if (!(asus->driver->wlan_ctrl_by_user && ashs_present())) {

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11478,6 +11478,8 @@ static int __must_check __init get_thinkpad_model_data(
1147811478
tp->vendor = PCI_VENDOR_ID_IBM;
1147911479
else if (dmi_name_in_vendors("LENOVO"))
1148011480
tp->vendor = PCI_VENDOR_ID_LENOVO;
11481+
else if (dmi_name_in_vendors("NEC"))
11482+
tp->vendor = PCI_VENDOR_ID_LENOVO;
1148111483
else
1148211484
return 0;
1148311485

0 commit comments

Comments
 (0)