Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1155433pxa; Thu, 13 Aug 2020 01:51:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1PyREmApQQ5VWYUTdYrWs00EpLbQbmu1AQfuDSPKpCnDpB+5SLbxUU7LxA+wj6HVVZqTT X-Received: by 2002:aa7:d948:: with SMTP id l8mr3708977eds.371.1597308715060; Thu, 13 Aug 2020 01:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597308715; cv=none; d=google.com; s=arc-20160816; b=jo7dwuC0akpuoP0c/N1xofV0DqRKKwgswW4kfqNCY4RBhHQERTLd1kO/CS/aYH8qtg IDG30Lxt+teT2MG4O3Lwdf9Dx66McVVLm4Cd+4eNn4zJfyuWz1MAPUMyNJggIzKdPKKZ gf9FsHB5WW4M3n8EUSlET1D3rSeYzQc6Hc1D1tFHrcpKFlaYm3e0vGH+onuh/tO+XSLc fD6ZOaVQSAYFXJ61ztELrPv6L8G9S4VZR18Ph+AfjtZovcQ1vFI5rx372rONp6sX0mF0 UiO3u97r3QwB+NGhfTvyoynXMuyoMthR3DPZ0gI47aPH6OCc9V9ydTBmj8XpWEGxT5Yj uXQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gA5BB/+6xQCvX9+gmlnfVRPEcDMzoMSPM6EjTizB38A=; b=C2kswvWHhUoUlJ9kAPams69HJ9fspDiKG090QmOU2gp2s03IU9vGDsh2yfAT0+OVzY K9eszHjXRToyqMe3QxikjlDpU+oKldYXRPaIz8fVL/Lz2fcKh2ozPs+0hG2ICDZ60aLQ 7caylye3riq8uVSRKd3noJ8mIRFxVLmFRxH1e5Nn/rer37TkiY2SpFasz0MuxUdkMy7z 22islbEUFABfZSVKyrf2R1F1trCNlsCVpkJj4sff+Mwwz8hNtILqLdCG8/FFI2hN/la4 gChU39gNJJmtQ1vm2YFs6gn1m2Fu9yzUZvdMau+qdtXINPkHXa6tVV/0QHKh3D0MwaZ5 vgQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=Ad03R5Sa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si3082517ejg.69.2020.08.13.01.51.32; Thu, 13 Aug 2020 01:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=Ad03R5Sa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbgHMIt6 (ORCPT + 99 others); Thu, 13 Aug 2020 04:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbgHMIt6 (ORCPT ); Thu, 13 Aug 2020 04:49:58 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDA87C061757 for ; Thu, 13 Aug 2020 01:49:57 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id z18so4489519wrm.12 for ; Thu, 13 Aug 2020 01:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gA5BB/+6xQCvX9+gmlnfVRPEcDMzoMSPM6EjTizB38A=; b=Ad03R5Saypn6P9X1Gr8J7GfoCKcFVoej6TsnRSjGxd8U5Rb4uTQzTPkd2xMUsQ4B/4 cGfkleKDShOLTjij8QNOz6l/eTLDiOW7q4MbS9NzEHqQrVMO3jxSN9d2FnZPmTH18HHt PoYaCyaGChM2zHe9Mrt2JYvs18uJTD0vQm3dsVJg2+7lZ2g7DH1XwAf53jE8TJS6OXZ5 mRL7xgMNinPPWL8xTtd7Pu9+Gl4xBZvBp+eZ2HSI9Twh1TtF2EYflORFuhGTi1ucT4LZ jpxhIWNex1+8aKVw/jNtVKafF1ogzF/Yg08k9X7fa0SAS85DxQggL5YeaHvmG0DnwRxj Rmrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gA5BB/+6xQCvX9+gmlnfVRPEcDMzoMSPM6EjTizB38A=; b=i5A1q/uPZ/YS19cZShSg4UmDtdpCoRlE8Y4LiLUmEkqOHqNMKlyQxKckAv+0xGP0fz T/1pYBY9xCAMdnsXR7krQQxdsvWkEjPy9TVtJgivAaOqh98yBtbQITLg3EiX/SIU3NAV vlsERzeLePpUsoySiDflv647oe/9qutR7HlbtDl97utLB2ZhZQKB5h5T+BHZALcrNUzA R5oDZc2zFFftvE2ePQffUTDsOVS1Njekgn01zNbq0yKS9HDvsVYXPUXywnddrQ3C3vNj aCY/LkAEOMFfZPWBA0m03SDBdhhig4Ac2DYjDOFl/CGvOSmAoEEHPDthCyQxtAbjJrn2 duWg== X-Gm-Message-State: AOAM533L3h/VMq0RTX5y/kO5FPFicC9sTFEKbE6gsdzzzN/exefyPmG7 Tpmt25hnua8KP67vOl9ijX9EXl0HsivJqNWOtDhjhw== X-Received: by 2002:adf:f247:: with SMTP id b7mr3217109wrp.128.1597308596480; Thu, 13 Aug 2020 01:49:56 -0700 (PDT) MIME-Version: 1.0 References: <20200813033807.19556-1-qiuwenbo@phytium.com.cn> In-Reply-To: <20200813033807.19556-1-qiuwenbo@phytium.com.cn> From: Anup Patel Date: Thu, 13 Aug 2020 14:19:44 +0530 Message-ID: Subject: Re: [PATCH v2] riscv: Setup exception vector for nommu platform To: Qiu Wenbo Cc: Palmer Dabbelt , Paul Walmsley , linux-riscv , Atish Patra , Albert Ou , Anup Patel , Atish Patra , Greentime Hu , Damien Le Moal , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 13, 2020 at 9:10 AM Qiu Wenbo wrote: > > Exception vector is missing on nommu platform and that is an issue. > This patch is tested in Sipeed Maix Bit Dev Board. > > Fixes: 79b1feba5455 ("RISC-V: Setup exception vector early") > Suggested-by: Anup Patel > Suggested-by: Atish Patra > Signed-off-by: Qiu Wenbo > --- > arch/riscv/kernel/head.S | 25 +++++++++++++++++-------- > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S > index d0c5c316e9bb..0a4e81b8dc79 100644 > --- a/arch/riscv/kernel/head.S > +++ b/arch/riscv/kernel/head.S > @@ -77,16 +77,10 @@ relocate: > csrw CSR_SATP, a0 > .align 2 > 1: > - /* Set trap vector to exception handler */ > - la a0, handle_exception > + /* Set trap vector to spin forever to help debug */ > + la a0, .Lsecondary_park > csrw CSR_TVEC, a0 > > - /* > - * Set sup0 scratch register to 0, indicating to exception vector that > - * we are presently executing in kernel. > - */ > - csrw CSR_SCRATCH, zero > - > /* Reload the global pointer */ > .option push > .option norelax > @@ -144,9 +138,23 @@ secondary_start_common: > la a0, swapper_pg_dir > call relocate > #endif > + call setup_trap_vector > tail smp_callin > #endif /* CONFIG_SMP */ > > +.align 2 > +setup_trap_vector: > + /* Set trap vector to exception handler */ > + la a0, handle_exception > + csrw CSR_TVEC, a0 > + > + /* > + * Set sup0 scratch register to 0, indicating to exception vector that > + * we are presently executing in kernel. > + */ > + csrw CSR_SCRATCH, zero > + ret > + > .Lsecondary_park: > /* We lack SMP support or have too many harts, so park this hart */ > wfi > @@ -240,6 +248,7 @@ clear_bss_done: > call relocate > #endif /* CONFIG_MMU */ > > + call setup_trap_vector > /* Restore C environment */ > la tp, init_task > sw zero, TASK_TI_CPU(tp) > -- > 2.28.0 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup