Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3361726rdb; Wed, 13 Sep 2023 09:40:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCdBJ+cOqsGo7lHo1Xzi93nP0d4DW6jX95dTIzxH6LwgKhNunoTmSRVHptNovJcMhvLDIO X-Received: by 2002:a54:450a:0:b0:3a7:2693:3293 with SMTP id l10-20020a54450a000000b003a726933293mr3191662oil.16.1694623255933; Wed, 13 Sep 2023 09:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694623255; cv=none; d=google.com; s=arc-20160816; b=VI4GUr5IrWfpEgBZDxW2JihYf2Jwr32OgdI2W3x2ROFLhXqMLcnE+JL/MsnAUsAW8L TugImt7AQew4v+HcqI2IDrE6RZ9DZcv2X64W/bJC+sGB4MaJUO4M4tjsvIdwEqqSgubu sBPXagSng36G+ZRNAVgUQBGXkhVqiZplYr93JhUwbGqfLV86D+bYtcmVaX0qYkTZIjl8 pUrH1M2Cpi04GFDqG8aGbYo/6HUYP6zzbTTmGwSOgDP1wkny9d0L1UqD6WJzUq6EcyHf +thbyFBDFvNUIT+5optQABLeOPx5TzF5gvoylLWJ1/PatLJlsvcbUWrcC2kAXXwZE8NZ SoBQ== 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=1ctR8ZCNNr7f0XTIyigb3hM1NYAwEJ1wpNQUZMMRwAM=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=lph6zVFpI4VXVyaiNh1/V8oD8sSWBfJ+TPxpcHx9xQxXKkHlVGe5qmYPmuakFez+Dz 9jf4I6pMYT1QD5evGxR+l8Ys49PPmV6MtemQWzvWFDETSOq5kheY4ZHJeDSUeRlzHrKY zifranKC0KWGF64gwcJOTaJEmD1whd3yXX0uxA4hJMqinZf0RRS8hAwnMjMVc7bDvzpU 5TdjACX8I1hwDhzNo/NRCoz261Aff8stmBTaHL68HSPfXgHesFkKWkUbh+Y6ikmVbq0E TpKsE1RQ8CjjMpiOwBEZ7Bl4uNRurRWf4O+YN0B1aGh0bMgz6TO+EbRR1nZcj/quZBIi 9KQw== 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:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x189-20020a6386c6000000b005646700b191si9905537pgd.371.2023.09.13.09.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:40:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8499881EB0F6; Wed, 13 Sep 2023 09:40:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbjIMQks (ORCPT + 99 others); Wed, 13 Sep 2023 12:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231245AbjIMQj5 (ORCPT ); Wed, 13 Sep 2023 12:39:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5CBC51BD6; Wed, 13 Sep 2023 09:39:33 -0700 (PDT) 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 5BBDB1FB; Wed, 13 Sep 2023 09:40:10 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 57FDF3F5A1; Wed, 13 Sep 2023 09:39:31 -0700 (PDT) From: James Morse 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 Cc: x86@kernel.org, Salil Mehta , Russell King , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com Subject: [RFC PATCH v2 20/35] ACPI: Rename acpi_processor_hotadd_init and remove pre-processor guards Date: Wed, 13 Sep 2023 16:38:08 +0000 Message-Id: <20230913163823.7880-21-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230913163823.7880-1-james.morse@arm.com> References: <20230913163823.7880-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:40:52 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 75257fae10e7..22a15a614f95 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -182,13 +182,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; @@ -222,12 +224,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 651dd43976a9..b7ab85857bb7 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -316,12 +316,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.39.2