Skip to content

Commit f4fe74c

Browse files
committed
Merge tag 'acpi-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "These update the ACPICA code in the kernel to the 20180508 upstream revision and make it support the RT patch, add CPPC v3 support to the ACPI CPPC library, add a WDAT-based watchdog quirk to prevent clashes with the RTC, add quirks to the ACPI AC and battery drivers, and update the ACPI SoC drivers. Specifics: - Update the ACPICA code in the kernel to the 20180508 upstream revision including: * iASL -tc option enhancement (Bob Moore). * Debugger improvements (Bob Moore). * Support for tables larger than 1 MB in acpidump/acpixtract (Bob Moore). * Minor fixes and cleanups (Colin Ian King, Toomas Soome). - Make the ACPICA code in the kernel support the RT patch (Sebastian Andrzej Siewior, Steven Rostedt). - Add a kmemleak annotation to the ACPICA code (Larry Finger). - Add CPPC v3 support to the ACPI CPPC library and fix two issues related to CPPC (Prashanth Prakash, Al Stone). - Add an ACPI WDAT-based watchdog quirk to prefer iTCO_wdt on systems where WDAT clashes with the RTC SRAM (Mika Westerberg). - Add some quirks to the ACPI AC and battery drivers (Carlo Caione, Hans de Goede). - Update the ACPI SoC drivers for Intel (LPSS) and AMD (APD) platforms (Akshu Agrawal, Hans de Goede). - Fix up some assorted minor issues (Al Stone, Laszlo Toth, Mathieu Malaterre)" * tag 'acpi-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits) ACPICA: Mark acpi_ut_create_internal_object_dbg() memory allocations as non-leaks ACPI / watchdog: Prefer iTCO_wdt always when WDAT table uses RTC SRAM mailbox: PCC: erroneous error message when parsing ACPI PCCT ACPICA: Update version to 20180508 ACPICA: acpidump/acpixtract: Support for tables larger than 1MB ACPI: APD: Add AMD misc clock handler support clk: x86: Add ST oscout platform clock ACPICA: Update version to 20180427 ACPICA: Debugger: Removed direct support for EC address space in "Test Objects" ACPICA: Debugger: Add Package support for "test objects" command ACPICA: Improve error messages for the namespace root node ACPICA: Fix potential infinite loop in acpi_rs_dump_byte_list ACPICA: vsnprintf: this statement may fall through ACPICA: Tables: Fix spelling mistake in comment ACPICA: iASL: Enhance the -tc option (create AML hex file in C) ACPI: Add missing prototype_for arch_post_acpi_subsys_init() ACPI / tables: improve comments regarding acpi_parse_entries_array() ACPICA: Convert acpi_gbl_hardware lock back to an acpi_raw_spinlock ACPICA: provide abstraction for raw_spinlock_t ACPI / CPPC: Fix invalid PCC channel status errors ...
2 parents 3c89adb + 2448d13 commit f4fe74c

36 files changed

+751
-194
lines changed

