Skip to content

Commit 9388076

Browse files
committed
Merge tag 'acpi-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "ACPI and PNP updates for 6.1-rc1. These rearrange the ACPI device object initialization code (to get rid of a redundant parent pointer from struct acpi_device among other things), unify the _UID handling, drop support for some _OSI strings that should not be necessary any more, add new IDs to support more hardware and some more quirks, fix a few issues and clean up code all over. Specifics: - Reimplement acpi_get_pci_dev() using the list of physical devices associated with the given ACPI device object (Rafael Wysocki) - Rename ACPI device object reference counting functions (Rafael Wysocki) - Rearrange ACPI device object initialization code (Rafael Wysocki) - Drop parent field from struct acpi_device (Rafael Wysocki) - Extend the the int3472-tps68470 driver to support multiple consumers of a single TPS68470 along with the requisite framework-level support (Daniel Scally) - Filter out non-memory resources in is_memory(), add a helper function to find all memory type resources of an ACPI device object and use that function in 3 places (Heikki Krogerus) - Add IRQ override quirks for Asus Vivobook K3402ZA/K3502ZA and ASUS model S5402ZA (Tamim Khan, Kellen Renshaw) - Fix acpi_dev_state_d0() kerneldoc (Sakari Ailus) - Fix up suspend-to-idle support on ASUS Rembrandt laptops (Mario Limonciello) - Clean up ACPI platform devices support code (Andy Shevchenko, John Garry) - Clean up ACPI bus management code (Andy Shevchenko, ye xingchen) - Add support for multiple DMA windows with different offsets to the ACPI device enumeration code and use it on LoongArch (Jianmin Lv) - Clean up the ACPI LPSS (Intel SoC) driver (Andy Shevchenko) - Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable (Mario Limonciello) - Drop unused dev_fmt() and redundant 'HMAT' prefix from the HMAT parsing code (Liu Shixin) - Make ACPI FPDT parsing code avoid calling acpi_os_map_memory() on invalid physical addresses (Hans de Goede) - Silence missing-declarations warning related to Apple device properties management (Lukas Wunner) - Disable frequency invariance in the CPPC library if registers used by cppc_get_perf_ctrs() are accessed via PCC (Jeremy Linton) - Add ACPI disabled check to acpi_cpc_valid() (Perry Yuan) - Fix Tx acknowledge in the PCC address space handler (Huisong Li) - Use wait_for_completion_timeout() for PCC mailbox operations (Huisong Li) - Release resources on PCC address space setup failure path (Rafael Mendonca) - Remove unneeded result variables from APEI code (ye xingchen) - Print total number of records found during BERT log parsing (Dmitry Monakhov) - Drop support for 3 _OSI strings that should not be necessary any more and update documentation on custom _OSI strings so that adding new ones is not encouraged any more (Mario Limonciello) - Drop unneeded result variable from ec_write() (ye xingchen) - Remove the leftover struct acpi_ac_bl from the ACPI AC driver (Hanjun Guo) - Reorder symbols to get rid of a few forward declarations in the ACPI fan driver (Uwe Kleine-König) - Add Toshiba Satellite/Portege Z830 ACPI backlight quirk (Arvid Norlander) - Add ARM DMA-330 controller to the supported list in the ACPI AMBA driver (Vijayenthiran Subramaniam) - Drop references to non-functional 01.org/linux-acpi web site from MAINTAINERS and Kconfig help texts (Rafael Wysocki) - Replace strlcpy() with unused retval with strscpy() in the ACPI support code (Wolfram Sang) - Do not initialize ret in main() in the pfrut utility (Shi junming) - Drop useless ACPI DSDT override documentation (Rafael Wysocki) - Fix a few typos and wording mistakes in the ACPI device enumeration documentation (Jean Delvare) - Introduce acpi_dev_uid_to_integer() to convert a _UID string into an integer value (Andy Shevchenko) - Use acpi_dev_uid_to_integer() in several places to unify _UID handling (Andy Shevchenko) - Drop unused pnpid32_to_pnpid() declaration from PNP code (Gaosheng Cui)" * tag 'acpi-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (79 commits) ACPI: LPSS: Deduplicate skipping device in acpi_lpss_create_device() ACPI: LPSS: Replace loop with first entry retrieval ACPI: x86: s2idle: Add another ID to s2idle_dmi_table ACPI: x86: s2idle: Fix a NULL pointer dereference MAINTAINERS: Drop records pointing to 01.org/linux-acpi ACPI: Kconfig: Drop link to https://01.org/linux-acpi ACPI: docs: Drop useless DSDT override documentation ACPI: DPTF: Drop stale link from Kconfig help ACPI: x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13 ACPI: x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7 ACPI: x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14 ACPI: x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE ACPI: x86: s2idle: Add module parameter to prefer Microsoft GUID ACPI: x86: s2idle: If a new AMD _HID is missing assume Rembrandt ACPI: x86: s2idle: Move _HID handling for AMD systems into structures platform/x86: int3472: Add board data for Surface Go2 IR camera platform/x86: int3472: Support multiple gpio lookups in board data platform/x86: int3472: Support multiple clock consumers ACPI: bus: Add iterator for dependent devices ACPI: scan: Add acpi_dev_get_next_consumer_dev() ...
2 parents f3dfe92 + c8efe77 commit 9388076

