Skip to content

Commit ed13f62

Browse files
superm1ij-intel
authored andcommitted
platform/x86/amd: pmf: Add infrastructure for quirking supported funcs
In the event of a BIOS bug add infrastructure that will be utilized to override the return value for supported_funcs to avoid enabling features. Signed-off-by: Mario Limonciello <[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 03cea82 commit ed13f62

File tree

5 files changed

+52
-2
lines changed

5 files changed

+52
-2
lines changed

drivers/platform/x86/amd/pmf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
obj-$(CONFIG_AMD_PMF) += amd-pmf.o
88
amd-pmf-objs := core.o acpi.o sps.o \
99
auto-mode.o cnqf.o \
10-
tee-if.o spc.o
10+
tee-if.o spc.o pmf-quirks.o

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ static int apmf_if_verify_interface(struct amd_pmf_dev *pdev)
343343
if (err)
344344
return err;
345345

346-
pdev->supported_func = output.supported_functions;
346+
/* only set if not already set by a quirk */
347+
if (!pdev->supported_func)
348+
pdev->supported_func = output.supported_functions;
349+
347350
dev_dbg(pdev->dev, "supported functions:0x%x notifications:0x%x version:%u\n",
348351
output.supported_functions, output.notification_mask, output.version);
349352

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ static int amd_pmf_probe(struct platform_device *pdev)
445445
mutex_init(&dev->lock);
446446
mutex_init(&dev->update_mutex);
447447

448+
amd_pmf_quirks_init(dev);
448449
apmf_acpi_init(dev);
449450
platform_set_drvdata(pdev, dev);
450451
amd_pmf_dbgfs_register(dev);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* AMD Platform Management Framework Driver Quirks
4+
*
5+
* Copyright (c) 2024, Advanced Micro Devices, Inc.
6+
* All Rights Reserved.
7+
*
8+
* Author: Mario Limonciello <[email protected]>
9+
*/
10+
11+
#include <linux/dmi.h>
12+
13+
#include "pmf.h"
14+
15+
struct quirk_entry {
16+
u32 supported_func;
17+
};
18+
19+
static struct quirk_entry quirk_no_sps_bug = {
20+
.supported_func = 0x4003,
21+
};
22+
23+
static const struct dmi_system_id fwbug_list[] = {
24+
{}
25+
};
26+
27+
void amd_pmf_quirks_init(struct amd_pmf_dev *dev)
28+
{
29+
const struct dmi_system_id *dmi_id;
30+
struct quirk_entry *quirks;
31+
32+
dmi_id = dmi_first_match(fwbug_list);
33+
if (!dmi_id)
34+
return;
35+
36+
quirks = dmi_id->driver_data;
37+
if (quirks->supported_func) {
38+
dev->supported_func = quirks->supported_func;
39+
pr_info("Using supported funcs quirk to avoid %s platform firmware bug\n",
40+
dmi_id->ident);
41+
}
42+
}
43+

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,4 +720,7 @@ int apmf_check_smart_pc(struct amd_pmf_dev *pmf_dev);
720720
void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
721721
void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
722722

723+
/* Quirk infrastructure */
724+
void amd_pmf_quirks_init(struct amd_pmf_dev *dev);
725+
723726
#endif /* PMF_H */

0 commit comments

Comments
 (0)