Skip to content

Commit 456ed86

Browse files
committed
Merge tag 'acpi-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and PNP updates from Rafael Wysocki: "These include new code (for instance, support for the FFH address space type and support for new firmware data structures in ACPICA), some new quirks (mostly related to backlight handling and I2C enumeration), a number of fixes and a fair amount of cleanups all over. Specifics: - Update the ACPICA code in the kernel to the 20221020 upstream version and fix a couple of issues in it: - Make acpi_ex_load_op() match upstream implementation (Rafael Wysocki) - Add support for loong_arch-specific APICs in MADT (Huacai Chen) - Add support for fixed PCIe wake event (Huacai Chen) - Add EBDA pointer sanity checks (Vit Kabele) - Avoid accessing VGA memory when EBDA < 1KiB (Vit Kabele) - Add CCEL table support to both compiler/disassembler (Kuppuswamy Sathyanarayanan) - Add a couple of new UUIDs to the known UUID list (Bob Moore) - Add support for FFH Opregion special context data (Sudeep Holla) - Improve warning message for "invalid ACPI name" (Bob Moore) - Add support for CXL 3.0 structures (CXIMS & RDPAS) in the CEDT table (Alison Schofield) - Prepare IORT support for revision E.e (Robin Murphy) - Finish support for the CDAT table (Bob Moore) - Fix error code path in acpi_ds_call_control_method() (Rafael Wysocki) - Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() (Li Zetao) - Update the version of the ACPICA code in the kernel (Bob Moore) - Use ZERO_PAGE(0) instead of empty_zero_page in the ACPI device enumeration code (Giulio Benetti) - Change the return type of the ACPI driver remove callback to void and update its users accordingly (Dawei Li) - Add general support for FFH address space type and implement the low- level part of it for ARM64 (Sudeep Holla) - Fix stale comments in the ACPI tables parsing code and make it print more messages related to MADT (Hanjun Guo, Huacai Chen) - Replace invocations of generic library functions with more kernel- specific counterparts in the ACPI sysfs interface (Christophe JAILLET, Xu Panda) - Print full name paths of ACPI power resource objects during enumeration (Kane Chen) - Eliminate a compiler warning regarding a missing function prototype in the ACPI power management code (Sudeep Holla) - Fix and clean up the ACPI processor driver (Rafael Wysocki, Li Zhong, Colin Ian King, Sudeep Holla) - Add quirk for the HP Pavilion Gaming 15-cx0041ur to the ACPI EC driver (Mia Kanashi) - Add some mew ACPI backlight handling quirks and update some existing ones (Hans de Goede) - Make the ACPI backlight driver prefer the native backlight control over vendor backlight control when possible (Hans de Goede) - Drop unsetting ACPI APEI driver data on remove (Uwe Kleine-König) - Use xchg_release() instead of cmpxchg() for updating new GHES cache slots (Ard Biesheuvel) - Clean up the ACPI APEI code (Sudeep Holla, Christophe JAILLET, Jay Lu) - Add new I2C device enumeration quirks for Medion Lifetab S10346 and Lenovo Yoga Tab 3 Pro (YT3-X90F) (Hans de Goede) - Make the ACPI battery driver notify user space about adding new battery hooks and removing the existing ones (Armin Wolf) - Modify the pfr_update and pfr_telemetry drivers to use ACPI_FREE() for freeing acpi_object structures to help diagnostics (Wang ShaoBo) - Make the ACPI fan driver use sysfs_emit_at() in its sysfs interface code (ye xingchen) - Fix the _FIF package extraction failure handling in the ACPI fan driver (Hanjun Guo) - Fix the PCC mailbox handling error code path (Huisong Li) - Avoid using PCC Opregions if there is no platform interrupt allocated for this purpose (Huisong Li) - Use sysfs_emit() instead of scnprintf() in the ACPI PAD driver and CPPC library (ye xingchen) - Fix some kernel-doc issues in the ACPI GSI processing code (Xiongfeng Wang) - Fix name memory leak in pnp_alloc_dev() (Yang Yingliang) - Do not disable PNP devices on suspend when they cannot be re-enabled on resume (Hans de Goede) - Clean up the ACPI thermal driver a bit (Rafael Wysocki)" * tag 'acpi-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (67 commits) ACPI: x86: Add skip i2c clients quirk for Medion Lifetab S10346 ACPI: APEI: EINJ: Refactor available_error_type_show() ACPI: APEI: EINJ: Fix formatting errors ACPI: processor: perflib: Adjust acpi_processor_notify_smm() return value ACPI: processor: perflib: Rearrange acpi_processor_notify_smm() ACPI: processor: perflib: Rearrange unregistration routine ACPI: processor: perflib: Drop redundant parentheses ACPI: processor: perflib: Adjust white space ACPI: processor: idle: Drop unnecessary statements and parens ACPI: thermal: Adjust critical.flags.valid check ACPI: fan: Convert to use sysfs_emit_at() API ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() ACPI: battery: Call power_supply_changed() when adding hooks ACPI: use sysfs_emit() instead of scnprintf() ACPI: x86: Add skip i2c clients quirk for Lenovo Yoga Tab 3 Pro (YT3-X90F) ACPI: APEI: Remove a useless include PNP: Do not disable devices on suspend when they cannot be re-enabled on resume ACPI: processor: Silence missing prototype warnings ACPI: processor_idle: Silence missing prototype warnings ACPI: PM: Silence missing prototype warning ...
2 parents 045e222 + bee74dc commit 456ed86