Some content is hidden

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

68 files changed

+904
-603
lines changed

Documentation/admin-guide/acpi/dsdt-override.rst

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

Documentation/firmware-guide/acpi/enumeration.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ possible we decided to do following:
2121
- Devices behind real busses where there is a connector resource
2222
are represented as struct spi_device or struct i2c_device. Note
2323
that standard UARTs are not busses so there is no struct uart_device,
24-
although some of them may be represented by sturct serdev_device.
24+
although some of them may be represented by struct serdev_device.
2525

2626
As both ACPI and Device Tree represent a tree of devices (and their
2727
resources) this implementation follows the Device Tree way as much as
@@ -205,7 +205,7 @@ Here is what the ACPI namespace for a SPI slave might look like::
205205
}
206206
...
207207

208-
The SPI device drivers only need to add ACPI IDs in a similar way than with
208+
The SPI device drivers only need to add ACPI IDs in a similar way to
209209
the platform device drivers. Below is an example where we add ACPI support
210210
to at25 SPI eeprom driver (this is meant for the above ACPI snippet)::
211211

@@ -362,7 +362,7 @@ These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
362362
specifies the path to the controller. In order to use these GPIOs in Linux
363363
we need to translate them to the corresponding Linux GPIO descriptors.
364364

365-
There is a standard GPIO API for that and is documented in
365+
There is a standard GPIO API for that and it is documented in
366366
Documentation/admin-guide/gpio/.
367367

368368
In the above example we can get the corresponding two GPIO descriptors with
@@ -538,8 +538,8 @@ information.
538538
PCI hierarchy representation
539539
============================
540540

541-
Sometimes could be useful to enumerate a PCI device, knowing its position on the
542-
PCI bus.
541+
Sometimes it could be useful to enumerate a PCI device, knowing its position on
542+
the PCI bus.
543543

544544
For example, some systems use PCI devices soldered directly on the mother board,
545545
in a fixed position (ethernet, Wi-Fi, serial ports, etc.). In this conditions it
@@ -550,7 +550,7 @@ To identify a PCI device, a complete hierarchical description is required, from
550550
the chipset root port to the final device, through all the intermediate
551551
bridges/switches of the board.
552552

553-
For example, let us assume to have a system with a PCIe serial port, an
553+
For example, let's assume we have a system with a PCIe serial port, an
554554
Exar XR17V3521, soldered on the main board. This UART chip also includes
555555
16 GPIOs and we want to add the property ``gpio-line-names`` [1] to these pins.
556556
In this case, the ``lspci`` output for this component is::
@@ -593,8 +593,8 @@ of the chipset bridge (also called "root port") with address::
593593

