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=1796383164; b=5DawjfAi3b7AES+pPXEYKEQbuD1o3dyWswNJ2LeHsM16csO9CGjdfMkgbj9y3XLJ1A4s 4beAxKSPQaRS2csPGVkS/sdSUqQ2smFzdqTB9lVhJ3w8kCSvxNfd3ANh594g5z5ltWYaM tzqgmNSnYKvllpUOskWlVTDgU+yS9BtVbJKmZR+XAFP0DmSFxF0BP50cj/r6ra9izjpK1 KLZOE+dfM4BhB1AaKpinckR+00t7cVlb3LOtSfEyc2EO3nkUaj7p4bLQXGVOeNVTsZc0z FnmFahH070Ktsa6CokTAMwL4/0yp87YyCz9YRppgqyvwhcKF1AIUCzzbKE7M51TMAPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383164; 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=OWawlhRvtnCdGrUaAaLnC+et32Hba7eJRIcHllRe0oc=; b=LkmCpwD/Plhz+hmo7uqzLEJjf3PtXYoC1mkisjR83fJDOcYoqvrYhaNwD+2pLPbYji3h L9Ox9wswJ5oNamjOPkqkSUrlDmbUwQOnRBf5ZlwS/z5dzY2iWJsx1cppLBgxbV1ylns+o XLUWpb9cSvo6PF8H5mmJyxBcop/KCjsO0mx0nhhz1Tw+YaqZ5Hrncfbht1wnsD8KpshqD 4pVFQBZhkClf1wgzn0ry+33resIPb3hnaugxqPrZinPv4hXDhenpXpl26xClwk2VHx+IO zLTJx8UYliHMn0lxKNtXS1VH/Yu8fnO8BfHADZ5g8Y1v5YuTeEsQokhSwKIW3DCEiLA== 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=1C2dK1sA; 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 D698B606A333; Fri, 4 Dec 2026 11:19:24 +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=1C2dK1sA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AD8A1F00897; Fri, 4 Dec 2026 11:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383164; bh=OWawlhRvtnCdGrUaAaLnC+et32Hba7eJRIcHllRe0oc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1C2dK1sAJqrV6/87vO85DMRueF+qVglhcHyYxebnYC5RyZKOLBDNk5Xez+IJr46Dh 1ehy94ET4FwY3/sCfrIBVIfMQfVYw62l4KBe6GLU1ufVj++KXJvsfjjzaYT0g3hCaS VOrQNPEYQIL2VRx77MH2fz+f0j9f1ZDnVEVesChE= 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 6.12 109/555] ACPI: PM: Avoid initializing power management for absent devices Date: Fri, 4 Dec 2026 19:02:32 +0900 Message-ID: <20261204100611.885626677@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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 6.12-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 fef0ec39b8bb8..8a5662078b6f4 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 f915a7c0e7cca..d2c1f969cef27 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