Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2661179ybl; Sun, 2 Feb 2020 03:52:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyx+3tsr7vf7eJL1d4v9gE/xPKKR1/V47u5jQ3i1hy441TKNyBaHOf2TyvtHf/cgHfDDjcF X-Received: by 2002:a05:6808:30d:: with SMTP id i13mr11205805oie.144.1580644326019; Sun, 02 Feb 2020 03:52:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580644326; cv=none; d=google.com; s=arc-20160816; b=MxVRiK9Ul85tI4b14noDjgPn+vA5xIeBx575/ciekqQk8raufBmeps+smYQkpOtmHT 3O7MmlZ2FTFiF0ERJxWSXuDg9IDoG6fm6EtBUyPcXL4f/S6yKXoB1lYGlVTXxMhWvf4+ Jurwjh9791eXYnlXGxZMQ0NS5Ss2tnPGGeTRy+JsH2EVX3J6KcjHeYE6UW1op2Yc5W1f 6G10/yFeO/3yhXk6NQOGalvqwfAP7FZdMAfbDqvtkWPQ0JScXXDVehqqN1HrknH7n0j/ e9EAuCet56ZtfPAI4XBM+EI4BZBzXACI2lbqpDgfD9LnPBJj626SUw46IB2zOFlQjbuq +u/g== 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=Op0zfe58XdVsuLFDv+kV1nCs9niSTB0gzCPSk7DxSPs=; b=tODJAIyrzxm9v6D20rJMrCw6YZOs9Zk+duQuXkVoR62VPZdoa18CwryIdWwkL9MmSl 6vIb0meAVA2iSbZ1+GJyQWLQREFauaF1V3dE4p2qS7HGpiBH+O1+k2+RYs9Gm+Jp9DVl JLzI4qO0rsKMmR+vpB3wkpdHSgxS74IooxmZwUA4ezPTCMXmaZBAY373k11j+zjDuLUx 98nQTb5efVcajklkCNrR4Fea+hg97lWqJvvYJ1EmBcSPadNgbLtV/oqBwgm6q23ScPOH qdgfy29BiBgbwhoMdl2ctfH3MI79r1/gbctTii3JWVfk2MQAI/pu2OI3nQJ1ch9W0F4o BTVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=UGxus0Uv; 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 q126si7190026oia.8.2020.02.02.03.51.24; Sun, 02 Feb 2020 03:52:06 -0800 (PST) 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=@atishpatra.org header.s=google header.b=UGxus0Uv; 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 S1726541AbgBBLsc (ORCPT + 99 others); Sun, 2 Feb 2020 06:48:32 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:39288 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbgBBLsc (ORCPT ); Sun, 2 Feb 2020 06:48:32 -0500 Received: by mail-wm1-f68.google.com with SMTP id c84so13781488wme.4 for ; Sun, 02 Feb 2020 03:48:30 -0800 (PST) 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=Op0zfe58XdVsuLFDv+kV1nCs9niSTB0gzCPSk7DxSPs=; b=UGxus0UvDEEJ26RDo6DrWOA2vo37glkXXFSFf+GTlBeShN0snPnY61EzyFpFflbcP6 1AgXPK07wWXJXS9BGhu9nzE6uaoHggg4jwSLJczzAxLPO33lbgqV07O3Z0jvovl7o3aG wfZukZU1s67yckW3jLJ8T1HiFu9IWrptgcPvcztYI2DIypbNNs7/Khp19P0WrNiaFJ+i NaK3kdgK6HEBrD0SPfcD98NTFP75FyC/Y2O6ctpqZmqsJZQmYs+BA4mBDxns/msWKpmy CqIsb3Ge7I9O09tHPaJpE6Xy7g4dD7HbrfcfSP+nT7X6J9aOXVcCcyVxatvywF3/UN6N vpHQ== 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=Op0zfe58XdVsuLFDv+kV1nCs9niSTB0gzCPSk7DxSPs=; b=j8qseUjQxcfeaow3OcMPezxS7xjMtkA5NrjOFwBsEJ3dZSKzmM6VtNDUFWV/e453zQ 9yl5W/oEFMdHJ5zVLKHsq0hmr5fmzk9g/4IEslaMFx6Fzqth9VYYHhwxk+/I0mjfCA7a 4pfPVimuV4XRcysGzI8s5v+C8qHtHWB6nf7xVsn2E4BVY4ePXduic1VvWeKzBnVHle4M zHaJa5NXQwRWUSXJVQo/ux9+SI27GsZ2ZfJyzmqo328V8anY95W/TPczZOR1UHTEyZTd fWvacqK3fbRJucfgU4GFZFNnPqi4tojY77CLfOkPR+VEFTe3BYhkkkviqQPXrR3MYKHk 9dFw== X-Gm-Message-State: APjAAAXbEC3gTJIQGkWNBNyBr4mlBQ4YsJfp+28ICEtFxQlmIjXnV7TN WlVzkLRWM60/A6z9tA71kHOU1E8rpcxfgZXaWmIcCXaQ0g2y X-Received: by 2002:a05:600c:2113:: with SMTP id u19mr22862304wml.78.1580644110192; Sun, 02 Feb 2020 03:48:30 -0800 (PST) MIME-Version: 1.0 References: <20200202110202.124048-1-anup.patel@wdc.com> In-Reply-To: <20200202110202.124048-1-anup.patel@wdc.com> From: Atish Patra Date: Sun, 2 Feb 2020 03:48:18 -0800 Message-ID: Subject: Re: [PATCH] RISC-V: Don't enable all interrupts in trap_init() To: Anup Patel Cc: Palmer Dabbelt , Paul Walmsley , Damien Le Moal , Anup Patel , "linux-kernel@vger.kernel.org List" , stable@vger.kernel.org, Atish Patra , Alistair Francis , linux-riscv , Christoph Hellwig 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 Sun, Feb 2, 2020 at 3:06 AM Anup Patel wrote: > > Historically, we have been enabling all interrupts for each > HART in trap_init(). Ideally, we should only enable M-mode > interrupts for M-mode kernel and S-mode interrupts for S-mode > kernel in trap_init(). > > Currently, we get suprious S-mode interrupts on Kendryte K210 > board running M-mode NO-MMU kernel because we are enabling all > interrupts in trap_init(). To fix this, we only enable software > and external interrupt in trap_init(). In future, trap_init() > will only enable software interrupt and PLIC driver will enable > external interrupt using CPU notifiers. > > Cc: stable@vger.kernel.org > Fixes: 76d2a0493a17 ("RISC-V: Init and Halt Code) > Signed-off-by: Anup Patel > --- > arch/riscv/kernel/traps.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c > index f4cad5163bf2..ffb3d94bf0cc 100644 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -156,6 +156,6 @@ void __init trap_init(void) > csr_write(CSR_SCRATCH, 0); > /* Set the exception vector address */ > csr_write(CSR_TVEC, &handle_exception); > - /* Enable all interrupts */ > - csr_write(CSR_IE, -1); > + /* Enable interrupts */ > + csr_write(CSR_IE, IE_SIE | IE_EIE); > } > -- > 2.17.1 > > Looks good. Reviewed-by: Atish Patra -- Regards, Atish