Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1097545pxa; Wed, 12 Aug 2020 23:47:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybf32rWsvNRt5MfJsTfcELouSUDu4CTAis0T3Vw/V9djxpCX6b/3ko+ErF3JGEl9HPAUto X-Received: by 2002:a17:906:8506:: with SMTP id i6mr3373760ejx.446.1597301279288; Wed, 12 Aug 2020 23:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597301279; cv=none; d=google.com; s=arc-20160816; b=nYEpUqU29XvocmHEv1uncv688WcKh/2KRXKJ/w7F3xg/bogd75FDo7TYG/70By5sMP otgVVXbzcfVeOKGfOc0GejK5vf17v0wHlWiMqFQSBNBbhg5sNMpqyujec1FrO/BLmL6a jh8yjuqdxKeICjc0IMGF0Oqf8Pni/c+okDbq6IR1O7m02yJ7Qar041MuMr2w0MrswFLb UUbu2Ia7WNaeicJ1+PTNRFzJh7uvcDMBkgXFdus6ff1hoSb43WJ08Ws8zZclB96maGu4 DslL+EyYe0VVdX7FYqBLilq6URWAGyckxmw6lZZ18VeJ7a1Ggnj7HopY58LfCd6bz5qi mmSg== 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=15/mwsQoBEuD1UnQg0WuQ5I0KeUnjP+2eB9N9GgL8EQ=; b=sjM93WAFdhGSca8XkufT+RtiAe3CSaWD+vEt3hGS9RR4qgeBCDnxxdXbi2ytne3Q8A SW2avT663l57iYSLnhTAGMXid1Xir2RsegQXX2R7c+C+bPIG8rWd+Wx0B8gNKdy6axl8 NZttLPAlGIMiyB9C2ExeoVEFGP9MwIoBLB1xChVWz6RDLbP3zYt4d8YKwwEHVE7NC9MP GFCXK7ZqJHSvEZ+4z15zvn0PHlLkhyKMy1AWXMp8mo6Wo9jdZoT6N00TD/OtqsGQJm7A NRa8sGF/W+OAA0YqEOXjovYYEfGdBOvZAN/ggA96bBrYyEKZ7fqFxErmtfsyFbF7woX/ cxAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=AkUXHOBK; 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 bd21si2787491edb.117.2020.08.12.23.47.35; Wed, 12 Aug 2020 23:47:59 -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=@atishpatra.org header.s=google header.b=AkUXHOBK; 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 S1726253AbgHMGpX (ORCPT + 99 others); Thu, 13 Aug 2020 02:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbgHMGpW (ORCPT ); Thu, 13 Aug 2020 02:45:22 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81E17C061757 for ; Wed, 12 Aug 2020 23:45:22 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id k8so4056143wma.2 for ; Wed, 12 Aug 2020 23:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=15/mwsQoBEuD1UnQg0WuQ5I0KeUnjP+2eB9N9GgL8EQ=; b=AkUXHOBKHkEJbIl8DXGc+JE/8Q+P3+MPn2+ghNpogZBAlbVu83PZnqRAjk6ld34dpo H398Iy2p5q7orn9oKHCWeBpd07JymChd2v8bDjaQ89t6j+H9MEXoSrG1cqpmTXim7WT8 8Z7GGanzTaBc1OSLTocvV4QR75gsL+txbYnxU= 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=15/mwsQoBEuD1UnQg0WuQ5I0KeUnjP+2eB9N9GgL8EQ=; b=WznuHyPB1bj9xEEpIaJG/2PeSQJXI0XGHC8SWTwbrM+qzDoUt8pQL88jW58tpmol4+ mTTx6T5KbOGcX8a2Wp+2645ILO7PyBXDEYXDtpIGhGAhlZBjD4XDZWkqAIvs+7Qm2+46 wxi9SdclP9EG4To+JeGepABkKjeFkhu+Eu6Ls48UuQa8NY8xUlpJbrz4FhY/+wHQvqnb WAkB3V7PoCaff3jubOoyBzib0zxcf/keu43sEv8OH6RlwNrIH9vY4sMJ36/WpcqYKO4f F7qVKLDjhhIlSZMEzyaPKPGTliLZ2rdS+R2W00V5FjiVpJ9IK4/CZTv+7kLcg8TysqAG NsSQ== X-Gm-Message-State: AOAM530bxh//lHGK06m6R4dj73skEAWHWiI+jV7+St6JDl2nPFAP/7ws Fe5LYlpFXBus8iEI7Zr7DNGzuMhpmGc7hm8w6dsD X-Received: by 2002:a1c:4d12:: with SMTP id o18mr2880135wmh.55.1597301120774; Wed, 12 Aug 2020 23:45:20 -0700 (PDT) MIME-Version: 1.0 References: <20200813033807.19556-1-qiuwenbo@phytium.com.cn> In-Reply-To: From: Atish Patra Date: Wed, 12 Aug 2020 23:45:09 -0700 Message-ID: Subject: Re: [PATCH v2] riscv: Setup exception vector for nommu platform To: Damien Le Moal Cc: Qiu Wenbo , Palmer Dabbelt , Paul Walmsley , "linux-riscv@lists.infradead.org" , Anup Patel , Albert Ou , Anup Patel , Atish Patra , Greentime Hu , "linux-kernel@vger.kernel.org" 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 Wed, Aug 12, 2020 at 10:44 PM Damien Le Moal wrote: > > On 2020/08/13 12:40, 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 > > Please add a cc stable #5.8 tag. Kendryte support is in 5.8 stable. > That won't be necessary as the patch that broke nommu (79b1feba5455) was part of the 1st PR sent towards 5.9-rc1. > > --- > > 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) > > > > > -- > Damien Le Moal > Western Digital Research -- Regards, Atish