Skip to content

Commit 87b5374

Browse files
committed
Merge branches 'acpi-scan', 'acpi-pm', 'acpi-resource' and 'acpi-ec'
Merge ACPI device enumeration changes, ACPI power management update, ACPI resources management updates and an EC driver update for 6.5-rc1: - Reduce ACPI device enumeration overhead related to devices with dependencies (Rafael Wysocki). - Fix the handling of Microsoft LPS0 _DSM for suspend-to-idle (Mario Limonciello). - Fix section mismatch warning in the ACPI suspend-to-idle code (Arnd Bergmann). - Drop several ACPI resource management quirks related to IRQ ovverides on AMD "Zen" systems (Mario Limonciello). - Modify the ACPI EC driver to make it only clear the EC GPE status when handling the GPE (Jeremy Compostella). * acpi-scan: ACPI: scan: Reduce overhead related to devices with dependencies * acpi-pm: ACPI: x86: s2idle: Adjust Microsoft LPS0 _DSM handling sequence ACPI: PM: s2idle: fix section mismatch warning * acpi-resource: ACPI: resource: Remove "Zen" specific match and quirks * acpi-ec: ACPI: EC: Clear GPE on interrupt handling only
5 parents e660abd + 3ba12d8 + f198478 + a9c4a91 + 896e97b commit 87b5374

File tree

6 files changed

+87
-103
lines changed

6 files changed

+87
-103
lines changed

drivers/acpi/ec.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -662,21 +662,6 @@ static void advance_transaction(struct acpi_ec *ec, bool interrupt)
662662

663663
ec_dbg_stm("%s (%d)", interrupt ? "IRQ" : "TASK", smp_processor_id());
664664

665-
/*
666-
* Clear GPE_STS upfront to allow subsequent hardware GPE_STS 0->1
667-
* changes to always trigger a GPE interrupt.
668-
*
669-
* GPE STS is a W1C register, which means:
670-
*
671-
* 1. Software can clear it without worrying about clearing the other
672-
* GPEs' STS bits when the hardware sets them in parallel.
673-
*
674-
* 2. As long as software can ensure only clearing it when it is set,
675-
* hardware won't set it in parallel.
676-
*/
677-
if (ec->gpe >= 0 && acpi_ec_gpe_status_set(ec))
678-
acpi_clear_gpe(NULL, ec->gpe);
679-
680665
status = acpi_ec_read_status(ec);
681666

682667
/*
@@ -1287,6 +1272,22 @@ static void acpi_ec_handle_interrupt(struct acpi_ec *ec)
12871272
unsigned long flags;
12881273

12891274
spin_lock_irqsave(&ec->lock, flags);
1275+
1276+
/*
1277+
* Clear GPE_STS upfront to allow subsequent hardware GPE_STS 0->1
1278+
* changes to always trigger a GPE interrupt.
1279+
*
1280+
* GPE STS is a W1C register, which means:
1281+
*
1282+
* 1. Software can clear it without worrying about clearing the other
1283+
* GPEs' STS bits when the hardware sets them in parallel.
1284+
*
1285+
* 2. As long as software can ensure only clearing it when it is set,
1286+
* hardware won't set it in parallel.
1287+
*/
1288+
if (ec->gpe >= 0 && acpi_ec_gpe_status_set(ec))
1289+
acpi_clear_gpe(NULL, ec->gpe);
1290+
12901291
advance_transaction(ec, true);
12911292
spin_unlock_irqrestore(&ec->lock, flags);
12921293
}

drivers/acpi/resource.c

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -470,52 +470,6 @@ static const struct dmi_system_id asus_laptop[] = {
470470
{ }
471471
};
472472

