Skip to content

Commit 67c7df8

Browse files
committed
Merge: update ACPI to match upstream v6.17 for RHEL-10.2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1445 Resolves: 114092 JIRA: https://issues.redhat.com/browse/RHEL-114092 Omitted-fix: c393bef "driver core: faux: Suppress bind attributes" Omitted-fix: ff53a6e "driver core: faux: Quiet probe failures" Both of these are included in MR !1357 along with the fundamentals of the faux bus. Periodic maintenance update for the ACPI subsystem. Several commits dealing with GCC 15's -Wunterminated-string-initialization were dropped since they seem to be unnecessary and caused weird compile issues. Also a commit for GCC-14's -Wflex-array-member-not-at-end for the same reasons. skipped commit 487d45d "drivers,hmat: use node-notifier instead of memory-notifier" because the rest of the hotplug_node_notifier support isn't available yet. Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: Aristeu Rozanski <arozansk@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents 1fc0ff5 + 4934687 commit 67c7df8

File tree

255 files changed

+1739
-811
lines changed

Some content is hidden

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

255 files changed

+1739
-811
lines changed

Documentation/ABI/testing/sysfs-firmware-acpi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ Description:
108108
number of a "General Purpose Events" (GPE).
109109

110110
A GPE vectors to a specified handler in AML, which
111-
can do a anything the BIOS writer wants from
111+
can do anything the BIOS writer wants from
112112
OS context. GPE 0x12, for example, would vector
113113
to a level or edge handler called _L12 or _E12.
114114
The handler may do its business and return.
115-
Or the handler may send send a Notify event
115+
Or the handler may send a Notify event
116116
to a Linux device driver registered on an ACPI device,
117117
such as a battery, or a processor.
118118

119-
To figure out where all the SCI's are coming from,
119+
To figure out where all the SCIs are coming from,
120120
/sys/firmware/acpi/interrupts contains a file listing
121121
every possible source, and the count of how many
122122
times it has triggered::

Documentation/firmware-guide/acpi/gpio-properties.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ and polarity settings. The table below shows the expectations:
9292
| | Low | as low, assuming active |
9393
+-------------+-------------+-----------------------------------------------+
9494

95-
That said, for our above example the both GPIOs, since the bias setting
96-
is explicit and _DSD is present, will be treated as active with a high
95+
That said, for our above example, since the bias setting is explicit and
96+
_DSD is present, both GPIOs will be treated as active with a high
9797
polarity and Linux will configure the pins in this state until a driver
9898
reprograms them differently.
9999

arch/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ config X86_64
3636
select ARCH_HAS_ELFCORE_COMPAT
3737
select ZONE_DMA32
3838
select EXECMEM if DYNAMIC_FTRACE
39+
select ACPI_MRRM if ACPI
3940

4041
config FORCE_DYNAMIC_FTRACE
4142
def_bool y

arch/x86/include/asm/topology.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ static inline bool topology_is_primary_thread(unsigned int cpu)
230230
return cpumask_test_cpu(cpu, cpu_primary_thread_mask);
231231
}
232232

233+
int topology_get_primary_thread(unsigned int cpu);
234+
235+
static inline bool topology_is_core_online(unsigned int cpu)
236+
{
237+
int pcpu = topology_get_primary_thread(cpu);
238+
239+
return pcpu >= 0 ? cpu_online(pcpu) : false;
240+
}
241+
#define topology_is_core_online topology_is_core_online
242+
233243
#else /* CONFIG_SMP */
234244
static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
235245
static inline int topology_max_smt_threads(void) { return 1; }

arch/x86/kernel/acpi/boot.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <linux/serial_core.h>
2424
#include <linux/pgtable.h>
2525

