Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3369841rdb; Wed, 13 Sep 2023 09:55:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFE/IeD13xEtsKEn7EzU6/Ot5ORWafPAWkk3xB5e0tv1L/xwGC1jPPQ00rbI5IUQge5g8/F X-Received: by 2002:a05:6a20:9188:b0:149:7944:a97c with SMTP id v8-20020a056a20918800b001497944a97cmr3399072pzd.53.1694624141621; Wed, 13 Sep 2023 09:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694624141; cv=none; d=google.com; s=arc-20160816; b=tAp2iDH5mWB/DaCNIk81SvBXuc13HTYpldR3EgNM9hniZ9+8pJc9mXS7KUrRDHXQpl 00Si8H0suRysV0VJYu0gnfTDKv9Fp5YwTp/o1+7yGxX6kEdpfsApQfI039WGYx1WW/t1 CDspuq6ztEm99GlKBnq/2Z8OHaMLboCgJrEwTwIshbysb2dkVP43+MLYXrsxhzuLnkBX iluz575MxEIhfK+VWwC9obnyvonRh3ckMXwB0tQmYjfKJGWycEQxr5aktFT2+KqyLr4a 1dpyeYpHkctrI+31CEqYwnbjLcWtYghuAjp1/rYc8+finDJ6tiGb04oHYGfxvkB07Qki 0u4A== 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=VW5WlltlR8foCn+pFQMJn3CWM7LLlXzRjzye3rcEDXo=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=fMKHbRzDlYAE5RpZSlcdlegBVOw3ev5CD4SEH9CBwJ6+HnUDRBBS0p1QFdhXWT/6VS Loy9Tt8gicbYs8rjz6s7ZzFV0SHBuP4a4LPOZFJov55HL86R3I3D/BwmrFeuhfz3nL9A XorBwvA1cD8MsW9YwIiuEFbVeHwdokotMcqNx5fna/QVCYbXSxKTynlvzOsxgmT8tTUD d2xcBZOuOHEVxPteIr1Jo1jO+cAaFmzn0poV5zHtET6jpMKiOxjiXrFZoHoDH7rUq2ia jV6nW5J6zmhMPnIJzbIYvKrM9SaCxT5mLB2RxXc62Fh3ae571gIGvgy4ZLV5HlSVKPaR 1mIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id cv5-20020a056a0044c500b0068a54cfcd74si10021628pfb.192.2023.09.13.09.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id BA4F680C7728; Wed, 13 Sep 2023 09:39:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbjIMQjv (ORCPT + 99 others); Wed, 13 Sep 2023 12:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbjIMQj3 (ORCPT ); Wed, 13 Sep 2023 12:39:29 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E66D1FCC; Wed, 13 Sep 2023 09:39:13 -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 3E2731FB; Wed, 13 Sep 2023 09:39:50 -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 436ED3F5A1; Wed, 13 Sep 2023 09:39:11 -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 10/35] riscv: Switch over to GENERIC_CPU_DEVICES Date: Wed, 13 Sep 2023 16:37:58 +0000 Message-Id: <20230913163823.7880-11-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 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:39:51 -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 lipwig.vger.email Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be overridden by the arch code, switch over to this to allow common code to choose when the register_cpu() call is made. This allows topology_init() to be removed. This is an intermediate step to the logic being moved to drivers/acpi, where GENERIC_CPU_DEVICES will do the work when booting with acpi=off. Signed-off-by: James Morse --- arch/riscv/Kconfig | 1 + arch/riscv/kernel/setup.c | 19 ++++--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index d607ab0f7c6d..eeb80fb55acc 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -69,6 +69,7 @@ config RISCV select GENERIC_ARCH_TOPOLOGY select GENERIC_ATOMIC64 if !64BIT select GENERIC_CLOCKEVENTS_BROADCAST if SMP + select GENERIC_CPU_DEVICES select GENERIC_EARLY_IOREMAP select GENERIC_ENTRY select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index e600aab116a4..f5bd6b8d0c52 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -62,7 +62,6 @@ atomic_t hart_lottery __section(".sdata") #endif ; unsigned long boot_cpu_hartid; -static DEFINE_PER_CPU(struct cpu, cpu_devices); /* * Place kernel memory regions on the resource tree so that @@ -320,23 +319,13 @@ void __init setup_arch(char **cmdline_p) riscv_set_dma_cache_alignment(); } -static int __init topology_init(void) +int arch_register_cpu(int cpu) { - int i, ret; + struct cpu *c = &per_cpu(cpu_devices, cpu); - for_each_possible_cpu(i) { - struct cpu *cpu = &per_cpu(cpu_devices, i); - - cpu->hotpluggable = cpu_has_hotplug(i); - ret = register_cpu(cpu, i); - if (unlikely(ret)) - pr_warn("Warning: %s: register_cpu %d failed (%d)\n", - __func__, i, ret); - } - - return 0; + c->hotpluggable = cpu_has_hotplug(cpu); + return register_cpu(c, cpu); } -subsys_initcall(topology_init); void free_initmem(void) { -- 2.39.2