Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp747356ybe; Fri, 6 Sep 2019 06:45:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqygUzCI2zKZI83UwH6SzW2d30uW4dF4olR11rogtlzPMK1Y0W6KP/4L+pzZu/DDn5Q/lbXn X-Received: by 2002:a17:902:b691:: with SMTP id c17mr9288334pls.265.1567777540033; Fri, 06 Sep 2019 06:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567777540; cv=none; d=google.com; s=arc-20160816; b=TNFHZY3zS0vFb9xVdsAJfW5YT+9An8KUv6nbCK0+6Aq9iTp9z4r4CV/rvtHjqaBDwK ZWMjdEYRZQzcf+/hFz4SSFymokhs/bmvpT2uraOnerBoQbv/KR4pC81kmuEgNg3KXcwx tSlVUxlpyNpDO5QqVp/fj4lXagXnUkgEYJ/U2+Sfz0ObCyjmOyxS+k/kChYtCnj1+sDl XV7DqEd67k4mPwvZvr3Uij+fVU2LkFWVUmyy1WP9X9m6Ra3mnmDyPDeoQkpaabeKrt4m wU3jSlAsyfPssSWAQZl/zzHbA5n20qsL8Jh7dfY/D83W4GhjoFFdYELawfWEtjOr5pP/ CXeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :feedback-id:message-id:subject:reply-to:cc:from:to:dkim-signature :date; bh=tnjEQHsjLTOwlXpsM+jIBd9kUJcYGN4t3QPxOXWDZXg=; b=01ImIq1OtixHr+pVGMCtzlrVJSo6NNgHpyb+/WF2OrcgSU4Xlq9ZbXWxib28pXPYV/ rsnj/hBRIJ7XCR7w/vo2nTYGB+WlFenqFFzIqgCuIqhbjLxd5aRhG6beGwuTKUz47h03 Q1bAFXQfdsNX6ITpnl9a+zjD9OIt8eXjsrqvtKBNfJxWHvbQgyt6qzSTft+wZ27PtWf0 r6/GfF479whvM1fqW4XilVJLfU1d4Hp+HXOlAQuqIcG69gxGb5ruQycug4JNuOSss2DG 5qF0PWbVgWCYBn65+64LOGN9RC96SumP4823KJnItOiiZ8smZKArYlWpDDxgUejOjZDF 68QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hardenedlinux.org header.s=protonmail header.b=XfrsGKJA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si4747103pjw.59.2019.09.06.06.45.24; Fri, 06 Sep 2019 06:45:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@hardenedlinux.org header.s=protonmail header.b=XfrsGKJA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392470AbfIFG40 (ORCPT + 99 others); Fri, 6 Sep 2019 02:56:26 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:47756 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732161AbfIFG4Z (ORCPT ); Fri, 6 Sep 2019 02:56:25 -0400 Date: Fri, 06 Sep 2019 06:56:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedlinux.org; s=protonmail; t=1567752983; bh=tnjEQHsjLTOwlXpsM+jIBd9kUJcYGN4t3QPxOXWDZXg=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=XfrsGKJAJrPo4xO99677ifuwvEb6/N4sg/bLFpox2BYBgnyajpCyTUP5pNywekQuh fUloulGna6+oMTCTSCvnclVj3heLf04JYo0pVKGDMIsquM6Y53GQv5st+xArh1Qqp4 zMYvDAlY+xu8EjJ2Do84Lb0gHmymoWVNsYM6lRv8= To: "paul.walmsley@sifive.com" , "palmer@sifive.com" , "aou@eecs.berkeley.edu" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" From: Xiang Wang Cc: "citypw@hardenedlinux.org" Reply-To: Xiang Wang Subject: [PATCH] arch/riscv: disable too many harts before pick main boot hart Message-ID: Feedback-ID: BRRa7Rf7LqOlikZR00e5gSr_IsihWq0drDTak4NnawY-ONQTW87vpTHz90bkJTl_rn8r4L6gc-nP1pm37CQtxw==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Fri, 6 Sep 2019 11:56:09 +0800 Subject: [PATCH] arch/riscv: disable too many harts before pick main boot h= art These harts with id greater than or equal to CONFIG_NR_CPUS need to be disa= bled. But pick the main Hart can choose any one. So, before pick the main hart, y= ou need to disable the hart with id greater than or equal to CONFIG_NR_CPUS. Signed-off-by: Xiang Wang --- arch/riscv/kernel/head.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S index 0f1ba17e476f..cfffea38eb17 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -63,6 +63,11 @@ _start_kernel: =09li t0, SR_FS =09csrc sstatus, t0 +#ifdef CONFIG_SMP +=09li t0, CONFIG_NR_CPUS +=09bgeu a0, t0, .Lsecondary_park +#endif + =09/* Pick one hart to run the main boot sequence */ =09la a3, hart_lottery =09li a2, 1 @@ -154,9 +159,6 @@ relocate: .Lsecondary_start: #ifdef CONFIG_SMP -=09li a1, CONFIG_NR_CPUS -=09bgeu a0, a1, .Lsecondary_park - =09/* Set trap vector to spin forever to help debug */ =09la a3, .Lsecondary_park =09csrw CSR_STVEC, a3 -- 2.20.1