Skip to content

Commit 6abf32f

Browse files
avpatelpalmer-dabbelt
authored andcommitted
cpuidle: Add RISC-V SBI CPU idle driver
The RISC-V SBI HSM extension provides HSM suspend call which can be used by Linux RISC-V to enter platform specific low-power state. This patch adds a CPU idle driver based on RISC-V SBI calls which will populate idle states from device tree and use SBI calls to entry these idle states. Signed-off-by: Anup Patel <anup.patel@wdc.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com> Acked-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 9d976d6 commit 6abf32f

5 files changed

Lines changed: 658 additions & 0 deletions

File tree

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5058,6 +5058,13 @@ S: Supported
50585058
F: drivers/cpuidle/dt_idle_genpd.c
50595059
F: drivers/cpuidle/dt_idle_genpd.h
50605060

5061+
CPUIDLE DRIVER - RISC-V SBI
5062+
M: Anup Patel <anup@brainfault.org>
5063+
L: linux-pm@vger.kernel.org
5064+
L: linux-riscv@lists.infradead.org
5065+
S: Maintained
5066+
F: drivers/cpuidle/cpuidle-riscv-sbi.c
5067+
50615068
CRAMFS FILESYSTEM
50625069
M: Nicolas Pitre <nico@fluxnic.net>
50635070
S: Maintained

drivers/cpuidle/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ depends on PPC
6666
source "drivers/cpuidle/Kconfig.powerpc"
6767
endmenu
6868

69+
menu "RISC-V CPU Idle Drivers"
70+
depends on RISCV
71+
source "drivers/cpuidle/Kconfig.riscv"
72+
endmenu
73+
6974
config HALTPOLL_CPUIDLE
7075
tristate "Halt poll cpuidle driver"
7176
depends on X86 && KVM_GUEST

drivers/cpuidle/Kconfig.riscv

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# RISC-V CPU Idle drivers
4+
#
5+
6+
config RISCV_SBI_CPUIDLE
7+
bool "RISC-V SBI CPU idle Driver"
8+
depends on RISCV_SBI
9+
select DT_IDLE_STATES
10+
select CPU_IDLE_MULTIPLE_DRIVERS
11+
select DT_IDLE_GENPD if PM_GENERIC_DOMAINS_OF
12+
help
13+
Select this option to enable RISC-V SBI firmware based CPU idle
14+
driver for RISC-V systems. This drivers also supports hierarchical
15+
DT based layout of the idle state.

drivers/cpuidle/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ obj-$(CONFIG_MIPS_CPS_CPUIDLE) += cpuidle-cps.o
3535
# POWERPC drivers
3636
obj-$(CONFIG_PSERIES_CPUIDLE) += cpuidle-pseries.o
3737
obj-$(CONFIG_POWERNV_CPUIDLE) += cpuidle-powernv.o
38+
39+
###############################################################################
40+
# RISC-V drivers
41+
obj-$(CONFIG_RISCV_SBI_CPUIDLE) += cpuidle-riscv-sbi.o

0 commit comments

Comments
 (0)