Skip to content

Commit 11b3125

Browse files
committed
Merge tag 'acpi-6.12-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 upstream version 20240827, add support for ACPI-based enumeration of interrupt controllers on RISC-V along with some related irqchip updates, clean up the ACPI device object sysfs interface, add some quirks for backlight handling and IRQ overrides, fix assorted issues and clean up code. Specifics: - Check return value in acpi_db_convert_to_package() (Pei Xiao) - Detect FACS and allow setting the waking vector on reduced-hardware ACPI platforms (Jiaqing Zhao) - Allow ACPICA to represent semaphores as integers (Adrien Destugues) - Complete CXL 3.0 CXIMS structures support in ACPICA (Zhang Rui) - Make ACPICA support SPCR version 4 and add RISC-V SBI Subtype to DBG2 (Sia Jee Heng) - Implement the Dword_PCC Resource Descriptor Macro in ACPICA (Jose Marinho) - Correct the typo in struct acpi_mpam_msc_node member (Punit Agrawal) - Implement ACPI_WARNING_ONCE() and ACPI_ERROR_ONCE() and use them to prevent a Stall() violation warning from being printed every time this takes place (Vasily Khoruzhick) - Allow PCC Data Type in MCTP resource (Adam Young) - Fix memory leaks on acpi_ps_get_next_namepath() and acpi_ps_get_next_field() failures (Armin Wolf) - Add support for supressing leading zeros in hex strings when converting them to integers and update integer-to-hex-string conversions in ACPICA (Armin Wolf) - Add support for Windows 11 22H2 _OSI string (Armin Wolf) - Avoid warning for Dump Functions in ACPICA (Adam Lackorzynski) - Add extended linear address mode to HMAT MSCIS in ACPICA (Dave Jiang) - Handle empty connection_node in iasl (Aleksandrs Vinarskis) - Allow for more flexibility in _DSM args (Saket Dumbre) - Setup for ACPICA release 20240827 (Saket Dumbre) - Add ACPI device enumeration support for interrupt controller probing including taking dependencies into account (Sunil V L) - Implement ACPI-based interrupt controller probing on RISC-V (Sunil V L) - Add ACPI support for AIA in riscv-intc and add ACPI support to riscv-imsic, riscv-aplic, and sifive-plic (Sunil V L) - Do not release locks during operation region accesses in the ACPI EC driver (Rafael Wysocki) - Fix up the _STR handling in the ACPI device object sysfs interface, make it represent the device object attributes as an attribute group and make it rely on driver core functionality for sysfs attrubute management (Thomas Weißschuh) - Extend error messages printed to the kernel log when acpi_evaluate_dsm() fails to include revision and function number (David Wang) - Add a new AMDI0015 platform device ID to the ACPi APD driver for AMD SoCs (Shyam Sundar S K) - Use the driver core for the async probing management in the ACPI battery driver (Thomas Weißschuh) - Remove redundant initalizations of a local variable to NULL from the ACPI battery driver (Ilpo Järvinen) - Remove unneeded check in tps68470_pmic_opregion_probe() (Aleksandr Mishin) - Add support for setting the EPP register through the ACPI CPPC sysfs interface if it is in FFH (Mario Limonciello) - Fix MASK_VAL() usage in the ACPI CPPC library (Clément Léger) - Reduce the log level of a per-CPU message about idle states in the ACPI processor driver (Li RongQing) - Fix crash in exit_round_robin() in the ACPI processor aggregator device (PAD) driver (Seiji Nishikawa) - Add force_vendor quirk for Panasonic Toughbook CF-18 in the ACPI backlight driver (Hans de Goede) - Make the DMI checks related to backlight handling on Lenovo Yoga Tab 3 X90F less strict (Hans de Goede) - Enforce native backlight handling on Apple MacbookPro9,2 (Esther Shimanovich) - Add IRQ override quirks for Asus Vivobook Go E1404GAB and MECHREV GM7XG0M, and refine the TongFang GMxXGxx quirk (Li Chen, Tamim Khan, Werner Sembach) - Quirk ASUS ROG M16 to default to S3 sleep (Luke D. Jones) - Define and use symbols for device and class name lengths in the ACPI bus type code and make the code use strscpy() instead of strcpy() in several places (Muhammad Qasim Abdul Majeed)" * tag 'acpi-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (70 commits) ACPI: resource: Add another DMI match for the TongFang GMxXGxx ACPI: CPPC: Add support for setting EPP register in FFH ACPI: PM: Quirk ASUS ROG M16 to default to S3 sleep ACPI: video: Add force_vendor quirk for Panasonic Toughbook CF-18 ACPI: battery: use driver core managed async probing ACPI: button: Use strscpy() instead of strcpy() ACPI: resource: Skip IRQ override on Asus Vivobook Go E1404GAB ACPI: CPPC: Fix MASK_VAL() usage irqchip/sifive-plic: Add ACPI support ACPICA: Setup for ACPICA release 20240827 ACPICA: Allow for more flexibility in _DSM args ACPICA: iasl: handle empty connection_node ACPICA: HMAT: Add extended linear address mode to MSCIS ACPICA: Avoid warning for Dump Functions ACPICA: Add support for Windows 11 22H2 _OSI string ACPICA: Update integer-to-hex-string conversions ACPICA: Add support for supressing leading zeros in hex strings ACPICA: Allow for supressing leading zeros when using acpi_ex_convert_to_ascii() ACPICA: Fix memory leak if acpi_ps_get_next_field() fails ACPICA: Fix memory leak if acpi_ps_get_next_namepath() fails ...
2 parents 64dd3b6 + 3dd2fcf commit 11b3125