106 files changed

Lines changed: 1172 additions & 635 deletions

Some content is hidden

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

arch/arm64/kernel/acpi.c

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define pr_fmt(fmt) "ACPI: " fmt
1414

1515
#include <linux/acpi.h>
16+
#include <linux/arm-smccc.h>
1617
#include <linux/cpumask.h>
1718
#include <linux/efi.h>
1819
#include <linux/efi-bgrt.h>
@@ -411,3 +412,108 @@ void arch_reserve_mem_area(acpi_physical_address addr, size_t size)
411412
{
412413
memblock_mark_nomap(addr, size);
413414
}
415+
416+
#ifdef CONFIG_ACPI_FFH
417+
/*
418+
* Implements ARM64 specific callbacks to support ACPI FFH Operation Region as
419+
* specified in https://developer.arm.com/docs/den0048/latest
420+
*/
421+
struct acpi_ffh_data {
422+
struct acpi_ffh_info info;
423+
void (*invoke_ffh_fn)(unsigned long a0, unsigned long a1,
424+
unsigned long a2, unsigned long a3,
425+
unsigned long a4, unsigned long a5,
426+
unsigned long a6, unsigned long a7,
427+
struct arm_smccc_res *args,
428+
struct arm_smccc_quirk *res);
429+
void (*invoke_ffh64_fn)(const struct arm_smccc_1_2_regs *args,
430+
struct arm_smccc_1_2_regs *res);
431+
};
432+
433+
int acpi_ffh_address_space_arch_setup(void *handler_ctxt, void **region_ctxt)
434+
{
435+
enum arm_smccc_conduit conduit;
436+
struct acpi_ffh_data *ffh_ctxt;
437+
438+
ffh_ctxt = kzalloc(sizeof(*ffh_ctxt), GFP_KERNEL);
439+
if (!ffh_ctxt)
440+
return -ENOMEM;
441+
442+
if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
443+
return -EOPNOTSUPP;
444+
445+
conduit = arm_smccc_1_1_get_conduit();
446+
if (conduit == SMCCC_CONDUIT_NONE) {
447+
pr_err("%s: invalid SMCCC conduit\n", __func__);
448+
return -EOPNOTSUPP;
449+
}
450+
451+
if (conduit == SMCCC_CONDUIT_SMC) {
452+
ffh_ctxt->invoke_ffh_fn = __arm_smccc_smc;
453+
ffh_ctxt->invoke_ffh64_fn = arm_smccc_1_2_smc;
454+
} else {
455+
ffh_ctxt->invoke_ffh_fn = __arm_smccc_hvc;
456+
ffh_ctxt->invoke_ffh64_fn = arm_smccc_1_2_hvc;
457+
}
458+
459+
memcpy(ffh_ctxt, handler_ctxt, sizeof(ffh_ctxt->info));
460+
461+
*region_ctxt = ffh_ctxt;
462+
return AE_OK;
463+
}
464+
465+
static bool acpi_ffh_smccc_owner_allowed(u32 fid)
466+
{
467+
int owner = ARM_SMCCC_OWNER_NUM(fid);
468+
469+
if (owner == ARM_SMCCC_OWNER_STANDARD ||
470+
owner == ARM_SMCCC_OWNER_SIP || owner == ARM_SMCCC_OWNER_OEM)
471+
return true;
472+
473+
return false;
474+
}
475+
476+
int acpi_ffh_address_space_arch_handler(acpi_integer *value, void *region_context)
477+
{
478+
int ret = 0;
479+
struct acpi_ffh_data *ffh_ctxt = region_context;
480+
481+
if (ffh_ctxt->info.offset == 0) {
482+
/* SMC/HVC 32bit call */
483+
struct arm_smccc_res res;
484+
u32 a[8] = { 0 }, *ptr = (u32 *)value;
485+
486+
if (!ARM_SMCCC_IS_FAST_CALL(*ptr) || ARM_SMCCC_IS_64(*ptr) ||
487+
!acpi_ffh_smccc_owner_allowed(*ptr) ||
488+
ffh_ctxt->info.length > 32) {
489+
ret = AE_ERROR;
490+
} else {
491+
int idx, len = ffh_ctxt->info.length >> 2;
492+
493+
for (idx = 0; idx < len; idx++)
494+
a[idx] = *(ptr + idx);
495+
496+
ffh_ctxt->invoke_ffh_fn(a[0], a[1], a[2], a[3], a[4],
497+
a[5], a[6], a[7], &res, NULL);
498+
memcpy(value, &res, sizeof(res));
499+
}
500+
501+
} else if (ffh_ctxt->info.offset == 1) {
502+
/* SMC/HVC 64bit call */
503+
struct arm_smccc_1_2_regs *r = (struct arm_smccc_1_2_regs *)value;
504+
505+
if (!ARM_SMCCC_IS_FAST_CALL(r->a0) || !ARM_SMCCC_IS_64(r->a0) ||
506+
!acpi_ffh_smccc_owner_allowed(r->a0) ||
507+
ffh_ctxt->info.length > sizeof(*r)) {
508+
ret = AE_ERROR;
509+
} else {
510+
ffh_ctxt->invoke_ffh64_fn(r, r);
511+
memcpy(value, r, ffh_ctxt->info.length);
512+
}
513+
} else {
514+
ret = AE_ERROR;
515+
}
516+
517+
return ret;
518+
}
519+
#endif /* CONFIG_ACPI_FFH */

