spapr: convert to memory API
[qemu.git] / target-ppc / kvm_ppc.h
blobc484e60bcb686873292a104f43497dc43299ca58
1 /*
2 * Copyright 2008 IBM Corporation.
3 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
5 * This work is licensed under the GNU GPL license version 2 or later.
7 */
9 #ifndef __KVM_PPC_H__
10 #define __KVM_PPC_H__
12 void kvmppc_init(void);
14 #ifdef CONFIG_KVM
16 uint32_t kvmppc_get_tbfreq(void);
17 uint64_t kvmppc_get_clockfreq(void);
18 int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len);
19 int kvmppc_set_interrupt(CPUState *env, int irq, int level);
20 void kvmppc_set_papr(CPUState *env);
22 #else
24 static inline uint32_t kvmppc_get_tbfreq(void)
26 return 0;
29 static inline uint64_t kvmppc_get_clockfreq(void)
31 return 0;
34 static inline int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len)
36 return -1;
39 static inline int kvmppc_set_interrupt(CPUState *env, int irq, int level)
41 return -1;
44 static inline void kvmppc_set_papr(CPUState *env)
48 #endif
50 #ifndef CONFIG_KVM
51 #define kvmppc_eieio() do { } while (0)
52 #else
53 #define kvmppc_eieio() \
54 do { \
55 if (kvm_enabled()) { \
56 asm volatile("eieio" : : : "memory"); \
57 } \
58 } while (0)
59 #endif
61 #ifndef KVM_INTERRUPT_SET
62 #define KVM_INTERRUPT_SET -1
63 #endif
65 #ifndef KVM_INTERRUPT_UNSET
66 #define KVM_INTERRUPT_UNSET -2
67 #endif
69 #ifndef KVM_INTERRUPT_SET_LEVEL
70 #define KVM_INTERRUPT_SET_LEVEL -3
71 #endif
73 #endif /* __KVM_PPC_H__ */