473-
static const struct dmi_system_id lenovo_laptop[] = {
474-
{
475-
.ident = "LENOVO IdeaPad Flex 5 14ALC7",
476-
.matches = {
477-
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
478-
DMI_MATCH(DMI_PRODUCT_NAME, "82R9"),
479-
},
480-
},
481-
{
482-
.ident = "LENOVO IdeaPad Flex 5 16ALC7",
483-
.matches = {
484-
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
485-
DMI_MATCH(DMI_PRODUCT_NAME, "82RA"),
486-
},
487-
},
488-
{ }
489-
};
490-
491-
static const struct dmi_system_id tongfang_gm_rg[] = {
492-
{
493-
.ident = "TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD",
494-
.matches = {
495-
DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"),
496-
},
497-
},
498-
{ }
499-
};
500-
501-
static const struct dmi_system_id maingear_laptop[] = {
502-
{
503-
.ident = "MAINGEAR Vector Pro 2 15",
504-
.matches = {
505-
DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"),
506-
DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-15A3070T"),
507-
}
508-
},
509-
{
510-
.ident = "MAINGEAR Vector Pro 2 17",
511-
.matches = {
512-
DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"),
513-
DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-17A3070T"),
514-
},
515-
},
516-
{ }
517-
};
518-
519473
static const struct dmi_system_id lg_laptop[] = {
520474
{
521475
.ident = "LG Electronics 17U70P",
@@ -539,10 +493,6 @@ struct irq_override_cmp {
539493
static const struct irq_override_cmp override_table[] = {
540494
{ medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
541495
{ asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
542-
{ lenovo_laptop, 6, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true },
543-
{ lenovo_laptop, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true },
544-
{ tongfang_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
545-
{ maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
546496
{ lg_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
547497
};
548498

@@ -562,16 +512,6 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
562512
return entry->override;
563513
}
564514

565-
#ifdef CONFIG_X86
566-
/*
567-
* IRQ override isn't needed on modern AMD Zen systems and
568-
* this override breaks active low IRQs on AMD Ryzen 6000 and
569-
* newer systems. Skip it.
570-
*/
571-
if (boot_cpu_has(X86_FEATURE_ZEN))
572-
return false;
573-
#endif
574-
575515
return true;
576516
}
577517

drivers/acpi/scan.c

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,8 +2029,6 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep)
20292029
return count;
20302030
}
20312031

2032-
static bool acpi_bus_scan_second_pass;
2033-
20342032
static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
20352033
struct acpi_device **adev_p)
20362034
{
@@ -2050,10 +2048,8 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
20502048
return AE_OK;
20512049

20522050
/* Bail out if there are dependencies. */
2053-
if (acpi_scan_check_dep(handle, check_dep) > 0) {
2054-
acpi_bus_scan_second_pass = true;
2051+
if (acpi_scan_check_dep(handle, check_dep) > 0)
20552052
return AE_CTRL_DEPTH;
2056-
}
20572053

20582054
fallthrough;
20592055
case ACPI_TYPE_ANY: /* for ACPI_ROOT_OBJECT */
@@ -2301,6 +2297,12 @@ static bool acpi_scan_clear_dep_queue(struct acpi_device *adev)
23012297
return true;
23022298
}
23032299

2300+
static void acpi_scan_delete_dep_data(struct acpi_dep_data *dep)
2301+
{
2302+
list_del(&dep->node);
2303+
kfree(dep);
2304+
}
2305+
23042306
static int acpi_scan_clear_dep(struct acpi_dep_data *dep, void *data)
23052307
{
23062308
struct acpi_device *adev = acpi_get_acpi_dev(dep->consumer);
@@ -2311,8 +2313,10 @@ static int acpi_scan_clear_dep(struct acpi_dep_data *dep, void *data)
23112313
acpi_dev_put(adev);
23122314
}
23132315

2314-
list_del(&dep->node);
2315-
kfree(dep);
2316+
if (dep->free_when_met)
2317+
acpi_scan_delete_dep_data(dep);
2318+
else
2319+
dep->met = true;
23162320

23172321
return 0;
23182322
}
@@ -2406,6 +2410,55 @@ struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier,
24062410
}
24072411
EXPORT_SYMBOL_GPL(acpi_dev_get_next_consumer_dev);
24082412

2413+
static void acpi_scan_postponed_branch(acpi_handle handle)
2414+
{
2415+
struct acpi_device *adev = NULL;
2416+
2417+
if (ACPI_FAILURE(acpi_bus_check_add(handle, false, &adev)))
2418+
return;
2419+
2420+
acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
2421+
acpi_bus_check_add_2, NULL, NULL, (void **)&adev);
2422+
acpi_bus_attach(adev, NULL);
2423+
}
2424+
2425+
static void acpi_scan_postponed(void)
2426+
{
2427+
struct acpi_dep_data *dep, *tmp;
2428+
2429+
mutex_lock(&acpi_dep_list_lock);
2430+
2431+
list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) {
2432+
acpi_handle handle = dep->consumer;
2433+
2434+
/*
2435+
* In case there are multiple acpi_dep_list entries with the
2436+
* same consumer, skip the current entry if the consumer device
2437+
* object corresponding to it is present already.
2438+
*/
2439+
if (!acpi_fetch_acpi_dev(handle)) {
2440+
/*
2441+
* Even though the lock is released here, tmp is
2442+
* guaranteed to be valid, because none of the list
2443+
* entries following dep is marked as "free when met"
2444+
* and so they cannot be deleted.
2445+
*/
2446+
mutex_unlock(&acpi_dep_list_lock);
2447+
2448+
acpi_scan_postponed_branch(handle);
2449+
2450+
mutex_lock(&acpi_dep_list_lock);
2451+
}
2452+
2453+
if (dep->met)
2454+
acpi_scan_delete_dep_data(dep);
2455+
else
2456+
dep->free_when_met = true;
2457+
}
2458+
2459+
mutex_unlock(&acpi_dep_list_lock);
2460+
}
2461+
24092462
/**
24102463
* acpi_bus_scan - Add ACPI device node objects in a given namespace scope.
24112464
* @handle: Root of the namespace scope to scan.
@@ -2424,8 +2477,6 @@ int acpi_bus_scan(acpi_handle handle)
24242477
{
24252478
struct acpi_device *device = NULL;
24262479

2427-
acpi_bus_scan_second_pass = false;
2428-
24292480
/* Pass 1: Avoid enumerating devices with missing dependencies. */
24302481

