Commit 8aed61b8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'platform-drivers-x86-v6.14-4' of...

Merge tag 'platform-drivers-x86-v6.14-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from Ilpo Järvinen:

 - amd/pmf:
     - Initialize 'cb_mutex'
     - Support for new version of PMF-TA

 - intel-hid: Fix volume buttons on Microsoft Surface Go 4 tablet

 - intel/vsec: Add Diamond Rapids support

 - thinkpad_acpi: Add battery quirk for ThinkPad X131e

* tag 'platform-drivers-x86-v6.14-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86/amd/pmf: Update PMF Driver for Compatibility with new PMF-TA
  platform/x86/amd/pmf: Propagate PMF-TA return codes
  platform/x86/intel/vsec: Add Diamond Rapids support
  platform/x86: thinkpad_acpi: Add battery quirk for ThinkPad X131e
  platform/x86: intel-hid: fix volume buttons on Microsoft Surface Go 4 tablet
  platform/x86/amd/pmf: Initialize and clean up `cb_mutex`
parents 2a405b36 376a8c2a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -452,6 +452,7 @@ static int amd_pmf_probe(struct platform_device *pdev)

	mutex_init(&dev->lock);
	mutex_init(&dev->update_mutex);
	mutex_init(&dev->cb_mutex);

	apmf_acpi_init(dev);
	platform_set_drvdata(pdev, dev);
@@ -477,6 +478,7 @@ static void amd_pmf_remove(struct platform_device *pdev)
	amd_pmf_dbgfs_unregister(dev);
	mutex_destroy(&dev->lock);
	mutex_destroy(&dev->update_mutex);
	mutex_destroy(&dev->cb_mutex);
	kfree(dev->buf);
}

+4 −1
Original line number Diff line number Diff line
@@ -106,9 +106,12 @@ struct cookie_header {
#define PMF_TA_IF_VERSION_MAJOR				1
#define TA_PMF_ACTION_MAX					32
#define TA_PMF_UNDO_MAX						8
#define TA_OUTPUT_RESERVED_MEM				906
#define TA_OUTPUT_RESERVED_MEM				922
#define MAX_OPERATION_PARAMS					4

#define TA_ERROR_CRYPTO_INVALID_PARAM				0x20002
#define TA_ERROR_CRYPTO_BIN_TOO_LARGE				0x2000d

#define PMF_IF_V1		1
#define PMF_IF_V2		2

+37 −15
Original line number Diff line number Diff line
@@ -27,8 +27,11 @@ module_param(pb_side_load, bool, 0444);
MODULE_PARM_DESC(pb_side_load, "Sideload policy binaries debug policy failures");
#endif

static const uuid_t amd_pmf_ta_uuid = UUID_INIT(0x6fd93b77, 0x3fb8, 0x524d,
						0xb1, 0x2d, 0xc5, 0x29, 0xb1, 0x3d, 0x85, 0x43);
static const uuid_t amd_pmf_ta_uuid[] = { UUID_INIT(0xd9b39bf2, 0x66bd, 0x4154, 0xaf, 0xb8, 0x8a,
						    0xcc, 0x2b, 0x2b, 0x60, 0xd6),
					  UUID_INIT(0x6fd93b77, 0x3fb8, 0x524d, 0xb1, 0x2d, 0xc5,
						    0x29, 0xb1, 0x3d, 0x85, 0x43),
					};

static const char *amd_pmf_uevent_as_str(unsigned int state)
{
@@ -321,9 +324,9 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
		 */
		schedule_delayed_work(&dev->pb_work, msecs_to_jiffies(pb_actions_ms * 3));
	} else {
		dev_err(dev->dev, "ta invoke cmd init failed err: %x\n", res);
		dev_dbg(dev->dev, "ta invoke cmd init failed err: %x\n", res);
		dev->smart_pc_enabled = false;
		return -EIO;
		return res;
	}

	return 0;
@@ -390,12 +393,12 @@ static int amd_pmf_amdtee_ta_match(struct tee_ioctl_version_data *ver, const voi
	return ver->impl_id == TEE_IMPL_ID_AMDTEE;
}

static int amd_pmf_ta_open_session(struct tee_context *ctx, u32 *id)
static int amd_pmf_ta_open_session(struct tee_context *ctx, u32 *id, const uuid_t *uuid)
{
	struct tee_ioctl_open_session_arg sess_arg = {};
	int rc;

	export_uuid(sess_arg.uuid, &amd_pmf_ta_uuid);
	export_uuid(sess_arg.uuid, uuid);
	sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC;
	sess_arg.num_params = 0;

@@ -434,7 +437,7 @@ static int amd_pmf_register_input_device(struct amd_pmf_dev *dev)
	return 0;
}

static int amd_pmf_tee_init(struct amd_pmf_dev *dev)
static int amd_pmf_tee_init(struct amd_pmf_dev *dev, const uuid_t *uuid)
{
	u32 size;
	int ret;
@@ -445,7 +448,7 @@ static int amd_pmf_tee_init(struct amd_pmf_dev *dev)
		return PTR_ERR(dev->tee_ctx);
	}

	ret = amd_pmf_ta_open_session(dev->tee_ctx, &dev->session_id);
	ret = amd_pmf_ta_open_session(dev->tee_ctx, &dev->session_id, uuid);
	if (ret) {
		dev_err(dev->dev, "Failed to open TA session (%d)\n", ret);
		ret = -EINVAL;
@@ -489,7 +492,8 @@ static void amd_pmf_tee_deinit(struct amd_pmf_dev *dev)

int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
{
	int ret;
	bool status;
	int ret, i;

	ret = apmf_check_smart_pc(dev);
	if (ret) {
@@ -502,10 +506,6 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
		return -ENODEV;
	}

	ret = amd_pmf_tee_init(dev);
	if (ret)
		return ret;

	INIT_DELAYED_WORK(&dev->pb_work, amd_pmf_invoke_cmd);

	ret = amd_pmf_set_dram_addr(dev, true);
@@ -534,8 +534,30 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
		goto error;
	}

	ret = amd_pmf_start_policy_engine(dev);
	for (i = 0; i < ARRAY_SIZE(amd_pmf_ta_uuid); i++) {
		ret = amd_pmf_tee_init(dev, &amd_pmf_ta_uuid[i]);
		if (ret)
			return ret;

		ret = amd_pmf_start_policy_engine(dev);
		switch (ret) {
		case TA_PMF_TYPE_SUCCESS:
			status = true;
			break;
		case TA_ERROR_CRYPTO_INVALID_PARAM:
		case TA_ERROR_CRYPTO_BIN_TOO_LARGE:
			amd_pmf_tee_deinit(dev);
			status = false;
			break;
		default:
			goto error;
		}

		if (status)
			break;
	}

	if (!status && !pb_side_load)
		goto error;

	if (pb_side_load)
+7 −0
Original line number Diff line number Diff line
@@ -139,6 +139,13 @@ static const struct dmi_system_id button_array_table[] = {
			DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"),
		},
	},
	{
		.ident = "Microsoft Surface Go 4",
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 4"),
		},
	},
	{ }
};