594594
Bus: 0 - Device: 14 - Function: 1
595595

596-
To find this information is necessary disassemble the BIOS ACPI tables, in
597-
particular the DSDT (see also [2])::
596+
To find this information, it is necessary to disassemble the BIOS ACPI tables,
597+
in particular the DSDT (see also [2])::
598598

599599
mkdir ~/tables/
600600
cd ~/tables/

Documentation/firmware-guide/acpi/osi.rst

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,23 @@ But it is likely that they will all eventually be added.
4141
What should an OEM do if they want to support Linux and Windows
4242
using the same BIOS image? Often they need to do something different
4343
for Linux to deal with how Linux is different from Windows.
44-
Here the BIOS should ask exactly what it wants to know:
4544

45+
In this case, the OEM should create custom ASL to be executed by the
46+
Linux kernel and changes to Linux kernel drivers to execute this custom
47+
ASL. The easiest way to accomplish this is to introduce a device specific
48+
method (_DSM) that is called from the Linux kernel.
49+
50+
In the past the kernel used to support something like:
4651
_OSI("Linux-OEM-my_interface_name")
4752
where 'OEM' is needed if this is an OEM-specific hook,
4853
and 'my_interface_name' describes the hook, which could be a
4954
quirk, a bug, or a bug-fix.
5055

51-
In addition, the OEM should send a patch to upstream Linux
52-
via the linux-acpi@vger.kernel.org mailing list. When that patch
53-
is checked into Linux, the OS will answer "YES" when the BIOS
54-
on the OEM's system uses _OSI to ask if the interface is supported
55-
by the OS. Linux distributors can back-port that patch for Linux
56-
pre-installs, and it will be included by all distributions that
57-
re-base to upstream. If the distribution can not update the kernel binary,
58-
they can also add an acpi_osi=Linux-OEM-my_interface_name
59-
cmdline parameter to the boot loader, as needed.
60-
61-
If the string refers to a feature where the upstream kernel
62-
eventually grows support, a patch should be sent to remove
63-
the string when that support is added to the kernel.
56+
However this was discovered to be abused by other BIOS vendors to change
57+
completely unrelated code on completely unrelated systems. This prompted
58+
an evaluation of all of it's uses. This uncovered that they aren't needed
59+
for any of the original reasons. As such, the kernel will not respond to
60+
any custom Linux-* strings by default.
6461

6562
That was easy. Read on, to find out how to do it wrong.
6663

MAINTAINERS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ M: "Rafael J. Wysocki" <rafael@kernel.org>
348348
R: Len Brown <lenb@kernel.org>
349349
L: linux-acpi@vger.kernel.org
350350
S: Supported
351-
W: https://01.org/linux-acpi
352351
Q: https://patchwork.kernel.org/project/linux-acpi/list/
353352
B: https://bugzilla.kernel.org
354353
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
@@ -427,7 +426,6 @@ M: Rafael J. Wysocki <rafael@kernel.org>
427426
R: Zhang Rui <rui.zhang@intel.com>
428427
L: linux-acpi@vger.kernel.org
429428
S: Supported
430-
W: https://01.org/linux-acpi
431429
B: https://bugzilla.kernel.org
432430
F: drivers/acpi/*thermal*
433431

@@ -10378,7 +10376,6 @@ INTEL MENLOW THERMAL DRIVER
1037810376
M: Sujith Thomas <sujith.thomas@intel.com>
1037910377
L: linux-pm@vger.kernel.org
1038010378
S: Supported
10381-
W: https://01.org/linux-acpi
1038210379
F: drivers/thermal/intel/intel_menlow.c
1038310380

1038410381
INTEL P-Unit IPC DRIVER

arch/loongarch/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ config LOONGARCH
1010
select ARCH_ENABLE_MEMORY_HOTPLUG
1111
select ARCH_ENABLE_MEMORY_HOTREMOVE
1212
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
13-
select ARCH_HAS_PHYS_TO_DMA
1413
select ARCH_HAS_PTE_SPECIAL
1514
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
1615
select ARCH_INLINE_READ_LOCK if !PREEMPTION

arch/loongarch/kernel/dma.c

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,29 @@
22
/*
33
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
44
*/
5-
#include <linux/init.h>
5+
#include <linux/acpi.h>
66
#include <linux/dma-direct.h>
7-
#include <linux/dma-mapping.h>
8-
#include <linux/dma-map-ops.h>
9-
#include <linux/swiotlb.h>
107