Some content is hidden

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

66 files changed

+1561
-607
lines changed

arch/arm64/kernel/pci.c

Lines changed: 0 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,7 @@
66
* Copyright (C) 2014 ARM Ltd.
77
*/
88

9-
#include <linux/acpi.h>
10-
#include <linux/init.h>
11-
#include <linux/io.h>
12-
#include <linux/kernel.h>
13-
#include <linux/mm.h>
149
#include <linux/pci.h>
15-
#include <linux/pci-acpi.h>
16-
#include <linux/pci-ecam.h>
17-
#include <linux/slab.h>
18-
19-
#ifdef CONFIG_ACPI
20-
/*
21-
* Try to assign the IRQ number when probing a new device
22-
*/
23-
int pcibios_alloc_irq(struct pci_dev *dev)
24-
{
25-
if (!acpi_disabled)
26-
acpi_pci_irq_enable(dev);
27-
28-
return 0;
29-
}
30-
#endif
3110

3211
/*
3312
* raw_pci_read/write - Platform-specific PCI config space access.
@@ -61,173 +40,3 @@ int pcibus_to_node(struct pci_bus *bus)
6140
EXPORT_SYMBOL(pcibus_to_node);
6241

6342
#endif
64-
65-
#ifdef CONFIG_ACPI
66-
67-
struct acpi_pci_generic_root_info {
68-
struct acpi_pci_root_info common;
69-
struct pci_config_window *cfg; /* config space mapping */
70-
};
71-
72-
int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
73-
{
74-
struct pci_config_window *cfg = bus->sysdata;
75-
struct acpi_device *adev = to_acpi_device(cfg->parent);
76-
struct acpi_pci_root *root = acpi_driver_data(adev);
77-
78-
return root->segment;
79-
}
80-
81-
int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
82-
{
83-
struct pci_config_window *cfg;
84-
struct acpi_device *adev;
85-
struct device *bus_dev;
86-
87-
if (acpi_disabled)
88-
return 0;
89-
90-
cfg = bridge->bus->sysdata;
91-
92-
/*
93-
* On Hyper-V there is no corresponding ACPI device for a root bridge,
94-
* therefore ->parent is set as NULL by the driver. And set 'adev' as
95-
* NULL in this case because there is no proper ACPI device.
96-
*/
97-
if (!cfg->parent)
98-
adev = NULL;
99-
else
100-
adev = to_acpi_device(cfg->parent);
101-
102-
bus_dev = &bridge->bus->dev;
103-
104-
ACPI_COMPANION_SET(&bridge->dev, adev);
105-
set_dev_node(bus_dev, acpi_get_node(acpi_device_handle(adev)));
106-
107-
return 0;
108-
}
109-
110-
static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci)
111-
{
112-
struct resource_entry *entry, *tmp;
113-
int status;
114-
115-
status = acpi_pci_probe_root_resources(ci);
116-
resource_list_for_each_entry_safe(entry, tmp, &ci->resources) {
117-
if (!(entry->res->flags & IORESOURCE_WINDOW))
118-
resource_list_destroy_entry(entry);
119-
}
120-
return status;
121-
}
122-
123-
/*
124-
* Lookup the bus range for the domain in MCFG, and set up config space
125-
* mapping.
126-
*/
127-
static struct pci_config_window *
128-
pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root)
129-
{
130-
struct device *dev = &root->device->dev;
131-
struct resource *bus_res = &root->secondary;
132-
u16 seg = root->segment;
133-
const struct pci_ecam_ops *ecam_ops;
134-
struct resource cfgres;
135-
struct acpi_device *adev;
136-
struct pci_config_window *cfg;
137-
int ret;
138-
139-
ret = pci_mcfg_lookup(root, &cfgres, &ecam_ops);
140-
if (ret) {
141-
dev_err(dev, "%04x:%pR ECAM region not found\n", seg, bus_res);
142-
return NULL;
143-
}
144-
145-
adev = acpi_resource_consumer(&cfgres);
146-
if (adev)
147-
dev_info(dev, "ECAM area %pR reserved by %s\n", &cfgres,
148-
dev_name(&adev->dev));
149-
else
150-
dev_warn(dev, FW_BUG "ECAM area %pR not reserved in ACPI namespace\n",
151-
&cfgres);
152-
153-
cfg = pci_ecam_create(dev, &cfgres, bus_res, ecam_ops);
154-
if (IS_ERR(cfg)) {
155-
dev_err(dev, "%04x:%pR error %ld mapping ECAM\n", seg, bus_res,
156-
PTR_ERR(cfg));
157-
return NULL;
158-
}
159-
160-
return cfg;
161-
}
162-
163-
/* release_info: free resources allocated by init_info */
164-
static void pci_acpi_generic_release_info(struct acpi_pci_root_info *ci)
165-
{
166-
struct acpi_pci_generic_root_info *ri;
167-
168-
ri = container_of(ci, struct acpi_pci_generic_root_info, common);
169-
pci_ecam_free(ri->cfg);
170-
kfree(ci->ops);
171-
kfree(ri);
172-
}
173-
174-
/* Interface called from ACPI code to setup PCI host controller */
175-
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
176-
{
177-
struct acpi_pci_generic_root_info *ri;
178-
struct pci_bus *bus, *child;
179-
struct acpi_pci_root_ops *root_ops;
180-
struct pci_host_bridge *host;
181-
182-
ri = kzalloc(sizeof(*ri), GFP_KERNEL);
183-
if (!ri)
184-
return NULL;
185-
186-
root_ops = kzalloc(sizeof(*root_ops), GFP_KERNEL);
187-
if (!root_ops) {
188-
kfree(ri);
189-
return NULL;
190-
}
191-
192-
ri->cfg = pci_acpi_setup_ecam_mapping(root);
193-
if (!ri->cfg) {
194-
kfree(ri);
195-
kfree(root_ops);
196-
return NULL;
197-
}
198-
199-
root_ops->release_info = pci_acpi_generic_release_info;
200-
root_ops->prepare_resources = pci_acpi_root_prepare_resources;
201-
root_ops->pci_ops = (struct pci_ops *)&ri->cfg->ops->pci_ops;
202-
bus = acpi_pci_root_create(root, root_ops, &ri->common, ri->cfg);
203-
if (!bus)
204-
return NULL;
205-
206-
/* If we must preserve the resource configuration, claim now */
207-
host = pci_find_host_bridge(bus);
208-
if (host->preserve_config)
209-
pci_bus_claim_resources(bus);
210-
211-
/*
212-
* Assign whatever was left unassigned. If we didn't claim above,
213-
* this will reassign everything.
214-
*/
215-
pci_assign_unassigned_root_bus_resources(bus);
216-
217-
list_for_each_entry(child, &bus->children, node)
218-
pcie_bus_configure_settings(child);
219-
220-
return bus;
221-
}
222-
223-
void pcibios_add_bus(struct pci_bus *bus)
224-
{
225-
acpi_pci_add_bus(bus);
226-
}
227-
228-
void pcibios_remove_bus(struct pci_bus *bus)
229-
{
230-
acpi_pci_remove_bus(bus);
231-
}
232-
233-
#endif

