Commit ebf8b135 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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
// SPDX-License-Identifier: GPL-2.0
#include <linux/dmi.h>
#include <linux/ioport.h>
#include <asm/e820/api.h>
......@@ -23,11 +24,31 @@ static void resource_clip(struct resource *res, resource_size_t start,
res->start = end + 1;
}
/*
* Some BIOS-es contain a bug where they add addresses which map to
* system RAM in the PCI host bridge window returned by the ACPI _CRS
* method, see commit 4dc2287c1805 ("x86: avoid E820 regions when
* allocating address space"). To avoid this Linux by default excludes
* E820 reservations when allocating addresses since 2010.
* In 2019 some systems have shown-up with E820 reservations which cover
* the entire _CRS returned PCI host bridge window, causing all attempts
* to assign memory to PCI BARs to fail if Linux uses E820 reservations.
*
* Ideally Linux would fully stop using E820 reservations, but then
* the old systems this was added for will regress.
* Instead keep the old behavior for old systems, while ignoring the
* E820 reservations for any systems from now on.
*/
static void remove_e820_regions(struct resource *avail)
{
int i;
int i, year = dmi_get_bios_year();
struct e820_entry *entry;
if (year >= 2018)
return;
pr_info_once("PCI: Removing E820 reservations from host bridge windows\n");
for (i = 0; i < e820_table->nr_entries; i++) {
entry = &e820_table->entries[i];
......
......@@ -95,6 +95,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
resource_size(rentry->res));
break;
}
if (!clk_data->base)
return -ENOMEM;
acpi_dev_free_resource_list(&resource_list);
......
......@@ -31,7 +31,7 @@ struct pcc_data {
struct acpi_pcc_info ctx;
};
struct acpi_pcc_info pcc_ctx;
static struct acpi_pcc_info pcc_ctx;
static void pcc_rx_callback(struct mbox_client *cl, void *m)
{
......
......@@ -107,8 +107,13 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
pr_info("SPCR table version %d\n", table->header.revision);
if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
switch (ACPI_ACCESS_BIT_WIDTH((
table->serial_port.access_width))) {
u32 bit_width = table->serial_port.access_width;
if (bit_width > ACPI_ACCESS_BIT_MAX) {
pr_err("Unacceptable wide SPCR Access Width. Defaulting to byte size\n");
bit_width = ACPI_ACCESS_BIT_DEFAULT;
}
switch (ACPI_ACCESS_BIT_WIDTH((bit_width))) {
default:
pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n");
fallthrough;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment