Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22181817rwd; Fri, 30 Jun 2023 05:07:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFfnzBikSpuMdTly8Dmhm/K+37fqRTMcKHMGdSTi9a7TiuLXkfgJYkfUNgZmoiP7iLyvaVy X-Received: by 2002:a17:902:c246:b0:1b7:f98d:5567 with SMTP id 6-20020a170902c24600b001b7f98d5567mr1697426plg.68.1688126848104; Fri, 30 Jun 2023 05:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688126848; cv=none; d=google.com; s=arc-20160816; b=QJWmsAjUyA8zoZ7J1J65I7A4KzGW1w7OD161mENSMJrFLUrtJgaQI3OAseBVL/DQlT Z59kWOPwGrWu/DB9fEnvdXi/LwY3QdBeb8sjUpyYxlzGeOfGoRT116tHT5Et8x5MQ3A3 +f4gPF+0yRMdwrHIdSaY905A2X9VxS/r/5FlUwobuX+PEV1WgsBtQvXlIfy4/jt0eoyG tl1hAVQslkc43RmCCZnCwjFLgR+XcLNhMFFk3GB3PRh2HOK/xcn3vBynSrrB7xs9v0/J AY969L01dCV7fEwmJOmEcHSslURnT3PAvea5M1D0JJO1oPwgRWLQx/IrOk2hU3cN8ejp gdMg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=VFrE+nd0LeR05nJ5NVrdpn/ufPx0wKCGgMdooQskSO8=; fh=r4NJ5aRdgpFmbPmuDu+a1GjZ5FRPtfTkHQFeiacollg=; b=VB7TPKrUiZRPX03+6Xe+PqNC5Br+u/IUGIpJqd1Lw42I6KzPFPHkISdUwFwAXI901l 59oBNRZ4z4FVzqJCoDk6DNXlRxp7mXuzp34A8B4DwGZNCgeqaE85ekWO8yHDJ6vMB9ix NHEi46g3DymVw6oqKXPobM8ASOg1Hz/0hCrNZn4dZ0C5ua3NBXJnVENLG3AzK4PbBUgz Ap91WkgcTNqzmllJPap8t8X8lkGC9mVKgjDUHOY/iL7To5n8kMy4zoWstTxHl+rOH3QB 7McWhEnip1Rd9MQXr1UF2P194fhCvtjHkmk+KnkHFkD6SlDpYN012kqWb1SEFeiCPZn7 8rWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=M62+hmz8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o14-20020a170902d4ce00b001a4f005d59dsi9303041plg.389.2023.06.30.05.07.12; Fri, 30 Jun 2023 05:07:28 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=M62+hmz8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232141AbjF3LAy (ORCPT + 99 others); Fri, 30 Jun 2023 07:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232111AbjF3LAt (ORCPT ); Fri, 30 Jun 2023 07:00:49 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD853C21 for ; Fri, 30 Jun 2023 04:00:05 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1b7e66ff65fso13392825ad.0 for ; Fri, 30 Jun 2023 04:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688122786; x=1690714786; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VFrE+nd0LeR05nJ5NVrdpn/ufPx0wKCGgMdooQskSO8=; b=M62+hmz8SSePadjJXz71Q8pq7HqyWXfJKK/UQMiabow3oyGMUgm9ZYsRS94utLkGwI 4Wsx8nROvO2Ib0/xd8v+4KdX2+7yeDpFd5PBrM/dyfF0cPN0HDkK8yPsCFqjHhPnDZXL quDB65UYh0TTv3lJ4aNeRNfp+vCd5lD3o/yRO4Ik/sboKP7QdKchzdOJx4l89gjXSUVU Zha2W5a4WkGTTDf2oN8cpQYk168Nwfu7penKwi8uFSmIj/UPW8riJ3sGbXwYr2R9WVvR EqRiKLhEiPN2d7/DHGt+EG669RXUmp/OKDjXXErwGitM5CIaMYqHPHHdRKUQPAYCDMu9 ZVIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688122786; x=1690714786; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VFrE+nd0LeR05nJ5NVrdpn/ufPx0wKCGgMdooQskSO8=; b=SeXBPSu8iReIMTRH3Aql5f+r66BIHJgBFFIhrejEDdJnZWRGu/UuDhpNT/2LflisFt F/t2BhRlVAEAen7q7ib1VTI1DbFULo16G0UIDx2Cz4KFZZZQhNyujPPvOGvpEhxFUEjC p5cgbchre5jW7nvKStDpk0Fto7njkO5j0cOjIc03Rp/fZT50yzJ916b/4Vorpf8A0eBE pY76DvYzEn8nuwp0vPTqn4M3POym4XZlPe2ZZypY3HO79YZKIxZj/gAGlf380Tvz/Hu8 +LZUm8b+sF5JVvVHocg8Ox4evU2NhN/BqQBnIMtRoDCxdAC6tZw5ykcgDt4I1xMC6P0S +z3w== X-Gm-Message-State: ABy/qLYenYPCvQP4UOlhwqjh8VyTJGjINPckl8M3160RlyMz/oPYvS+m 4Ype1R75xORz1cg70cK7YkQ= X-Received: by 2002:a17:90a:4b:b0:262:df8e:fcb6 with SMTP id 11-20020a17090a004b00b00262df8efcb6mr1998839pjb.43.1688122786288; Fri, 30 Jun 2023 03:59:46 -0700 (PDT) Received: from localhost.localdomain ([2408:843e:c10:118:1a0:d87f:f44e:7fe7]) by smtp.gmail.com with ESMTPSA id q9-20020a17090a68c900b0025bf1ea918asm10435172pjj.55.2023.06.30.03.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 03:59:45 -0700 (PDT) From: Song Shuai To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, ajones@ventanamicro.com, sunilvl@ventanamicro.com, heiko.stuebner@vrull.eu, apatel@ventanamicro.com, suagrfillet@gmail.com, evan@rivosinc.com, greentime.hu@sifive.com, leyfoon.tan@starfivetech.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2] riscv: Add BUG_ON() for no cpu nodes in devicetree Date: Fri, 30 Jun 2023 18:59:38 +0800 Message-Id: <20230630105938.1377262-1-suagrfillet@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 When only the ACPI tables are passed to kernel, the tiny devictree created by EFI Stub doesn't provide cpu nodes. While if append the "acpi=off" to kernel cmdline to disable ACPI for kernel the BUG_ON() in of_parse_and_init_cpus() indicates there's no boot cpu found in the devicetree, not there're no cpu nodes in the devicetree. Add BUG_ON() in the first place of of_parse_and_init_cpus() to make it clear. Signed-off-by: Song Shuai --- Changes since V1: https://lore.kernel.org/linux-riscv/20230629105839.1160895-1-suagrfillet@gmail.com/ - revise the commit-msg and move the BUG_ON into of_parse_and_init_cpus() as Conor suggests --- arch/riscv/kernel/smpboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 6ca2b5309aab..04d33afbdf55 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -147,6 +147,8 @@ static void __init of_parse_and_init_cpus(void) int cpuid = 1; int rc; + BUG_ON(!of_get_next_cpu_node(NULL)); + cpu_set_ops(0); for_each_of_cpu_node(dn) { -- 2.20.1