Re: [PATCH 04/12] riscv: cleanup the default power off implementation

Paul Walmsley
2019-10-31T20:49:53Z

On Mon, 28 Oct 2019, Christoph Hellwig wrote:

> Move the sbi poweroff to a separate function and file that is only
> compiled if CONFIG_SBI is set. Provide a new default fallback
> power off that just sits in a wfi loop to save some power.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Anup Patel <anup@brainfault.org>
> Reviewed-by: Atish Patra <atish.patra@wdc.com>

Thanks, I've split the WFI optimization out into a separate patch (below)
and queued it for v5.5-rc1.

- Paul

From: Christoph Hellwig <hch@lst.de>
Date: Wed, 30 Oct 2019 16:11:47 -0700
Subject: [PATCH] riscv: enter WFI in default_power_off() if SBI does not
shutdown

Provide a new default fallback power off that just sits in a wfi loop
to save some power.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
[paul.walmsley@sifive.com: split the WFI improvement apart from the
nommu-related default_power_off() changes; wrote commit summary]
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
---
arch/riscv/kernel/reset.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c
index aa56bb135ec4..485be426d9b1 100644
--- a/arch/riscv/kernel/reset.c
+++ b/arch/riscv/kernel/reset.c
@@ -10,7 +10,8 @@
static void default_power_off(void)
{
sbi_shutdown();
- while (1);
+ while (1)
+ wait_for_interrupt();
}

void (*pm_power_off)(void) = default_power_off;
--
2.24.0.rc0