From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A587CC433E6 for ; Wed, 20 Jan 2021 01:26:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39DE52242A for ; Wed, 20 Jan 2021 01:26:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39DE52242A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DsNt8ZOwmv564X2qEv/MFjgpYnFeF79juM9NW32C+j4=; b=xBYIhDEBTZrwBPs9ku89CBSNH /dkNt3EJMXGLXT5svyc6QJTJHaUOxvOkGPNdw16qErr2u/jT6d/qM3KyQJrj7cu4mR9INxdtdmlUr myrz9kTQNaQaWoGDeRbxYMkzDF74vEgobKI0ntaQVD1T8w6iDRH0nxRrH6tvSHei+GlTYw5IRKMVR hx+0TL6129xL1UbXA4FrYhoPJTSH4e8LzT7xqaJfBFVVeT/nWbC0vycSJrRw23YxBzqo7/IVlKTPG V3x10NkH2ql4A5B5YLGY3mqkdZFTwaOJlfqcOAjXFn0ufjve7XhsUrek7m8YNBr4gHHyTOdk1oMJf kJ2x255Jg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l22GU-0002l2-28; Wed, 20 Jan 2021 01:26:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l22GO-0002j3-9n for linux-riscv@lists.infradead.org; Wed, 20 Jan 2021 01:26:25 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B110623158; Wed, 20 Jan 2021 01:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611105983; bh=YYgKReb4iChjozIJRJvtv/aAfeRqgZZcx5EeBcUYleQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q/NVXEm7WCnNGHaK+1BxCWllrrU8GMrUca9QuKyW9dAycz3J82moqn7brLMNjAXzT tJyXjYaRjJgzo3p2bwPViZfhBFTJOFdUptugst2clybqaYY1p8Qm2Q97gNBliucrxg /3Q7LaTMdbuzo+3AuagxBHn3vbxhIiMRGbgXy02yNMzyhpVm4MTyoUR48JsRTvj3Iv rtSpIGOAYDH5m9Fe0ekPP9LLxBch5UvhrRICLq96uhrjo6BTKId+aofry7AdLE9HUb C4FCfPuCSaC2wDFtLNcbkKhrXTFFG7pK4+XRrHFMMJ9lWMM5edq2ua6lU889lhVwNW ysHR5psxdhTAw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 16/45] riscv: Enable interrupts during syscalls with M-Mode Date: Tue, 19 Jan 2021 20:25:33 -0500 Message-Id: <20210120012602.769683-16-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210120012602.769683-1-sashal@kernel.org> References: <20210120012602.769683-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210119_202624_443796_C0B381FD X-CRM114-Status: UNSURE ( 9.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Damien Le Moal , Palmer Dabbelt , linux-riscv@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Damien Le Moal [ Upstream commit 643437b996bac9267785e0bd528332e2d5811067 ] When running is M-Mode (no MMU config), MPIE does not get set. This results in all syscalls being executed with interrupts disabled as handle_exception never sets SR_IE as it always sees SR_PIE being cleared. Fix this by always force enabling interrupts in handle_syscall when CONFIG_RISCV_M_MODE is enabled. Signed-off-by: Damien Le Moal Reviewed-by: Palmer Dabbelt Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/kernel/entry.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index 524d918f3601b..080eb8d78589d 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S @@ -155,6 +155,15 @@ skip_context_tracking: tail do_trap_unknown handle_syscall: +#ifdef CONFIG_RISCV_M_MODE + /* + * When running is M-Mode (no MMU config), MPIE does not get set. + * As a result, we need to force enable interrupts here because + * handle_exception did not do set SR_IE as it always sees SR_PIE + * being cleared. + */ + csrs CSR_STATUS, SR_IE +#endif #if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING) /* Recover a0 - a7 for system calls */ REG_L a0, PT_A0(sp) -- 2.27.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv