Skip to content

Commit 8e2308c

Browse files
committed
Merge branches 'acpica', 'acpi-osl' and 'acpi-tables'
Merge ACPICA updates, an ACPI OS service layer (OSL) update and assorted updates related to parsing ACPI tables for 7.1-rc1: - Update maintainers information regarding ACPICA (Rafael Wysocki) - Replace strncpy() with strscpy_pad() in acpi_ut_safe_strncpy() (Kees Cook) - Trigger an ordered system power off after encountering a fatal error operator in AML (Armin Wolf) - Enable ACPI FPDT parsing on LoongArch (Xi Ruoyao) - Remove the temporary stop-gap acpi_pptt_cache_v1_full structure from the ACPI PPTT parser (Ben Horgan) - Add support for exposing ACPI FPDT subtables FBPT and S3PT (Nate DeSimone) * acpica: ACPICA: Update maintainers information ACPICA: Replace strncpy() with strscpy_pad() in acpi_ut_safe_strncpy() * acpi-osl: ACPI: OSL: Poweroff when encountering a fatal ACPI error * acpi-tables: ACPI: tables: Enable FPDT on LoongArch Documentation: ABI: add FBPT and S3PT entries to sysfs-firmware-acpi ACPI: FPDT: expose FBPT and S3PT subtables via sysfs ACPI: PPTT: Remove duplicate structure, acpi_pptt_cache_v1_full
4 parents abdd2a8 + 22dd51b + f862f29 + 1b7cbe3 commit 8e2308c

8 files changed

Lines changed: 69 additions & 30 deletions

File tree

Documentation/ABI/testing/sysfs-firmware-acpi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ Description:
4141
platform runtime firmware S3 resume, just prior to
4242
handoff to the OS waking vector. In nanoseconds.
4343

44+
FBPT: The raw binary contents of the Firmware Basic Boot
45+
Performance Table (FBPT) subtable.
46+
47+
S3PT: The raw binary contents of the S3 Performance Table
48+
(S3PT) subtable.
49+
4450
What: /sys/firmware/acpi/bgrt/
4551
Date: January 2012
4652
Contact: Matthew Garrett <mjg@redhat.com>

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ Kernel parameters
190190
unusable. The "log_buf_len" parameter may be useful
191191
if you need to capture more output.
192192

193+
acpi.poweroff_on_fatal= [ACPI]
194+
{0 | 1}
195+
Causes the system to poweroff when the ACPI bytecode signals
196+
a fatal error. The default value of this setting is 1.
197+
Overriding this value should only be done for diagnosing
198+
ACPI firmware problems, as the system might behave erratically
199+
after having encountered a fatal ACPI error.
200+
193201
acpi_enforce_resources= [ACPI]
194202
{ strict | lax | no }
195203
Check for resource conflicts between native drivers

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ F: drivers/firmware/efi/cper*
318318

319319
ACPI COMPONENT ARCHITECTURE (ACPICA)
320320
M: "Rafael J. Wysocki" <rafael@kernel.org>
321-
M: Robert Moore <robert.moore@intel.com>
321+
M: Saket Dumbre <saket.dumbre@intel.com>
322322
L: linux-acpi@vger.kernel.org
323323
L: acpica-devel@lists.linux.dev
324324
S: Supported

drivers/acpi/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ config ACPI_SPCR_TABLE
9696

9797
config ACPI_FPDT
9898
bool "ACPI Firmware Performance Data Table (FPDT) support"
99-
depends on X86_64 || ARM64
99+
depends on X86_64 || ARM64 || LOONGARCH
100100
help
101101
Enable support for the Firmware Performance Data Table (FPDT).
102102
This table provides information on the timing of the system

drivers/acpi/acpi_fpdt.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ static const struct attribute_group boot_attr_group = {
141141
.name = "boot",
142142
};
143143

144+
static BIN_ATTR(FBPT, 0400, sysfs_bin_attr_simple_read, NULL, 0);
145+
static BIN_ATTR(S3PT, 0400, sysfs_bin_attr_simple_read, NULL, 0);
146+
144147
static struct kobject *fpdt_kobj;
145148

146149
#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT
@@ -254,9 +257,34 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
254257
break;
255258
}
256259
}
260+
261+
if (subtable_type == SUBTABLE_FBPT) {
262+
bin_attr_FBPT.private = subtable_header;
263+
bin_attr_FBPT.size = length;
264+
result = sysfs_create_bin_file(fpdt_kobj, &bin_attr_FBPT);
265+
if (result)
266+
pr_warn("Failed to create FBPT sysfs attribute.\n");
267+
} else if (subtable_type == SUBTABLE_S3PT) {
268+
bin_attr_S3PT.private = subtable_header;
269+
bin_attr_S3PT.size = length;
270+
result = sysfs_create_bin_file(fpdt_kobj, &bin_attr_S3PT);
271+
if (result)
272+
pr_warn("Failed to create S3PT sysfs attribute.\n");
273+
}
274+
257275
return 0;
258276

259277
err:
278+
if (bin_attr_FBPT.private) {
279+
sysfs_remove_bin_file(fpdt_kobj, &bin_attr_FBPT);
280+
bin_attr_FBPT.private = NULL;
281+
}
282+
283+
if (bin_attr_S3PT.private) {
284+
sysfs_remove_bin_file(fpdt_kobj, &bin_attr_S3PT);
285+
bin_attr_S3PT.private = NULL;
286+
}
287+
260288
if (record_boot)
261289
sysfs_remove_group(fpdt_kobj, &boot_attr_group);
262290

