diff mbox series

[08/17] riscv: improve the default power off implementation

Message ID 20190624054311.30256-9-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/17] mm: provide a print_vma_addr stub for !CONFIG_MMU | expand

Commit Message

Christoph Hellwig June 24, 2019, 5:43 a.m. UTC
Only call the SBI code if we are not running in M mode, and if we didn't
do the SBI call, or it didn't succeed call wfi in a loop to at least
save some power.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/kernel/reset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Atish Patra July 1, 2019, 9:07 p.m. UTC | #1
On Mon, 2019-06-24 at 07:43 +0200, Christoph Hellwig wrote:
> Only call the SBI code if we are not running in M mode, and if we
> didn't
> do the SBI call, or it didn't succeed call wfi in a loop to at least
> save some power.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/riscv/kernel/reset.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c
> index d0fe623bfb8f..2f5ca379747e 100644
> --- a/arch/riscv/kernel/reset.c
> +++ b/arch/riscv/kernel/reset.c
> @@ -8,8 +8,11 @@
>  
>  static void default_power_off(void)
>  {
> +#ifndef CONFIG_M_MODE
>  	sbi_shutdown();
> -	while (1);
> +#endif
> +	while (1)
> +		wait_for_interrupt();
>  }
>  
>  void (*pm_power_off)(void) = default_power_off;

Reviewed-by: Atish Patra <atish.patra@wdc.com>

Regards,
Atish
diff mbox series

Patch

diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c
index d0fe623bfb8f..2f5ca379747e 100644
--- a/arch/riscv/kernel/reset.c
+++ b/arch/riscv/kernel/reset.c
@@ -8,8 +8,11 @@ 
 
 static void default_power_off(void)
 {
+#ifndef CONFIG_M_MODE
 	sbi_shutdown();
-	while (1);
+#endif
+	while (1)
+		wait_for_interrupt();
 }
 
 void (*pm_power_off)(void) = default_power_off;