Skip to content

Commit 6a8d7fb

Browse files
committed
Merge tag 'acpi-5.17-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more ACPI updates from Rafael Wysocki: "The most significant item here is the Platform Firmware Runtime Update and Telemetry (PFRUT) support designed to allow certain pieces of the platform firmware to be updated on the fly, among other things. Also important is the e820 handling change on x86 that should work around PCI BAR allocation issues on some systems shipping since 2019. The rest is just a handful of assorted fixes and cleanups on top of the ACPI material merged previously. Specifics: - Add support for the the Platform Firmware Runtime Update and Telemetry (PFRUT) interface based on ACPI to allow certain pieces of the platform firmware to be updated without restarting the system and to provide a mechanism for collecting platform firmware telemetry data (Chen Yu, Dan Carpenter, Yang Yingliang). - 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). - Fix and clean up acpi_scan_init() (Rafael Wysocki). - 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)" * tag 'acpi-5.17-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: PCC: pcc_ctx can be static ACPI: scan: Rename label in acpi_scan_init() ACPI: scan: Simplify initialization of power and sleep buttons ACPI: scan: Change acpi_scan_init() return value type to void ACPI: SPCR: check if table->serial_port.access_width is too wide ACPI: APD: Check for NULL pointer after calling devm_ioremap() x86/PCI: Ignore E820 reservations for bridge windows on newer systems ACPI: pfr_telemetry: Fix info leak in pfrt_log_ioctl() ACPI: pfr_update: Fix return value check in pfru_write() ACPI: tools: Introduce utility for firmware updates/telemetry ACPI: Introduce Platform Firmware Runtime Telemetry driver ACPI: Introduce Platform Firmware Runtime Update device driver efi: Introduce EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER and corresponding structures
2 parents e3a8b6a + e3daa26 commit 6a8d7fb

File tree

19 files changed

+1997
-62
lines changed

19 files changed

+1997
-62
lines changed

Documentation/userspace-api/ioctl/ioctl-number.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ Code Seq# Include File Comments
367367
<mailto:aherrman@de.ibm.com>
368368
0xE5 00-3F linux/fuse.h
369369
0xEC 00-01 drivers/platform/chrome/cros_ec_dev.h ChromeOS EC driver
370+
0xEE 00-09 uapi/linux/pfrut.h Platform Firmware Runtime Update and Telemetry
370371
0xF3 00-3F drivers/usb/misc/sisusbvga/sisusb.h sisfb (in development)
371372
<mailto:thomas@winischhofer.net>
372373
0xF6 all LTTng Linux Trace Toolkit Next Generation

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/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,28 @@ config ACPI_CONFIGFS
520520
userspace. The configurable ACPI groups will be visible under
521521
/config/acpi, assuming configfs is mounted under /config.
522522

523+
config ACPI_PFRUT
524+
tristate "ACPI Platform Firmware Runtime Update and Telemetry"
525+
depends on 64BIT
526+
help
527+
This mechanism allows certain pieces of the platform firmware
528+
to be updated on the fly while the system is running (runtime)
529+
without the need to restart it, which is key in the cases when
530+
the system needs to be available 100% of the time and it cannot
531+
afford the downtime related to restarting it, or when the work
532+
carried out by the system is particularly important, so it cannot
533+
be interrupted, and it is not practical to wait until it is complete.
534+
535+
The existing firmware code can be modified (driver update) or
536+
extended by adding new code to the firmware (code injection).
537+
538+
Besides, the telemetry driver allows user space to fetch telemetry
539+
data from the firmware with the help of the Platform Firmware Runtime
540+
Telemetry interface.
541+
542+
To compile the drivers as modules, choose M here:
543+
the modules will be called pfr_update and pfr_telemetry.
544+
523545
if ARM64
524546
source "drivers/acpi/arm64/Kconfig"
525547

drivers/acpi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o
103103
obj-$(CONFIG_ACPI_SPCR_TABLE) += spcr.o
104104
obj-$(CONFIG_ACPI_DEBUGGER_USER) += acpi_dbg.o
105105
obj-$(CONFIG_ACPI_PPTT) += pptt.o
106+
obj-$(CONFIG_ACPI_PFRUT) += pfr_update.o pfr_telemetry.o
106107

107108
# processor has its own "processor." module_param namespace
108109
processor-y := processor_driver.o

drivers/acpi/acpi_apd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
102102
resource_size(rentry->res));
103103
break;
104104
}
105+
if (!clk_data->base)
106+
return -ENOMEM;
105107

106108
acpi_dev_free_resource_list(&resource_list);
107109

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/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
int early_acpi_osi_init(void);
1515
int acpi_osi_init(void);
1616
acpi_status acpi_os_initialize1(void);
17-
int acpi_scan_init(void);
17+
void acpi_scan_init(void);
1818
#ifdef CONFIG_PCI
1919
void acpi_pci_root_init(void);
2020
void acpi_pci_link_init(void);

0 commit comments

Comments
 (0)