Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3367114rdb; Wed, 13 Sep 2023 09:50:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4ARQcLB1Ukdbr70BWcyZ2MXNofyIM0FT7Lcqy15oZHcb9tu1fC8kGQW/D0i41jemMYLkj X-Received: by 2002:a05:6a00:24d4:b0:68e:351b:15b9 with SMTP id d20-20020a056a0024d400b0068e351b15b9mr4443466pfv.4.1694623833391; Wed, 13 Sep 2023 09:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694623833; cv=none; d=google.com; s=arc-20160816; b=Xl0gFLjNk9uBgShGJL+Sd8PW0+86YPDyqTdrh6vltx4fvG0/HVsWTEfC4iVnPf6d1L WAEewiPgn+2O6Yz/4C122vL/5hdsPWDso1VlSzljatpn6FmUkdUFk/CaTvzjhNOGQjWJ KprNqph4UlAN54QEEmhdkLhr4/AgD/dK2t3WvMbcnkMcsoHm4FzOo5eUQTbZCE1DHrdh sieGTkUxx4W8DhvuRlj3tf0KgVGUiV2y9WTUGK55ng0/12s/j6WDb9w+VikW1TxukgWY 7sCeg+KO+6xx7cB2ObZ3mVLUWlS5mQNWjQPRtaxYKyg4AtHch8Ljxfy+f+Fy8VWWGvNI JYuw== 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=jDAEm+yVMTd95B0G9tQuwSGx+8rybFj95oMdwyrSpxA=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=tqLFZOIpUCeumcvHfD66nyDDr1BjvmPSReM/h83jZjO3Lig/uDS0zh+//8o4gEuYkc Io5kiN4ohXnnk7D7wmGjAZfamuzvyHGErlHcCAgW4iFZ6fcZelIbV1HHB8FXJtVFtL29 hSbrndHJlWLmj5saKlmyyBMNyDrzTSRcRndfDGOLTw9rUag9haIe1Ez10CC5I+pRlzI3 tQQXQJOxs0k/bXuV/e2hExUBbpYRCDTnuhuCoafZHc+pbV4zvYLQuJBTlSpNn4wzdL2t n0qDnUkehiqvJqoJARfjeytNLaQR+VGk5x3uFy3uxDY0utmP4e8IIhM6z8GQH6zq454u 8UHQ== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id p16-20020a056a000b5000b0069026fd5a29si55653pfo.19.2023.09.13.09.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:50:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 83AE28021221; Wed, 13 Sep 2023 09:39:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230451AbjIMQjR (ORCPT + 99 others); Wed, 13 Sep 2023 12:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbjIMQjJ (ORCPT ); Wed, 13 Sep 2023 12:39:09 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7A964198B; Wed, 13 Sep 2023 09:39:05 -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 437381FB; Wed, 13 Sep 2023 09:39:42 -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 47F8C3F5A1; Wed, 13 Sep 2023 09:39:03 -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 06/35] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu() Date: Wed, 13 Sep 2023 16:37:54 +0000 Message-Id: <20230913163823.7880-7-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 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:39:21 -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 morse.vger.email To allow ACPI's _STA value to hide CPUs that are present, but not available to online right now due to VMM or firmware policy, the register_cpu() call needs to be made by the ACPI machinery when ACPI is in use. This allows it to hide CPUs that are unavailable from sysfs. Switching to GENERIC_CPU_DEVICES is an intermediate step to allow all five ACPI architectures to be modified at once. Switch over to GENERIC_CPU_DEVICES, and provide an arch_register_cpu() that populates the hotpluggable flag. arch_register_cpu() is also the interface the ACPI machinery expects. The struct cpu in struct cpuinfo_arm64 is never used directly, remove it to use the one GENERIC_CPU_DEVICES provides. This changes the CPUs visible in sysfs from possible to present, but on arm64 smp_prepare_cpus() ensures these are the same. Signed-off-by: James Morse --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/cpu.h | 1 - arch/arm64/kernel/setup.c | 13 ++++--------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b10515c0200b..7b3990abf87a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -132,6 +132,7 @@ config ARM64 select GENERIC_ARCH_TOPOLOGY select GENERIC_CLOCKEVENTS_BROADCAST select GENERIC_CPU_AUTOPROBE + select GENERIC_CPU_DEVICES select GENERIC_CPU_VULNERABILITIES select GENERIC_EARLY_IOREMAP select GENERIC_IDLE_POLL_SETUP diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h index e749838b9c5d..887bd0d992bb 100644 --- a/arch/arm64/include/asm/cpu.h +++ b/arch/arm64/include/asm/cpu.h @@ -38,7 +38,6 @@ struct cpuinfo_32bit { }; struct cpuinfo_arm64 { - struct cpu cpu; struct kobject kobj; u64 reg_ctr; u64 reg_cntfrq; diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 417a8a86b2db..165bd2c0dd5a 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -402,19 +402,14 @@ static inline bool cpu_can_disable(unsigned int cpu) return false; } -static int __init topology_init(void) +int arch_register_cpu(int num) { - int i; + struct cpu *cpu = &per_cpu(cpu_devices, num); - for_each_possible_cpu(i) { - struct cpu *cpu = &per_cpu(cpu_data.cpu, i); - cpu->hotpluggable = cpu_can_disable(i); - register_cpu(cpu, i); - } + cpu->hotpluggable = cpu_can_disable(num); - return 0; + return register_cpu(cpu, num); } -subsys_initcall(topology_init); static void dump_kernel_offset(void) { -- 2.39.2