Documentation/acpi/cppc_sysfs.txt

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
Collaborative Processor Performance Control (CPPC)
3+
4+
CPPC defined in the ACPI spec describes a mechanism for the OS to manage the
5+
performance of a logical processor on a contigious and abstract performance
6+
scale. CPPC exposes a set of registers to describe abstract performance scale,
7+
to request performance levels and to measure per-cpu delivered performance.
8+
9+
For more details on CPPC please refer to the ACPI specification at:
10+
11+
http://uefi.org/specifications
12+
13+
Some of the CPPC registers are exposed via sysfs under:
14+
15+
/sys/devices/system/cpu/cpuX/acpi_cppc/
16+
17+
for each cpu X
18+
19+
--------------------------------------------------------------------------------
20+
21+
$ ls -lR /sys/devices/system/cpu/cpu0/acpi_cppc/
22+
/sys/devices/system/cpu/cpu0/acpi_cppc/:
23+
total 0
24+
-r--r--r-- 1 root root 65536 Mar 5 19:38 feedback_ctrs
25+
-r--r--r-- 1 root root 65536 Mar 5 19:38 highest_perf
26+
-r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_freq
27+
-r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_nonlinear_perf
28+
-r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_perf
29+
-r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_freq
30+
-r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_perf
31+
-r--r--r-- 1 root root 65536 Mar 5 19:38 reference_perf
32+
-r--r--r-- 1 root root 65536 Mar 5 19:38 wraparound_time
33+
34+
--------------------------------------------------------------------------------
35+
36+
* highest_perf : Highest performance of this processor (abstract scale).
37+
* nominal_perf : Highest sustained performance of this processor (abstract scale).
38+
* lowest_nonlinear_perf : Lowest performance of this processor with nonlinear
39+
power savings (abstract scale).
40+
* lowest_perf : Lowest performance of this processor (abstract scale).
41+
42+
* lowest_freq : CPU frequency corresponding to lowest_perf (in MHz).
43+
* nominal_freq : CPU frequency corresponding to nominal_perf (in MHz).
44+
The above frequencies should only be used to report processor performance in
45+
freqency instead of abstract scale. These values should not be used for any
46+
functional decisions.
47+
48+
* feedback_ctrs : Includes both Reference and delivered performance counter.
49+
Reference counter ticks up proportional to processor's reference performance.
50+
Delivered counter ticks up proportional to processor's delivered performance.
51+
* wraparound_time: Minimum time for the feedback counters to wraparound (seconds).
52+
* reference_perf : Performance level at which reference performance counter
53+
accumulates (abstract scale).
54+
55+
--------------------------------------------------------------------------------
56+
57+
Computing Average Delivered Performance
58+
59+
Below describes the steps to compute the average performance delivered by taking
60+
two different snapshots of feedback counters at time T1 and T2.
61+
62+
T1: Read feedback_ctrs as fbc_t1
63+
Wait or run some workload
64+
T2: Read feedback_ctrs as fbc_t2
65+
66+
delivered_counter_delta = fbc_t2[del] - fbc_t1[del]
67+
reference_counter_delta = fbc_t2[ref] - fbc_t1[ref]
68+
69+
delivered_perf = (refernce_perf x delivered_counter_delta) / reference_counter_delta

drivers/acpi/ac.c

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
8686

8787

8888
static int ac_sleep_before_get_state_ms;
89+
static int ac_check_pmic = 1;
8990

9091
static struct acpi_driver acpi_ac_driver = {
9192
.name = "ac",
@@ -293,21 +294,43 @@ static int acpi_ac_battery_notify(struct notifier_block *nb,
293294
return NOTIFY_OK;
294295
}
295296

296-
static int thinkpad_e530_quirk(const struct dmi_system_id *d)
297+
static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
297298
{
298299
ac_sleep_before_get_state_ms = 1000;
299300
return 0;
300301
}
301302

302-
static const struct dmi_system_id ac_dmi_table[] = {
303+
static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
304+
{
305+
ac_check_pmic = 0;
306+
return 0;
307+
}
308+
309+
static const struct dmi_system_id ac_dmi_table[] __initconst = {
303310
{
311+
/* Thinkpad e530 */
304312
.callback = thinkpad_e530_quirk,
305-
.ident = "thinkpad e530",
306313
.matches = {
307314
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
308315
DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
309316
},
310317
},
318+
{
319+
/* ECS EF20EA */
320+
.callback = ac_do_not_check_pmic_quirk,
321+
.matches = {
322+
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
323+
},
324+
},
325+
{
326+
/* Lenovo Ideapad Miix 320 */
327+
.callback = ac_do_not_check_pmic_quirk,
328+
.matches = {
329+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
330+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
331+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
332+
},
333+
},
311334
{},
312335
};
313336

@@ -367,7 +390,6 @@ static int acpi_ac_add(struct acpi_device *device)
367390
kfree(ac);
368391
}
369392

370-
dmi_check_system(ac_dmi_table);
371393
return result;
372394
}
373395

@@ -425,13 +447,17 @@ static int __init acpi_ac_init(void)
425447
if (acpi_disabled)
426448
return -ENODEV;
427449

428-
for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
429-
if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
430-
acpi_ac_blacklist[i].hrv)) {
431-
pr_info(PREFIX "AC: found native %s PMIC, not loading\n",
432-
acpi_ac_blacklist[i].hid);
433-
return -ENODEV;
434-
}
450+
dmi_check_system(ac_dmi_table);
451+
452+
if (ac_check_pmic) {
453+
for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
454+
if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
455+
acpi_ac_blacklist[i].hrv)) {
456+
pr_info(PREFIX "AC: found native %s PMIC, not loading\n",
457+
acpi_ac_blacklist[i].hid);
458+
return -ENODEV;
459+
}
460+
}
435461

