Skip to content

Commit bca2175

Browse files
committed
Merge tag 'acpi-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "These are usual ACPICA code updates (although there are more of them than in the last few releases), a noticeable EC driver update (which mostly consists of cleanups, though), the device enumeration quirks handling rework from Hans, some updates eliminating unnecessary CPU cache flushing in some places (processor idle and system-wide PM code) and a bunch of assorted cleanups and fixes. Specifics: - Update ACPICA code in the kernel to the 20211217 upstream release including the following changes: - iASL/Disassembler: Additional support for NHLT table (Bob Moore). - Change a return_ACPI_STATUS (AE_BAD_PARAMETER) (Bob Moore). - Fix a couple of warnings under MSVC (Bob Moore). - iASL: Add TDEL table to both compiler/disassembler (Bob Moore). - iASL/NHLT table: "Specific Data" field support (Bob Moore). - Use original data_table_region pointer for accesses (Jessica Clarke). - Use original pointer for virtual origin tables (Jessica Clarke). - Macros: Remove ACPI_PHYSADDR_TO_PTR (Jessica Clarke). - Avoid subobject buffer overflow when validating RSDP signature (Jessica Clarke). - iASL: Add suppport for AGDI table (Ilkka Koskinen). - Hardware: Do not flush CPU cache when entering S4 and S5 (Kirill A. Shutemov). - Expand the ACPI_ACCESS_ definitions (Mark Langsdorf). - Utilities: Avoid deleting the same object twice in a row (Rafael Wysocki). - Executer: Fix REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() (Rafael Wysocki). - Fix AEST Processor generic resource substructure data field byte length (Shuuichirou Ishii). - Fix wrong interpretation of PCC address (Sudeep Holla). - Add support for PCC Opregion special context data (Sudeep Holla). - Implement OperationRegion handler for PCC Type 3 subtype (Sudeep Holla). - Introduce acpi_fetch_acpi_dev() as a replacement for acpi_bus_get_device() and use it in the ACPI subsystem (Rafael Wysocki). - Avoid using _CID for device enumaration if _HID is missing or invalid (Rafael Wysocki). - Rework quirk handling during ACPI device enumeration and add some new quirks for known broken platforms (Hans de Goede). - Avoid unnecessary or redundant CPU cache flushing during system PM transitions (Kirill A. Shutemov). - Add PM debug messages related to power resources (Rafael Wysocki). - Fix kernel-doc comment in the PCI host bridge ACPI driver (Yang Li). - Rework flushing of EC work while suspended to idle and clean up the handling of events in the ACPI EC driver (Rafael Wysocki). - Prohibit ec_sys module parameter write_support from being used when the system is locked down (Hans de Goede). - Make the ACPI processor thermal driver use cpufreq_cpu_get() to check for presence of cpufreq policy (Manfred Spraul). - Avoid unnecessary CPU cache flushing in the ACPI processor idle driver (Kirill A. Shutemov). - Replace kernel.h with the necessary inclusions in the ACPI processor driver (Andy Shevchenko). - Use swap() instead of open coding it in the ACPI processor idle driver (Guo Zhengkui). - Fix the handling of defective LPAT in the ACPI xpower PMIC driver and clean up some definitions of PMIC data structures (Hans de Goede). - Fix outdated comment in the ACPI DPTF driver (Sumeet Pawnikar). - Add AEST to the list of known ACPI table signatures (Shuuichirou Ishii). - Make ACPI NUMA code take hotpluggable memblocks into account when CONFIG_MEMORY_HOTPLUG is not set (Vitaly Kuznetsov). - Use default_groups in kobj_type in the ACPI sysfs code (Greg Kroah-Hartman). - Rearrange _CPC structure documentation (Andy Shevchenko). - Drop an always true check from the ACPI thermal driver (Adam Borowski). - Add new "not charging" quirk for Lenovo ThinkPads to the ACPI battery driver (Thomas Weißschuh)" * tag 'acpi-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (64 commits) ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype ACPI / x86: Skip AC and battery devices on x86 Android tablets with broken DSDTs ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper ACPI: processor: thermal: avoid cpufreq_get_policy() serdev: Do not instantiate serdevs on boards with known bogus DSDT entries i2c: acpi: Do not instantiate I2C-clients on boards with known bogus DSDT entries ACPI / x86: Add acpi_quirk_skip_[i2c_client|serdev]_enumeration() helpers ACPI: scan: Create platform device for BCM4752 and LNV4752 ACPI nodes PCI/ACPI: Fix acpi_pci_osc_control_set() kernel-doc comment ACPI: battery: Add the ThinkPad "Not Charging" quirk ACPI: sysfs: use default_groups in kobj_type ACPICA: Update version to 20211217 ACPICA: iASL/NHLT table: "Specific Data" field support ACPICA: iASL: Add suppport for AGDI table ACPICA: iASL: Add TDEL table to both compiler/disassembler ACPICA: Fixed a couple of warnings under MSVC ACPICA: Change a return_ACPI_STATUS (AE_BAD_PARAMETER) ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 ACPICA: Add support for PCC Opregion special context data ACPICA: Fix wrong interpretation of PCC address ...
2 parents 63045bf + 70df8e1 commit bca2175

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1210
-590
lines changed