11-
#include <asm/bootinfo.h>
12-
#include <asm/dma.h>
13-
#include <asm/loongson.h>
14-
15-
/*
16-
* We extract 4bit node id (bit 44~47) from Loongson-3's
17-
* 48bit physical address space and embed it into 40bit.
18-
*/
19-
20-
static int node_id_offset;
21-
22-
dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
23-
{
24-
long nid = (paddr >> 44) & 0xf;
25-
26-
return ((nid << 44) ^ paddr) | (nid << node_id_offset);
27-
}
28-
29-
phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
8+
void acpi_arch_dma_setup(struct device *dev)
309
{
31-
long nid = (daddr >> node_id_offset) & 0xf;
10+
int ret;
11+
u64 mask, end = 0;
12+
const struct bus_dma_region *map = NULL;
13+
14+
ret = acpi_dma_get_range(dev, &map);
15+
if (!ret && map) {
16+
const struct bus_dma_region *r = map;
17+
18+
for (end = 0; r->size; r++) {
19+
if (r->dma_start + r->size - 1 > end)
20+
end = r->dma_start + r->size - 1;
21+
}
22+
23+
mask = DMA_BIT_MASK(ilog2(end) + 1);
24+
dev->bus_dma_limit = end;
25+
dev->dma_range_map = map;
26+
dev->coherent_dma_mask = min(dev->coherent_dma_mask, mask);
27+
*dev->dma_mask = min(*dev->dma_mask, mask);
28+
}
3229

33-
return ((nid << node_id_offset) ^ daddr) | (nid << 44);
34-
}
35-
36-
void __init plat_swiotlb_setup(void)
37-
{
38-
swiotlb_init(true, SWIOTLB_VERBOSE);
39-
node_id_offset = ((readl(LS7A_DMA_CFG) & LS7A_DMA_NODE_MASK) >> LS7A_DMA_NODE_SHF) + 36;
4030
}

arch/loongarch/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static void __init arch_mem_init(char **cmdline_p)
247247
sparse_init();
248248
memblock_set_bottom_up(true);
249249

250-
plat_swiotlb_setup();
250+
swiotlb_init(true, SWIOTLB_VERBOSE);
251251

252252
dma_contiguous_reserve(PFN_PHYS(max_low_pfn));
253253

drivers/acpi/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ menuconfig ACPI
2727
Management (APM) specification. If both ACPI and APM support
2828
are configured, ACPI is used.
2929

30-
The project home page for the Linux ACPI subsystem is here:
31-
<https://01.org/linux-acpi>
32-
3330
Linux support for ACPI is based on Intel Corporation's ACPI
3431
Component Architecture (ACPI CA). For more information on the
3532
ACPI CA, see:
@@ -347,7 +344,6 @@ config ACPI_CUSTOM_DSDT_FILE
347344
depends on !STANDALONE
348345
help
349346
This option supports a custom DSDT by linking it into the kernel.
350-
See Documentation/admin-guide/acpi/dsdt-override.rst
351347

352348
Enter the full path name to the file which includes the AmlCode
353349
or dsdt_aml_code declaration.