436462
#ifdef CONFIG_ACPI_PROCFS_POWER
437463
acpi_ac_dir = acpi_lock_ac_dir();

drivers/acpi/acpi_apd.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
#include <linux/clk-provider.h>
14+
#include <linux/platform_data/clk-st.h>
1415
#include <linux/platform_device.h>
1516
#include <linux/pm_domain.h>
1617
#include <linux/clkdev.h>
@@ -72,6 +73,47 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
7273
}
7374

7475
#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
76+
77+
static int misc_check_res(struct acpi_resource *ares, void *data)
78+
{
79+
struct resource res;
80+
81+
return !acpi_dev_resource_memory(ares, &res);
82+
}
83+
84+
static int st_misc_setup(struct apd_private_data *pdata)
85+
{
86+
struct acpi_device *adev = pdata->adev;
87+
struct platform_device *clkdev;
88+
struct st_clk_data *clk_data;
89+
struct resource_entry *rentry;
90+
struct list_head resource_list;
91+
int ret;
92+
93+
clk_data = devm_kzalloc(&adev->dev, sizeof(*clk_data), GFP_KERNEL);
94+
if (!clk_data)
95+
return -ENOMEM;
96+
97+
INIT_LIST_HEAD(&resource_list);
98+
ret = acpi_dev_get_resources(adev, &resource_list, misc_check_res,
99+
NULL);
100+
if (ret < 0)
101+
return -ENOENT;
102+
103+
list_for_each_entry(rentry, &resource_list, node) {
104+
clk_data->base = devm_ioremap(&adev->dev, rentry->res->start,
105+
resource_size(rentry->res));
106+
break;
107+
}
108+
109+
acpi_dev_free_resource_list(&resource_list);
110+
111+
clkdev = platform_device_register_data(&adev->dev, "clk-st",
112+
PLATFORM_DEVID_NONE, clk_data,
113+
sizeof(*clk_data));
114+
return PTR_ERR_OR_ZERO(clkdev);
115+
}
116+
75117
static const struct apd_device_desc cz_i2c_desc = {
76118
.setup = acpi_apd_setup,
77119
.fixed_clk_rate = 133000000,
@@ -94,6 +136,10 @@ static const struct apd_device_desc cz_uart_desc = {
94136
.fixed_clk_rate = 48000000,
95137
.properties = uart_properties,
96138
};
139+
140+
static const struct apd_device_desc st_misc_desc = {
141+
.setup = st_misc_setup,
142+
};
97143
#endif
98144

99145
#ifdef CONFIG_ARM64
@@ -179,6 +225,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
179225
{ "AMD0020", APD_ADDR(cz_uart_desc) },
180226
{ "AMDI0020", APD_ADDR(cz_uart_desc) },
181227
{ "AMD0030", },
228+
{ "AMD0040", APD_ADDR(st_misc_desc)},
182229
#endif
183230
#ifdef CONFIG_ARM64
184231
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },

drivers/acpi/acpi_lpss.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ ACPI_MODULE_NAME("acpi_lpss");
6969
#define LPSS_SAVE_CTX BIT(4)
7070
#define LPSS_NO_D3_DELAY BIT(5)
7171

72+
/* Crystal Cove PMIC shares same ACPI ID between different platforms */
73+
#define BYT_CRC_HRV 2
74+
#define CHT_CRC_HRV 3
75+
7276
struct lpss_private_data;
7377

7478
struct lpss_device_desc {
@@ -162,7 +166,7 @@ static void byt_pwm_setup(struct lpss_private_data *pdata)
162166
if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
163167
return;
164168

165-
if (!acpi_dev_present("INT33FD", NULL, -1))
169+
if (!acpi_dev_present("INT33FD", NULL, BYT_CRC_HRV))
166170
pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
167171
}
168172

drivers/acpi/acpi_watchdog.c

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,51 @@
1212
#define pr_fmt(fmt) "ACPI: watchdog: " fmt
1313

1414
#include <linux/acpi.h>
15-
#include <linux/dmi.h>
1615
#include <linux/ioport.h>
1716
#include <linux/platform_device.h>
1817

1918
#include "internal.h"
2019