drivers/acpi/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,23 @@ config ACPI_PPTT
524524
bool
525525
endif
526526

527+
config ACPI_PCC
528+
bool "ACPI PCC Address Space"
529+
depends on PCC
530+
default y
531+
help
532+
The PCC Address Space also referred as PCC Operation Region pertains
533+
to the region of PCC subspace that succeeds the PCC signature.
534+
535+
The PCC Operation Region works in conjunction with the PCC Table
536+
(Platform Communications Channel Table). PCC subspaces that are
537+
marked for use as PCC Operation Regions must not be used as PCC
538+
subspaces for the standard ACPI features such as CPPC, RASF, PDTT and
539+
MPST. These standard features must always use the PCC Table instead.
540+
541+
Enable this feature if you want to set up and install the PCC Address
542+
Space handler to handle PCC OpRegion in the firmware.
543+
527544
source "drivers/acpi/pmic/Kconfig"
528545

529546
config ACPI_VIOT

drivers/acpi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ acpi-$(CONFIG_ACPI_LPIT) += acpi_lpit.o
6767
acpi-$(CONFIG_ACPI_GENERIC_GSI) += irq.o
6868
acpi-$(CONFIG_ACPI_WATCHDOG) += acpi_watchdog.o
6969
acpi-$(CONFIG_ACPI_PRMT) += prmt.o
70+
acpi-$(CONFIG_ACPI_PCC) += acpi_pcc.o
7071

7172
# Address translation
7273
acpi-$(CONFIG_ACPI_ADXL) += acpi_adxl.o

drivers/acpi/ac.c

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,12 @@ static const struct acpi_device_id ac_device_ids[] = {
4848
};
4949
MODULE_DEVICE_TABLE(acpi, ac_device_ids);
5050

51-
/* Lists of PMIC ACPI HIDs with an (often better) native charger driver */
52-
static const struct acpi_ac_bl acpi_ac_blacklist[] = {
53-
{ "INT33F4", -1 }, /* X-Powers AXP288 PMIC */
54-
{ "INT34D3", 3 }, /* Intel Cherrytrail Whiskey Cove PMIC */
55-
};
56-
5751
#ifdef CONFIG_PM_SLEEP
5852
static int acpi_ac_resume(struct device *dev);
5953
#endif
6054
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
6155

6256
static int ac_sleep_before_get_state_ms;
63-
static int ac_check_pmic = 1;
6457
static int ac_only;
6558

6659
static struct acpi_driver acpi_ac_driver = {
@@ -200,12 +193,6 @@ static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
200193
return 0;
201194
}
202195

