Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6787123rdb; Fri, 15 Dec 2023 08:17:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxkHBgfiukH2QEPNgmERf57f/g8VFKvvf4ie8a43rYnPTIRJRuozaXHOoW+sFQakVs/vPL X-Received: by 2002:a05:6a21:9989:b0:193:f701:9c29 with SMTP id ve9-20020a056a21998900b00193f7019c29mr521856pzb.19.1702657027807; Fri, 15 Dec 2023 08:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702657027; cv=none; d=google.com; s=arc-20160816; b=S6Ow8IKbt25VrF7SQYfUMOru1J9474n7KThmnPG54vaNRbKrqYZFnBUDxnR2jmgzXu k+GTBRJ2ZAJs8DM1b7qSQAu0hxljTkRlxf6Cw5sBi7L1eHT16oJPZnnGDTMiTIEeOlQA jUxdaWVqxTxMY4aGTylT+RcyaCb71OB6o1i5og48iSg9jDY1htfG7Vn1AzSzlmD5t7DD 5cX+bx+8YaiX/rRxWgY8Vl33SLTXlmpYAfXF6cvdoavM8OfOYn7U1wCoIP2LM7UY9fE7 oI46mW2GY4JYj8mCIJ+zhD1RXIBBacf+EPKf7peiw6r+9SwyMJ2vyqyEYllMyPrWRhsR nJ6A== ARC-Message-Signature: i=1; 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=Xi22T//t+DfmHf/bLmWFTz8XBYjb+HFGM504yYQlAPE=; fh=Znsn6mtEq8jmuIJgUo/xbgu3B+TeYmx4q5iWwbda34A=; b=O68xn97gS2TAb/WjI9rUDOqkPsymY5cJThpwIUFXCMFZmuVZv1T1IsI68RR9bdQKai C1uBFflmh/NAzEpGssAzSgieA5oXtcAmDSjdVMCYcTv4h2nHgqNz0jwT6ER/ce1kwmOR PTfAQx9hAgaOjEroqM8449nW5+5ie9TzPXQZ/gpE+bppCYup5nzJ+cATaw297NqogGQl CnqaIvqJ4BK1n0BTw0f+wku3c7bonOOF+ANb8ezSTxIjoX2Rp2ZGj05tmRTGn9M3qgsE p0ajvtogog8glqCmtqT7tEL6lS9wQOeOKAr7TFpXiJ3UhkmyBdJ3asq8PLvgPcoeKZ7Z MuKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1276-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1276-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j26-20020a63fc1a000000b005c624eec079si6980363pgi.724.2023.12.15.08.17.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 08:17:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1276-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1276-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1276-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C8E5BB233A9 for ; Fri, 15 Dec 2023 16:15:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28AD43BB46; Fri, 15 Dec 2023 16:15:46 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 D8E5B37163; Fri, 15 Dec 2023 16:15:43 +0000 (UTC) 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.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SsDmQ6g1zz6K8tP; Sat, 16 Dec 2023 00:13:42 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id C2B1C140133; Sat, 16 Dec 2023 00:15:41 +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_128_GCM_SHA256) id 15.1.2507.35; Fri, 15 Dec 2023 16:15:41 +0000 Date: Fri, 15 Dec 2023 16:15:39 +0000 From: Jonathan Cameron To: "Russell King (Oracle)" CC: "Rafael J. Wysocki" , , , , , , , , , , , , , , , Salil Mehta , Jean-Philippe Brucker , , , James Morse Subject: Re: [PATCH RFC v3 01/21] ACPI: Only enumerate enabled (or functional) devices Message-ID: <20231215161539.00000940@Huawei.com> In-Reply-To: References: <20231214173241.0000260f@Huawei.com> 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="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) To lhrpeml500005.china.huawei.com (7.191.163.240) On Fri, 15 Dec 2023 15:31:55 +0000 "Russell King (Oracle)" wrote: > On Thu, Dec 14, 2023 at 07:37:10PM +0100, Rafael J. Wysocki wrote: > > On Thu, Dec 14, 2023 at 7:16=E2=80=AFPM Rafael J. Wysocki wrote: =20 > > > > > > On Thu, Dec 14, 2023 at 7:10=E2=80=AFPM Russell King (Oracle) > > > wrote: =20 > > > > I guess we need something like: > > > > > > > > if (device->status.present) > > > > return device->device_type !=3D ACPI_BUS_TYPE_PROCE= SSOR || > > > > device->status.enabled; > > > > else > > > > return device->status.functional; > > > > > > > > so we only check device->status.enabled for processor-type devices?= =20 > > > > > > Yes, something like this. =20 > >=20 > > However, that is not sufficient, because there are > > ACPI_BUS_TYPE_DEVICE devices representing processors. > >=20 > > I'm not sure about a clean way to do it ATM. =20 >=20 > Ok, how about: >=20 > static bool acpi_dev_is_processor(const struct acpi_device *device) > { > struct acpi_hardware_id *hwid; >=20 > if (device->device_type =3D=3D ACPI_BUS_TYPE_PROCESSOR) > return true; >=20 > if (device->device_type !=3D ACPI_BUS_TYPE_DEVICE) > return false; >=20 > 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; >=20 > return false; > } >=20 > and then: >=20 > if (device->status.present) > return !acpi_dev_is_processor(device) || device->status.enabled; > else > return device->status.functional; >=20 > ? >=20 Changing it to CPU only for now makes sense to me and I think this code sni= ppet should do the job. Nice and simple.