24312482
if (ACPI_SUCCESS(acpi_bus_check_add(handle, true, &device)))
@@ -2438,19 +2489,9 @@ int acpi_bus_scan(acpi_handle handle)
24382489

24392490
acpi_bus_attach(device, (void *)true);
24402491

2441-
if (!acpi_bus_scan_second_pass)
2442-
return 0;
2443-
24442492
/* Pass 2: Enumerate all of the remaining devices. */
24452493

2446-
device = NULL;
2447-
2448-
if (ACPI_SUCCESS(acpi_bus_check_add(handle, false, &device)))
2449-
acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
2450-
acpi_bus_check_add_2, NULL, NULL,
2451-
(void **)&device);
2452-
2453-
acpi_bus_attach(device, NULL);
2494+
acpi_scan_postponed();
24542495

24552496
return 0;
24562497
}

drivers/acpi/sleep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ void __weak acpi_s2idle_setup(void)
848848
s2idle_set_ops(&acpi_s2idle_ops);
849849
}
850850

851-
static void acpi_sleep_suspend_setup(void)
851+
static void __init acpi_sleep_suspend_setup(void)
852852
{
853853
bool suspend_ops_needed = false;
854854
int i;

drivers/acpi/x86/s2idle.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,11 @@ int acpi_s2idle_prepare_late(void)
485485
ACPI_LPS0_ENTRY,
486486
lps0_dsm_func_mask, lps0_dsm_guid);
487487
if (lps0_dsm_func_mask_microsoft > 0) {
488-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
489-
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
490488
/* modern standby entry */
491489
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
492490
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
491+
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
492+
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
493493
}
494494

495495
list_for_each_entry(handler, &lps0_s2idle_devops_head, list_node) {
@@ -524,11 +524,6 @@ void acpi_s2idle_restore_early(void)
524524
if (handler->restore)
525525
handler->restore();
526526

527-
/* Modern standby exit */
528-
if (lps0_dsm_func_mask_microsoft > 0)
529-
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
530-
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
531-
532527
/* LPS0 exit */
533528
if (lps0_dsm_func_mask > 0)
534529
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
@@ -539,6 +534,11 @@ void acpi_s2idle_restore_early(void)
539534
acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
540535
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
541536

537+
/* Modern standby exit */
538+
if (lps0_dsm_func_mask_microsoft > 0)
539+
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
540+
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
541+
542542
/* Screen on */
543543
if (lps0_dsm_func_mask_microsoft > 0)
544544
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,

include/acpi/acpi_bus.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ struct acpi_dep_data {
289289
acpi_handle supplier;
290290
acpi_handle consumer;
291291
bool honor_dep;
292+
bool met;
293+
bool free_when_met;
292294
};
293295

294296
/* Performance Management */

0 commit comments

Comments
 (0)