arch/riscv/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config 32BIT
1313
config RISCV
1414
def_bool y
1515
select ACPI_GENERIC_GSI if ACPI
16+
select ACPI_MCFG if (ACPI && PCI)
1617
select ACPI_PPTT if ACPI
1718
select ACPI_REDUCED_HARDWARE_ONLY if ACPI
1819
select ACPI_SPCR_TABLE if ACPI
@@ -188,6 +189,7 @@ config RISCV
188189
select OF_EARLY_FLATTREE
189190
select OF_IRQ
190191
select PCI_DOMAINS_GENERIC if PCI
192+
select PCI_ECAM if (ACPI && PCI)
191193
select PCI_MSI if PCI
192194
select RISCV_ALTERNATIVE if !XIP_KERNEL
193195
select RISCV_APLIC

arch/riscv/include/asm/irq.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,63 @@
1212

1313
#include <asm-generic/irq.h>
1414

15+
#define INVALID_CONTEXT UINT_MAX
16+
1517
void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void));
1618

1719
struct fwnode_handle *riscv_get_intc_hwnode(void);
1820

21+
#ifdef CONFIG_ACPI
22+
23+
enum riscv_irqchip_type {
24+
ACPI_RISCV_IRQCHIP_INTC = 0x00,
25+
ACPI_RISCV_IRQCHIP_IMSIC = 0x01,
26+
ACPI_RISCV_IRQCHIP_PLIC = 0x02,
27+
ACPI_RISCV_IRQCHIP_APLIC = 0x03,
28+
};
29+
30+
int riscv_acpi_get_gsi_info(struct fwnode_handle *fwnode, u32 *gsi_base,
31+
u32 *id, u32 *nr_irqs, u32 *nr_idcs);
32+
struct fwnode_handle *riscv_acpi_get_gsi_domain_id(u32 gsi);
33+
unsigned long acpi_rintc_index_to_hartid(u32 index);
34+
unsigned long acpi_rintc_ext_parent_to_hartid(unsigned int plic_id, unsigned int ctxt_idx);
35+
unsigned int acpi_rintc_get_plic_nr_contexts(unsigned int plic_id);
36+
unsigned int acpi_rintc_get_plic_context(unsigned int plic_id, unsigned int ctxt_idx);
37+
int __init acpi_rintc_get_imsic_mmio_info(u32 index, struct resource *res);
38+
39+
#else
40+
static inline int riscv_acpi_get_gsi_info(struct fwnode_handle *fwnode, u32 *gsi_base,
41+
u32 *id, u32 *nr_irqs, u32 *nr_idcs)
42+
{
43+
return 0;
44+
}
45+
46+
static inline unsigned long acpi_rintc_index_to_hartid(u32 index)
47+
{
48+
return INVALID_HARTID;
49+
}
50+
51+
static inline unsigned long acpi_rintc_ext_parent_to_hartid(unsigned int plic_id,
52+
unsigned int ctxt_idx)
53+
{
54+
return INVALID_HARTID;
55+
}
56+
57+
static inline unsigned int acpi_rintc_get_plic_nr_contexts(unsigned int plic_id)
58+
{
59+
return INVALID_CONTEXT;
60+
}
61+
62+
static inline unsigned int acpi_rintc_get_plic_context(unsigned int plic_id, unsigned int ctxt_idx)
63+
{
64+
return INVALID_CONTEXT;
65+
}
66+
67+
static inline int __init acpi_rintc_get_imsic_mmio_info(u32 index, struct resource *res)
68+
{
69+
return 0;
70+
}
71+
72+
#endif /* CONFIG_ACPI */
73+
1974
#endif /* _ASM_RISCV_IRQ_H */

