Skip to content

Commit 03d5c98

Browse files
committed
Merge branches 'acpi-pm', 'acpi-properties', 'acpi-misc' and 'acpi-x86'
Merge ACPI power management changes, ACPI device properties handling changes, x86-specific ACPI changes and miscellaneous ACPI changes for 5.18-rc1: - Add power management debug messages related to suspend-to-idle in two places (Rafael Wysocki). - Fix __acpi_node_get_property_reference() return value and clean up that function (Andy Shevchenko, Sakari Ailus). - Fix return value of the __setup handler in the ACPI PM timer clock source driver (Randy Dunlap). - Clean up double words in two comments (Tom Rix). - Add "skip i2c clients" quirks for Lenovo Yoga Tablet 1050F/L and Nextbook Ares 8 (Hans de Goede). - Clean up frequency invariance handling on x86 in the ACPI CPPC library (Huang Rui). - Work around broken XSDT on the Advantech DAC-BJ01 board (Mark Cilissen). * acpi-pm: ACPI: EC / PM: Print additional debug message in acpi_ec_dispatch_gpe() ACPI: PM: Print additional debug message in acpi_s2idle_wake() * acpi-properties: ACPI: property: Get rid of redundant 'else' ACPI: properties: Consistently return -ENOENT if there are no more references * acpi-misc: clocksource: acpi_pm: fix return value of __setup handler ACPI: clean up double words in two comments * acpi-x86: ACPI / x86: Work around broken XSDT on Advantech DAC-BJ01 board x86/ACPI: CPPC: Move init_freq_invariance_cppc() into x86 CPPC x86: Expose init_freq_invariance() to topology header x86/ACPI: CPPC: Move AMD maximum frequency ratio setting function into x86 CPPC x86/ACPI: CPPC: Rename cppc_msr.c to cppc.c ACPI / x86: Add skip i2c clients quirk for Lenovo Yoga Tablet 1050F/L ACPI / x86: Add skip i2c clients quirk for Nextbook Ares 8
5 parents 314b97c + 977dc30 + 9978f44 + 6a861ab + e702196 commit 03d5c98

13 files changed

Lines changed: 191 additions & 139 deletions

File tree

arch/x86/include/asm/topology.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,26 @@ extern void arch_scale_freq_tick(void);
215215
#define arch_scale_freq_tick arch_scale_freq_tick
216216

217217
extern void arch_set_max_freq_ratio(bool turbo_disabled);
218+
void init_freq_invariance(bool secondary, bool cppc_ready);
218219
#else
219220
static inline void arch_set_max_freq_ratio(bool turbo_disabled)
220221
{
221222
}
223+
static inline void init_freq_invariance(bool secondary, bool cppc_ready)
224+
{
225+
}
222226
#endif
223227

224-
#if defined(CONFIG_ACPI_CPPC_LIB) && defined(CONFIG_SMP)
228+
#ifdef CONFIG_ACPI_CPPC_LIB
225229
void init_freq_invariance_cppc(void);
226230
#define init_freq_invariance_cppc init_freq_invariance_cppc
231+
232+
bool amd_set_max_freq_ratio(u64 *ratio);
233+
#else
234+
static inline bool amd_set_max_freq_ratio(u64 *ratio)
235+
{
236+
return false;
237+
}
227238
#endif
228239

229240
#endif /* _ASM_X86_TOPOLOGY_H */

arch/x86/kernel/acpi/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
obj-$(CONFIG_ACPI) += boot.o
44
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o
55
obj-$(CONFIG_ACPI_APEI) += apei.o
6-
obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_msr.o
6+
obj-$(CONFIG_ACPI_CPPC_LIB) += cppc.o
77

88
ifneq ($(CONFIG_ACPI_PROCESSOR),)
99
obj-y += cstate.o

arch/x86/kernel/acpi/boot.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,17 @@ static int __init disable_acpi_pci(const struct dmi_system_id *d)
13281328
return 0;
13291329
}
13301330

1331+
static int __init disable_acpi_xsdt(const struct dmi_system_id *d)
1332+
{
1333+
if (!acpi_force) {
1334+
pr_notice("%s detected: force use of acpi=rsdt\n", d->ident);
1335+
acpi_gbl_do_not_use_xsdt = TRUE;
1336+
} else {
1337+
pr_notice("Warning: DMI blacklist says broken, but acpi XSDT forced\n");
1338+
}
1339+
return 0;
1340+
}
1341+
13311342
static int __init dmi_disable_acpi(const struct dmi_system_id *d)
13321343
{
13331344
if (!acpi_force) {
@@ -1451,6 +1462,19 @@ static const struct dmi_system_id acpi_dmi_table[] __initconst = {
14511462
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
14521463
},
14531464
},
1465+
/*
1466+
* Boxes that need ACPI XSDT use disabled due to corrupted tables
1467+
*/
1468+
{
1469+
.callback = disable_acpi_xsdt,
1470+
.ident = "Advantech DAC-BJ01",
1471+
.matches = {
1472+
DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
1473+
DMI_MATCH(DMI_PRODUCT_NAME, "Bearlake CRB Board"),
1474+
DMI_MATCH(DMI_BIOS_VERSION, "V1.12"),
1475+
DMI_MATCH(DMI_BIOS_DATE, "02/01/2011"),
1476+
},
1477+
},
14541478
{}
14551479
};
14561480

