From patchwork Fri Feb 3 13:50:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 52505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp850569wrn; Fri, 3 Feb 2023 05:57:10 -0800 (PST) X-Google-Smtp-Source: AK7set/AGQP9YFl1h1yHHbBDBBbaEaYZls39FqTojlxcG6Td2VmytcMpcrMuNCV6mOAv3X3kUrau X-Received: by 2002:a17:907:98f9:b0:87b:db62:d659 with SMTP id ke25-20020a17090798f900b0087bdb62d659mr11335544ejc.19.1675432629880; Fri, 03 Feb 2023 05:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675432629; cv=none; d=google.com; s=arc-20160816; b=1EKx4n8LRYZNPLMjUj1J+UbKE9SCTr0jfKJkZ5bK1kBUzOTm1sWHbMnwrMPyNjcdpP UlBjmnbNvT5AZZSF5+PMse8P3Y3daKzTzlLkU4AJCZsvUce/VTgIIOWOzpQmVMju111u ffGY09B3lfgxRg8diw0ZidY7Ux2oLGbY7yAcJQm7jjk30qZaSyoriSjxrFXNRcfYv+eS SCcSqtSEpyik1NIZ8boYOJy9VD8pJq5jeRmKHlilRfGIgCaMkuA3T432g7ia7yvCcVMM UyZWYTSbs0816lxJFIztBgMHsv3J3QBWsl8wfqpvQltgGRr9iYFtkaCEYizT/YJHbemT GORA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=V+BmHj4DF/8UdN0BzfCe1ERC8bZCmINzG2rzcGXbIP0=; b=fNvgNcjY/VBzmaSN3NQ9tVqBNtNhWV485K/jU2IYXRAjBgIDCzhQi17MzSnGOBBOsS CzghrkYWF1DIc9leyWE5qi2Bf7LogEILFDlh4Y6nUcJOvKrkoztyGl98wJc+ekNr3po3 31UkIlvopOeR7esw5KrEK2mpK3T7DU1LqOZw1CS9WOgYXWtDkTnSqeu0Fm0xaeBvPBka DNo2xinHYAvLdEvpsdpmkEk3RvXdTyAn8bwjrAbHF/TdExc3X4vlIiMUwb6Ez1mMulE5 FxFGqIi3LTElIKGPJCiXdqFTYb641w/LgBgnxeWCF4dRjx3h7+KtEll01f0EpIxa0lUa hmsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ep17-20020a1709069b5100b00877a3efe20dsi2555812ejc.257.2023.02.03.05.56.45; Fri, 03 Feb 2023 05:57:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233613AbjBCNz4 (ORCPT + 99 others); Fri, 3 Feb 2023 08:55:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233112AbjBCNzF (ORCPT ); Fri, 3 Feb 2023 08:55:05 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BB73A7EEC; Fri, 3 Feb 2023 05:53:31 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9FBC11650; Fri, 3 Feb 2023 05:53:42 -0800 (PST) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D29A43F71E; Fri, 3 Feb 2023 05:52:56 -0800 (PST) From: James Morse To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Cc: Marc Zyngier , Thomas Gleixner , Lorenzo Pieralisi , Mark Rutland , Sudeep Holla , Borislav Petkov , H Peter Anvin , Dave Hansen , Ingo Molnar , Will Deacon , Catalin Marinas , Huacai Chen , James Morse , Suzuki K Poulose , Oliver Upton , Len Brown , Rafael Wysocki , WANG Xuerui , Salil Mehta , Russell King , Jean-Philippe Brucker Subject: [RFC PATCH 16/32] ACPI: Rename acpi_processor_hotadd_init and remove pre-processor guards Date: Fri, 3 Feb 2023 13:50:27 +0000 Message-Id: <20230203135043.409192-17-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230203135043.409192-1-james.morse@arm.com> References: <20230203135043.409192-1-james.morse@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756818445577293446?= X-GMAIL-MSGID: =?utf-8?q?1756818445577293446?= 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 --- 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 682721594820..6ab55f109417 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -149,13 +149,15 @@ static int acpi_processor_errata(void) } /* 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; @@ -189,12 +191,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) { @@ -287,7 +283,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 0bc1eacd0dfc..a59bca4dbcd5 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -327,12 +327,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);