Skip to content

Commit b2ffa16

Browse files
committed
Merge branches 'acpi-x86', 'acpi-resources', 'acpi-scan' and 'acpi-misc'
Merge x86-specific ACPI updates, ACPI resources management updates, one ACPI device enumeration update and miscellaneous ACPI updates for 5.16-rc1: - Avoid flushing caches before entering C3 type of idle states on AMD processors (Deepak Sharma). - Avoid enumerating CPUs that are not present and not online-capable according to the platform firmware (Mario Limonciello). - Add DMI-based mechanism to quirk IRQ overrides and use it for two platforms (Hui Wang). - Change the configuration of unused ACPI device objects to reflect the D3cold power state after enumerating devices (Rafael Wysocki). - Update MAINTAINERS information regarding ACPI (Rafael Wysocki). - Fix typo in ACPI Kconfig (Masanari Iid). - Use sysfs_emit() instead of snprintf() in some places (Qing Wang). * acpi-x86: x86: ACPI: cstate: Optimize C3 entry on AMD CPUs x86/ACPI: Don't add CPUs that are not online capable ACPICA: Add support for MADT online enabled bit * acpi-resources: ACPI: resources: Add one more Medion model in IRQ override quirk ACPI: resources: Add DMI-based legacy IRQ override quirk * acpi-scan: ACPI: scan: Release PM resources blocked by unused objects * acpi-misc: ACPI: replace snprintf() in "show" functions with sysfs_emit() ACPI: Update information in MAINTAINERS ACPI: Kconfig: Fix a typo in Kconfig
5 parents 9cb31aa + a8fb409 + 1b26ae4 + c10383e + d47e983 commit b2ffa16

File tree

11 files changed

+119
-26
lines changed

11 files changed

+119
-26
lines changed

MAINTAINERS

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ F: drivers/platform/x86/acer-wmi.c
334334

335335
ACPI
336336
M: "Rafael J. Wysocki" <[email protected]>
337-
M: Len Brown <[email protected]>
337+
R: Len Brown <[email protected]>
338338
339339
S: Supported
340340
W: https://01.org/linux-acpi
@@ -355,7 +355,7 @@ F: tools/power/acpi/
355355

356356
ACPI APEI
357357
M: "Rafael J. Wysocki" <[email protected]>
358-
M: Len Brown <[email protected]>
358+
R: Len Brown <[email protected]>
359359
R: James Morse <[email protected]>
360360
R: Tony Luck <[email protected]>
361361
R: Borislav Petkov <[email protected]>
@@ -378,14 +378,6 @@ F: drivers/acpi/acpica/
378378
F: include/acpi/
379379
F: tools/power/acpi/
380380