arch/x86/kernel/acpi/cppc.c

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* cppc.c: CPPC Interface for x86
4+
* Copyright (c) 2016, Intel Corporation.
5+
*/
6+
7+
#include <acpi/cppc_acpi.h>
8+
#include <asm/msr.h>
9+
#include <asm/processor.h>
10+
#include <asm/topology.h>
11+
12+
/* Refer to drivers/acpi/cppc_acpi.c for the description of functions */
13+
14+
bool cpc_ffh_supported(void)
15+
{
16+
return true;
17+
}
18+
19+
int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val)
20+
{
21+
int err;
22+
23+
err = rdmsrl_safe_on_cpu(cpunum, reg->address, val);
24+
if (!err) {
25+
u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
26+
reg->bit_offset);
27+
28+
*val &= mask;
29+
*val >>= reg->bit_offset;
30+
}
31+
return err;
32+
}
33+
34+
int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
35+
{
36+
u64 rd_val;
37+
int err;
38+
39+
err = rdmsrl_safe_on_cpu(cpunum, reg->address, &rd_val);
40+
if (!err) {
41+
u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
42+
reg->bit_offset);
43+
44+
val <<= reg->bit_offset;
45+
val &= mask;
46+
rd_val &= ~mask;
47+
rd_val |= val;
48+
err = wrmsrl_safe_on_cpu(cpunum, reg->address, rd_val);
49+
}
50+
return err;
51+
}
52+
53+
bool amd_set_max_freq_ratio(u64 *ratio)
54+
{
55+
struct cppc_perf_caps perf_caps;
56+
u64 highest_perf, nominal_perf;
57+
u64 perf_ratio;
58+
int rc;
59+
60+
if (!ratio)
61+
return false;
62+
63+
rc = cppc_get_perf_caps(0, &perf_caps);
64+
if (rc) {
65+
pr_debug("Could not retrieve perf counters (%d)\n", rc);
66+
return false;
67+
}
68+
69+
highest_perf = amd_get_highest_perf();
70+
nominal_perf = perf_caps.nominal_perf;
71+
72+
if (!highest_perf || !nominal_perf) {
73+
pr_debug("Could not retrieve highest or nominal performance\n");
74+
return false;
75+
}
76+
77+
perf_ratio = div_u64(highest_perf * SCHED_CAPACITY_SCALE, nominal_perf);
78+
/* midpoint between max_boost and max_P */
79+
perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1;
80+
if (!perf_ratio) {
81+
pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n");
82+
return false;
83+
}
84+
85+
*ratio = perf_ratio;
86+
arch_set_max_freq_ratio(false);
87+
88+
return true;
89+
}
90+
91+
static DEFINE_MUTEX(freq_invariance_lock);
92+
93+
void init_freq_invariance_cppc(void)
94+
{
95+
static bool secondary;
96+
97+
mutex_lock(&freq_invariance_lock);
98+
99+
init_freq_invariance(secondary, true);
100+
secondary = true;
101+
102+
mutex_unlock(&freq_invariance_lock);
103+
}

arch/x86/kernel/acpi/cppc_msr.c

Lines changed: 0 additions & 49 deletions
This file was deleted.

arch/x86/kernel/smpboot.c

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@
8383
#include <asm/hw_irq.h>
8484
#include <asm/stackprotector.h>
8585

