Commit 7a8bdc7f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'platform-drivers-x86-v6.15-5' of...

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
parents 8b64199a bfcfe6d3
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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"
+1 −0
Original line number Diff line number Diff line
@@ -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;
+5 −1
Original line number Diff line number Diff line
@@ -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;
+7 −0
Original line number Diff line number Diff line
@@ -217,6 +217,13 @@ static const struct dmi_system_id fwbug_list[] = {
			DMI_MATCH(DMI_BIOS_VERSION, "03.05"),
		}
	},
	{
		.ident = "MECHREVO Wujie 14X (GX4HRXL)",
		.driver_data = &quirk_spurious_8042,
		.matches = {
			DMI_MATCH(DMI_BOARD_NAME, "WUJIE14-GX4HRXL"),
		}
	},
	{}
};

+22 −1
Original line number Diff line number Diff line
@@ -334,6 +334,11 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
	return 0;
}

static inline bool amd_pmf_pb_valid(struct amd_pmf_dev *dev)
{
	return memchr_inv(dev->policy_buf, 0xff, dev->policy_sz);
}

#ifdef CONFIG_AMD_PMF_DEBUG
static void amd_pmf_hex_dump_pb(struct amd_pmf_dev *dev)
{
@@ -361,12 +366,22 @@ static ssize_t amd_pmf_get_pb_data(struct file *filp, const char __user *buf,
	dev->policy_buf = new_policy_buf;
	dev->policy_sz = length;

	if (!amd_pmf_pb_valid(dev)) {
		ret = -EINVAL;
		goto cleanup;
	}

	amd_pmf_hex_dump_pb(dev);
	ret = amd_pmf_start_policy_engine(dev);
	if (ret < 0)
		return ret;
		goto cleanup;

	return length;

cleanup:
	kfree(dev->policy_buf);
	dev->policy_buf = NULL;
	return ret;
}

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

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

	if (!amd_pmf_pb_valid(dev)) {
		dev_info(dev->dev, "No Smart PC policy present\n");
		ret = -EINVAL;
		goto err_free_policy;
	}

	amd_pmf_hex_dump_pb(dev);

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