From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379938; b=FJvXYsfjQiuSP1ZOmDayb4fiNv+eBhe+eDZUi8AQ+Z7azFEN5soC6wKe9MIoQomwdtSe WKDrZFmmvWBPabW7s1wpFgj7BfV2b+KL/gGIyx1UhOwdzm58dB/RCqNaSoYABLPEra3nU tHEXmsagc0eTw9Lp18ntXY7pMmkssdhSNmsanz0JMv8yrix0Xzjv8tmsxtazd8dP4eNtv Y6KNAtuMEP906t4h8aJJpixw/eOgxWZRQimAmgyFCRziPxYqzbbu97e1zXnq0y+y3lU6+ ll1L9VegD4RFPOoFrBP/PS4W8w79kGQ1BaXQ9p2O8/+igOqf9tB5Gvvh7TLjm5pk8qA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379938; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=G186DWvxPht8yB7jCzRkW87dAiCoRnLyedHduzieR7U=; b=QpTzX9z/Z6sk1tgHMwXfAAWnHGgdyCz/9Q5DcsmGj492XuFXFeGfyMYEMsHK9qOEABM4 wHdA2ykJyVKYoSPf7taFebHIC2bnV7TKpn5vpIYXpRiDITtyd8DrUFyIa0ByxHXBipUVL NKT/PC7r5nF1Nr2IDzhU1KI1JL3vdlfwz+bwMukK2t3J6nagqLgPG8NfxqdhqLc0twJwY nqtdx5ngOsNC2oETDdpW/TVqdoyRpi36TXWM06UqP2LBlr/6Vwce1nUjmBiU+roV6BijC cIHjdOQVRPQ9kNTgr3s83WsnUi0TgrzJhEva4gGzJT/K7UYnbYZWGCcsH9kDTXsHVkQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hdzckQyI; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 236C9606A322; Fri, 4 Dec 2026 10:25:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hdzckQyI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CC531F000C2; Fri, 4 Dec 2026 10:25:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379938; bh=G186DWvxPht8yB7jCzRkW87dAiCoRnLyedHduzieR7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hdzckQyIKPVtFLrTz8xsMhruYJxeNF2PwKDV7gZUY0+SJWFj9hZKBJoxkDzxZzY+F Rwq/N0UQ8J5zuO782EdR/Ue7oBzKSJHavEXh0Rgxd+rKAb0TK47P9DfujBt9sEXnTT mpwKox7m2/ZxGyI1wXH/hKD47vyZ8ehs/tYlH+tg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alan Borzeszkowski , "Rafael J. Wysocki" , Mika Westerberg , Sasha Levin Subject: [PATCH 7.3 034/742] ACPI: PM: Avoid initializing power management for absent devices Date: Fri, 4 Dec 2026 18:58:18 +0900 Message-ID: <20261204100635.956754721@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rafael J. Wysocki [ Upstream commit b91ad39f29ceeee3e3d37eedff6b7c912855623c ] Commit 2f4ddf2bd1ba ("ACPI: scan: Stop calling acpi_bus_init_power() early") removed a device presence check from acpi_bus_init_power() which in some cases causes power management to be initialized for an ACPI device object and never used going forward. That in turn may prevent power management from working as expected for other devices. Namely, if a given ACPI device object is not enabled according to its _STA, find_child_checks() will return an error for it which will prevent it from being used as an ACPI companion for a PCI device. Thus if acpi_device_init_power() initializes power management for it and its initial power state turns out to be different from D3cold, it may stay in that power state forever. If it has power resources and they are "on" during the initialization, they may be reference-counted and never turned off. If they are shared with other devices, they will prevent power from going down after attempting to put the other devices into low-power states. To prevent that from happening, restore the device presence check in acpi_bus_init_power(), but also adjust find_child_checks() to return an error for absent devices (instead of doing that for disabled devices) in accordance with acpi_bus_init_power() and the existing check in acpi_bus_attach(). Fixes: 2f4ddf2bd1ba ("ACPI: scan: Stop calling acpi_bus_init_power() early") Reported-by: Alan Borzeszkowski Tested-by: Alan Borzeszkowski Signed-off-by: Rafael J. Wysocki Tested-by: Mika Westerberg Reviewed-by: Mika Westerberg Link: https://patch.msgid.link/13013440.O9o76ZdvQC@rafael.j.wysocki Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/device_pm.c | 15 +++++++++++++-- drivers/acpi/glue.c | 8 ++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 76104f715efa1..d975700936e87 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -365,14 +365,25 @@ int acpi_bus_init_power(struct acpi_device *device) * fails, ACPI power management will not be used for the device going * forward. */ + if (!acpi_device_is_present(device)) { + acpi_handle_debug(device->handle, + "Device not present, ACPI PM disabled\n"); + result = -ENXIO; + goto fail; + } + result = acpi_device_init_power(device); if (result) { - device->flags.power_manageable = 0; - device->power.state = ACPI_D_STATE_INVALID; acpi_handle_info(device->handle, "Initial power state undetermined, ACPI PM disabled\n"); + goto fail; } + return 0; + +fail: + device->flags.power_manageable = 0; + device->power.state = ACPI_D_STATE_INVALID; return result; } diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index e55daa4221da8..9348b98d93d85 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -105,14 +105,10 @@ static bool acpi_dev_has_children(struct acpi_device *adev) static int find_child_checks(struct acpi_device *adev, bool check_children) { - unsigned long long sta; - acpi_status status; - if (check_children && !acpi_dev_has_children(adev)) return -ENODEV; - status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); - if (status == AE_NOT_FOUND) { + if (!acpi_has_method(adev->handle, METHOD_NAME__STA)) { /* * Special case: backlight device objects without _STA are * preferred to other objects with the same _ADR value, because @@ -124,7 +120,7 @@ static int find_child_checks(struct acpi_device *adev, bool check_children) return FIND_CHILD_MIN_SCORE; } - if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) + if (!acpi_device_is_present(adev)) return -ENODEV; /* -- 2.53.0