From patchwork Fri Jun 30 10:59:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Shuai X-Patchwork-Id: 114689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10283607vqr; Fri, 30 Jun 2023 04:28:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEBIiF+uFve5yTsfV3eeszQdOjTroXtzd9H+4E0UkJZHvC8AriS/s5teEmNCtMdSI07EMxc X-Received: by 2002:a17:903:2351:b0:1b8:7616:82d4 with SMTP id c17-20020a170903235100b001b8761682d4mr743002plh.19.1688124482547; Fri, 30 Jun 2023 04:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688124482; cv=none; d=google.com; s=arc-20160816; b=c2aNcEl4k0cjnAtEr2SndR4K0YRLu3mdu5YG7C/NcQs/vs9zwq4PyBrofPUBsEg68d a4cCmlW0Q2hcZvcxV7Of+yeffAJvf6uGgz0d5MWLzRC6uJx3IfNpIJByavGYOWB52zch 2Twsyrw2gGpAQFnbNYHYYZGAwvzgumM7NN3+m7sKzqxXwEa1+dzSW6Ip7/qpSMHJ0Jw4 X6wXcJkqNVyYPK41n3LgnEZUM72JUx26/GSAaViIlSWEuAfY6q9w+ZkLbEUDsoQG8yZD j5DItzdTS70WEfFvWqtQ6acHPmjq5I/ECwGsusogNkTSdmBN9ezrrZF2xNcAtMKPCbeO KSxg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a170902b40300b001b668bb6ac8si11903094plr.447.2023.06.30.04.27.49; Fri, 30 Jun 2023 04:28:02 -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 S232144AbjF3LAz (ORCPT + 99 others); Fri, 30 Jun 2023 07:00:55 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770126817103098724?= X-GMAIL-MSGID: =?utf-8?q?1770126817103098724?= 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) {