From patchwork Wed Feb 21 20:01:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 204415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1268632dyc; Wed, 21 Feb 2024 12:05:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWUseFYqG+6gm7JZcaIpO3iaJT/+ClaTjb3tnUeb2Ds1vtxwoHfueWDQd97OxCywNgXk8NlywdH8HifVKXsquoDJWDDhg== X-Google-Smtp-Source: AGHT+IEyyB1wUsRGBt51R1UDczs/hbGJ1cjVu5FFe3LIagQmdRiZvlzjIWeoisaW0yfzJm9+KWPL X-Received: by 2002:ac8:5804:0:b0:42e:404e:238e with SMTP id g4-20020ac85804000000b0042e404e238emr1823832qtg.16.1708545941691; Wed, 21 Feb 2024 12:05:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545941; cv=pass; d=google.com; s=arc-20160816; b=TqAXWmvEGRZFVflhP/FuHSQuukxMiO34Friz5gvKsPWcTZBtnjDGO/9RIOqiM9FMEy tAtQMNAeJUtJd+wtvod9dfvjrUpWbHiV6UMbHODT9HWC/L93w10NeVfn2esylEaXX77v wvmwKq4uKAyGCHfKdZ/n3AMqxqMlewBueglMRwKB7nS6/tP1D6DkjWflGlETlxLrZ2Xt zmehRlFkFzl/mA9yCCcFoNWYo5Tw6uxOgkZg+v0I4DwD2gP26kFJhne9qJ1AYeMD/29z 1Z5+nmutLim26NHN3hyRGqb+H1qpNfZTPdS0DBBcfCU05H2lm1fbYYa8BtzJx0szD1hX 5ceA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=uTnwWgntg8JlbgzacOBA8I5jMqM8rgs4FK0lOlPBe8I=; fh=s5Fc0MEg8Xcp85xwyejK4S4zs7msQB7g1OY0X3YpOJg=; b=GmxlCqz4cVlXlGdhcyG7KlYAxP0lZIyFgIATJfCbIau1mpfzCu94jjVoznpvPek3GR fShqayAwWP4cZfazwBfmSSQk4ENY59093a+z87HLYJrLd8PaD9nrPvVwWYpYXRMliNx2 WDnapncrbMMbHBWTYLnvirlmpCHHCerQ+qXzHdKk63l9SEuQXb11lfDdli6u1fbxBKel xm3Qx1PyHT6EPrsFZdg1sCYGq3IWrM2amEgttb0vvwEBNGmR9TlSTP7xqxes+/My+EhM wkQu//Mxu466TB7LRDRQrmq0wyJ4yoTdGQ9urc3gILprtrf5R9RBeCr6x17iijOdI3P0 0W7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75446-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c14-20020ac87d8e000000b0042e19bebcfdsi29765qtd.322.2024.02.21.12.05.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:05:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75446-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75446-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 479621C24784 for ; Wed, 21 Feb 2024 20:05:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71E7F128364; Wed, 21 Feb 2024 20:04:50 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C804E86636; Wed, 21 Feb 2024 20:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545888; cv=none; b=cZ7LFVZ1smGn6f1JKEf+ICcPJhL2pX94TIU2g6k5inwQ2nc6T/Gyhio00nzRheE6wOjeAykNtfufLbz5Fg7CH4xrMYIOp8yTU1fhCmA1bEYgu5qSpm9qDJNWb6UHHl4QWw6u2licGKQ2Z9lc+QmAKGqM/RQ/Gla+W/+WB+PnGpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545888; c=relaxed/simple; bh=O76Kyj6+pIZBCaJtFD/N8mTlFGfeFfY2Ir+N2iw27Uo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZBB1mKpOSy0+AYqQCfXHGN19Kmg+q2LzfQiwdt7znD59PFOR9+vUzRaYlVk3nDCIWpsNfI1tSX4TlCnnskAitcz/JraA6Ug0vvQwL2UZ1KqkPYxvaNUQhAQCcb+Nus21dBUMUz3eBFCVuPoFhZA4Un6llRta4T4kJbZB++a+Gs0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id aa8ad21d5d791cda; Wed, 21 Feb 2024 21:04:38 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 688B066A243; Wed, 21 Feb 2024 21:04:38 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Jonathan Cameron Cc: LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: [PATCH v1 1/4] ACPI: scan: Fix device check notification handling Date: Wed, 21 Feb 2024 21:01:02 +0100 Message-ID: <4886572.GXAFRqVoOG@kreacher> In-Reply-To: <4562925.LvFx2qVVIh@kreacher> References: <4562925.LvFx2qVVIh@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrfedvgddufeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehjohhnrghthhgrnhdrtggrmhgvrhhonheshhhurgifvghirdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhikhgrrdifvghsthgvrhgsvghrgheslhhinhhugidrihhnthgv lhdrtghomhdprhgtphhtthhopehrrghfrggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugiesrghrmhhlihhnuhigrdhorhhgrdhukh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791540269626400202 X-GMAIL-MSGID: 1791540269626400202 From: Rafael J. Wysocki It is generally invalid to fail a Device Check notification if the scan handler has not been attached to the given device after a bus rescan, because there may be valid reasons for the scan handler to refuse attaching to the device (for example, the device is not ready). For this reason, modify acpi_scan_device_check() to return 0 in that case without printing a warning. While at it, reduce the log level of the "already enumerated" message in the same function, because it is only interesting when debugging notification handling Fixes: 443fc8202272 ("ACPI / hotplug: Rework generic code to handle suprise removals") Signed-off-by: Rafael J. Wysocki Reviewed-by: Jonathan Cameron --- drivers/acpi/scan.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -314,18 +314,14 @@ static int acpi_scan_device_check(struct * again). */ if (adev->handler) { - dev_warn(&adev->dev, "Already enumerated\n"); - return -EALREADY; + dev_dbg(&adev->dev, "Already enumerated\n"); + return 0; } error = acpi_bus_scan(adev->handle); if (error) { dev_warn(&adev->dev, "Namespace scan failure\n"); return error; } - if (!adev->handler) { - dev_warn(&adev->dev, "Enumeration failure\n"); - error = -ENODEV; - } } else { error = acpi_scan_device_not_enumerated(adev); } From patchwork Wed Feb 21 20:01:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 204416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1268658dyc; Wed, 21 Feb 2024 12:05:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhMoEhxfmnX54q/7wk1rebhcb7r4oOkuWi84UHwTAeyyUYhhG1OaZoqz1DuE8cj29kZS6oLXzEibPv5eM2OGktjNkEJg== X-Google-Smtp-Source: AGHT+IEfDfRw+AwTAdNw0Yj96oKB2uieRbK0BvcMzIclI4aNqnl/RllQz9xVuaY3LftSnOWNTpVu X-Received: by 2002:a17:90b:4016:b0:29a:1ed5:18a2 with SMTP id ie22-20020a17090b401600b0029a1ed518a2mr1809438pjb.47.1708545943677; Wed, 21 Feb 2024 12:05:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545943; cv=pass; d=google.com; s=arc-20160816; b=AUy+dbPXmXKrwlpNOFRaQi4HDheej6DXxHoVcCuxdz6EAy3KP+QpaYxumLXPdOuqrb HWHMfk/dDNgLr4sUBoq4BFF1nfw5Ecbe8RqKtlOKyncyq2/Lh91qrGhhdVnkYXh8BtVY r+FVVI+Ys5jopJeN88RKNNcp64I4e2gYb9169lO6MoZ2uaQUpElJ++erxVvb9lSuutlf yV76kpsRLcPoZEELj2PPgdQ8BYF1TAxXWe0ZXv6VgTMSb5wdk6FkZemIv2M9vewd+t6E /jaDEqwtzf71CUqUX40sXfhq1WPZa8geUwKLdSho+1j4LVutMvhkdxcdmnjE7Mj4HPgN M+0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=eFF/IM5C+uM/fCtCikk2ixeNqdbLBPzLcmKrNLbKDRc=; fh=s5Fc0MEg8Xcp85xwyejK4S4zs7msQB7g1OY0X3YpOJg=; b=J9BpoqyLgs4Corm4q5VVBbQ+EM/a3JQfwR/gyab67E+l1Zkmgm0D1jnjwyuSyZvWmW 9Bw/PISUOew6eFYNOcFQ1lhL4XcJv4eefQYQCKRqY5C3BHSiyBFv3Q/4H7ghDWQXNkPo U9CTfTDN7+dYPSJusrjqbqnpsnc9wXSFaZUsmO4EBt+L4UC304j2WrYvlGC8aeEFebzm R4VbtE7dLqNAE11SZhGXsv0OkCywwSK+MQVP2xVin7eSlbFjPau90VPCWTGZyOvAQFzO jJ4TN+2BRWBS+hIh1Ga8ENcamNbKM1ctTDoRi2ZccH21UqjpXr7BK4a/4X7JH5nL9qc0 h1eg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p5-20020a17090a868500b002935f38dcf1si2066208pjn.181.2024.02.21.12.05.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:05:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 36151283875 for ; Wed, 21 Feb 2024 20:05:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D28871272D7; Wed, 21 Feb 2024 20:04:49 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E47DE86151; Wed, 21 Feb 2024 20:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545888; cv=none; b=om4YFqH/hsPNeMM0o02w+DPUdSGnbzenTKXXB5lgDfH6xbeYeHItXdo3uyd0wqRyItsRw1g51GW0TwWvBFd6w8JTuZG+FcP85iOBdVkkbYxu6PuQxhr4WVJlR4SucuBnaEjST6w02sJhryR//TCkCT44ibvbc+u6bCAEwybrPEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545888; c=relaxed/simple; bh=ZsHdlJrJVlvGSfzCG6LWBqpX9udtvXpPnuXEOa0+fSY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dTk0zeuKKalDGrFxydzLXsGXe9+pQBRZxVLZPqNLF3Fy0EULIRFeJW7jXHDIQvnnzhHknxSmV4L2Tty2HMWnF2+cKxZpKpzCt6G/7x9HWUlhFr4uXTv02SSISTEIMV2VIraDxQ1eZasDF84C5uUL3IFkLakCxDN5Ye1ewPqy15Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 67b712691066ea71; Wed, 21 Feb 2024 21:04:38 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 89EF366A243; Wed, 21 Feb 2024 21:04:37 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Jonathan Cameron Cc: LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: [PATCH v1 2/4] ACPI: scan: Relocate acpi_bus_trim_one() Date: Wed, 21 Feb 2024 21:01:48 +0100 Message-ID: <2189881.irdbgypaU6@kreacher> In-Reply-To: <4562925.LvFx2qVVIh@kreacher> References: <4562925.LvFx2qVVIh@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrfedvgddufedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehjohhnrghthhgrnhdrtggrmhgvrhhonheshhhurgifvghirdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhikhgrrdifvghsthgvrhgsvghrgheslhhinhhugidrihhnthgv lhdrtghomhdprhgtphhtthhopehrrghfrggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugiesrghrmhhlihhnuhigrdhorhhgrdhukh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791540271832350480 X-GMAIL-MSGID: 1791540271832350480 From: Rafael J. Wysocki Relocate acpi_bus_trim_one() (without modifications) so as to avoid the need to add a forward declaration of it in a subsequent patch. No functional changes. Signed-off-by: Rafael J. Wysocki Reviewed-by: Jonathan Cameron --- drivers/acpi/scan.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -244,6 +244,32 @@ static int acpi_scan_try_to_offline(stru return 0; } +static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used) +{ + struct acpi_scan_handler *handler = adev->handler; + + acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL); + + adev->flags.match_driver = false; + if (handler) { + if (handler->detach) + handler->detach(adev); + + adev->handler = NULL; + } else { + device_release_driver(&adev->dev); + } + /* + * Most likely, the device is going away, so put it into D3cold before + * that. + */ + acpi_device_set_power(adev, ACPI_STATE_D3_COLD); + adev->flags.initialized = false; + acpi_device_clear_enumerated(adev); + + return 0; +} + static int acpi_scan_hot_remove(struct acpi_device *device) { acpi_handle handle = device->handle; @@ -2547,32 +2573,6 @@ int acpi_bus_scan(acpi_handle handle) } EXPORT_SYMBOL(acpi_bus_scan); -static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used) -{ - struct acpi_scan_handler *handler = adev->handler; - - acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL); - - adev->flags.match_driver = false; - if (handler) { - if (handler->detach) - handler->detach(adev); - - adev->handler = NULL; - } else { - device_release_driver(&adev->dev); - } - /* - * Most likely, the device is going away, so put it into D3cold before - * that. - */ - acpi_device_set_power(adev, ACPI_STATE_D3_COLD); - adev->flags.initialized = false; - acpi_device_clear_enumerated(adev); - - return 0; -} - /** * acpi_bus_trim - Detach scan handlers and drivers from ACPI device objects. * @adev: Root of the ACPI namespace scope to walk. From patchwork Wed Feb 21 20:02:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 204417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1268724dyc; Wed, 21 Feb 2024 12:05:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1ZDf03C3KNGXi6DlSsasZT2fIEEo01vV/qmk3vHxdlZ1Gqz1ZBNr0F/F3Lb7II8Cv0OEu+0ht0gkBB4CY3lr+FA8oKw== X-Google-Smtp-Source: AGHT+IEQZ98QBXcwXQCK5TiGh8Wh2EENX4DklfPoYTDPOGo9Jfz1omzSzvPPNeOh7CmaK7LbtBO9 X-Received: by 2002:a17:90a:dc0a:b0:299:3657:494c with SMTP id i10-20020a17090adc0a00b002993657494cmr13219225pjv.24.1708545950802; Wed, 21 Feb 2024 12:05:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545950; cv=pass; d=google.com; s=arc-20160816; b=vrN6RIx2amonyWjoWpMGOolAijQTbKwHuj3zaY8qaRhrJDEvo00VEYiFnYZnWMoF4v Hwt2Al8kkvUQ+yBZSoPYa3OR5wM0Lmadsu9oaZ+JpFfgqcJzorktQ+/mAs+/9/iDfpOl 2ep528Uk9SAeoKOprJTsxeZotCgn0FZW/zZ54TwBlQEwa/IYcCcRyknhNXi3xnPieSsD gBnny3y4qtQi2KBojGLgI4cTwYVo8VAVW5fr7u7jRuFZUJlvi5hxH2eA84yWDVLCXsNS zNZFIkNEdW5vGzy5T2M3OLSZ9we4GP9zuXmSgld5B9X1gY6sbG+iRwsXDEPvEcEdE7q3 2XMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=CO+7uRfnhHt/pKB3AR4u9SNJ35QL4elVu3j2eUxNzDs=; fh=s5Fc0MEg8Xcp85xwyejK4S4zs7msQB7g1OY0X3YpOJg=; b=qshWrjRrBtjXPUr2xVOhYhT0ALdIvHvXgeACqNXOilZFmKonS9GH2V9HgTmNe6wNlM BtaBOg0oTDqLRM2O3fOKMvIeTAjQUu+DPOcNGx6LhVAEhektIw2ylck9+LuIE+4Wxm3n 2k5RK6iFKrRT0TR5pM2Rpxd9htfFFbJ8hDo5X3Ve+pmzBeFeaIN2hiddVs4wFxvvzZ2Z N9cmuMTGefKCaPdJCIhH1yE6O7E7qhH/hjX8jeTGLqWZan7luP49gcMCcvaWuhX5CL5s I45iqgUICwfIiF/4sRrozg0qRKbluDsdmktfn1ufp6NNjANtC5Cdc0w0yGOFWuse9MDo fL2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75444-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75444-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p5-20020a17090a868500b002935f38dcf1si2066208pjn.181.2024.02.21.12.05.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:05:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75444-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75444-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75444-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 17553285616 for ; Wed, 21 Feb 2024 20:05:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FD57127B66; Wed, 21 Feb 2024 20:04:50 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEC7D85C52; Wed, 21 Feb 2024 20:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545887; cv=none; b=pUAolk9hsaO2AePQE0CorQ8332DKd2l4WF7nfDQzLVCECh0MJlM9JaIX2B2KrE+2wSL60EAgEcS3HfEynNvUZHQPFQcgduVASAWHf19jeDgLOsmNNSa28OUCAc4wz3KmqNimrWBNieNsVjGp0Y5kWRFVVlw/5gq02BQTuh7epaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545887; c=relaxed/simple; bh=XCeQqPrzLM1Q/X1k44hyO1nlx52uelheaiY8eSQfYxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qUcWNkdmoH2gBX3Fz9VSK3WdQPT3kiW6NGZNeT8E7waqJtKUHj1uF4+MeQNqUggizxL5IrUhJgPszftg5ct/uhrcFbLu16xxrNSckHmJ8vNWV7Mqd6duOwcdZnygvn4xJ66DOIE/sKalaP5Pt+ub3DMd2wE0tbilRNPQdL/itjo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 4363d43caa6d8b51; Wed, 21 Feb 2024 21:04:37 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 6EDE266A243; Wed, 21 Feb 2024 21:04:36 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Jonathan Cameron Cc: LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: [PATCH v1 3/4] ACPI: scan: Rework Device Check and Bus Check notification handling Date: Wed, 21 Feb 2024 21:02:33 +0100 Message-ID: <2939512.e9J7NaK4W3@kreacher> In-Reply-To: <4562925.LvFx2qVVIh@kreacher> References: <4562925.LvFx2qVVIh@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrfedvgddufedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepkedtvdevieejkeevkedvffeiffehiedtheekkeefieehffekgfeltdehleehvddunecuffhomhgrihhnpehuvghfihdrohhrghenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepjhhonhgrthhhrghnrdgtrghmvghrohhnsehhuhgrfigvihdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmihhkrgdrfigvshht vghrsggvrhhgsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigsegrrhhmlhhinhhugidrohhrghdruhhk X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791540279000007673 X-GMAIL-MSGID: 1791540279000007673 From: Rafael J. Wysocki The underlying problem is the handling of the enabled bit in device status (bit 1 of _STA return value) which is required by the ACPI specification to be observed in addition to the present bit (bit 0 of _STA return value) [1], but Linux does not observe it. Since Linux has not looked at that bit for a long time, it is generally risky to start obseving it in all device enumeration cases, especially at the system initialization time, but it can be observed when the kernel receives a Bus Check or Device Check notification indicating a change in device configuration. In those cases, seeing the enabled bit clear may be regarded as an indication that the device at hand should not be used any more. For this reason, rework the handling of Device Check and Bus Check notifications in the ACPI core device enumeration code in the following way: 1. Make acpi_bus_trim_one() check device status if its second argument is not NULL, in which case it will only detach scan handlers or ACPI drivers from devices whose _STA returns the enabled bit clear. 2. Make acpi_scan_device_check() and acpi_scan_bus_check() invoke acpi_bus_trim_one() with a non-NULL second argument unconditionally, so scan handlers and ACPI drivers are detached from the target device and its ancestors if their _STA returns the enabled bit clear. 3. Make acpi_scan_device_check() skip the bus rescan if _STA for the target device return the enabled bit clear, which is allowed by the ACPI specification in the Device Check case. [2] In addition to the above: 4. Make sure that the bus rescan that needs to be triggered in the case when a new device has appeared is carried out in the same way in both the Device Check and Bus Check cases. 5. In the Device Check case, start the bus rescan mentioned above from the target device's parent, as per the specification. [2] Link: https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#sta-device-status # [1] Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#device-object-notification-values # [2] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/internal.h | 1 drivers/acpi/scan.c | 109 +++++++++++++++++++++++++++--------------------- 2 files changed, 64 insertions(+), 46 deletions(-) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -244,11 +244,27 @@ static int acpi_scan_try_to_offline(stru return 0; } -static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used) +static int acpi_bus_trim_one(struct acpi_device *adev, void *check_status) { struct acpi_scan_handler *handler = adev->handler; - acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL); + acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, check_status); + + if (check_status) { + acpi_bus_get_status(adev); + /* + * Skip devices that are still there and take the enabled + * flag into account. + */ + if (acpi_device_is_enabled(adev)) + return 0; + + /* Skip device that have not been enumerated. */ + if (!acpi_device_enumerated(adev)) { + dev_dbg(&adev->dev, "Still not enumerated\n"); + return 0; + } + } adev->flags.match_driver = false; if (handler) { @@ -315,71 +331,67 @@ static int acpi_scan_hot_remove(struct a return 0; } -static int acpi_scan_device_not_enumerated(struct acpi_device *adev) +static void acpi_scan_check_gone(struct acpi_device *adev) { - if (!acpi_device_enumerated(adev)) { - dev_warn(&adev->dev, "Still not enumerated\n"); - return -EALREADY; - } - acpi_bus_trim(adev); - return 0; + acpi_bus_trim_one(adev, (void *)true); } -static int acpi_scan_device_check(struct acpi_device *adev) +static int acpi_scan_rescan_bus(struct acpi_device *adev) { + struct acpi_scan_handler *handler = adev->handler; int error; - acpi_bus_get_status(adev); - if (acpi_device_is_present(adev)) { - /* - * This function is only called for device objects for which - * matching scan handlers exist. The only situation in which - * the scan handler is not attached to this device object yet - * is when the device has just appeared (either it wasn't - * present at all before or it was removed and then added - * again). - */ - if (adev->handler) { - dev_dbg(&adev->dev, "Already enumerated\n"); - return 0; - } + if (handler && handler->hotplug.scan_dependent) + error = handler->hotplug.scan_dependent(adev); + else error = acpi_bus_scan(adev->handle); - if (error) { - dev_warn(&adev->dev, "Namespace scan failure\n"); - return error; - } - } else { - error = acpi_scan_device_not_enumerated(adev); - } + + if (error) + dev_info(&adev->dev, "Namespace scan failure\n"); + return error; } -static int acpi_scan_bus_check(struct acpi_device *adev, void *not_used) +static int acpi_scan_device_check(struct acpi_device *adev) { - struct acpi_scan_handler *handler = adev->handler; - int error; + struct acpi_device *parent; - acpi_bus_get_status(adev); - if (!acpi_device_is_present(adev)) { - acpi_scan_device_not_enumerated(adev); + acpi_scan_check_gone(adev); + + if (!acpi_device_is_enabled(adev)) return 0; - } - if (handler && handler->hotplug.scan_dependent) - return handler->hotplug.scan_dependent(adev); - error = acpi_bus_scan(adev->handle); - if (error) { - dev_warn(&adev->dev, "Namespace scan failure\n"); - return error; + /* + * This function is only called for device objects for which matching + * scan handlers exist. The only situation in which the scan handler + * is not attached to this device object yet is when the device has + * just appeared (either it wasn't present or enabled at all before or + * it was removed and then added again). + */ + if (adev->handler) { + dev_dbg(&adev->dev, "Already enumerated\n"); + return 0; } - return acpi_dev_for_each_child(adev, acpi_scan_bus_check, NULL); + + parent = acpi_dev_parent(adev); + if (!parent) + parent = adev; + + return acpi_scan_rescan_bus(parent); +} + +static int acpi_scan_bus_check(struct acpi_device *adev) +{ + acpi_scan_check_gone(adev); + + return acpi_scan_rescan_bus(adev); } static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type) { switch (type) { case ACPI_NOTIFY_BUS_CHECK: - return acpi_scan_bus_check(adev, NULL); + return acpi_scan_bus_check(adev); case ACPI_NOTIFY_DEVICE_CHECK: return acpi_scan_device_check(adev); case ACPI_NOTIFY_EJECT_REQUEST: @@ -1945,6 +1957,11 @@ bool acpi_device_is_present(const struct return adev->status.present || adev->status.functional; } +bool acpi_device_is_enabled(const struct acpi_device *adev) +{ + return acpi_device_is_present(adev) && adev->status.enabled; +} + static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler, const char *idstr, const struct acpi_device_id **matchid) Index: linux-pm/drivers/acpi/internal.h =================================================================== --- linux-pm.orig/drivers/acpi/internal.h +++ linux-pm/drivers/acpi/internal.h @@ -121,6 +121,7 @@ int acpi_device_setup_files(struct acpi_ void acpi_device_remove_files(struct acpi_device *dev); void acpi_device_add_finalize(struct acpi_device *device); void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); +bool acpi_device_is_enabled(const struct acpi_device *adev); bool acpi_device_is_present(const struct acpi_device *adev); bool acpi_device_is_battery(struct acpi_device *adev); bool acpi_device_is_first_physical_node(struct acpi_device *adev, From patchwork Wed Feb 21 20:03:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 204414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1268241dyc; Wed, 21 Feb 2024 12:05:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVxRtIlpETZr8mn6Cm4o0T8Tpzu2qopoAI80bd8DI+7gyK1KmoEBQrdov7OjK/Q2KubtBbpDKZANC08Zm0UXLQGVovXOA== X-Google-Smtp-Source: AGHT+IHYVSMS3yFhY9+SqlK68HyYMZtPBiAUzb6IagjKlevPBrcw82IFcsOTRTqdCHPEIX7GE1RM X-Received: by 2002:a17:906:abd0:b0:a3f:686c:1d88 with SMTP id kq16-20020a170906abd000b00a3f686c1d88mr568188ejb.11.1708545902916; Wed, 21 Feb 2024 12:05:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545902; cv=pass; d=google.com; s=arc-20160816; b=QI6bcuzcV42tY+YYUmQ5FZroEauelgToXmnqXP5Bd4cm1kHnJjOy7yvDXOqig2/Y1u 0JGbNQ44weKqDjRHNK9XKsPIFnOkFvIIrEFOZzTHHPSjgLpywbCw0NM33z59coV7Z5zD K4W6ia/Qo88l0oqqb/IN7nGiHQVT/R2o9k8aKD1dSjZIybO78qhfwBSz4t/gD63lsOWH msWem15OZV3KBwC6Kc7bU9X2HaoD1vcEqb+f6FibBwFsSLl+qKmyMKP80HuSPtEzRPof vBkvJ0UYxy7vrsGPRlWK9wLe0uW6ZyB1MVuXlViC5j5zaL+Qy3N6KB4ZHmmJl+dm3XF7 2i4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=VbHKg7NT8SmXHUT2pr1u9bWcSAoQ8UPuQKdsuU3YKg8=; fh=s5Fc0MEg8Xcp85xwyejK4S4zs7msQB7g1OY0X3YpOJg=; b=S3s+S0nLgKQxEAGbUky3M6vFSqcyT1h57AvhYk0nYGtid+/oEnsD9ayqsXdXIDFR/a vq5IsEepJd0uqEljUYK6N4rcMeFcUCXnjrB4v2OMFwSLmOEWwSmwOxvpLUQLAnp06BcJ tLXTc3M52Ac8Y9Dv57t07lERIzsLkh257ZM7iuLF3c74axvVH7/4Qbega5mWRCW/amHc nAg6c+3MEA+2kkHO/coXnOMP6bKMbC6xdFQRkVx97Q2+GkIvpnOXQM8Bt8tW0CVCcotY noYOxXhO68Y6xG/0XzWwlqGkobtgUinPXp62tTQMXNWB1BDdOHHxWZHiBLAXHPeVbKbQ gWMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75443-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75443-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dv19-20020a170906b81300b00a3ef7c0e120si1903842ejb.958.2024.02.21.12.05.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:05:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75443-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75443-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75443-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8719B1F2995D for ; Wed, 21 Feb 2024 20:05:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B93586AE9; Wed, 21 Feb 2024 20:04:48 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A54B42A8E; Wed, 21 Feb 2024 20:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545886; cv=none; b=qgVcRa2w010hYfhV5UBjLq7TrzelbvHqCZKXl78Kw+wnmYX0s3Mu386qAJTSTVVEDV7RFhJ/5KNRisU2CCwWNK9oyq0H80R9qTOlsyFXqm9tpo7rl4kCDJoIBC9rTlMkHXmOctIvhVS/Q9reW+hndfI3JB1xzwW96IhgrfqLPfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545886; c=relaxed/simple; bh=HyUVCsjQzKDy4y3IbS6W3hreF7bH4BoXJ2aTGIKqH1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C20tbOh3VqSDNCPPQ1TcQPJshIzZgqd3nZGf74o9SsEFqW8snINRYAyYAFpobIMHAmwW4WDNQ4V5YoSomNw0xw07WddLVqQmovj5ttmsDSLZWbtGS0QhDHWxYUx9ajRK6FmG3LzD/FWoouKUb7OJ66LdetCh7m6udcl6eHPFk+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id a3ca0b28fd2e1865; Wed, 21 Feb 2024 21:04:35 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 5C1A066A243; Wed, 21 Feb 2024 21:04:35 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Jonathan Cameron Cc: LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: [PATCH v1 4/4] ACPI: scan: Make acpi_processor_add() check the device enabled bit Date: Wed, 21 Feb 2024 21:03:17 +0100 Message-ID: <3298279.44csPzL39Z@kreacher> In-Reply-To: <4562925.LvFx2qVVIh@kreacher> References: <4562925.LvFx2qVVIh@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrfedvgddufedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepkedtvdevieejkeevkedvffeiffehiedtheekkeefieehffekgfeltdehleehvddunecuffhomhgrihhnpehuvghfihdrohhrghenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepjhhonhgrthhhrghnrdgtrghmvghrohhnsehhuhgrfigvihdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmihhkrgdrfigvshht vghrsggvrhhgsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigsegrrhhmlhhinhhugidrohhrghdruhhk X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791540228392548488 X-GMAIL-MSGID: 1791540228392548488 From: Rafael J. Wysocki Modify acpi_processor_add() return an error if _STA returns the enabled bit clear for the given processor device, so as to avoid using processors that don't decode their resources, as per the ACPI specification. [1] Link: https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#sta-device-status # [1] Signed-off-by: Rafael J. Wysocki Reviewed-by: Jonathan Cameron --- drivers/acpi/acpi_processor.c | 3 +++ 1 file changed, 3 insertions(+) Index: linux-pm/drivers/acpi/acpi_processor.c =================================================================== --- linux-pm.orig/drivers/acpi/acpi_processor.c +++ linux-pm/drivers/acpi/acpi_processor.c @@ -381,6 +381,9 @@ static int acpi_processor_add(struct acp struct device *dev; int result = 0; + if (!acpi_device_is_enabled(device)) + return -ENODEV; + pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); if (!pr) return -ENOMEM;