arch/ia64/hp/common/aml_nfw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ static int aml_nfw_add(struct acpi_device *device)
187187
return aml_nfw_add_global_handler();
188188
}
189189

190-
static int aml_nfw_remove(struct acpi_device *device)
190+
static void aml_nfw_remove(struct acpi_device *device)
191191
{
192-
return aml_nfw_remove_global_handler();
192+
aml_nfw_remove_global_handler();
193193
}
194194

195195
static const struct acpi_device_id aml_nfw_ids[] = {

arch/loongarch/include/asm/acpi.h

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -31,148 +31,6 @@ static inline bool acpi_has_cpu_in_madt(void)
3131

3232
extern struct list_head acpi_wakeup_device_list;
3333

34-
/*
35-
* Temporary definitions until the core ACPICA code gets updated (see
36-
* 1656837932-18257-1-git-send-email-lvjianmin@loongson.cn and its
37-
* follow-ups for the "rationale").
38-
*
39-
* Once the "legal reasons" are cleared and that the code is merged,
40-
* this can be dropped entierely.
41-
*/
42-
#if (ACPI_CA_VERSION == 0x20220331 && !defined(LOONGARCH_ACPICA_EXT))
43-
44-
#define LOONGARCH_ACPICA_EXT 1
45-
46-
#define ACPI_MADT_TYPE_CORE_PIC 17
47-
#define ACPI_MADT_TYPE_LIO_PIC 18
48-
#define ACPI_MADT_TYPE_HT_PIC 19
49-
#define ACPI_MADT_TYPE_EIO_PIC 20
50-
#define ACPI_MADT_TYPE_MSI_PIC 21
51-
#define ACPI_MADT_TYPE_BIO_PIC 22
52-
#define ACPI_MADT_TYPE_LPC_PIC 23
53-
54-
/* Values for Version field above */
55-
56-
enum acpi_madt_core_pic_version {
57-
ACPI_MADT_CORE_PIC_VERSION_NONE = 0,
58-
ACPI_MADT_CORE_PIC_VERSION_V1 = 1,
59-
ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
60-
};
61-
62-
enum acpi_madt_lio_pic_version {
63-
ACPI_MADT_LIO_PIC_VERSION_NONE = 0,
64-
ACPI_MADT_LIO_PIC_VERSION_V1 = 1,
65-
ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
66-
};
67-
68-
enum acpi_madt_eio_pic_version {
69-
ACPI_MADT_EIO_PIC_VERSION_NONE = 0,
70-
ACPI_MADT_EIO_PIC_VERSION_V1 = 1,
71-
ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
72-
};
73-
74-
enum acpi_madt_ht_pic_version {
75-
ACPI_MADT_HT_PIC_VERSION_NONE = 0,
76-
ACPI_MADT_HT_PIC_VERSION_V1 = 1,
77-
ACPI_MADT_HT_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
78-
};
79-
80-
enum acpi_madt_bio_pic_version {
81-
ACPI_MADT_BIO_PIC_VERSION_NONE = 0,
82-
ACPI_MADT_BIO_PIC_VERSION_V1 = 1,
83-
ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
84-
};
85-
86-
enum acpi_madt_msi_pic_version {
87-
ACPI_MADT_MSI_PIC_VERSION_NONE = 0,
88-
ACPI_MADT_MSI_PIC_VERSION_V1 = 1,
89-
ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
90-
};
91-
92-
enum acpi_madt_lpc_pic_version {
93-
ACPI_MADT_LPC_PIC_VERSION_NONE = 0,
94-
ACPI_MADT_LPC_PIC_VERSION_V1 = 1,
95-
ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
96-
};
97-
98-
#pragma pack(1)
99-
100-
/* Core Interrupt Controller */
101-
102-
struct acpi_madt_core_pic {
103-
struct acpi_subtable_header header;
104-
u8 version;
105-
u32 processor_id;
106-
u32 core_id;
107-
u32 flags;
108-
};
109-
110-
/* Legacy I/O Interrupt Controller */
111-
112-
struct acpi_madt_lio_pic {
113-
struct acpi_subtable_header header;
114-
u8 version;
115-
u64 address;
116-
u16 size;
117-
u8 cascade[2];
118-
u32 cascade_map[2];
119-
};
120-
121-
/* Extend I/O Interrupt Controller */
122-
123-
struct acpi_madt_eio_pic {
124-
struct acpi_subtable_header header;
125-
u8 version;
126-
u8 cascade;
127-
u8 node;
128-
u64 node_map;
129-
};
130-
131-
/* HT Interrupt Controller */
132-
133-
struct acpi_madt_ht_pic {
134-
struct acpi_subtable_header header;
135-
u8 version;
136-
u64 address;
137-
u16 size;
138-
u8 cascade[8];
139-
};
140-
141-
/* Bridge I/O Interrupt Controller */
142-
143-
struct acpi_madt_bio_pic {
144-
struct acpi_subtable_header header;
145-
u8 version;
146-
u64 address;
147-
u16 size;
148-
u16 id;
149-
u16 gsi_base;
150-
};
151-
152-
/* MSI Interrupt Controller */
153-
154-
struct acpi_madt_msi_pic {
155-
struct acpi_subtable_header header;
156-
u8 version;
157-
u64 msg_address;
158-
u32 start;
159-
u32 count;
160-
};
161-
162-
/* LPC Interrupt Controller */
163-
164-
struct acpi_madt_lpc_pic {
165-
struct acpi_subtable_header header;
166-
u8 version;
167-
u64 address;
168-
u16 size;
169-
u8 cascade;
170-
};
171-
172-
#pragma pack()
173-
174-
#endif
175-
17634
#endif /* !CONFIG_ACPI */
17735

17836
#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT

arch/x86/platform/olpc/olpc-xo15-sci.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,12 @@ static int xo15_sci_add(struct acpi_device *device)
183183
return r;
184184
}
185185