203-
static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
204-
{
205-
ac_check_pmic = 0;
206-
return 0;
207-
}
208-
209196
static int __init ac_only_quirk(const struct dmi_system_id *d)
210197
{
211198
ac_only = 1;
@@ -214,29 +201,13 @@ static int __init ac_only_quirk(const struct dmi_system_id *d)
214201

215202
/* Please keep this list alphabetically sorted */
216203
static const struct dmi_system_id ac_dmi_table[] __initconst = {
217-
{
218-
/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
219-
.callback = ac_do_not_check_pmic_quirk,
220-
.matches = {
221-
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
222-
},
223-
},
224204
{
225205
/* Kodlix GK45 returning incorrect state */
226206
.callback = ac_only_quirk,
227207
.matches = {
228208
DMI_MATCH(DMI_PRODUCT_NAME, "GK45"),
229209
},
230210
},
231-
{
232-
/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
233-
.callback = ac_do_not_check_pmic_quirk,
234-
.matches = {
235-
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
236-
DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
237-
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
238-
},
239-
},
240211
{
241212
/* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */
242213
.callback = thinkpad_e530_quirk,
@@ -341,23 +312,15 @@ static int acpi_ac_remove(struct acpi_device *device)
341312

342313
static int __init acpi_ac_init(void)
343314
{
344-
unsigned int i;
345315
int result;
346316

347317
if (acpi_disabled)
348318
return -ENODEV;
349319

350-
dmi_check_system(ac_dmi_table);
320+
if (acpi_quirk_skip_acpi_ac_and_battery())
321+
return -ENODEV;
351322

352-
if (ac_check_pmic) {
353-
for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
354-
if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
355-
acpi_ac_blacklist[i].hrv)) {
356-
pr_info("found native %s PMIC, not loading\n",
357-
acpi_ac_blacklist[i].hid);
358-
return -ENODEV;
359-
}
360-
}
323+
dmi_check_system(ac_dmi_table);
361324

362325
result = acpi_bus_register_driver(&acpi_ac_driver);
363326
if (result < 0)

drivers/acpi/acpi_pcc.c

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Author: Sudeep Holla <sudeep.holla@arm.com>
4+
* Copyright 2021 Arm Limited
5+
*
6+
* The PCC Address Space also referred as PCC Operation Region pertains to the
7+
* region of PCC subspace that succeeds the PCC signature. The PCC Operation
8+
* Region works in conjunction with the PCC Table(Platform Communications
9+
* Channel Table). PCC subspaces that are marked for use as PCC Operation
10+
* Regions must not be used as PCC subspaces for the standard ACPI features
11+
* such as CPPC, RASF, PDTT and MPST. These standard features must always use
12+
* the PCC Table instead.
13+
*
14+
* This driver sets up the PCC Address Space and installs an handler to enable
15+
* handling of PCC OpRegion in the firmware.
16+
*
17+
*/
18+
#include <linux/kernel.h>
19+
#include <linux/acpi.h>
20+
#include <linux/completion.h>
21+
#include <linux/idr.h>
22+
#include <linux/io.h>
23+
24+
#include <acpi/pcc.h>
25+
26+
struct pcc_data {
27+
struct pcc_mbox_chan *pcc_chan;
28+
void __iomem *pcc_comm_addr;
29+
struct completion done;
30+
struct mbox_client cl;
31+
struct acpi_pcc_info ctx;
32+
};
33+
34+
struct acpi_pcc_info pcc_ctx;
35+
36+
static void pcc_rx_callback(struct mbox_client *cl, void *m)
37+
{
38+
struct pcc_data *data = container_of(cl, struct pcc_data, cl);
39+
40+
complete(&data->done);
41+
}
42+
43+
static acpi_status
44+
acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
45+
void *handler_context, void **region_context)
46+
{
47+
struct pcc_data *data;
48+
struct acpi_pcc_info *ctx = handler_context;
49+
struct pcc_mbox_chan *pcc_chan;
50+
51+
data = kzalloc(sizeof(*data), GFP_KERNEL);
52+
if (!data)
53+
return AE_NO_MEMORY;
54+
55+
data->cl.rx_callback = pcc_rx_callback;
56+
data->cl.knows_txdone = true;
57+
data->ctx.length = ctx->length;
58+
data->ctx.subspace_id = ctx->subspace_id;
59+
data->ctx.internal_buffer = ctx->internal_buffer;
60+
61+
init_completion(&data->done);
62+
data->pcc_chan = pcc_mbox_request_channel(&data->cl, ctx->subspace_id);
63+
if (IS_ERR(data->pcc_chan)) {
64+
pr_err("Failed to find PCC channel for subspace %d\n",
65+
ctx->subspace_id);
66+
return AE_NOT_FOUND;
67+
}
68+
69+
pcc_chan = data->pcc_chan;
70+
data->pcc_comm_addr = acpi_os_ioremap(pcc_chan->shmem_base_addr,
71+
pcc_chan->shmem_size);
72+
if (!data->pcc_comm_addr) {
73+
pr_err("Failed to ioremap PCC comm region mem for %d\n",
74+
ctx->subspace_id);
75+
return AE_NO_MEMORY;
76+
}
77+
78+
*region_context = data;
79+
return AE_OK;
80+
}
81+
82+
static acpi_status
83+
acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
84+
u32 bits, acpi_integer *value,
85+
void *handler_context, void *region_context)
86+
{
87+
int ret;
88+
struct pcc_data *data = region_context;
89+
90+
reinit_completion(&data->done);
91+
92+
/* Write to Shared Memory */
93+
memcpy_toio(data->pcc_comm_addr, (void *)value, data->ctx.length);
94+
95+
ret = mbox_send_message(data->pcc_chan->mchan, NULL);
96+
if (ret < 0)
97+
return AE_ERROR;
98+
99+
if (data->pcc_chan->mchan->mbox->txdone_irq)
100+
wait_for_completion(&data->done);
101+
102+
mbox_client_txdone(data->pcc_chan->mchan, ret);
103+
104+
memcpy_fromio(value, data->pcc_comm_addr, data->ctx.length);
105+
106+
return AE_OK;
107+
}
108+
109+
void __init acpi_init_pcc(void)
110+
{
111+
acpi_status status;
112+
113+
status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
114+
ACPI_ADR_SPACE_PLATFORM_COMM,
115+
&acpi_pcc_address_space_handler,
116+
&acpi_pcc_address_space_setup,
117+
&pcc_ctx);
118+
if (ACPI_FAILURE(status))
119+
pr_alert("OperationRegion handler could not be installed\n");
120+
}

