1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * Copyright (C) 2012 Freescale Semiconductor, Inc. 4 */ 5 6#include <linux/threads.h> 7#include <asm/epapr_hcalls.h> 8#include <asm/reg.h> 9#include <asm/page.h> 10#include <asm/cputable.h> 11#include <asm/thread_info.h> 12#include <asm/ppc_asm.h> 13#include <asm/asm-compat.h> 14#include <asm/asm-offsets.h> 15#include <asm/export.h> 16 17#ifndef CONFIG_PPC64 18/* epapr_ev_idle() was derived from e500_idle() */ 19_GLOBAL(epapr_ev_idle) 20 PPC_LL r4, TI_LOCAL_FLAGS(r2) /* set napping bit */ 21 ori r4, r4,_TLF_NAPPING /* so when we take an exception */ 22 PPC_STL r4, TI_LOCAL_FLAGS(r2) /* it will return to our caller */ 23 24 wrteei 1 25 26idle_loop: 27 LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE)) 28 29.global epapr_ev_idle_start 30epapr_ev_idle_start: 31 li r3, -1 32 nop 33 nop 34 nop 35 36 /* 37 * Guard against spurious wakeups from a hypervisor -- 38 * only interrupt will cause us to return to LR due to 39 * _TLF_NAPPING. 40 */ 41 b idle_loop 42#endif 43 44/* Hypercall entry point. Will be patched with device tree instructions. */ 45.global epapr_hypercall_start 46epapr_hypercall_start: 47 li r3, -1 48 nop 49 nop 50 nop 51 blr 52EXPORT_SYMBOL(epapr_hypercall_start) 53