virtio-scsi: create VirtIOSCSICommon
[qemu.git] / target-ppc / kvm_ppc.h
blob6bcc5cc36ca8c9aab6b07b116bd2b353c386e3b8
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 #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
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_hasidle(CPUPPCState *env);
23 int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
24 int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
25 void kvmppc_set_papr(PowerPCCPU *cpu);
26 void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
27 int kvmppc_smt_threads(void);
28 #ifndef CONFIG_USER_ONLY
29 off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
30 void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
31 int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
32 int kvmppc_reset_htab(int shift_hint);
33 uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
34 #endif /* !CONFIG_USER_ONLY */
35 int kvmppc_fixup_cpu(PowerPCCPU *cpu);
37 #else
39 static inline uint32_t kvmppc_get_tbfreq(void)
41 return 0;
44 static inline uint64_t kvmppc_get_clockfreq(void)
46 return 0;
49 static inline uint32_t kvmppc_get_vmx(void)
51 return 0;
54 static inline uint32_t kvmppc_get_dfp(void)
56 return 0;
59 static inline int kvmppc_get_hasidle(CPUPPCState *env)
61 return 0;
64 static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
66 return -1;
69 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
71 return -1;
74 static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
76 return -1;
79 static inline void kvmppc_set_papr(PowerPCCPU *cpu)
83 static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
87 static inline int kvmppc_smt_threads(void)
89 return 1;
92 #ifndef CONFIG_USER_ONLY
93 static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
95 return 0;
98 static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
99 uint32_t window_size, int *fd)
101 return NULL;
104 static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
105 uint32_t window_size)
107 return -1;
110 static inline int kvmppc_reset_htab(int shift_hint)
112 return -1;
115 static inline uint64_t kvmppc_rma_size(uint64_t current_size,
116 unsigned int hash_shift)
118 return ram_size;
121 static inline int kvmppc_update_sdr1(CPUPPCState *env)
123 return 0;
126 #endif /* !CONFIG_USER_ONLY */
128 static inline int kvmppc_fixup_cpu(PowerPCCPU *cpu)
130 return -1;
132 #endif
134 #ifndef CONFIG_KVM
135 #define kvmppc_eieio() do { } while (0)
136 #else
137 #define kvmppc_eieio() \
138 do { \
139 if (kvm_enabled()) { \
140 asm volatile("eieio" : : : "memory"); \
142 } while (0)
143 #endif
145 #ifndef KVM_INTERRUPT_SET
146 #define KVM_INTERRUPT_SET -1
147 #endif
149 #ifndef KVM_INTERRUPT_UNSET
150 #define KVM_INTERRUPT_UNSET -2
151 #endif
153 #ifndef KVM_INTERRUPT_SET_LEVEL
154 #define KVM_INTERRUPT_SET_LEVEL -3
155 #endif
157 #endif /* __KVM_PPC_H__ */