Skip to content

Commit ebf8b13

Browse files
committed
Merge branches 'acpi-x86', 'acpi-tables', 'acpi-soc' and 'acpi-pcc'
Merge additional ACPI-related updates for 5.17-rc1: - Ignore E820 reservations covering PCI host bridge windows on sufficiently recent x86 systems to avoid issues with allocating PCI BARs on systems where the E820 reservations cover the entire PCI host bridge memory window returned by the _CRS object in the system's ACPI tables (Hans de Goede). - Add more sanity checking to ACPI SPCR tables parsing (Mark Langsdorf). - Fix up ACPI APD (AMD Soc) driver initialization (Jiasheng Jiang). - Drop unnecessary "static" from the ACPI PCC address space handling driver added recently (kernel test robot). * acpi-x86: x86/PCI: Ignore E820 reservations for bridge windows on newer systems * acpi-tables: ACPI: SPCR: check if table->serial_port.access_width is too wide * acpi-soc: ACPI: APD: Check for NULL pointer after calling devm_ioremap() * acpi-pcc: ACPI: PCC: pcc_ctx can be static
5 parents c96f195 + 7f7b423 + ee3fe99 + 2cea3ec + 415b4b6 commit ebf8b13

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

arch/x86/kernel/resource.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#include <linux/dmi.h>
23
#include <linux/ioport.h>
34
#include <asm/e820/api.h>
45

@@ -23,11 +24,31 @@ static void resource_clip(struct resource *res, resource_size_t start,
2324
res->start = end + 1;
2425
}
2526

27+
/*
28+
* Some BIOS-es contain a bug where they add addresses which map to
29+
* system RAM in the PCI host bridge window returned by the ACPI _CRS
30+
* method, see commit 4dc2287c1805 ("x86: avoid E820 regions when
31+
* allocating address space"). To avoid this Linux by default excludes
32+
* E820 reservations when allocating addresses since 2010.
33+
* In 2019 some systems have shown-up with E820 reservations which cover
34+
* the entire _CRS returned PCI host bridge window, causing all attempts
35+
* to assign memory to PCI BARs to fail if Linux uses E820 reservations.
36+
*
37+
* Ideally Linux would fully stop using E820 reservations, but then
38+
* the old systems this was added for will regress.
39+
* Instead keep the old behavior for old systems, while ignoring the
40+
* E820 reservations for any systems from now on.
41+
*/
2642
static void remove_e820_regions(struct resource *avail)
2743
{
28-
int i;
44+
int i, year = dmi_get_bios_year();
2945
struct e820_entry *entry;
3046

47+
if (year >= 2018)
48+
return;
49+
50+
pr_info_once("PCI: Removing E820 reservations from host bridge windows\n");
51+
3152
for (i = 0; i < e820_table->nr_entries; i++) {
3253
entry = &e820_table->entries[i];
3354

drivers/acpi/acpi_apd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
9595
resource_size(rentry->res));
9696
break;
9797
}
98+
if (!clk_data->base)
99+
return -ENOMEM;
98100

99101
acpi_dev_free_resource_list(&resource_list);
100102

drivers/acpi/acpi_pcc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct pcc_data {
3131
struct acpi_pcc_info ctx;
3232
};
3333

34-
struct acpi_pcc_info pcc_ctx;
34+
static struct acpi_pcc_info pcc_ctx;
3535

3636
static void pcc_rx_callback(struct mbox_client *cl, void *m)
3737
{

drivers/acpi/spcr.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,13 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
107107
pr_info("SPCR table version %d\n", table->header.revision);
108108

109109
if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
110-
switch (ACPI_ACCESS_BIT_WIDTH((
111-
table->serial_port.access_width))) {
110+
u32 bit_width = table->serial_port.access_width;
111+
112+
if (bit_width > ACPI_ACCESS_BIT_MAX) {
113+
pr_err("Unacceptable wide SPCR Access Width. Defaulting to byte size\n");
114+
bit_width = ACPI_ACCESS_BIT_DEFAULT;
115+
}
116+
switch (ACPI_ACCESS_BIT_WIDTH((bit_width))) {
112117
default:
113118
pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n");
114119
fallthrough;

0 commit comments

Comments
 (0)