Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6754444rdb; Fri, 15 Dec 2023 07:32:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiDeW4bKkA+BijsMICUatR4L/hMnvD+nWDccNC9JkjHx4x6EbHJotajZHiZABsmwc/GxK2 X-Received: by 2002:a5e:9204:0:b0:7b7:afb9:3c52 with SMTP id y4-20020a5e9204000000b007b7afb93c52mr481389iop.27.1702654350938; Fri, 15 Dec 2023 07:32:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702654350; cv=none; d=google.com; s=arc-20160816; b=h32UhcoOHvnaQyJWSV1eOLtyAUa7Z3wu6uVdCJo0DZfryVh2T0oeDOtAc3+bQgrCaQ bV2gFHY2ce/YrDWuaVYS/+o2ntkIQGwLXgVwkYQ03Q3N3H9y9fDp+bMr4KbLan5+uSjO EwKS5QBl59qIx3k8trw6ngWX/SEydrp/bbJ07OCcfX6Ey4pA/XlURGDOAdqKyN0d0NR6 DVlUrf3HGAuaZ7X3yA5CS7m3pmmxEP93zszbWivs4DE5ezsfHZEyOax1TZnrqBdI/7eX RSKFzXIWdJXl1Nx17jjYTb9R4elhcbkHuMR7YxVTiIGksFq4BtHPIdc1cce6uGTWdY4s CHKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nvVr24yJlTcKSpTw1UQi3U4632hdafX2X9T8yNVWb/s=; fh=jk49YxFvkeKEe21V4UzhmJ9WhP6xdFgUEwa1GfJNKdo=; b=0WCZF7LYInQSWvGceDz5efTxRbqIGeOqngqvDEJv7rG7d9nECBvwDsXJnmWQ3ldYyh EhcebiRo6c8By8eBfOu9P+5kDtkIqXLwzvQU4uCgHkeugTSDoUOa+j6FjyR4LiWVqIUG haOVROxZ4Xt/ZEZ/BMfgpF02IVwfJ89QjKXZZCmJzHaz6J/Nk6dXpC7uQEcZ2UVDXHuS rMnWFwGX/R7Nf/JwU/CfkyGy+g2dQH3TSx9O3U3/Taen9ybUO8zlns5xQN/lLHql8/7d N4eiA2XtHgI16FAX9cAZoTrYYrF9Bw9NvOwgVitI5fR3JtVIa9RzQR8IL1Vb+qpuIEPs 5PLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=RR12zPsU; spf=pass (google.com: domain of linux-kernel+bounces-1218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e33-20020a630f21000000b005c6faf0a670si11950560pgl.257.2023.12.15.07.32.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 07:32:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=RR12zPsU; spf=pass (google.com: domain of linux-kernel+bounces-1218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 633C8B2162F for ; Fri, 15 Dec 2023 15:32:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B66CE374CA; Fri, 15 Dec 2023 15:32:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="RR12zPsU" X-Original-To: linux-kernel@vger.kernel.org Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (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 6798136AF3; Fri, 15 Dec 2023 15:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nvVr24yJlTcKSpTw1UQi3U4632hdafX2X9T8yNVWb/s=; b=RR12zPsUj34Qy44F0kIaQPaAZB nPc+zWXztM2JH+6eKjddRnEJOcP4lHMaZs0Ok+6Eho9xjDst2RRvXpsCCyoi7ja6CGEcydbSwFAla 53X4gkcQ8TpZWIlIRo/ThKhe3wdKOcfl7yUOyXTd80QhoYvEG1X1gzin5cMl7VuHRsiaoHUkm/vCF PYV3ouDdMG+9zRwjqRNnemtSmGGjTl1pO8Bz5P4ZH+wXgC0S9oDcdiSR5YyOfn5ipO2ghRZtIMuIZ 6tcgCPy1Ngdj7NUdlCPMO+WdfmNzTDSJrQZBHAb7IAFs/jxP1GIaaGn85jf5fzZNPpucwpWFKdF2Q MkpmY3mA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:48236) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rEAAQ-0002qa-0q; Fri, 15 Dec 2023 15:31:58 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rEAAN-0003iY-2B; Fri, 15 Dec 2023 15:31:55 +0000 Date: Fri, 15 Dec 2023 15:31:55 +0000 From: "Russell King (Oracle)" To: "Rafael J. Wysocki" Cc: Jonathan Cameron , linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, acpica-devel@lists.linuxfoundation.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Subject: Re: [PATCH RFC v3 01/21] ACPI: Only enumerate enabled (or functional) devices Message-ID: References: <20231214173241.0000260f@Huawei.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) On Thu, Dec 14, 2023 at 07:37:10PM +0100, Rafael J. Wysocki wrote: > On Thu, Dec 14, 2023 at 7:16 PM Rafael J. Wysocki wrote: > > > > On Thu, Dec 14, 2023 at 7:10 PM Russell King (Oracle) > > wrote: > > > I guess we need something like: > > > > > > if (device->status.present) > > > return device->device_type != ACPI_BUS_TYPE_PROCESSOR || > > > device->status.enabled; > > > else > > > return device->status.functional; > > > > > > so we only check device->status.enabled for processor-type devices? > > > > Yes, something like this. > > However, that is not sufficient, because there are > ACPI_BUS_TYPE_DEVICE devices representing processors. > > I'm not sure about a clean way to do it ATM. Ok, how about: static bool acpi_dev_is_processor(const struct acpi_device *device) { struct acpi_hardware_id *hwid; if (device->device_type == ACPI_BUS_TYPE_PROCESSOR) return true; if (device->device_type != ACPI_BUS_TYPE_DEVICE) return false; list_for_each_entry(hwid, &device->pnp.ids, list) if (!strcmp(ACPI_PROCESSOR_OBJECT_HID, hwid->id) || !strcmp(ACPI_PROCESSOR_DEVICE_HID, hwid->id)) return true; return false; } and then: if (device->status.present) return !acpi_dev_is_processor(device) || device->status.enabled; else return device->status.functional; ? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!