Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5290346rdb; Wed, 13 Dec 2023 04:52:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFN8AoFfhzPo8molCyOwwdDIboPntminRP1b93X2C5hW74LGTA4sgybALFfxh0v3/j4jUWG X-Received: by 2002:a05:6a20:158b:b0:18f:d156:5b16 with SMTP id h11-20020a056a20158b00b0018fd1565b16mr4796567pzj.104.1702471925983; Wed, 13 Dec 2023 04:52:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702471925; cv=none; d=google.com; s=arc-20160816; b=UKnx5IL9AONp24+UhsBDsxKKKBc9nsHYz7hB1kPVKUrIwyrWRc2djzc1syRrVWOrBG M/HrpFDFFZNClrPkvo6VnQkd3U+VoLdq8EI1YPYDeZbrObLCCxHQAKjIQXw0QCTnx0Ou 9/xszn8VfZ0uo+Z7uCV1XAp98BkA3Y6Pnzrr/TMutFilFvoSWWYGOBZX2rS1UWJWZMoG uT4m5nn0z+NVQBirp7pb/oDCmF/sxy/atB14wDCzMAzKPUrrnOmZSJaC5PZeJ92GVqUu lQfvdblRRFIqJd0S/cfS6z8OcZvwKohiCbYrBh3Ug1XxKtYy+RX4tikquPzI7Tc2SKLu QuGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=kQ4xjAWUxEG0ANx7LMdmdHmPUnFC4tC8apeLWjcG8Og=; fh=YWIBRcP8cdLYR894sEToaan3lN1VSUITe+B678IO0WY=; b=WVxC5b8OhQo7fOc52ypUsQjDNMbTuIPwfUNri/8hy+pnQfNhNvEDxNWmXAiVDh4LCZ nka+bc9pUIMkf82tXuAfSdxNvfI9btx3QRoCRg3INBaH9r96Xh/67PQeB92FhpQvp92/ 5ABGFhljhfo9Hevf9F9vCFxouEhLGsYshhQgXRtBEP1BUEYQeEMhRQYbVZxNvKQElz8B fZfpAxBL8J8tVIV/zX7BfTSTiurLetWJx4Ycak7+8YopICYWePfFSCUyxWoIb8M2ZbgU vwz5i++nRxK4bMudL+GLkZ2IknEJYEoa7KeYHafrPvwKELsbg+7t/+xoGVjTuP7jSudE XqLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=X90FTAwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id o12-20020a170902778c00b001d04b4485a7si9431889pll.76.2023.12.13.04.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 04:52:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=X90FTAwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 97DF18217A7B; Wed, 13 Dec 2023 04:51:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378949AbjLMMuB (ORCPT + 99 others); Wed, 13 Dec 2023 07:50:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378944AbjLMMts (ORCPT ); Wed, 13 Dec 2023 07:49:48 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886FD109; Wed, 13 Dec 2023 04:49:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To: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=kQ4xjAWUxEG0ANx7LMdmdHmPUnFC4tC8apeLWjcG8Og=; b=X90FTAwQnBfHmSIKYLsWfRlpia 375dpkt1T6mkAwKyEadpQymyIe0dg3/p2GwJurKcYd8p3XZRGklvmexrzgscGSrA+E2Yv6aoT86MB ijJOedBgttvzTKBfT9eUkiHEXrz2WuPlFfeI4lj+ac0nHIA6yBoKCgnau1V8tzQjrNKo+vgA5IvnG HYzMibJAtMCmVnc6CLNbKTEpSs0Y0S0suWGF9Ss1Gsl3tCiP/+CHBou3NEzC+Zl6kwj+tV2mTQjT5 04I/JuGQif9ZoTv4TXeya3FEre5X/d4oNidSnw0HnoEtJPLc0iw3ZdEBkG4oHPQUXpWCCbPO2kXKc nDBjPYQw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:34582 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rDOgL-0008E5-0Y; Wed, 13 Dec 2023 12:49:45 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rDOgN-00DvkE-D8; Wed, 13 Dec 2023 12:49:47 +0000 In-Reply-To: References: From: Russell King (Oracle) To: 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 Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Subject: [PATCH RFC v3 07/21] ACPI: Rename acpi_processor_hotadd_init and remove pre-processor guards MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Wed, 13 Dec 2023 12:49:47 +0000 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Wed, 13 Dec 2023 04:51:48 -0800 (PST) From: James Morse acpi_processor_hotadd_init() will make a CPU present by mapping it based on its hardware id. 'hotadd_init' is ambiguous once there are two different behaviours for cpu hotplug. This is for toggling the _STA present bit. Subsequent patches will add support for toggling the _STA enabled bit, named acpi_processor_make_enabled(). Rename it acpi_processor_make_present() to make it clear this is for CPUs that were not previously present. Expose the function prototypes it uses to allow the preprocessor guards to be removed. The IS_ENABLED() check will let the compiler dead-code elimination pass remove this if it isn't going to be used. Signed-off-by: James Morse Tested-by: Miguel Luis Tested-by: Vishnu Pajjuri Tested-by: Jianyong Wu --- Outstanding comments: https://lore.kernel.org/r/20230914151720.00007105@Huawei.com https://lore.kernel.org/r/b8f430c1-c30f-191f-18c6-f750fa6ba476@redhat.com For this comment, we use IS_ENABLED() in multiple places in the kernel in this way, and it isn't a problem. --- drivers/acpi/acpi_processor.c | 14 +++++--------- include/linux/acpi.h | 2 -- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index c8e960ff0aca..26e3efb74614 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -183,13 +183,15 @@ static void __init acpi_pcc_cpufreq_init(void) {} #endif /* CONFIG_X86 */ /* Initialization */ -#ifdef CONFIG_ACPI_HOTPLUG_PRESENT_CPU -static int acpi_processor_hotadd_init(struct acpi_processor *pr) +static int acpi_processor_make_present(struct acpi_processor *pr) { unsigned long long sta; acpi_status status; int ret; + if (!IS_ENABLED(CONFIG_ACPI_HOTPLUG_PRESENT_CPU)) + return -ENODEV; + if (invalid_phys_cpuid(pr->phys_id)) return -ENODEV; @@ -223,12 +225,6 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) cpu_maps_update_done(); return ret; } -#else -static inline int acpi_processor_hotadd_init(struct acpi_processor *pr) -{ - return -ENODEV; -} -#endif /* CONFIG_ACPI_HOTPLUG_PRESENT_CPU */ static int acpi_processor_get_info(struct acpi_device *device) { @@ -335,7 +331,7 @@ static int acpi_processor_get_info(struct acpi_device *device) * because cpuid <-> apicid mapping is persistent now. */ if (invalid_logical_cpuid(pr->id) || !cpu_present(pr->id)) { - int ret = acpi_processor_hotadd_init(pr); + int ret = acpi_processor_make_present(pr); if (ret) return ret; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 36071bc11acd..19d009ca9e7a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -301,12 +301,10 @@ static inline int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, } #endif -#ifdef CONFIG_ACPI_HOTPLUG_PRESENT_CPU /* Arch dependent functions for cpu hotplug support */ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, int *pcpu); int acpi_unmap_cpu(int cpu); -#endif /* CONFIG_ACPI_HOTPLUG_PRESENT_CPU */ #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr); -- 2.30.2