+7 −0
Original line number Diff line number Diff line
@@ -404,6 +404,11 @@ static const struct intel_vsec_platform_info oobmsm_info = {
	.caps = VSEC_CAP_TELEMETRY | VSEC_CAP_SDSI | VSEC_CAP_TPMI,
};

/* DMR OOBMSM info */
static const struct intel_vsec_platform_info dmr_oobmsm_info = {
	.caps = VSEC_CAP_TELEMETRY | VSEC_CAP_TPMI,
};

/* TGL info */
static const struct intel_vsec_platform_info tgl_info = {
	.caps = VSEC_CAP_TELEMETRY,
@@ -420,6 +425,7 @@ static const struct intel_vsec_platform_info lnl_info = {
#define PCI_DEVICE_ID_INTEL_VSEC_MTL_M		0x7d0d
#define PCI_DEVICE_ID_INTEL_VSEC_MTL_S		0xad0d
#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM		0x09a7
#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM_DMR	0x09a1
#define PCI_DEVICE_ID_INTEL_VSEC_RPL		0xa77d
#define PCI_DEVICE_ID_INTEL_VSEC_TGL		0x9a0d
#define PCI_DEVICE_ID_INTEL_VSEC_LNL_M		0x647d
@@ -430,6 +436,7 @@ static const struct pci_device_id intel_vsec_pci_ids[] = {
	{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_M, &mtl_info) },
	{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_S, &mtl_info) },
	{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &oobmsm_info) },
	{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM_DMR, &dmr_oobmsm_info) },
	{ PCI_DEVICE_DATA(INTEL, VSEC_RPL, &tgl_info) },
	{ PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) },
	{ PCI_DEVICE_DATA(INTEL, VSEC_LNL_M, &lnl_info) },
Loading