Skip to content

Commit 8aed61b

Browse files
committed
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`
2 parents 2a405b3 + 376a8c2 commit 8aed61b

File tree

6 files changed

+58
-16
lines changed

6 files changed

+58
-16
lines changed

drivers/platform/x86/amd/pmf/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ static int amd_pmf_probe(struct platform_device *pdev)
452452

453453
mutex_init(&dev->lock);
454454
mutex_init(&dev->update_mutex);
455+
mutex_init(&dev->cb_mutex);
455456

456457
apmf_acpi_init(dev);
457458
platform_set_drvdata(pdev, dev);
@@ -477,6 +478,7 @@ static void amd_pmf_remove(struct platform_device *pdev)
477478
amd_pmf_dbgfs_unregister(dev);
478479
mutex_destroy(&dev->lock);
479480
mutex_destroy(&dev->update_mutex);
481+
mutex_destroy(&dev->cb_mutex);
480482
kfree(dev->buf);
481483
}
482484

drivers/platform/x86/amd/pmf/pmf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ struct cookie_header {
106106
#define PMF_TA_IF_VERSION_MAJOR 1
107107
#define TA_PMF_ACTION_MAX 32
108108
#define TA_PMF_UNDO_MAX 8
109-
#define TA_OUTPUT_RESERVED_MEM 906
109+
#define TA_OUTPUT_RESERVED_MEM 922
110110
#define MAX_OPERATION_PARAMS 4
111111

112+
#define TA_ERROR_CRYPTO_INVALID_PARAM 0x20002
113+
#define TA_ERROR_CRYPTO_BIN_TOO_LARGE 0x2000d
114+
112115
#define PMF_IF_V1 1
113116
#define PMF_IF_V2 2
114117

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

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ module_param(pb_side_load, bool, 0444);
2727
MODULE_PARM_DESC(pb_side_load, "Sideload policy binaries debug policy failures");
2828
#endif
2929

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

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

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

393-
static int amd_pmf_ta_open_session(struct tee_context *ctx, u32 *id)
396+
static int amd_pmf_ta_open_session(struct tee_context *ctx, u32 *id, const uuid_t *uuid)
394397
{
395398
struct tee_ioctl_open_session_arg sess_arg = {};
396399
int rc;
397400

398-
export_uuid(sess_arg.uuid, &amd_pmf_ta_uuid);
401+
export_uuid(sess_arg.uuid, uuid);
399402
sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC;
400403
sess_arg.num_params = 0;
401404

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

437-
static int amd_pmf_tee_init(struct amd_pmf_dev *dev)
440+
static int amd_pmf_tee_init(struct amd_pmf_dev *dev, const uuid_t *uuid)
438441
{
439442
u32 size;
440443
int ret;
@@ -445,7 +448,7 @@ static int amd_pmf_tee_init(struct amd_pmf_dev *dev)
445448
return PTR_ERR(dev->tee_ctx);
446449
}
447450

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

490493
int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
491494
{
492-
int ret;
495+
bool status;
496+
int ret, i;
493497

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

505-
ret = amd_pmf_tee_init(dev);
506-
if (ret)
507-
return ret;
508-
509509
INIT_DELAYED_WORK(&dev->pb_work, amd_pmf_invoke_cmd);
510510

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

537-
ret = amd_pmf_start_policy_engine(dev);
538-
if (ret)
537+
for (i = 0; i < ARRAY_SIZE(amd_pmf_ta_uuid); i++) {
538+
ret = amd_pmf_tee_init(dev, &amd_pmf_ta_uuid[i]);
539+
if (ret)
540+
return ret;
541+
542+
ret = amd_pmf_start_policy_engine(dev);
543+
switch (ret) {
544+
case TA_PMF_TYPE_SUCCESS:
545+
status = true;
546+
break;
547+
case TA_ERROR_CRYPTO_INVALID_PARAM:
548+
case TA_ERROR_CRYPTO_BIN_TOO_LARGE:
549+
amd_pmf_tee_deinit(dev);
550+
status = false;
551+
break;
552+
default:
553+
goto error;
554+
}
555+
556+
if (status)
557+
break;
558+
}
559+
560+
if (!status && !pb_side_load)
539561
goto error;
540562

541563
if (pb_side_load)

drivers/platform/x86/intel/hid.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ static const struct dmi_system_id button_array_table[] = {
139139
DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"),
140140
},
141141
},
142+
{
143+
.ident = "Microsoft Surface Go 4",
144+
.matches = {
145+
DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
146+
DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 4"),
147+
},
148+
},
142149
{ }
143150
};
144151

drivers/platform/x86/intel/vsec.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ static const struct intel_vsec_platform_info oobmsm_info = {
404404
.caps = VSEC_CAP_TELEMETRY | VSEC_CAP_SDSI | VSEC_CAP_TPMI,
405405
};
406406

407+
/* DMR OOBMSM info */
408+
static const struct intel_vsec_platform_info dmr_oobmsm_info = {
409+
.caps = VSEC_CAP_TELEMETRY | VSEC_CAP_TPMI,
410+
};
411+
407412
/* TGL info */
408413
static const struct intel_vsec_platform_info tgl_info = {
409414
.caps = VSEC_CAP_TELEMETRY,
@@ -420,6 +425,7 @@ static const struct intel_vsec_platform_info lnl_info = {
420425
#define PCI_DEVICE_ID_INTEL_VSEC_MTL_M 0x7d0d
421426
#define PCI_DEVICE_ID_INTEL_VSEC_MTL_S 0xad0d
422427
#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM 0x09a7
428+
#define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM_DMR 0x09a1
423429
#define PCI_DEVICE_ID_INTEL_VSEC_RPL 0xa77d
424430
#define PCI_DEVICE_ID_INTEL_VSEC_TGL 0x9a0d
425431
#define PCI_DEVICE_ID_INTEL_VSEC_LNL_M 0x647d
@@ -430,6 +436,7 @@ static const struct pci_device_id intel_vsec_pci_ids[] = {
430436
{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_M, &mtl_info) },
431437
{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_S, &mtl_info) },
432438
{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &oobmsm_info) },
439+
{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM_DMR, &dmr_oobmsm_info) },
433440
{ PCI_DEVICE_DATA(INTEL, VSEC_RPL, &tgl_info) },
434441
{ PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) },
435442
{ PCI_DEVICE_DATA(INTEL, VSEC_LNL_M, &lnl_info) },

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9972,6 +9972,7 @@ static const struct tpacpi_quirk battery_quirk_table[] __initconst = {
99729972
* Individual addressing is broken on models that expose the
99739973
* primary battery as BAT1.
99749974
*/
9975+
TPACPI_Q_LNV('G', '8', true), /* ThinkPad X131e */
99759976
TPACPI_Q_LNV('8', 'F', true), /* Thinkpad X120e */
99769977
TPACPI_Q_LNV('J', '7', true), /* B5400 */
99779978
TPACPI_Q_LNV('J', 'I', true), /* Thinkpad 11e */

0 commit comments

Comments
 (0)