186-
static int xo15_sci_remove(struct acpi_device *device)
186+
static void xo15_sci_remove(struct acpi_device *device)
187187
{
188188
acpi_disable_gpe(NULL, xo15_sci_gpe);
189189
acpi_remove_gpe_handler(NULL, xo15_sci_gpe, xo15_sci_gpe_handler);
190190
cancel_work_sync(&sci_work);
191191
sysfs_remove_file(&device->dev.kobj, &lid_wake_on_close_attr.attr);
192-
return 0;
193192
}
194193

195194
#ifdef CONFIG_PM_SLEEP

drivers/acpi/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,16 @@ config ACPI_PCC
564564
Enable this feature if you want to set up and install the PCC Address
565565
Space handler to handle PCC OpRegion in the firmware.
566566

567+
config ACPI_FFH
568+
bool "ACPI FFH Address Space"
569+
default n
570+
help
571+
The FFH(Fixed Function Hardware) Address Space also referred as FFH
572+
Operation Region allows to define platform specific opregion.
573+
574+
Enable this feature if you want to set up and install the FFH Address
575+
Space handler to handle FFH OpRegion in the firmware.
576+
567577
source "drivers/acpi/pmic/Kconfig"
568578

569579
config ACPI_VIOT

drivers/acpi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ acpi-$(CONFIG_ACPI_GENERIC_GSI) += irq.o
6868
acpi-$(CONFIG_ACPI_WATCHDOG) += acpi_watchdog.o
6969
acpi-$(CONFIG_ACPI_PRMT) += prmt.o
7070
acpi-$(CONFIG_ACPI_PCC) += acpi_pcc.o
71+
acpi-$(CONFIG_ACPI_FFH) += acpi_ffh.o
7172

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

