From: Damien Le Moal <damien.lemoal@wdc.com> To: Palmer Dabbelt <palmer@dabbelt.com>, linux-riscv@lists.infradead.org, Rob Herring <robh+dt@kernel.org>, devicetree@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>, linux-clk@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>, linux-gpio@vger.kernel.org, Philipp Zabel <p.zabel@pengutronix.de> Cc: Sean Anderson <seanga2@gmail.com> Subject: [PATCH v5 03/21] riscv: Enable interrupts during syscalls with M-Mode Date: Tue, 8 Dec 2020 16:33:37 +0900 [thread overview] Message-ID: <20201208073355.40828-4-damien.lemoal@wdc.com> (raw) In-Reply-To: <20201208073355.40828-1-damien.lemoal@wdc.com> 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 <damien.lemoal@wdc.com> --- 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 524d918f3601..080eb8d78589 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.28.0
WARNING: multiple messages have this Message-ID (diff)
From: Damien Le Moal <damien.lemoal@wdc.com> To: Palmer Dabbelt <palmer@dabbelt.com>, linux-riscv@lists.infradead.org, Rob Herring <robh+dt@kernel.org>, devicetree@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>, linux-clk@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>, linux-gpio@vger.kernel.org, Philipp Zabel <p.zabel@pengutronix.de> Cc: Sean Anderson <seanga2@gmail.com> Subject: [PATCH v5 03/21] riscv: Enable interrupts during syscalls with M-Mode Date: Tue, 8 Dec 2020 16:33:37 +0900 [thread overview] Message-ID: <20201208073355.40828-4-damien.lemoal@wdc.com> (raw) In-Reply-To: <20201208073355.40828-1-damien.lemoal@wdc.com> 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 <damien.lemoal@wdc.com> --- 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 524d918f3601..080eb8d78589 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.28.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2020-12-08 7:36 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-08 7:33 [PATCH v5 00/21] RISC-V Kendryte K210 support improvements Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 01/21] riscv: Fix kernel time_init() Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 02/21] riscv: Fix sifive serial driver Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal [this message] 2020-12-08 7:33 ` [PATCH v5 03/21] riscv: Enable interrupts during syscalls with M-Mode Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 04/21] riscv: Fix builtin DTB handling Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 05/21] riscv: Use vendor name for K210 SoC support Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 06/21] dt-bindings: Add Canaan vendor prefix Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 07/21] dt-binding: clock: Document canaan,k210-clk bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 07/21] dt-binding: clock: Document canaan, k210-clk bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 08/21] dt-bindings: reset: Document canaan,k210-rst bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 08/21] dt-bindings: reset: Document canaan, k210-rst bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 09/21] dt-bindings: pinctrl: Document canaan,k210-fpioa bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 09/21] dt-bindings: pinctrl: Document canaan, k210-fpioa bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 10/21] dt-binding: mfd: Document canaan,k210-sysctl bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 10/21] dt-binding: mfd: Document canaan, k210-sysctl bindings Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 11/21] riscv: Add Canaan Kendryte K210 clock driver Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 12/21] riscv: Add Canaan Kendryte K210 reset controller Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 11:44 ` Philipp Zabel 2020-12-08 11:44 ` Philipp Zabel 2020-12-09 5:26 ` Damien Le Moal 2020-12-09 5:26 ` Damien Le Moal 2020-12-09 11:29 ` Philipp Zabel 2020-12-09 11:29 ` Philipp Zabel 2020-12-08 7:33 ` [PATCH v5 13/21] riscv: Add Canaan Kendryte K210 FPIOA driver Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 14/21] riscv: Update Canaan Kendryte K210 device tree Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 15/21] riscv: Add SiPeed MAIX BiT board " Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 16/21] riscv: Add SiPeed MAIX DOCK " Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 17/21] riscv: Add SiPeed MAIX GO " Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 18/21] riscv: Add SiPeed MAIXDUINO " Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 19/21] riscv: Add Kendryte KD233 " Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 20/21] riscv: Update Canaan Kendryte K210 defconfig Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal 2020-12-08 7:33 ` [PATCH v5 21/21] riscv: Add Canaan Kendryte K210 SD card defconfig Damien Le Moal 2020-12-08 7:33 ` Damien Le Moal
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201208073355.40828-4-damien.lemoal@wdc.com \ --to=damien.lemoal@wdc.com \ --cc=devicetree@vger.kernel.org \ --cc=linus.walleij@linaro.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=p.zabel@pengutronix.de \ --cc=palmer@dabbelt.com \ --cc=robh+dt@kernel.org \ --cc=sboyd@kernel.org \ --cc=seanga2@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.