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=1796381575; b=cK9QURQprNuHIy8sMUt7UmCvXt+1b6YOyLGd05q6UXT3YLxbiE24HEyiUlTEp2Q/JDwY pDk/MOllXuzxL/FaK4Gsq1WDWJNoy6pG53t8iRimX84EIX0W1q4vbldkOalVvsF7g9osL bQzrbQLavuW1W0dkazde1yL8yijez4zmDyo7YYSQU0zUoDDNtLd9OE6D9mRJI17AeIdum 01KBPJ3Sk8S6gUUaQw1bNaRYdGyXIwsP0MpBtlU8apx8aLUgGs34gGHsd9tHYnvw5URfU ARmY7cPVwBA5fkKmttHwTPg8bj9eZf6ZkPJPOuXL0CuA4lKK6ySnfoqL8cYKzy4d3bg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381575; 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=//nmJgzdIr5DQUHyxq0pJBqlO7OhsasdPrbDU6Z+BQQ=; b=ShEtYNsCwMb0JDnSKYxSjQiyBPEsnBtqrulm56VUVReOn2K34jhXeXRalLhnoNcY3s7s EoB223vT0QJL59vRPxTrAt2YvXkhcmZsBPOGRhK5nisct3LNsv227Rk8tgrT728KNBixW L90U6EAmOsji8+4tVwtsOjn/JESeLya+dUjjKYHWJPpNeY0ASpD+vpobcWFU4ZO4EOQqN fhVGaac4BASmlG7mUpRvxJ2AMfq2+ZPkGNQUWJ3CpivFNg1P2SSB5r189aFclMB+39RGP RRKxPncieI583zKEBjShVK8V6spJMPJjuqs0wFMrkmXZdO4GLn4jbwJFam6prx6JfdA== 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=zf06cwL6; 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 48810606A322; Fri, 4 Dec 2026 10:52:55 +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=zf06cwL6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6E321F000C2; Fri, 4 Dec 2026 10:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381575; bh=//nmJgzdIr5DQUHyxq0pJBqlO7OhsasdPrbDU6Z+BQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zf06cwL6Cw2jMFkwTNK51wjVBgbFRdI1eQGpXJR8VNoEQgnVkfg39CxgJxoNxZJZg 5CA7Zzxk9oRGj9RdxJuXTFa5LIjAXpSQKdc+jI31pGPZC5KVkbmArDNPHY4VMI1eDl wWnVxZ6pFz4jc2vGgTJb2J0YXSzvgSktCN4zIhOc= 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.18 083/703] ACPI: PM: Avoid initializing power management for absent devices Date: Fri, 4 Dec 2026 18:59:42 +0900 Message-ID: <20261204100629.942173559@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 62bce1ae8c1d6..b54a4c540344a 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