diff mbox series

[v1,2/2,RFT] ACPI: PM: Check states of power resources during initialization

Message ID 8835496.CDJkKcVGEf@kreacher (mailing list archive)
State Accepted
Commit a1224f34d72a103829d6953935d6c6621f135b83
Delegated to: Bjorn Helgaas
Headers show
Series ACPI: PM: Fix up turning off unused power resources | expand

Commit Message

Rafael J. Wysocki Oct. 15, 2021, 5:14 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

To avoid situations in which the actual states of certain ACPI power
resources are not known just because they have never been referenced
by any device configuration objects, check the initial states of all
power resources as soon as they are found in the ACPI namespace (and
fall back to turning them on if the state check fails).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

Andreas, please test this patch (on top of the [1/2]) and let me know
if it works for you.

Thanks!

---
 drivers/acpi/power.c |   30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

Comments

Andreas K. Huettel Oct. 18, 2021, 10:40 a.m. UTC | #1
Am Freitag, 15. Oktober 2021, 19:14:10 CEST schrieb Rafael J. Wysocki:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> To avoid situations in which the actual states of certain ACPI power
> resources are not known just because they have never been referenced
> by any device configuration objects, check the initial states of all
> power resources as soon as they are found in the ACPI namespace (and
> fall back to turning them on if the state check fails).
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> Andreas, please test this patch (on top of the [1/2]) and let me know
> if it works for you.
> 

I see no negative impact (actually, no impact at all) of the second
additional patch. The network card is again working fine now.

Boot logs (unpatched, with one patch, with both patches) at
https://dev.gentoo.org/~dilfridge/igb/  (the 5.14.12* files).

Best,
Andreas
Rafael J. Wysocki Oct. 19, 2021, 10:59 a.m. UTC | #2
On Mon, Oct 18, 2021 at 12:41 PM Andreas K. Huettel
<andreas.huettel@ur.de> wrote:
>
> Am Freitag, 15. Oktober 2021, 19:14:10 CEST schrieb Rafael J. Wysocki:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > To avoid situations in which the actual states of certain ACPI power
> > resources are not known just because they have never been referenced
> > by any device configuration objects, check the initial states of all
> > power resources as soon as they are found in the ACPI namespace (and
> > fall back to turning them on if the state check fails).
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >
> > Andreas, please test this patch (on top of the [1/2]) and let me know
> > if it works for you.
> >
>
> I see no negative impact (actually, no impact at all) of the second
> additional patch. The network card is again working fine now.
>
> Boot logs (unpatched, with one patch, with both patches) at
> https://dev.gentoo.org/~dilfridge/igb/  (the 5.14.12* files).

Thanks!
diff mbox series

Patch

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -923,6 +919,7 @@  struct acpi_device *acpi_add_power_resou
 	union acpi_object acpi_object;
 	struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object };
 	acpi_status status;
+	u8 state_dummy;
 	int result;
 
 	acpi_bus_get_device(handle, &device);
@@ -951,6 +948,10 @@  struct acpi_device *acpi_add_power_resou
 	resource->order = acpi_object.power_resource.resource_order;
 	resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
 
+	/* Get the initial state or just flip it on if that fails. */
+	if (acpi_power_get_state(resource, &state_dummy))
+		__acpi_power_on(resource);
+
 	pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device));
 
 	device->flags.match_driver = true;