Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1810267rbb; Tue, 27 Feb 2024 01:40:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUkH1Lcdfh1WtZLP/Un+xMHzmSjNga4Q7zVTOtkSrQGhaiZwJsAX0KMjUieD8pcy+mP4VqnqMb6h/kSTnf3kV4MyrC66MIdHEJecEtJ4w== X-Google-Smtp-Source: AGHT+IFUdnzwojqTyX13PdLnaxs4djNJ2VCEfC7ftr1TrHh1cACuubVsNxO4PHFZatQgQdbSZesu X-Received: by 2002:a05:6a20:9598:b0:1a0:e8f3:14f2 with SMTP id iu24-20020a056a20959800b001a0e8f314f2mr2133626pzb.50.1709026802061; Tue, 27 Feb 2024 01:40:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709026802; cv=pass; d=google.com; s=arc-20160816; b=NTBjUH6PM4zI0MsK3xoBuG2WbOoLOjIqK8vNE+hf/sne3iC+9nt9yU0Kl0KFjjWgT9 6AzwIiNvx4jrRw0Cw46TKSgLPbZP4/KuAgNemEElryafMRfeA8TodQuvDNCRYvedJiId zrbxVGbqGSYvvp5ts9rYAFFoSgZyRb9cTaXZF02pZyNfwBLPRAWEwjy9T2XSYveMR/JW PJJNpCn95Z/cgWXsSlIz7OZAU/qMv7kQbAu1S+1BUjRfF1yrOIrsVUCG08KTJ36kQSZE on5XIq4ImUkgl4prashKK1ya6Zr9HT4IWKpqqbPpCVAi2qNmLtIcqdxQGtRaKYyNnrIt gBww== 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:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=NZO5rVECo19sv9qU/vORg1rObSFXAqQ6aaMRpi+iPsg=; fh=qca6Lao8FW7Clj+3Gs90PIlM0S5qGE+Ig2lyYgPloPw=; b=OFAuSTJ2a8hhHW1IYqHorTQ8BBS7n60YhVqS8Rn2nlbYFwm2NRdTZlvwB2tPJqiHNC 2+Qec1cAHW2Xny6OQoX5GZhkWvjsFOA+mCkbCSZM5qp4dPlxiEDYi5M21igvgz1/PPJh HD7A71hIJAPr8+5L8DLJ1lG/nObR7nGSqSsVHwe8eGEXxZsKV+TW5MExqAWBO0IoWpDm c1F4qSnNROJ5dgay/2Ov6hGqnIdPMmiYs+D2uT/KMX2XbJI35DW5ScE9Fw0guxyELVlJ 2GZNCfi3ChpvZHCizXs5XNQH9fNdK8Xv4CA0fmy8+XfSF/0znACQV49+8bLBU9fCissR V/sA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-82971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d6-20020a170903230600b001da17ce989dsi1145760plh.278.2024.02.27.01.40.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 01:40:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82971-linux.lists.archive=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=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-82971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 C1E1628DC85 for ; Tue, 27 Feb 2024 09:40:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E0B513699A; Tue, 27 Feb 2024 09:39:56 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 C857C7BAE7; Tue, 27 Feb 2024 09:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709026795; cv=none; b=ZHktK43MpTh1/GdNFJeyu4VyHRp0aVHGqU3t8aC8s7M/GlDO+HCQOaxcZbxuN+Pj132KRVytpFHOzLriotQC+PbRUBJ77g7RrdhVaPTH0k+OX1NGC/g3XlSCO4LLm4YLlMtklZIINAOLMNTWdmLjHRyvRtQ8oCXzu1cVt2rlt08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709026795; c=relaxed/simple; bh=0qPbRd+6tnaV2H2MEITsFHJAWN/QQ+mGHBMovXvJtdQ=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hsjGf0JPRKP1XKDxEn3P3q5i1zbPfCSkuDMkoHvcgoIFEuesSOSQUC6aGfXHcxRomK7+bBJH3fBpUqhIMFG8DzV2PhewVvf0+yF4X+cLaBarlzNSRNu3w6P7LowJ4B2z0MqPvJ/hWzAVVhUq+ADdBg0DaHHSvAJRm854U6RjHHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4TkXRT4Vxcz6H7Wb; Tue, 27 Feb 2024 17:36:05 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 236B11400C9; Tue, 27 Feb 2024 17:39:50 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 27 Feb 2024 09:39:49 +0000 Date: Tue, 27 Feb 2024 09:39:48 +0000 From: Jonathan Cameron To: "Rafael J. Wysocki" CC: Linux ACPI , LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: Re: [PATCH v2 4/5] ACPI: scan: Rework Device Check and Bus Check notification handling Message-ID: <20240227093948.000050c9@Huawei.com> In-Reply-To: <1958983.PYKUYFuaPT@kreacher> References: <6021126.lOV4Wx5bFT@kreacher> <1958983.PYKUYFuaPT@kreacher> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) On Mon, 26 Feb 2024 17:45:11 +0100 "Rafael J. Wysocki" wrote: > 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. Rename acpi_bus_trim_one() to acpi_scan_check_and_detach() and make > it check device status if its second argument is not NULL, in which > case it will detach scan handlers or ACPI drivers from devices whose > _STA returns the enabled bit clear. New name is much better - thanks! > > 2. Make acpi_scan_device_check() and acpi_scan_bus_check() invoke > acpi_scan_check_and_detach() 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. > > Link: https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#sta-device-status # [1] > Signed-off-by: Rafael J. Wysocki Looks good. Reviewed-by: Jonathan Cameron