virtio-blk: cleanup: QOM cast
[qemu/agraf.git] / target-ppc / kvm_ppc.h
blobc30b0066744083558fbf4793fb55cc79a164c8d1
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 "exec/memory.h"
14 #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
16 void kvmppc_init(void);
18 #ifdef CONFIG_KVM
20 uint32_t kvmppc_get_tbfreq(void);
21 uint64_t kvmppc_get_clockfreq(void);
22 uint32_t kvmppc_get_vmx(void);
23 uint32_t kvmppc_get_dfp(void);
24 int kvmppc_get_hasidle(CPUPPCState *env);
25 int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
26 int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
27 void kvmppc_set_papr(PowerPCCPU *cpu);
28 void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
29 int kvmppc_smt_threads(void);
30 #ifndef CONFIG_USER_ONLY
31 off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
32 void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
33 int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
34 int kvmppc_reset_htab(int shift_hint);
35 uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
36 #endif /* !CONFIG_USER_ONLY */
37 int kvmppc_fixup_cpu(PowerPCCPU *cpu);
39 #else
41 static inline uint32_t kvmppc_get_tbfreq(void)
43 return 0;
46 static inline uint64_t kvmppc_get_clockfreq(void)
48 return 0;
51 static inline uint32_t kvmppc_get_vmx(void)
53 return 0;
56 static inline uint32_t kvmppc_get_dfp(void)
58 return 0;
61 static inline int kvmppc_get_hasidle(CPUPPCState *env)
63 return 0;
66 static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
68 return -1;
71 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
73 return -1;
76 static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
78 return -1;
81 static inline void kvmppc_set_papr(PowerPCCPU *cpu)
85 static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
89 static inline int kvmppc_smt_threads(void)
91 return 1;
94 #ifndef CONFIG_USER_ONLY
95 static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
97 return 0;
100 static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
101 uint32_t window_size, int *fd)
103 return NULL;
106 static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
107 uint32_t window_size)
109 return -1;
112 static inline int kvmppc_reset_htab(int shift_hint)
114 return -1;
117 static inline uint64_t kvmppc_rma_size(uint64_t current_size,
118 unsigned int hash_shift)
120 return ram_size;
123 static inline int kvmppc_update_sdr1(CPUPPCState *env)
125 return 0;
128 #endif /* !CONFIG_USER_ONLY */
130 static inline int kvmppc_fixup_cpu(PowerPCCPU *cpu)
132 return -1;
134 #endif
136 #ifndef CONFIG_KVM
137 #define kvmppc_eieio() do { } while (0)
138 #else
139 #define kvmppc_eieio() \
140 do { \
141 if (kvm_enabled()) { \
142 asm volatile("eieio" : : : "memory"); \
144 } while (0)
145 #endif
147 #ifndef KVM_INTERRUPT_SET
148 #define KVM_INTERRUPT_SET -1
149 #endif
151 #ifndef KVM_INTERRUPT_UNSET
152 #define KVM_INTERRUPT_UNSET -2
153 #endif
155 #ifndef KVM_INTERRUPT_SET_LEVEL
156 #define KVM_INTERRUPT_SET_LEVEL -3
157 #endif
159 #endif /* __KVM_PPC_H__ */