1 #ifndef _ASM_POWERPC_ASM_PROTOTYPES_H 2 #define _ASM_POWERPC_ASM_PROTOTYPES_H 3 /* 4 * This file is for prototypes of C functions that are only called 5 * from asm, and any associated variables. 6 * 7 * Copyright 2016, Daniel Axtens, IBM Corporation. 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 */ 14 15 #include <linux/threads.h> 16 #include <asm/cacheflush.h> 17 #include <asm/checksum.h> 18 #include <linux/uaccess.h> 19 #include <asm/epapr_hcalls.h> 20 #include <asm/dcr.h> 21 #include <asm/mmu_context.h> 22 23 #include <uapi/asm/ucontext.h> 24 25 /* SMP */ 26 extern struct task_struct *current_set[NR_CPUS]; 27 extern struct task_struct *secondary_current; 28 void start_secondary(void *unused); 29 30 /* kexec */ 31 struct paca_struct; 32 struct kimage; 33 extern struct paca_struct kexec_paca; 34 void kexec_copy_flush(struct kimage *image); 35 36 /* pseries hcall tracing */ 37 extern struct static_key hcall_tracepoint_key; 38 void __trace_hcall_entry(unsigned long opcode, unsigned long *args); 39 void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf); 40 41 /* OPAL */ 42 int64_t __opal_call(int64_t a0, int64_t a1, int64_t a2, int64_t a3, 43 int64_t a4, int64_t a5, int64_t a6, int64_t a7, 44 int64_t opcode, uint64_t msr); 45 46 /* VMX copying */ 47 int enter_vmx_usercopy(void); 48 int exit_vmx_usercopy(void); 49 int enter_vmx_ops(void); 50 void *exit_vmx_ops(void *dest); 51 52 /* Traps */ 53 long machine_check_early(struct pt_regs *regs); 54 long hmi_exception_realmode(struct pt_regs *regs); 55 void SMIException(struct pt_regs *regs); 56 void handle_hmi_exception(struct pt_regs *regs); 57 void instruction_breakpoint_exception(struct pt_regs *regs); 58 void RunModeException(struct pt_regs *regs); 59 void single_step_exception(struct pt_regs *regs); 60 void program_check_exception(struct pt_regs *regs); 61 void alignment_exception(struct pt_regs *regs); 62 void StackOverflow(struct pt_regs *regs); 63 void kernel_fp_unavailable_exception(struct pt_regs *regs); 64 void altivec_unavailable_exception(struct pt_regs *regs); 65 void vsx_unavailable_exception(struct pt_regs *regs); 66 void fp_unavailable_tm(struct pt_regs *regs); 67 void altivec_unavailable_tm(struct pt_regs *regs); 68 void vsx_unavailable_tm(struct pt_regs *regs); 69 void facility_unavailable_exception(struct pt_regs *regs); 70 void TAUException(struct pt_regs *regs); 71 void altivec_assist_exception(struct pt_regs *regs); 72 void unrecoverable_exception(struct pt_regs *regs); 73 void kernel_bad_stack(struct pt_regs *regs); 74 void system_reset_exception(struct pt_regs *regs); 75 void machine_check_exception(struct pt_regs *regs); 76 void emulation_assist_interrupt(struct pt_regs *regs); 77 long do_slb_fault(struct pt_regs *regs, unsigned long ea); 78 void do_bad_slb_fault(struct pt_regs *regs, unsigned long ea, long err); 79 80 /* signals, syscalls and interrupts */ 81 long sys_swapcontext(struct ucontext __user *old_ctx, 82 struct ucontext __user *new_ctx, 83 long ctx_size); 84 #ifdef CONFIG_PPC32 85 long sys_debug_setcontext(struct ucontext __user *ctx, 86 int ndbg, struct sig_dbg_op __user *dbg); 87 int 88 ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp); 89 unsigned long __init early_init(unsigned long dt_ptr); 90 void __init machine_init(u64 dt_ptr); 91 #endif 92 93 long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, 94 u32 len_high, u32 len_low); 95 long sys_switch_endian(void); 96 notrace unsigned int __check_irq_replay(void); 97 void notrace restore_interrupts(void); 98 99 /* ptrace */ 100 long do_syscall_trace_enter(struct pt_regs *regs); 101 void do_syscall_trace_leave(struct pt_regs *regs); 102 103 /* process */ 104 void restore_math(struct pt_regs *regs); 105 void restore_tm_state(struct pt_regs *regs); 106 107 /* prom_init (OpenFirmware) */ 108 unsigned long __init prom_init(unsigned long r3, unsigned long r4, 109 unsigned long pp, 110 unsigned long r6, unsigned long r7, 111 unsigned long kbase); 112 113 /* setup */ 114 void __init early_setup(unsigned long dt_ptr); 115 void early_setup_secondary(void); 116 117 /* time */ 118 void accumulate_stolen_time(void); 119 120 /* misc runtime */ 121 extern u64 __bswapdi2(u64); 122 extern s64 __lshrdi3(s64, int); 123 extern s64 __ashldi3(s64, int); 124 extern s64 __ashrdi3(s64, int); 125 extern int __cmpdi2(s64, s64); 126 extern int __ucmpdi2(u64, u64); 127 128 /* tracing */ 129 void _mcount(void); 130 unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip); 131 132 void pnv_power9_force_smt4_catch(void); 133 void pnv_power9_force_smt4_release(void); 134 135 /* Transaction memory related */ 136 void tm_enable(void); 137 void tm_disable(void); 138 void tm_abort(uint8_t cause); 139 140 struct kvm_vcpu; 141 void _kvmppc_restore_tm_pr(struct kvm_vcpu *vcpu, u64 guest_msr); 142 void _kvmppc_save_tm_pr(struct kvm_vcpu *vcpu, u64 guest_msr); 143 144 /* Patch sites */ 145 extern s32 patch__call_flush_count_cache; 146 extern s32 patch__flush_count_cache_return; 147 extern s32 patch__memset_nocache, patch__memcpy_nocache; 148 149 extern long flush_count_cache; 150 151 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 152 void kvmppc_save_tm_hv(struct kvm_vcpu *vcpu, u64 msr, bool preserve_nv); 153 void kvmppc_restore_tm_hv(struct kvm_vcpu *vcpu, u64 msr, bool preserve_nv); 154 #else 155 static inline void kvmppc_save_tm_hv(struct kvm_vcpu *vcpu, u64 msr, 156 bool preserve_nv) { } 157 static inline void kvmppc_restore_tm_hv(struct kvm_vcpu *vcpu, u64 msr, 158 bool preserve_nv) { } 159 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 160 161 void kvmhv_save_host_pmu(void); 162 void kvmhv_load_host_pmu(void); 163 void kvmhv_save_guest_pmu(struct kvm_vcpu *vcpu, bool pmu_in_use); 164 void kvmhv_load_guest_pmu(struct kvm_vcpu *vcpu); 165 166 int __kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu); 167 168 long kvmppc_h_set_dabr(struct kvm_vcpu *vcpu, unsigned long dabr); 169 long kvmppc_h_set_xdabr(struct kvm_vcpu *vcpu, unsigned long dabr, 170 unsigned long dabrx); 171 172 #endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */ 173