86-
#ifdef CONFIG_ACPI_CPPC_LIB
87-
#include <acpi/cppc_acpi.h>
88-
#endif
89-
9086
/* representing HT siblings of each logical CPU */
9187
DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
9288
EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
@@ -155,8 +151,6 @@ static inline void smpboot_restore_warm_reset_vector(void)
155151
*((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0;
156152
}
157153

158-
static void init_freq_invariance(bool secondary, bool cppc_ready);
159-
160154
/*
161155
* Report back to the Boot Processor during boot time or to the caller processor
162156
* during CPU online.
@@ -2097,48 +2091,6 @@ static bool intel_set_max_freq_ratio(void)
20972091
return true;
20982092
}
20992093

2100-
#ifdef CONFIG_ACPI_CPPC_LIB
2101-
static bool amd_set_max_freq_ratio(void)
2102-
{
2103-
struct cppc_perf_caps perf_caps;
2104-
u64 highest_perf, nominal_perf;
2105-
u64 perf_ratio;
2106-
int rc;
2107-
2108-
rc = cppc_get_perf_caps(0, &perf_caps);
2109-
if (rc) {
2110-
pr_debug("Could not retrieve perf counters (%d)\n", rc);
2111-
return false;
2112-
}
2113-
2114-
highest_perf = amd_get_highest_perf();
2115-
nominal_perf = perf_caps.nominal_perf;
2116-
2117-
if (!highest_perf || !nominal_perf) {
2118-
pr_debug("Could not retrieve highest or nominal performance\n");
2119-
return false;
2120-
}
2121-
2122-
perf_ratio = div_u64(highest_perf * SCHED_CAPACITY_SCALE, nominal_perf);
2123-
/* midpoint between max_boost and max_P */
2124-
perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1;
2125-
if (!perf_ratio) {
2126-
pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n");
2127-
return false;
2128-
}
2129-
2130-
arch_turbo_freq_ratio = perf_ratio;
2131-
arch_set_max_freq_ratio(false);
2132-
2133-
return true;
2134-
}
2135-
#else
2136-
static bool amd_set_max_freq_ratio(void)
2137-
{
2138-
return false;
2139-
}
2140-
#endif
2141-
21422094
static void init_counter_refs(void)
21432095
{
21442096
u64 aperf, mperf;
@@ -2167,7 +2119,7 @@ static void register_freq_invariance_syscore_ops(void)
21672119
static inline void register_freq_invariance_syscore_ops(void) {}
21682120
#endif
21692121

2170-
static void init_freq_invariance(bool secondary, bool cppc_ready)
2122+
void init_freq_invariance(bool secondary, bool cppc_ready)
21712123
{
21722124
bool ret = false;
21732125

@@ -2187,7 +2139,7 @@ static void init_freq_invariance(bool secondary, bool cppc_ready)
21872139
if (!cppc_ready) {
21882140
return;
21892141
}
2190-
ret = amd_set_max_freq_ratio();
2142+
ret = amd_set_max_freq_ratio(&arch_turbo_freq_ratio);
21912143
}
21922144

21932145
if (ret) {
@@ -2200,22 +2152,6 @@ static void init_freq_invariance(bool secondary, bool cppc_ready)
22002152
}
22012153
}
22022154

2203-
#ifdef CONFIG_ACPI_CPPC_LIB
2204-
static DEFINE_MUTEX(freq_invariance_lock);
2205-
2206-
void init_freq_invariance_cppc(void)
2207-
{
2208-
static bool secondary;
2209-
2210-
mutex_lock(&freq_invariance_lock);
2211-
2212-
init_freq_invariance(secondary, true);
2213-
secondary = true;
2214-
2215-
mutex_unlock(&freq_invariance_lock);
2216-
}
2217-
#endif
2218-
22192155
static void disable_freq_invariance_workfn(struct work_struct *work)
22202156
{
22212157
static_branch_disable(&arch_scale_freq_key);
@@ -2264,8 +2200,4 @@ void arch_scale_freq_tick(void)
22642200
pr_warn("Scheduler frequency invariance went wobbly, disabling!\n");
22652201
schedule_work(&disable_freq_invariance_work);
22662202
}
2267-
#else
2268-
static inline void init_freq_invariance(bool secondary, bool cppc_ready)
2269-
{
2270-
}
22712203
#endif /* CONFIG_X86_64 */

drivers/acpi/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ config ACPI_IPMI
302302
help
303303
This driver enables the ACPI to access the BMC controller. And it
304304
uses the IPMI request/response message to communicate with BMC
305-
controller, which can be found on on the server.
305+
controller, which can be found on the server.
306306

307307
To compile this driver as a module, choose M here:
308308
the module will be called as acpi_ipmi.

drivers/acpi/ec.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,8 +2081,11 @@ bool acpi_ec_dispatch_gpe(void)
20812081
*/
20822082
spin_lock_irq(&first_ec->lock);
20832083

2084-
if (acpi_ec_gpe_status_set(first_ec))
2084+
if (acpi_ec_gpe_status_set(first_ec)) {
2085+
pm_pr_dbg("ACPI EC GPE status set\n");
2086+
20852087
work_in_progress = advance_transaction(first_ec, false);
2088+
}
20862089

20872090
spin_unlock_irq(&first_ec->lock);
20882091

drivers/acpi/pci_link.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource,
185185
if (!p || !p->interrupt_count) {
186186
/*
187187
* IRQ descriptors may have no IRQ# bits set,
188-
* particularly those those w/ _STA disabled
188+
* particularly those w/ _STA disabled
189189
*/
190190
pr_debug("Blank _CRS IRQ resource\n");
191191
return AE_OK;

0 commit comments

Comments
 (0)