drivers/acpi/ac.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ static int acpi_ac_add(struct acpi_device *device);
3636
static int acpi_ac_remove(struct acpi_device *device);
3737
static void acpi_ac_notify(struct acpi_device *device, u32 event);
3838

39-
struct acpi_ac_bl {
40-
const char *hid;
41-
int hrv;
42-
};
43-
4439
static const struct acpi_device_id ac_device_ids[] = {
4540
{"ACPI0003", 0},
4641
{"", 0},

drivers/acpi/acpi_amba.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
static const struct acpi_device_id amba_id_list[] = {
2323
{"ARMH0061", 0}, /* PL061 GPIO Device */
24+
{"ARMH0330", 0}, /* ARM DMA Controller DMA-330 */
2425
{"ARMHC500", 0}, /* ARM CoreSight ETM4x */
2526
{"ARMHC501", 0}, /* ARM CoreSight ETR */
2627
{"ARMHC502", 0}, /* ARM CoreSight STM */
@@ -48,6 +49,7 @@ static void amba_register_dummy_clk(void)
4849
static int amba_handler_attach(struct acpi_device *adev,
4950
const struct acpi_device_id *id)
5051
{
52+
struct acpi_device *parent = acpi_dev_parent(adev);
5153
struct amba_device *dev;
5254
struct resource_entry *rentry;
5355
struct list_head resource_list;
@@ -97,8 +99,8 @@ static int amba_handler_attach(struct acpi_device *adev,
9799
* attached to it, that physical device should be the parent of
98100
* the amba device we are about to create.
99101
*/
100-
if (adev->parent)
101-
dev->dev.parent = acpi_get_first_physical_node(adev->parent);
102+
if (parent)
103+
dev->dev.parent = acpi_get_first_physical_node(parent);
102104

103105
ACPI_COMPANION_SET(&dev->dev, adev);
104106

drivers/acpi/acpi_apd.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
6060
}
6161

6262
#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
63-
static int misc_check_res(struct acpi_resource *ares, void *data)
64-
{
65-
struct resource res;
66-
67-
return !acpi_dev_resource_memory(ares, &res);
68-
}
6963

7064
static int fch_misc_setup(struct apd_private_data *pdata)
7165
{
@@ -82,8 +76,7 @@ static int fch_misc_setup(struct apd_private_data *pdata)
8276
return -ENOMEM;
8377

8478
INIT_LIST_HEAD(&resource_list);
85-
ret = acpi_dev_get_resources(adev, &resource_list, misc_check_res,
86-
NULL);
79+
ret = acpi_dev_get_memory_resources(adev, &resource_list);
8780
if (ret < 0)
8881
return -ENOENT;
8982

drivers/acpi/acpi_fpdt.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,23 @@ static const struct attribute_group boot_attr_group = {
143143

144144
static struct kobject *fpdt_kobj;
145145

146+
#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT
147+
#include <linux/processor.h>
148+
static bool fpdt_address_valid(u64 address)
149+
{
150+
/*
151+
* On some systems the table contains invalid addresses
152+
* with unsuppored high address bits set, check for this.
153+
*/
154+
return !(address >> boot_cpu_data.x86_phys_bits);
155+
}
156+
#else
157+
static bool fpdt_address_valid(u64 address)
158+
{
159+
return true;
160+
}
161+
#endif
162+
146163
static int fpdt_process_subtable(u64 address, u32 subtable_type)
147164
{
148165
struct fpdt_subtable_header *subtable_header;
@@ -151,6 +168,11 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
151168
u32 length, offset;
152169
int result;
153170

171+
if (!fpdt_address_valid(address)) {
172+
pr_info(FW_BUG "invalid physical address: 0x%llx!\n", address);
173+
return -EINVAL;
174+
}
175+
154176
subtable_header = acpi_os_map_memory(address, sizeof(*subtable_header));
155177
if (!subtable_header)
156178
return -ENOMEM;

0 commit comments

Comments
 (0)