Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp580569ybe; Wed, 18 Sep 2019 23:55:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIAu9tFQLZar74kA2bJcyHcfCyt9SSaYb8KPXtkk6VfvCpUytURZa+EmsvQMfskb7H4afY X-Received: by 2002:a50:9f42:: with SMTP id b60mr14668731edf.192.1568876127606; Wed, 18 Sep 2019 23:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568876127; cv=none; d=google.com; s=arc-20160816; b=0yq5A3vdWt697tJuxYybkNZtyK2V1ot1fywgxKLEf4d+CezXuqM3u96qgtR6gJCyw8 4/TgU1Jb1MfcbGR4nX4YGOiNuif09G8dAEqqEr0BHJ4us5+PWy+OssfLeiWg4ns+5XEs Uq9BZO8akkNNnFUmb4o/+VbxozCDfuDF91CVtvdvcFCn0/hk4LXd4hKz282vY2b6x6WH /YfumguE15xSs6cbY3v07pcLdO5QQqzxkGytGNLRNFy0kLgpiSBBYUwIRjSAHTRO9zqL pHc0caZ49POgtaUP/nZTHfsAYk3MecX4fmm4Kc/gKuToYrgcXu4wQ/stsMOGuetat3Ov BLLQ== 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:references:in-reply-to:message-id:subject:reply-to:cc :from:to:dkim-signature:date; bh=UGPlxdw/GA0C+GgCymCvb83hIycn10vrVkMuVgnbqls=; b=RdbxZUTPKHxIf2eq8E18ujzicSH4Ivwq+jhFQDrOfUVers/GEG5OyylGHcTFQ3QMwQ nxG4kF7KLoP5AK9ztAB0UPGmxXMUvdQRYwFxKgsmlsMBphijBa1GsS56oa9RtOdAETmP ZFv5+RdmjkLRvoLZBFzmsf1m9gwYkz7JF30CfctYJINYbO7oGkeKdzvr0zJybAlpFE03 2SlOhBXm/B7P1DcFBi7TamrJrNHwBOLb9vsVJgQVEdQU37QeqOPfQt6wdlK0KNfokTsw cRQkGTddhHRWIOpJMnDzxcGl5B0OGVsLNOxzgG5FajbQL5gKENrZv1IlJmf4hipJLMIM /rig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hardenedlinux.org header.s=protonmail header.b=eQupdZtb; 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 r16si4396688edo.307.2019.09.18.23.55.01; Wed, 18 Sep 2019 23:55:27 -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=eQupdZtb; 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 S1731386AbfISDZB (ORCPT + 99 others); Wed, 18 Sep 2019 23:25:01 -0400 Received: from mail1.protonmail.ch ([185.70.40.18]:33052 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728423AbfISDZB (ORCPT ); Wed, 18 Sep 2019 23:25:01 -0400 Date: Thu, 19 Sep 2019 03:24:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedlinux.org; s=protonmail; t=1568863498; bh=UGPlxdw/GA0C+GgCymCvb83hIycn10vrVkMuVgnbqls=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=eQupdZtbt6KaoPyu7zLqHFSOw/5smDSldJpuvRo2+051rY8TyCtLzGQrY7FNutC4e u6xjnBS5v9xDo5d3SbxvElYg5bQa4oeqMV3ohqbhezE/tYTCAgdl+XZN5tuZV8OUNo VZqe/467zvs8aT6lKehkXnyBSJHXO6Ia+aJPv4Pg= To: Palmer Dabbelt From: Xiang Wang Cc: Paul Walmsley , "aou@eecs.berkeley.edu" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "citypw@hardenedlinux.org" Reply-To: Xiang Wang Subject: Re: arch/riscv: disable too many harts before pick main boot hart Message-ID: In-Reply-To: References: 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 =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On 2019=E5=B9=B49=E6=9C=8814=E6=97=A5SaturdayAM3=E7=82=B904=E5=88=86, Palme= r Dabbelt wrote: > On Thu, 05 Sep 2019 23:51:15 PDT (-0700), merle@hardenedlinux.org wrote: > > > From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00 2001 > > From: Xiang Wang merle@hardenedlinux.org > > Date: Fri, 6 Sep 2019 11:56:09 +0800 > > Subject: [PATCH] arch/riscv: disable too many harts before pick main bo= ot hart > > These harts with id greater than or equal to CONFIG_NR_CPUS need to be = disabled. > > But pick the main Hart can choose any one. So, before pick the main har= t, you > > need to disable the hart with id greater than or equal to CONFIG_NR_CPU= S. > > > > Signed-off-by: Xiang Wang merle@hardenedlinux.org > > > > -------------------------------------------------- > > > > 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: > > li t0, SR_FS > > csrc sstatus, t0 > > +#ifdef CONFIG_SMP > > > > - li t0, CONFIG_NR_CPUS > > - bgeu a0, t0, .Lsecondary_park > > +#endif > > > > - > > > > /* Pick one hart to run the main boot sequence */ > > la a3, hart_lottery > > li a2, 1 > > @@ -154,9 +159,6 @@ relocate: > > .Lsecondary_start: > > #ifdef CONFIG_SMP > > > > - li a1, CONFIG_NR_CPUS > > - bgeu a0, a1, .Lsecondary_park > > - > > > > /* Set trap vector to spin forever to help debug */ > > la a3, .Lsecondary_park > > csrw CSR_STVEC, a3 > > It would be better to decouple the hart masks from NR_CPUS, as there's re= ally > no reason for these to be the same. This may be new feature. Need to define new macros such as disabled_hart_ma= sk, this patch is used to fix bug and not add new feature. > > Reviewed-by: Palmer Dabbelt palmer@sifive.com