Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp442158rdb; Mon, 29 Jan 2024 07:06:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUIF+kJ+O+qNqxwZHcd+lryXwxuwo2/kdcw6cscmWhw74/X8UoCNzmdYisOPVkDJSuWAWG X-Received: by 2002:aa7:c316:0:b0:55f:bca:8505 with SMTP id l22-20020aa7c316000000b0055f0bca8505mr1409416edq.19.1706540770596; Mon, 29 Jan 2024 07:06:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706540770; cv=pass; d=google.com; s=arc-20160816; b=zkhRJu2460EMCPU+nQpCVhY1Q7RNmU35SSL08SCIcG0eGAp3B16zbpDDoRD5MEUy1z +Pj9F4nngm2Z0mBMzrxq5UZqbaYNh4kxtrBFJ8ViuEh0S7a0gQbY7QI8O0QBtgATGowK iOWjjcfEu25G2LjnkjAqz+QkQ3LeZuTdTQTv8m8VIEGjdBJTpdSoTrhjPifN8qv2rVxG PsPYcLOo7dYNge3uVzHUlDVdgNOl/EB/cFnUmWXu4XU5PhgcaXKsLBwdaneJ7bB1l93C D5+6j34+mgou5cUjaYT90PkCSF25y3k8NqwELJPGcJwEWAX/3+ytxiZrxytIKtirIDM6 GMNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=EkpAjVvacpcOYBIZJzTULHFzBo21BcPnaUhokGVxGPM=; fh=0lCPcHPVvx4+S+7CTTCCUUPAqze53aFz7gg0MrrXZSI=; b=wFAjSk891FE1Dvzc2ABaAzSfu+vfgHSje+hazGtx0IdYDfvWgXYIS1AG/IwI/eGlaK 4USpHT/9QrEtS1F/lCEGHZy682LbElHR/CFTQbu94TFO3RpEmjUz+LJYeUGZqAqE9n16 W3YwFPacqnd9KmzLm8AuabpL4D0qZTn8iX5JHlbOHebW4mznh/GtfHiKKvPb+RHAbpnn xpeNSxYY1Zz8ohXL5gl/54CylEVoDhYpyW06xjwCvqvITqBs/Nc/B5h0za1ozC/wnZiF d4g5U+WXBS7mm2yOLgf/8TiVFx2wq8mjWaNs8hzuGiuWmGz3212185KviDSjXbRbo700 akBA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-42959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fj11-20020a0564022b8b00b00557f62bb415si3823744edb.30.2024.01.29.07.06.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 07:06:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-42959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 5AE991F288E2 for ; Mon, 29 Jan 2024 15:06:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C24615351F; Mon, 29 Jan 2024 15:05:57 +0000 (UTC) Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39C461534FA; Mon, 29 Jan 2024 15:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540756; cv=none; b=BlTqYCNVkxatawn0jsvXkH0NOKXRJVJQUru+vHACrFOYlw3VKycmxn41v8TLVyZy80nK27VMYGCrK35PxToAgSd0dsVsWKPE6YgsLvuHNdPsiKS7fEsDggGbCcRr+5FVPsB/T0xXKynTOBk8J6nhUthTwOXYHYsIveqlOCmtmBk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706540756; c=relaxed/simple; bh=q6I0vmpSP+EMAN7W7TMgr8TqOcKWKp2AWgbxZCoyOoc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jshDNDuXyMa6IjBPRyZsbT5mW1WKGMJa5plJtQW1BQf4/9dSsAbrxH1ciqcJzZwl1+Kom0Kqor3+7S3V+yNJkugESGDile7P/tqhHaZed/qyp2bK1JqHM/GPxE0hNHZPgUJFhvTQsviiatpFtx+yDia5dywNbrieETJvoWx42qY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.161.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5958d3f2d8aso366388eaf.1; Mon, 29 Jan 2024 07:05:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706540754; x=1707145554; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EkpAjVvacpcOYBIZJzTULHFzBo21BcPnaUhokGVxGPM=; b=PMHpL80aiNTB4ZvOmet2EYAuO6Flfy9141JhM5N3Ummz/dDXwURf4bASPc1qeR2yJE a4NhOIuROgiJ4gA6IA8RrynZYdKxL8LCvvFTQbliG3aXiI+uyJYBc1Cyq33+pAQ/z9Bj dpBwiLH8fQZLe35za1edbynpQ+Qhv4524XM8S1w3AgKLEubxIbLakMZPw6vT/ydt+DK8 QtSkS77Td4qdfKCcuEfxz3hS02YbmpvGPizkAQwfegs4GtDgPdg1m0MYesRfvA3A/QCC JiBmHSLFIi1GdjN7ABmy5tAdNxkftNge1xmGSUfzSE0rNNcMAq39rdQDnSStA7K6+kW8 DXLQ== X-Gm-Message-State: AOJu0Yxuk9ZpxzMuQXKzTXox41y8h4cz6jObDkWB14/QcJnxSKpEw4VZ yYjUCv1YlapoMsaRph1JlGyJPMAX5WRRe7HxrJtry2iiAVpegOdDaLcsb0NGuPpzUG91n/ZpKKP Njqg03uSDVtJz5BtSwE29ksegdlE= X-Received: by 2002:a4a:c48a:0:b0:599:fbcc:1c75 with SMTP id f10-20020a4ac48a000000b00599fbcc1c75mr6541388ooq.0.1706540754026; Mon, 29 Jan 2024 07:05:54 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231215161539.00000940@Huawei.com> <5760569.DvuYhMxLoT@kreacher> <20240102143925.00004361@Huawei.com> <20240111101949.000075dc@Huawei.com> <20240112115205.000043b0@Huawei.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 29 Jan 2024 16:05:42 +0100 Message-ID: Subject: Re: [PATCH RFC v3 01/21] ACPI: Only enumerate enabled (or functional) devices To: "Russell King (Oracle)" Cc: Jonathan Cameron , "Rafael J. Wysocki" , "Rafael J. Wysocki" , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 29, 2024 at 3:55=E2=80=AFPM Russell King (Oracle) wrote: > > Hi Jonathan, > > On Fri, Jan 12, 2024 at 11:52:05AM +0000, Jonathan Cameron wrote: > > On Thu, 11 Jan 2024 10:26:15 +0000 > > "Russell King (Oracle)" wrote: > > > @@ -2381,16 +2388,38 @@ EXPORT_SYMBOL_GPL(acpi_dev_clear_dependencies= ); > > > * acpi_dev_ready_for_enumeration - Check if the ACPI device is read= y for enumeration > > > * @device: Pointer to the &struct acpi_device to check > > > * > > > - * Check if the device is present and has no unmet dependencies. > > > + * Check if the device is functional or enabled and has no unmet dep= endencies. > > > * > > > - * Return true if the device is ready for enumeratino. Otherwise, re= turn false. > > > + * Return true if the device is ready for enumeration. Otherwise, re= turn false. > > > */ > > > bool acpi_dev_ready_for_enumeration(const struct acpi_device *device= ) > > > { > > > if (device->flags.honor_deps && device->dep_unmet) > > > return false; > > > > > > - return acpi_device_is_present(device); > > > + /* > > > + * ACPI 6.5's 6.3.7 "_STA (Device Status)" allows firmware to ret= urn > > > + * (!present && functional) for certain types of devices that sho= uld be > > > + * enumerated. Note that the enabled bit should not be set unless= the > > > + * present bit is set. > > > + * > > > + * However, limit this only to processor devices to reduce possib= le > > > + * regressions with firmware. > > > + */ > > > + if (device->status.functional) > > > + return true; > > I have a report from within Oracle that this causes testing failures > with QEMU using -smp cpus=3D2,maxcpus=3D4. I think it needs to be: > > if (!device->status.present) > return device->status.functional; > > if (device->status.enabled) > return true; > > return !acpi_device_is_processor(device); The above is fine by me. > So we can better understand the history here, let's list it as a > truth table. P=3Dpresent, F=3Dfunctional, E=3Denabled, Orig=3Dhow the cod= e > is in mainline, James=3DJames' original proposal, Rafael=3Dthe proposed > replacement but seems to be buggy, Rmk=3Dthe fixed version that passes > tests: > > P F E Orig James Rafael Rmk > 0 0 0 0 0 0 0 > 0 0 1 0 0 0 0 > 0 1 0 1 1 1 1 > 0 1 1 1 0 1 1 > 1 0 0 1 0 !processor !processor > 1 0 1 1 1 1 1 > 1 1 0 1 0 1 !processor > 1 1 1 1 1 1 1 > > Any objections to this? So AFAIAC it can return false if not enabled, but present and functional. [Side note: I'm wondering what "functional" means then, but whatever.]