migration: replace qemu_stdio_fd with qemu_get_fd
[qemu/opensuse.git] / target-ppc / kvm_ppc.h
blobbaad6eb75ba0a1ea0e3f27995b4627fd19a36dd1
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 int kvmppc_reset_htab(int shift_hint);
31 uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
32 #endif /* !CONFIG_USER_ONLY */
33 const ppc_def_t *kvmppc_host_cpu_def(void);
34 int kvmppc_fixup_cpu(CPUPPCState *env);
36 #else
38 static inline uint32_t kvmppc_get_tbfreq(void)
40 return 0;
43 static inline uint64_t kvmppc_get_clockfreq(void)
45 return 0;
48 static inline uint32_t kvmppc_get_vmx(void)
50 return 0;
53 static inline uint32_t kvmppc_get_dfp(void)
55 return 0;
58 static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
60 return -1;
63 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
65 return -1;
68 static inline int kvmppc_set_interrupt(CPUPPCState *env, int irq, int level)
70 return -1;
73 static inline void kvmppc_set_papr(CPUPPCState *env)
77 static inline int kvmppc_smt_threads(void)
79 return 1;
82 #ifndef CONFIG_USER_ONLY
83 static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
85 return 0;
88 static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
89 uint32_t window_size, int *fd)
91 return NULL;
94 static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
95 uint32_t window_size)
97 return -1;
100 static inline int kvmppc_reset_htab(int shift_hint)
102 return -1;
105 static inline uint64_t kvmppc_rma_size(uint64_t current_size,
106 unsigned int hash_shift)
108 return ram_size;
111 static inline int kvmppc_update_sdr1(CPUPPCState *env)
113 return 0;
116 #endif /* !CONFIG_USER_ONLY */
118 static inline const ppc_def_t *kvmppc_host_cpu_def(void)
120 return NULL;
123 static inline int kvmppc_fixup_cpu(CPUPPCState *env)
125 return -1;
127 #endif
129 #ifndef CONFIG_KVM
130 #define kvmppc_eieio() do { } while (0)
131 #else
132 #define kvmppc_eieio() \
133 do { \
134 if (kvm_enabled()) { \
135 asm volatile("eieio" : : : "memory"); \
137 } while (0)
138 #endif
140 #ifndef KVM_INTERRUPT_SET
141 #define KVM_INTERRUPT_SET -1
142 #endif
144 #ifndef KVM_INTERRUPT_UNSET
145 #define KVM_INTERRUPT_UNSET -2
146 #endif
148 #ifndef KVM_INTERRUPT_SET_LEVEL
149 #define KVM_INTERRUPT_SET_LEVEL -3
150 #endif
152 #endif /* __KVM_PPC_H__ */