26+
#include <xen/xen.h>
27+
2628
#include <asm/e820/api.h>
2729
#include <asm/irqdomain.h>
2830
#include <asm/pci_x86.h>
@@ -1692,6 +1694,15 @@ int __init acpi_mps_check(void)
16921694
{
16931695
#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
16941696
/* mptable code is not built-in*/
1697+
1698+
/*
1699+
* Xen disables ACPI in PV DomU guests but it still emulates APIC and
1700+
* supports SMP. Returning early here ensures that APIC is not disabled
1701+
* unnecessarily and the guest is not limited to a single vCPU.
1702+
*/
1703+
if (xen_pv_domain() && !xen_initial_domain())
1704+
return 0;
1705+
16951706
if (acpi_disabled || acpi_noirq) {
16961707
pr_warn("MPS support code is not built-in, using acpi=off or acpi=noirq or pci=noacpi may have problem\n");
16971708
return 1;

arch/x86/kernel/cpu/topology.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,19 @@ unsigned int topology_unit_count(u32 apicid, enum x86_topology_domains which_uni
371371
return topo_unit_count(lvlid, at_level, apic_maps[which_units].map);
372372
}
373373

374+
#ifdef CONFIG_SMP
375+
int topology_get_primary_thread(unsigned int cpu)
376+
{
377+
u32 apic_id = cpuid_to_apicid[cpu];
378+
379+
/*
380+
* Get the core domain level APIC id, which is the primary thread
381+
* and return the CPU number assigned to it.
382+
*/
383+
return topo_lookup_cpuid(topo_apicid(apic_id, TOPO_CORE_DOMAIN));
384+
}
385+
#endif
386+
374387
#ifdef CONFIG_ACPI_HOTPLUG_CPU
375388
/**
376389
* topology_hotplug_apic - Handle a physical hotplugged APIC after boot

drivers/acpi/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD
394394

395395
config ACPI_DEBUG
396396
bool "Debug Statements"
397+
default y
397398
help
398399
The ACPI subsystem can produce debug output. Saying Y enables this
399400
output and increases the kernel size by around 50K.
@@ -576,6 +577,9 @@ config ACPI_FFH
576577
Enable this feature if you want to set up and install the FFH Address
577578
Space handler to handle FFH OpRegion in the firmware.
578579

580+
config ACPI_MRRM
581+
bool
582+
579583
source "drivers/acpi/pmic/Kconfig"
580584

581585
config ACPI_VIOT

drivers/acpi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ acpi-$(CONFIG_ACPI_WATCHDOG) += acpi_watchdog.o
6262
acpi-$(CONFIG_ACPI_PRMT) += prmt.o
6363
acpi-$(CONFIG_ACPI_PCC) += acpi_pcc.o
6464
acpi-$(CONFIG_ACPI_FFH) += acpi_ffh.o
65+
acpi-$(CONFIG_ACPI_MRRM) += acpi_mrrm.o
6566

6667
# Address translation
6768
acpi-$(CONFIG_ACPI_ADXL) += acpi_adxl.o

drivers/acpi/acpi_mrrm.c

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (c) 2025, Intel Corporation.
4+
*
5+
* Memory Range and Region Mapping (MRRM) structure
6+
*
7+
* Parse and report the platform's MRRM table in /sys.
8+
*/
9+
10+
#define pr_fmt(fmt) "acpi/mrrm: " fmt
11+
12+
#include <linux/acpi.h>
13+
#include <linux/init.h>
14+
#include <linux/string.h>
15+
#include <linux/sysfs.h>
16+
17+
/* Default assume one memory region covering all system memory, per the spec */
18+
static int max_mem_region = 1;
19+
20+
/* Access for use by resctrl file system */
21+
int acpi_mrrm_max_mem_region(void)
22+
{
23+
return max_mem_region;
24+
}
25+
26+
struct mrrm_mem_range_entry {
27+
u64 base;
28+
u64 length;
29+
int node;
30+
u8 local_region_id;
31+
u8 remote_region_id;
32+
};
33+
34+
static struct mrrm_mem_range_entry *mrrm_mem_range_entry;
35+
static u32 mrrm_mem_entry_num;
36+
37+
static int get_node_num(struct mrrm_mem_range_entry *e)
38+
{
39+
unsigned int nid;
40+
41+
for_each_online_node(nid) {
42+
for (int z = 0; z < MAX_NR_ZONES; z++) {
43+
struct zone *zone = NODE_DATA(nid)->node_zones + z;
44+
45+
if (!populated_zone(zone))
46+
continue;
47+
if (zone_intersects(zone, PHYS_PFN(e->base), PHYS_PFN(e->length)))
48+
return zone_to_nid(zone);
49+
}
50+
}
51+
52+
return -ENOENT;
53+
}
54+
55+
static __init int acpi_parse_mrrm(struct acpi_table_header *table)
56+
{
57+
struct acpi_mrrm_mem_range_entry *mre_entry;
58+
struct acpi_table_mrrm *mrrm;
59+
void *mre, *mrrm_end;
60+
int mre_count = 0;
61+
62+
mrrm = (struct acpi_table_mrrm *)table;
63+
if (!mrrm)
64+
return -ENODEV;
65+
66+
if (mrrm->flags & ACPI_MRRM_FLAGS_REGION_ASSIGNMENT_OS)
67+
return -EOPNOTSUPP;
68+
69+
mrrm_end = (void *)mrrm + mrrm->header.length - 1;
70+
mre = (void *)mrrm + sizeof(struct acpi_table_mrrm);
71+
while (mre < mrrm_end) {
72+
mre_entry = mre;
73+
mre_count++;
74+
mre += mre_entry->header.length;
75+
}
76+
if (!mre_count) {
77+
pr_info(FW_BUG "No ranges listed in MRRM table\n");
78+
return -EINVAL;
79+
}
80+
81+
mrrm_mem_range_entry = kmalloc_array(mre_count, sizeof(*mrrm_mem_range_entry),
82+
GFP_KERNEL | __GFP_ZERO);
83+
if (!mrrm_mem_range_entry)
84+
return -ENOMEM;
85+
86+
mre = (void *)mrrm + sizeof(struct acpi_table_mrrm);
87+
while (mre < mrrm_end) {
88+
struct mrrm_mem_range_entry *e;
89+
90+
mre_entry = mre;
91+
e = mrrm_mem_range_entry + mrrm_mem_entry_num;
92+
93+
e->base = mre_entry->addr_base;
94+
e->length = mre_entry->addr_len;
95+
e->node = get_node_num(e);
96+
97+
if (mre_entry->region_id_flags & ACPI_MRRM_VALID_REGION_ID_FLAGS_LOCAL)
98+
e->local_region_id = mre_entry->local_region_id;
99+
else
100+
e->local_region_id = -1;
101+
if (mre_entry->region_id_flags & ACPI_MRRM_VALID_REGION_ID_FLAGS_REMOTE)
102+
e->remote_region_id = mre_entry->remote_region_id;
103+
else
104+
e->remote_region_id = -1;
105+
106+
mrrm_mem_entry_num++;
107+
mre += mre_entry->header.length;
108+
}
109+
110+
max_mem_region = mrrm->max_mem_region;
111+
112+
return 0;
113+
}
114+
115+
#define RANGE_ATTR(name, fmt) \
116+
static ssize_t name##_show(struct kobject *kobj, \
117+
struct kobj_attribute *attr, char *buf) \
118+
{ \
119+
struct mrrm_mem_range_entry *mre; \
120+
const char *kname = kobject_name(kobj); \
121+
int n, ret; \
122+
\
123+
ret = kstrtoint(kname + 5, 10, &n); \
124+
if (ret) \
125+
return ret; \
126+
\
127+
mre = mrrm_mem_range_entry + n; \
128+
\
129+
return sysfs_emit(buf, fmt, mre->name); \
130+
} \
131+
static struct kobj_attribute name##_attr = __ATTR_RO(name)
132+
133+
RANGE_ATTR(base, "0x%llx\n");
134+
RANGE_ATTR(length, "0x%llx\n");
135+
RANGE_ATTR(node, "%d\n");
136+
RANGE_ATTR(local_region_id, "%d\n");
137+
RANGE_ATTR(remote_region_id, "%d\n");
138+
139+
static struct attribute *memory_range_attrs[] = {
140+
&base_attr.attr,
141+
&length_attr.attr,
142+
&node_attr.attr,
143+
&local_region_id_attr.attr,
144+
&remote_region_id_attr.attr,
145+
NULL
146+
};
147+
148+
ATTRIBUTE_GROUPS(memory_range);
149+
150+
static __init int add_boot_memory_ranges(void)
151+
{
152+
struct kobject *pkobj, *kobj;
153+
int ret = -EINVAL;
154+
char *name;
155+
156+
pkobj = kobject_create_and_add("memory_ranges", acpi_kobj);
157+
158+
for (int i = 0; i < mrrm_mem_entry_num; i++) {
159+
name = kasprintf(GFP_KERNEL, "range%d", i);
160+
if (!name) {
161+
ret = -ENOMEM;
162+
break;
163+
}
164+
165+
kobj = kobject_create_and_add(name, pkobj);
166+
167+
ret = sysfs_create_groups(kobj, memory_range_groups);
168+
if (ret)
169+
return ret;
170+
}
171+
172+
return ret;
173+
}
174+
175+
static __init int mrrm_init(void)
176+
{
177+
int ret;
178+
179+
ret = acpi_table_parse(ACPI_SIG_MRRM, acpi_parse_mrrm);
180+
if (ret < 0)
181+
return ret;
182+
183+
return add_boot_memory_ranges();
184+
}
185+
device_initcall(mrrm_init);

drivers/acpi/acpi_pad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
static DEFINE_MUTEX(isolated_cpus_lock);
3434
static DEFINE_MUTEX(round_robin_lock);
3535

36-
static unsigned long power_saving_mwait_eax;
36+
static unsigned int power_saving_mwait_eax;
3737

3838
static unsigned char tsc_detected_unstable;
3939
static unsigned char tsc_marked_unstable;

0 commit comments

Comments
 (0)