21-
static const struct dmi_system_id acpi_watchdog_skip[] = {
22-
{
23-
/*
24-
* On Lenovo Z50-70 there are two issues with the WDAT
25-
* table. First some of the instructions use RTC SRAM
26-
* to store persistent information. This does not work well
27-
* with Linux RTC driver. Second, more important thing is
28-
* that the instructions do not actually reset the system.
29-
*
30-
* On this particular system iTCO_wdt seems to work just
31-
* fine so we prefer that over WDAT for now.
32-
*
33-
* See also https://bugzilla.kernel.org/show_bug.cgi?id=199033.
34-
*/
35-
.ident = "Lenovo Z50-70",
36-
.matches = {
37-
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
38-
DMI_MATCH(DMI_PRODUCT_NAME, "20354"),
39-
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Z50-70"),
40-
},
41-
},
42-
{}
43-
};
20+
#ifdef CONFIG_RTC_MC146818_LIB
21+
#include <linux/mc146818rtc.h>
22+
23+
/*
24+
* There are several systems where the WDAT table is accessing RTC SRAM to
25+
* store persistent information. This does not work well with the Linux RTC
26+
* driver so on those systems we skip WDAT driver and prefer iTCO_wdt
27+
* instead.
28+
*
29+
* See also https://bugzilla.kernel.org/show_bug.cgi?id=199033.
30+
*/
31+
static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat)
32+
{
33+
const struct acpi_wdat_entry *entries;
34+
int i;
35+
36+
entries = (struct acpi_wdat_entry *)(wdat + 1);
37+
for (i = 0; i < wdat->entries; i++) {
38+
const struct acpi_generic_address *gas;
39+
40+
gas = &entries[i].register_region;
41+
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
42+
switch (gas->address) {
43+
case RTC_PORT(0):
44+
case RTC_PORT(1):
45+
case RTC_PORT(2):
46+
case RTC_PORT(3):
47+
return true;
48+
}
49+
}
50+
}
51+
52+
return false;
53+
}
54+
#else
55+
static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat)
56+
{
57+
return false;
58+
}
59+
#endif
4460

4561
static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
4662
{
@@ -50,16 +66,18 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
5066
if (acpi_disabled)
5167
return NULL;
5268

53-
if (dmi_check_system(acpi_watchdog_skip))
54-
return NULL;
55-
5669
status = acpi_get_table(ACPI_SIG_WDAT, 0,
5770
(struct acpi_table_header **)&wdat);
5871
if (ACPI_FAILURE(status)) {
5972
/* It is fine if there is no WDAT */
6073
return NULL;
6174
}
6275

76+
if (acpi_watchdog_uses_rtc(wdat)) {
77+
pr_info("Skipping WDAT on this system because it uses RTC SRAM\n");
78+
return NULL;
79+
}
80+
6381
return wdat;
6482
}
6583

drivers/acpi/acpica/acapps.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ acpi_status
143143
fl_split_input_pathname(char *input_path,
144144
char **out_directory_path, char **out_filename);
145145

146+
char *fl_get_file_basename(char *file_pathname);
147+
146148
char *ad_generate_filename(char *prefix, char *table_id);
147149

148150
void

drivers/acpi/acpica/acglobal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ ACPI_GLOBAL(u8, acpi_gbl_global_lock_pending);
8282
* interrupt level
8383
*/
8484
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_gpe_lock); /* For GPE data structs and registers */
85-
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_hardware_lock); /* For ACPI H/W except GPE registers */
85+
ACPI_GLOBAL(acpi_raw_spinlock, acpi_gbl_hardware_lock); /* For ACPI H/W except GPE registers */
8686
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_reference_count_lock);
8787

8888
/* Mutex for _OSI support */

drivers/acpi/acpica/dbnames.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,15 @@ void acpi_db_dump_namespace(char *start_arg, char *depth_arg)
189189
}
190190

191191
acpi_db_set_output_destination(ACPI_DB_DUPLICATE_OUTPUT);
192-
acpi_os_printf("ACPI Namespace (from %4.4s (%p) subtree):\n",
193-
((struct acpi_namespace_node *)subtree_entry)->name.
194-
ascii, subtree_entry);
192+
193+
if (((struct acpi_namespace_node *)subtree_entry)->parent) {
194+
acpi_os_printf("ACPI Namespace (from %4.4s (%p) subtree):\n",
195+
((struct acpi_namespace_node *)subtree_entry)->
196+
name.ascii, subtree_entry);
197+
} else {
198+
acpi_os_printf("ACPI Namespace (from %s):\n",
199+
ACPI_NAMESPACE_ROOT);
200+
}
195201

196202
/* Display the subtree */
197203

0 commit comments

Comments
 (0)