xref: /openbmc/linux/arch/riscv/include/asm/cpuidle.h (revision f6e64b66)
1*f6e64b66SAnup Patel /* SPDX-License-Identifier: GPL-2.0 */
2*f6e64b66SAnup Patel /*
3*f6e64b66SAnup Patel  * Copyright (C) 2021 Allwinner Ltd
4*f6e64b66SAnup Patel  * Copyright (C) 2021 Western Digital Corporation or its affiliates.
5*f6e64b66SAnup Patel  */
6*f6e64b66SAnup Patel 
7*f6e64b66SAnup Patel #ifndef _ASM_RISCV_CPUIDLE_H
8*f6e64b66SAnup Patel #define _ASM_RISCV_CPUIDLE_H
9*f6e64b66SAnup Patel 
10*f6e64b66SAnup Patel #include <asm/barrier.h>
11*f6e64b66SAnup Patel #include <asm/processor.h>
12*f6e64b66SAnup Patel 
cpu_do_idle(void)13*f6e64b66SAnup Patel static inline void cpu_do_idle(void)
14*f6e64b66SAnup Patel {
15*f6e64b66SAnup Patel 	/*
16*f6e64b66SAnup Patel 	 * Add mb() here to ensure that all
17*f6e64b66SAnup Patel 	 * IO/MEM accesses are completed prior
18*f6e64b66SAnup Patel 	 * to entering WFI.
19*f6e64b66SAnup Patel 	 */
20*f6e64b66SAnup Patel 	mb();
21*f6e64b66SAnup Patel 	wait_for_interrupt();
22*f6e64b66SAnup Patel }
23*f6e64b66SAnup Patel 
24*f6e64b66SAnup Patel #endif
25