Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp718073pxa; Fri, 14 Aug 2020 16:27:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9rqFg2f+ycmcTLDi2mg9JY/mWsdbxpWufBulLn3DCJpFsFzAdsPMIie3aEioQFzD/+DAY X-Received: by 2002:a17:906:248d:: with SMTP id e13mr4543168ejb.169.1597447659948; Fri, 14 Aug 2020 16:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597447659; cv=none; d=google.com; s=arc-20160816; b=tI7Fa4XlflcjuCHIujTjKS7FuaYrFddLEBXQ5Clt3lPms6whsChM9v6dvvl+cEZJNr o19dPDjr8hIEzNf1ddx6m4XMkcVeLZn2/4TEgWSIG9k1Vt9GCDQBFGsL7mOQQq6r863D d42ILeTZo0cQs0+j9nswtXNQ703Dzl5aEjQFdon8E265GJq9ojSkelz7AQCUFd4nZBoO v2HPHEMXv9S7BtbwU2r+7mcEozPhktwAnPXviuAl7jjC8q6G201ylUi6NT0EZe+xErDn 8P6PubOPWXdc8tYwOqsYP5sMU+2lgvykf7DzNJ+7OuWfGT2MRist2RoLvSah+9ZbV5Bh Dc5g== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=hfkleEwSe7pLkB1i+3oiskPIgfmW6z+glQ5do1GkngU=; b=VkhvwFHdIp9BNhxOUpHZzt7ZahmNuKha/xnX5jquOgNMs0QfZ1N2Bdyo155kWNG20M DkL/tnhjSeLG1sVItjwnJAeQawNyDTST211+2Il6lAjHrTD0SqQqP/nBwfhTtpk81mFn OBCuk8ZI/KefbsFN0aO/Wo00LlS5T5+X1PfeadUr5dllFIj8RZjkFhl1F+hHFx6pWbOi rXkVUb2XQPqUIraRWLt8Ok4IDL5XshO1dUSmK1/2b/pzSDsdTONRyoXOPKO2KVZVxucZ GoW324w/FaqHeJSNvtc0lNUvInv2UiYy6/doPqoymitGow3ri2YDR6oml4WedgwtIMwu ez/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=ueoQGnQg; 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 k17si6476012eds.353.2020.08.14.16.27.16; Fri, 14 Aug 2020 16:27:39 -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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=ueoQGnQg; 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 S1728145AbgHNWq6 (ORCPT + 99 others); Fri, 14 Aug 2020 18:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbgHNWq5 (ORCPT ); Fri, 14 Aug 2020 18:46:57 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C540C061385 for ; Fri, 14 Aug 2020 15:46:57 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id y6so4825063plt.3 for ; Fri, 14 Aug 2020 15:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=hfkleEwSe7pLkB1i+3oiskPIgfmW6z+glQ5do1GkngU=; b=ueoQGnQgW5aNBF+q57GgcNTXjdyuwW3K88ga2JaQhzV7mJG76V/u7U1gG63QK7QKSY V+SB8kr0uA9VzGzKQ3mPanX+ObE513VSRBxefsfMR3hsIf20tUPoKWF6SGvVkO7CoRbf rvhYjx3CdRJS2K24smJ1WJRY/6RTXoRcauaf4af9pqbxeGUEPjFaojrI6c1i5cHvxIBJ PHRPhPvJ+IOeua5/oMKIDNehV/d7cHXIMqnXXMvYnBvG5T2fFyi2ao7MVWMhNnyHVyNQ 9XfQPDzaxCBJlLhoO51zSDDDVcYqapC9p4iw3QTd8mrh+JBv/grkt/x5zP+UU4e4cmao 47NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=hfkleEwSe7pLkB1i+3oiskPIgfmW6z+glQ5do1GkngU=; b=a84DV4xsmDyTQIfuV2r/1VSen1gAF5cS9KwWVskUqeEUvrqgQCthWdWXAtakBpwwQd 2hQCw/8HdhKUQTWvmfdEB8pjBEECXN1xcv6B1/gytHaeSnS01EqJpRfnx4aCsF/Mggew 87q5VOMH6VYxz0pNlYQntTmwdwgtSghFzRMtnYS2Mhp1w73+LFKcVlrGuNmB/7xvi6YA Wj9JUc0t17ZdgScy3Raymif3mGrK0OIn4p+1RT1kz6Tzkq8COwPcPrNJYFdYCWKhuHTq dPPV+V9Yvk8RYO05DThhthwyM/BGRt3P1KurPpOkujbigsf6GQpWVqv9t2T++mzX2Ej9 QFLA== X-Gm-Message-State: AOAM532jLzYdXIYEEczVU1Dl9tl2rJwJS9bKeVHwuNkFkNKNj0nGemr2 qIQDeholZdk+1h5kiSWV4Z9bcg== X-Received: by 2002:a17:902:d346:: with SMTP id l6mr3263838plk.77.1597445216938; Fri, 14 Aug 2020 15:46:56 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id g4sm9643218pjh.32.2020.08.14.15.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 15:46:56 -0700 (PDT) Date: Fri, 14 Aug 2020 15:46:56 -0700 (PDT) X-Google-Original-Date: Fri, 14 Aug 2020 15:46:54 PDT (-0700) Subject: Re: [PATCH v2] riscv: Setup exception vector for nommu platform In-Reply-To: CC: qiuwenbo@phytium.com.cn, Paul Walmsley , linux-riscv@lists.infradead.org, atishp@atishpatra.org, aou@eecs.berkeley.edu, Anup Patel , Atish Patra , greentime.hu@sifive.com, Damien Le Moal , linux-kernel@vger.kernel.org From: Palmer Dabbelt To: anup@brainfault.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 13 Aug 2020 01:49:44 PDT (-0700), anup@brainfault.org wrote: > 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 Thanks, this is on fixes.