drivers/acpi/acpi_video.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,13 +1733,12 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context,
17331733
{
17341734
struct acpi_device *device = context;
17351735
struct acpi_device *sibling;
1736-
int result;
17371736

17381737
if (handle == device->handle)
17391738
return AE_CTRL_TERMINATE;
17401739

1741-
result = acpi_bus_get_device(handle, &sibling);
1742-
if (result)
1740+
sibling = acpi_fetch_acpi_dev(handle);
1741+
if (!sibling)
17431742
return AE_OK;
17441743

17451744
if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME))

drivers/acpi/acpica/acevents.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle,
223223
u32 function,
224224
void *handler_context, void **region_context);
225225

226+
acpi_status
227+
acpi_ev_data_table_region_setup(acpi_handle handle,
228+
u32 function,
229+
void *handler_context, void **region_context);
230+
226231
acpi_status
227232
acpi_ev_default_region_setup(acpi_handle handle,
228233
u32 function,

drivers/acpi/acpica/acobject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ struct acpi_object_region {
138138
union acpi_operand_object *next;
139139
acpi_physical_address address;
140140
u32 length;
141+
void *pointer; /* Only for data table regions */
141142
};
142143

143144
struct acpi_object_method {

drivers/acpi/acpica/actables.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc,
3535

3636
acpi_status
3737
acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc,
38-
acpi_physical_address address, u8 flags);
38+
acpi_physical_address address,
39+
u8 flags, struct acpi_table_header *table);
3940

4041
void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc);
4142

@@ -86,6 +87,7 @@ acpi_tb_release_table(struct acpi_table_header *table,
8687
acpi_status
8788
acpi_tb_install_standard_table(acpi_physical_address address,
8889
u8 flags,
90+
struct acpi_table_header *table,
8991
u8 reload, u8 override, u32 *table_index);
9092

9193
void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc);
@@ -95,7 +97,9 @@ acpi_tb_load_table(u32 table_index, struct acpi_namespace_node *parent_node);
9597

9698
acpi_status
9799
acpi_tb_install_and_load_table(acpi_physical_address address,
98-
u8 flags, u8 override, u32 *table_index);
100+
u8 flags,
101+
struct acpi_table_header *table,
102+
u8 override, u32 *table_index);
99103

100104
acpi_status acpi_tb_unload_table(u32 table_index);
101105

drivers/acpi/acpica/dsopcode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
531531

532532
obj_desc->region.address = ACPI_PTR_TO_PHYSADDR(table);
533533
obj_desc->region.length = table->length;
534+
obj_desc->region.pointer = table;
534535

535536
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
536537
obj_desc,

drivers/acpi/acpica/evhandler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node *node,
386386
case ACPI_ADR_SPACE_DATA_TABLE:
387387

388388
handler = acpi_ex_data_table_space_handler;
389-
setup = NULL;
389+
setup = acpi_ev_data_table_region_setup;
390390
break;
391391

392392
default:

0 commit comments

Comments
 (0)