381-
ACPI FAN DRIVER
382-
M: Zhang Rui <[email protected]>
383-
384-
S: Supported
385-
W: https://01.org/linux-acpi
386-
B: https://bugzilla.kernel.org
387-
F: drivers/acpi/fan.c
388-
389381
ACPI FOR ARM64 (ACPI/arm64)
390382
M: Lorenzo Pieralisi <[email protected]>
391383
M: Hanjun Guo <[email protected]>
@@ -422,14 +414,6 @@ W: https://01.org/linux-acpi
422414
B: https://bugzilla.kernel.org
423415
F: drivers/acpi/*thermal*
424416

425-
ACPI VIDEO DRIVER
426-
M: Zhang Rui <[email protected]>
427-
428-
S: Supported
429-
W: https://01.org/linux-acpi
430-
B: https://bugzilla.kernel.org
431-
F: drivers/acpi/acpi_video.c
432-
433417
ACPI VIOT DRIVER
434418
M: Jean-Philippe Brucker <[email protected]>
435419

arch/x86/kernel/acpi/boot.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ int acpi_fix_pin2_polarity __initdata;
6262

6363
#ifdef CONFIG_X86_LOCAL_APIC
6464
static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
65+
static bool acpi_support_online_capable;
6566
#endif
6667

6768
#ifdef CONFIG_X86_IO_APIC
@@ -138,6 +139,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
138139

139140
pr_debug("Local APIC address 0x%08x\n", madt->address);
140141
}
142+
if (madt->header.revision >= 5)
143+
acpi_support_online_capable = true;
141144

142145
default_acpi_madt_oem_check(madt->header.oem_id,
143146
madt->header.oem_table_id);
@@ -239,6 +242,12 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end)
239242
if (processor->id == 0xff)
240243
return 0;
241244

245+
/* don't register processors that can not be onlined */
246+
if (acpi_support_online_capable &&
247+
!(processor->lapic_flags & ACPI_MADT_ENABLED) &&
248+
!(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
249+
return 0;
250+
242251
/*
243252
* We need to register disabled CPU as well to permit
244253
* counting disabled CPUs. This allows us to size

arch/x86/kernel/acpi/cstate.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
7979
*/
8080
flags->bm_control = 0;
8181
}
82+
if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17) {
83+
/*
84+
* For all AMD Zen or newer CPUs that support C3, caches
85+
* should not be flushed by software while entering C3
86+
* type state. Set bm->check to 1 so that kernel doesn't
87+
* need to execute cache flush operation.
88+
*/
89+
flags->bm_check = 1;
90+
/*
91+
* In current AMD C state implementation ARB_DIS is no longer
92+
* used. So set bm_control to zero to indicate ARB_DIS is not
93+
* required while entering C3 type state.
94+
*/
95+
flags->bm_control = 0;
96+
}
8297
}
8398
EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
8499

drivers/acpi/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ config ACPI_DEBUGGER
7171
if ACPI_DEBUGGER
7272

7373
config ACPI_DEBUGGER_USER
74-
tristate "Userspace debugger accessiblity"
74+
tristate "Userspace debugger accessibility"
7575
depends on DEBUG_FS
7676
help
7777
Export /sys/kernel/debug/acpi/acpidbg for userspace utilities

drivers/acpi/acpi_lpss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static ssize_t lpss_ltr_show(struct device *dev, struct device_attribute *attr,
750750
if (ret)
751751
return ret;
752752

753-
return snprintf(buf, PAGE_SIZE, "%08x\n", ltr_value);
753+
return sysfs_emit(buf, "%08x\n", ltr_value);
754754
}
755755

756756
static ssize_t lpss_ltr_mode_show(struct device *dev,

drivers/acpi/dock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static ssize_t docked_show(struct device *dev,
492492
struct acpi_device *adev = NULL;
493493

494494
acpi_bus_get_device(dock_station->handle, &adev);
495-
return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
495+
return sysfs_emit(buf, "%u\n", acpi_device_enumerated(adev));
496496
}
497497
static DEVICE_ATTR_RO(docked);
498498

@@ -504,7 +504,7 @@ static ssize_t flags_show(struct device *dev,
504504
{
505505
struct dock_station *dock_station = dev->platform_data;
506506

507-
return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags);
507+
return sysfs_emit(buf, "%d\n", dock_station->flags);
508508

509509
}
510510
static DEVICE_ATTR_RO(flags);
@@ -543,7 +543,7 @@ static ssize_t uid_show(struct device *dev,
543543
if (ACPI_FAILURE(status))
544544
return 0;
545545

546-
return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf);
546+
return sysfs_emit(buf, "%llx\n", lbuf);
547547
}
548548
static DEVICE_ATTR_RO(uid);
549549

@@ -562,7 +562,7 @@ static ssize_t type_show(struct device *dev,
562562
else
563563
type = "unknown";
564564

565-
return snprintf(buf, PAGE_SIZE, "%s\n", type);
565+
return sysfs_emit(buf, "%s\n", type);
566566
}
567567
static DEVICE_ATTR_RO(type);
568568

drivers/acpi/glue.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,28 @@ void acpi_device_notify_remove(struct device *dev)
340340