drivers/acpi/acpica/utnonansi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size)
168168
{
169169
/* Always terminate destination string */
170170

171-
strncpy(dest, source, dest_size);
172-
dest[dest_size - 1] = 0;
171+
strscpy_pad(dest, source, dest_size);
173172
}
174173

175174
#endif

drivers/acpi/osl.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include <linux/module.h>
1515
#include <linux/kernel.h>
16+
#include <linux/panic.h>
17+
#include <linux/reboot.h>
1618
#include <linux/slab.h>
1719
#include <linux/mm.h>
1820
#include <linux/highmem.h>
@@ -70,6 +72,10 @@ static bool acpi_os_initialized;
7072
unsigned int acpi_sci_irq = INVALID_ACPI_IRQ;
7173
bool acpi_permanent_mmap = false;
7274

75+
static bool poweroff_on_fatal = true;
76+
module_param(poweroff_on_fatal, bool, 0);
77+
MODULE_PARM_DESC(poweroff_on_fatal, "Poweroff when encountering a fatal ACPI error");
78+
7379
/*
7480
* This list of permanent mappings is for memory that may be accessed from
7581
* interrupt context, where we can't do the ioremap().
@@ -1381,9 +1387,20 @@ acpi_status acpi_os_notify_command_complete(void)
13811387

13821388
acpi_status acpi_os_signal(u32 function, void *info)
13831389
{
1390+
struct acpi_signal_fatal_info *fatal_info;
1391+
13841392
switch (function) {
13851393
case ACPI_SIGNAL_FATAL:
1386-
pr_err("Fatal opcode executed\n");
1394+
fatal_info = info;
1395+
pr_emerg("Fatal error while evaluating ACPI control method\n");
1396+
pr_emerg("Type 0x%X Code 0x%X Argument 0x%X\n",
1397+
fatal_info->type, fatal_info->code, fatal_info->argument);
1398+
1399+
if (poweroff_on_fatal)
1400+
orderly_poweroff(true);
1401+
else
1402+
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
1403+
13871404
break;
13881405
case ACPI_SIGNAL_BREAKPOINT:
13891406
/*

drivers/acpi/pptt.c

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,6 @@
2121
#include <linux/cacheinfo.h>
2222
#include <acpi/processor.h>
2323

24-
/*
25-
* The acpi_pptt_cache_v1 in actbl2.h, which is imported from acpica,
26-
* only contains the cache_id field rather than all the fields of the
27-
* Cache Type Structure. Use this alternative structure until it is
28-
* resolved in acpica.
29-
*/
30-
struct acpi_pptt_cache_v1_full {
31-
struct acpi_subtable_header header;
32-
u16 reserved;
33-
u32 flags;
34-
u32 next_level_of_cache;
35-
u32 size;
36-
u32 number_of_sets;
37-
u8 associativity;
38-
u8 attributes;
39-
u16 line_size;
40-
u32 cache_id;
41-
} __packed;
42-
4324
static struct acpi_subtable_header *fetch_pptt_subtable(struct acpi_table_header *table_hdr,
4425
u32 pptt_ref)
4526
{
@@ -75,16 +56,16 @@ static struct acpi_pptt_cache *fetch_pptt_cache(struct acpi_table_header *table_
7556
return (struct acpi_pptt_cache *)fetch_pptt_subtable(table_hdr, pptt_ref);
7657
}
7758

78-
static struct acpi_pptt_cache_v1_full *upgrade_pptt_cache(struct acpi_pptt_cache *cache)
59+
static struct acpi_pptt_cache_v1 *upgrade_pptt_cache(struct acpi_pptt_cache *cache)
7960
{
80-
if (cache->header.length < sizeof(struct acpi_pptt_cache_v1_full))
61+
if (cache->header.length < sizeof(struct acpi_pptt_cache_v1))
8162
return NULL;
8263

8364
/* No use for v1 if the only additional field is invalid */
8465
if (!(cache->flags & ACPI_PPTT_CACHE_ID_VALID))
8566
return NULL;
8667

87-
return (struct acpi_pptt_cache_v1_full *)cache;
68+
return (struct acpi_pptt_cache_v1 *)cache;
8869
}
8970

9071
static struct acpi_subtable_header *acpi_get_pptt_resource(struct acpi_table_header *table_hdr,
@@ -397,7 +378,7 @@ static void update_cache_properties(struct cacheinfo *this_leaf,
397378
struct acpi_pptt_cache *found_cache,
398379
struct acpi_pptt_processor *cpu_node)
399380
{
400-
struct acpi_pptt_cache_v1_full *found_cache_v1;
381+
struct acpi_pptt_cache_v1 *found_cache_v1;
401382

402383
this_leaf->fw_token = cpu_node;
403384
if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID)
@@ -1000,7 +981,7 @@ int find_acpi_cache_level_from_id(u32 cache_id)
1000981

1001982
empty = true;
1002983
for (int i = 0; i < ARRAY_SIZE(cache_type); i++) {
1003-
struct acpi_pptt_cache_v1_full *cache_v1;
984+
struct acpi_pptt_cache_v1 *cache_v1;
1004985

1005986
cache = acpi_find_cache_node(table, acpi_cpu_id, cache_type[i],
1006987
level, &cpu_node);
@@ -1067,7 +1048,7 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus)
10671048

10681049
empty = true;
10691050
for (int i = 0; i < ARRAY_SIZE(cache_type); i++) {
1070-
struct acpi_pptt_cache_v1_full *cache_v1;
1051+
struct acpi_pptt_cache_v1 *cache_v1;
10711052

10721053
cache = acpi_find_cache_node(table, acpi_cpu_id, cache_type[i],
10731054
level, &cpu_node);

0 commit comments

Comments
 (0)