Merge commit 'c9159fe9aa9abe24115ea4d16127179e9cb07e22' into upstream-merge
[qemu-kvm.git] / target-ppc / kvm_ppc.h
blobe2f8703853602c665b78b5b91f07b440852d305d
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 #include "memory.h"
14 void kvmppc_init(void);
16 #ifdef CONFIG_KVM
18 uint32_t kvmppc_get_tbfreq(void);
19 uint64_t kvmppc_get_clockfreq(void);
20 uint32_t kvmppc_get_vmx(void);
21 uint32_t kvmppc_get_dfp(void);
22 int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
23 int kvmppc_set_interrupt(CPUPPCState *env, int irq, int level);
24 void kvmppc_set_papr(CPUPPCState *env);
25 int kvmppc_smt_threads(void);
26 #ifndef CONFIG_USER_ONLY
27 off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
28 void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
29 int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
30 #endif /* !CONFIG_USER_ONLY */
31 const ppc_def_t *kvmppc_host_cpu_def(void);
32 int kvmppc_fixup_cpu(CPUPPCState *env);
34 #else
36 static inline uint32_t kvmppc_get_tbfreq(void)
38 return 0;
41 static inline uint64_t kvmppc_get_clockfreq(void)
43 return 0;
46 static inline uint32_t kvmppc_get_vmx(void)
48 return 0;
51 static inline uint32_t kvmppc_get_dfp(void)
53 return 0;
56 static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
58 return -1;
61 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
63 return -1;
66 static inline int kvmppc_set_interrupt(CPUPPCState *env, int irq, int level)
68 return -1;
71 static inline void kvmppc_set_papr(CPUPPCState *env)
75 static inline int kvmppc_smt_threads(void)
77 return 1;
80 #ifndef CONFIG_USER_ONLY
81 static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
83 return 0;
86 static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
87 uint32_t window_size, int *fd)
89 return NULL;
92 static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
93 uint32_t window_size)
95 return -1;
97 #endif /* !CONFIG_USER_ONLY */
99 static inline const ppc_def_t *kvmppc_host_cpu_def(void)
101 return NULL;
104 static inline int kvmppc_fixup_cpu(CPUPPCState *env)
106 return -1;
108 #endif
110 #ifndef CONFIG_KVM
111 #define kvmppc_eieio() do { } while (0)
112 #else
113 #define kvmppc_eieio() \
114 do { \
115 if (kvm_enabled()) { \
116 asm volatile("eieio" : : : "memory"); \
118 } while (0)
119 #endif
121 #ifndef KVM_INTERRUPT_SET
122 #define KVM_INTERRUPT_SET -1
123 #endif
125 #ifndef KVM_INTERRUPT_UNSET
126 #define KVM_INTERRUPT_UNSET -2
127 #endif
129 #ifndef KVM_INTERRUPT_SET_LEVEL
130 #define KVM_INTERRUPT_SET_LEVEL -3
131 #endif
133 #endif /* __KVM_PPC_H__ */