arch/riscv/kernel/acpi.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -311,29 +311,26 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
311311
#ifdef CONFIG_PCI
312312

313313
/*
314-
* These interfaces are defined just to enable building ACPI core.
315-
* TODO: Update it with actual implementation when external interrupt
316-
* controller support is added in RISC-V ACPI.
314+
* raw_pci_read/write - Platform-specific PCI config space access.
317315
*/
318-
int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
319-
int reg, int len, u32 *val)
316+
int raw_pci_read(unsigned int domain, unsigned int bus,
317+
unsigned int devfn, int reg, int len, u32 *val)
320318
{
321-
return PCIBIOS_DEVICE_NOT_FOUND;
322-
}
319+
struct pci_bus *b = pci_find_bus(domain, bus);
323320

324-
int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
325-
int reg, int len, u32 val)
326-
{
327-
return PCIBIOS_DEVICE_NOT_FOUND;
321+
if (!b)
322+
return PCIBIOS_DEVICE_NOT_FOUND;
323+
return b->ops->read(b, devfn, reg, len, val);
328324
}
329325

330-
int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
326+
int raw_pci_write(unsigned int domain, unsigned int bus,
327+
unsigned int devfn, int reg, int len, u32 val)
331328
{
332-
return -1;
333-
}
329+
struct pci_bus *b = pci_find_bus(domain, bus);
334330