drivers/acpi/ac.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ MODULE_DESCRIPTION("ACPI AC Adapter Driver");
3333
MODULE_LICENSE("GPL");
3434

3535
static int acpi_ac_add(struct acpi_device *device);
36-
static int acpi_ac_remove(struct acpi_device *device);
36+
static void acpi_ac_remove(struct acpi_device *device);
3737
static void acpi_ac_notify(struct acpi_device *device, u32 event);
3838

3939
static const struct acpi_device_id ac_device_ids[] = {
@@ -288,21 +288,19 @@ static int acpi_ac_resume(struct device *dev)
288288
#define acpi_ac_resume NULL
289289
#endif
290290

291-
static int acpi_ac_remove(struct acpi_device *device)
291+
static void acpi_ac_remove(struct acpi_device *device)
292292
{
293293
struct acpi_ac *ac = NULL;
294294

295295
if (!device || !acpi_driver_data(device))
296-
return -EINVAL;
296+
return;
297297

298298
ac = acpi_driver_data(device);
299299

300300
power_supply_unregister(ac->charger);
301301
unregister_acpi_notifier(&ac->battery_nb);
302302

303303
kfree(ac);
304-
305-
return 0;
306304
}
307305

308306
static int __init acpi_ac_init(void)

0 commit comments

Comments
 (0)