341341
acpi_unbind_one(dev);
342342
}
343+
344+
int acpi_dev_turn_off_if_unused(struct device *dev, void *not_used)
345+
{
346+
struct acpi_device *adev = to_acpi_device(dev);
347+
348+
/*
349+
* Skip device objects with device IDs, because they may be in use even
350+
* if they are not companions of any physical device objects.
351+
*/
352+
if (adev->pnp.type.hardware_id)
353+
return 0;
354+
355+
mutex_lock(&adev->physical_node_lock);
356+
357+
/*
358+
* Device objects without device IDs are not in use if they have no
359+
* corresponding physical device objects.
360+
*/
361+
if (list_empty(&adev->physical_node_list))
362+
acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
363+
364+
mutex_unlock(&adev->physical_node_lock);
365+
366+
return 0;
367+
}

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ bool acpi_device_is_battery(struct acpi_device *adev);
117117
bool acpi_device_is_first_physical_node(struct acpi_device *adev,
118118
const struct device *dev);
119119
int acpi_bus_register_early_device(int type);
120+
int acpi_dev_turn_off_if_unused(struct device *dev, void *not_used);
120121

121122
/* --------------------------------------------------------------------------
122123
Device Matching and Notification

drivers/acpi/resource.c

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/ioport.h>
1717
#include <linux/slab.h>
1818
#include <linux/irq.h>
19+
#include <linux/dmi.h>
1920

2021
#ifdef CONFIG_X86
2122
#define valid_IRQ(i) (((i) != 0) && ((i) != 2))
@@ -380,9 +381,58 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
380381
}
381382
EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
382383

384+
static const struct dmi_system_id medion_laptop[] = {
385+
{
386+
.ident = "MEDION P15651",
387+
.matches = {
388+
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
389+
DMI_MATCH(DMI_BOARD_NAME, "M15T"),
390+
},
391+
},
392+
{
393+
.ident = "MEDION S17405",
394+
.matches = {
395+
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
396+
DMI_MATCH(DMI_BOARD_NAME, "M17T"),
397+
},
398+
},
399+
{ }
400+
};
401+
402+
struct irq_override_cmp {
403+
const struct dmi_system_id *system;
404+
unsigned char irq;
405+
unsigned char triggering;
406+
unsigned char polarity;
407+
unsigned char shareable;
408+
};
409+
410+
static const struct irq_override_cmp skip_override_table[] = {
411+
{ medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
412+
};
413+
414+
static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
415+
u8 shareable)
416+
{
417+
int i;
418+
419+
for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) {
420+
const struct irq_override_cmp *entry = &skip_override_table[i];
421+
422+
if (dmi_check_system(entry->system) &&
423+
entry->irq == gsi &&
424+
entry->triggering == triggering &&
425+
entry->polarity == polarity &&
426+
entry->shareable == shareable)
427+
return false;
428+
}
429+
430+
return true;
431+
}
432+
383433
static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
384434
u8 triggering, u8 polarity, u8 shareable,
385-
bool legacy)
435+
bool check_override)
386436
{
387437
int irq, p, t;
388438

@@ -401,7 +451,9 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
401451
* using extended IRQ descriptors we take the IRQ configuration
402452
* from _CRS directly.
403453
*/
404-
if (legacy && !acpi_get_override_irq(gsi, &t, &p)) {
454+
if (check_override &&
455+
acpi_dev_irq_override(gsi, triggering, polarity, shareable) &&
456+
!acpi_get_override_irq(gsi, &t, &p)) {
405457
u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
406458
u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
407459

drivers/acpi/scan.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,6 +2559,12 @@ int __init acpi_scan_init(void)
25592559
}
25602560
}
25612561

2562+
/*
2563+
* Make sure that power management resources are not blocked by ACPI
2564+
* device objects with no users.
2565+
*/
2566+
bus_for_each_dev(&acpi_bus_type, NULL, NULL, acpi_dev_turn_off_if_unused);
2567+
25622568
acpi_turn_off_unused_power_resources();
25632569

25642570
acpi_scan_initialized = true;

0 commit comments

Comments
 (0)