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

From: Paul Walmsley
Date: Thu Oct 31 2019 - 16:49:53 EST


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@xxxxxx>
> Reviewed-by: Anup Patel <anup@xxxxxxxxxxxxxx>
> Reviewed-by: Atish Patra <atish.patra@xxxxxxx>

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@xxxxxx>
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@xxxxxx>
Reviewed-by: Anup Patel <anup@xxxxxxxxxxxxxx>
Reviewed-by: Atish Patra <atish.patra@xxxxxxx>
[paul.walmsley@xxxxxxxxxx: split the WFI improvement apart from the
nommu-related default_power_off() changes; wrote commit summary]
Signed-off-by: Paul Walmsley <paul.walmsley@xxxxxxxxxx>
---
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