Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6191927rdb; Thu, 14 Dec 2023 10:37:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTCqpVMVWCsywT6FLq75Rf+RtHF6lRGYg1o7RLCz3CIuc3uNaskf2NZQBvvbQJlb3JNdVM X-Received: by 2002:a17:902:654a:b0:1d3:5b35:543a with SMTP id d10-20020a170902654a00b001d35b35543amr2335475pln.109.1702579050740; Thu, 14 Dec 2023 10:37:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579050; cv=none; d=google.com; s=arc-20160816; b=wxkNhnAdhkww9QJ//aOytutSgt6bLVKFHt2b2slXPoQlPIeDnOnpopytYfa6sucOZJ T1DgcSBhVBy5LN34zxzFP+cDl/GjZbuk5iqDgI75acq36yA2s1Mo2Zy952etzpwGW3Cw X6bdKC3JhhLpvKoRX3e+ss5D0wwfbi3kQGtn71+1hYa/tvqz5N0Z8JgRao73RibzTEmY 86k+G1/KnxBLJr2hZa2po5rmDd3iW8ih41/jfEkq5IrVbda9PXWC1rtIYiuErIKRHlE0 pnwy/28OM2uX5RWuHh6TB0f1RrExS9ps1V4KMZs+YQPhswWI13gRm71q53KSY03ZAe/f 02lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=jZ2xTymEvv2/ccigQUXUQpn233xkKgAmTFAwaUu3hX8=; fh=NhIYZijmfJtpxtinfDP4CBoc7tLbJO+KZm3T35ruZaU=; b=TiSYjdtQBtrFTqMAxNlWoVIFQRcmmRjiTXa1Y5c7yWzXXOuhmL/giJN4iLyQQjmzm2 HR5czDnMZdz0RkxfzBYsnqWNIOOeJDRX7ywNRBGZHPfSeZp6O7fPfcj+nogwJALxM0ul FMPqLOmEUcjqPQ755Hi8T8sETMXAIlUwBTQDbhytJLnHYMLtuMaYQpnD6dUW7WlMdPQf sQMiB7l2xw1GcZx307Ka+N5q5rluVQYt88iuVWSOGwyfMlVmiml65eJxdoWYNxgPoFAh MjZolqXyQc+1uGhbhHRCNO/Cus78BTCKvO+0D+C3frzrVDSfVI4EoalD1gr5lQCFoEh2 Cihw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k15-20020a170902c40f00b001d346f6804fsi2677309plk.11.2023.12.14.10.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:37:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D5EE780E0706; Thu, 14 Dec 2023 10:37:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbjLNShT convert rfc822-to-8bit (ORCPT + 99 others); Thu, 14 Dec 2023 13:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjLNShS (ORCPT ); Thu, 14 Dec 2023 13:37:18 -0500 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E272410E; Thu, 14 Dec 2023 10:37:22 -0800 (PST) Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6d9db92bd71so1362896a34.1; Thu, 14 Dec 2023 10:37:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702579042; x=1703183842; 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=VqDz+iAKQeDij2eq7OD06mj+eeeCJzCcbsR1GzAidN0=; b=XPa67Fu8rCw9+gYXEnw46OvwrzQGu2ZUqMJvgc6Wb/9g8bImHk47f48+MC57wXWGZN 5za+OI1931IkcQZjRvhSe0YVXx8bCjIq24aI5uUyuh4hmWHDhPkV8WjdqGrerPI0TEbK Kusub0AQ26qOLEHzeb/ERkZBnB7RjVrZMZqFCTP5LXjvn+yMpJoTiGr+np/Q2HOP3aWZ G48w+kW+acRpW45nHmQC2Lrg5fayElUNHHNK0v/RBfPRoq/RNX9QKr//U6tITHmOaOZf LN1OkqcBUjOOL7eXeNAt/LumEVWso5Vu1wByD43cZYhKP6bw43XD0qgNUN3up1dm/mZ1 Smjg== X-Gm-Message-State: AOJu0Yw/qDxVDglLonMlcfzGNwjZ1UgzLI464Ws5JAXdfcM8K/8QiG89 L+xwhDTHSZ/i5cwX6QylYpRKel4a+n4cQg5BXr0= X-Received: by 2002:a05:6871:2284:b0:1fb:648:5207 with SMTP id sd4-20020a056871228400b001fb06485207mr19135855oab.2.1702579042101; Thu, 14 Dec 2023 10:37:22 -0800 (PST) MIME-Version: 1.0 References: <20231214173241.0000260f@Huawei.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 14 Dec 2023 19:37:10 +0100 Message-ID: Subject: Re: [PATCH RFC v3 01/21] ACPI: Only enumerate enabled (or functional) devices To: "Russell King (Oracle)" Cc: "Rafael J. Wysocki" , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 10:37:29 -0800 (PST) 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: > > > > On Thu, Dec 14, 2023 at 06:47:00PM +0100, Rafael J. Wysocki wrote: > > > On Thu, Dec 14, 2023 at 6:32 PM Jonathan Cameron > > > wrote: > > > > > > > > On Wed, 13 Dec 2023 12:49:16 +0000 > > > > Russell King (Oracle) wrote: > > > > > > > > > From: James Morse > > > > > > > > > > Today the ACPI enumeration code 'visits' all devices that are present. > > > > > > > > > > This is a problem for arm64, where CPUs are always present, but not > > > > > always enabled. When a device-check occurs because the firmware-policy > > > > > has changed and a CPU is now enabled, the following error occurs: > > > > > | acpi ACPI0007:48: Enumeration failure > > > > > > > > > > This is ultimately because acpi_dev_ready_for_enumeration() returns > > > > > true for a device that is not enabled. The ACPI Processor driver > > > > > will not register such CPUs as they are not 'decoding their resources'. > > > > > > > > > > Change acpi_dev_ready_for_enumeration() to also check the enabled bit. > > > > > ACPI allows a device to be functional instead of maintaining the > > > > > present and enabled bit. Make this behaviour an explicit check with > > > > > a reference to the spec, and then check the present and enabled bits. > > > > > This is needed to avoid enumerating present && functional devices that > > > > > are not enabled. > > > > > > > > > > Signed-off-by: James Morse > > > > > Tested-by: Miguel Luis > > > > > Tested-by: Vishnu Pajjuri > > > > > Tested-by: Jianyong Wu > > > > > Signed-off-by: Russell King (Oracle) > > > > > --- > > > > > If this change causes problems on deployed hardware, I suggest an > > > > > arch opt-in: ACPI_IGNORE_STA_ENABLED, that causes > > > > > acpi_dev_ready_for_enumeration() to only check the present bit. > > > > > > > > My gut feeling (having made ACPI 'fixes' in the past that ran into > > > > horribly broken firmware and had to be reverted) is reduce the blast > > > > radius preemptively from the start. I'd love to live in a world were > > > > that wasn't necessary but I don't trust all the generators of ACPI tables. > > > > I'll leave it to Rafael and other ACPI experts suggest how narrow we should > > > > make it though - arch opt in might be narrow enough. > > > > > > A chicken bit wouldn't help much IMO, especially in the cases when > > > working setups get broken. > > > > > > I would very much prefer to limit the scope of it, say to processors > > > only, in the first place. > > > > Thanks for the feedback and the idea. > > > > 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.