335-
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
336-
{
337-
return NULL;
331+
if (!b)
332+
return PCIBIOS_DEVICE_NOT_FOUND;
333+
return b->ops->write(b, devfn, reg, len, val);
338334
}
335+
339336
#endif /* CONFIG_PCI */

drivers/acpi/ac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ static int acpi_ac_probe(struct platform_device *pdev)
213213
return -ENOMEM;
214214

215215
ac->device = adev;
216-
strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
217-
strcpy(acpi_device_class(adev), ACPI_AC_CLASS);
216+
strscpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
217+
strscpy(acpi_device_class(adev), ACPI_AC_CLASS);
218218

219219
platform_set_drvdata(pdev, ac);
220220

drivers/acpi/acpi_apd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ static const struct apd_device_desc wt_i2c_desc = {
118118
.fixed_clk_rate = 150000000,
119119
};
120120

121+
static const struct apd_device_desc wt_i3c_desc = {
122+
.setup = acpi_apd_setup,
123+
.fixed_clk_rate = 125000000,
124+
};
125+
121126
static struct property_entry uart_properties[] = {
122127
PROPERTY_ENTRY_U32("reg-io-width", 4),
123128
PROPERTY_ENTRY_U32("reg-shift", 2),
@@ -231,6 +236,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
231236
{ "AMD0030", },
232237
{ "AMD0040", APD_ADDR(fch_misc_desc)},
233238
{ "AMDI0010", APD_ADDR(wt_i2c_desc) },
239+
{ "AMDI0015", APD_ADDR(wt_i3c_desc) },
234240
{ "AMDI0019", APD_ADDR(wt_i2c_desc) },
235241
{ "AMDI0020", APD_ADDR(cz_uart_desc) },
236242
{ "AMDI0022", APD_ADDR(cz_uart_desc) },

drivers/acpi/acpi_pad.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ static void exit_round_robin(unsigned int tsk_index)
136136
{
137137
struct cpumask *pad_busy_cpus = to_cpumask(pad_busy_cpus_bits);
138138

139-
cpumask_clear_cpu(tsk_in_cpu[tsk_index], pad_busy_cpus);
140-
tsk_in_cpu[tsk_index] = -1;
139+
if (tsk_in_cpu[tsk_index] != -1) {
140+
cpumask_clear_cpu(tsk_in_cpu[tsk_index], pad_busy_cpus);
141+
tsk_in_cpu[tsk_index] = -1;
142+
}
141143
}
142144

143145
static unsigned int idle_pct = 5; /* percentage */
@@ -428,8 +430,8 @@ static int acpi_pad_probe(struct platform_device *pdev)
428430
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
429431
acpi_status status;
430432

431-
strcpy(acpi_device_name(adev), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
432-
strcpy(acpi_device_class(adev), ACPI_PROCESSOR_AGGREGATOR_CLASS);
433+
strscpy(acpi_device_name(adev), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
434+
strscpy(acpi_device_class(adev), ACPI_PROCESSOR_AGGREGATOR_CLASS);
433435

434436
status = acpi_install_notify_handler(adev->handle,
435437
ACPI_DEVICE_NOTIFY, acpi_pad_notify, adev);

0 commit comments

Comments
 (0)