]> git.proxmox.com Git - qemu.git/blob - target-ppc/kvm_ppc.h
Merge remote-tracking branch 'bonzini/hw-dirs' into staging
[qemu.git] / target-ppc / kvm_ppc.h
1 /*
2 * Copyright 2008 IBM Corporation.
3 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
4 *
5 * This work is licensed under the GNU GPL license version 2 or later.
6 *
7 */
8
9 #ifndef __KVM_PPC_H__
10 #define __KVM_PPC_H__
11
12 #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
13
14 void kvmppc_init(void);
15
16 #ifdef CONFIG_KVM
17
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);
36
37 #else
38
39 static inline uint32_t kvmppc_get_tbfreq(void)
40 {
41 return 0;
42 }
43
44 static inline uint64_t kvmppc_get_clockfreq(void)
45 {
46 return 0;
47 }
48
49 static inline uint32_t kvmppc_get_vmx(void)
50 {
51 return 0;
52 }
53
54 static inline uint32_t kvmppc_get_dfp(void)
55 {
56 return 0;
57 }
58
59 static inline int kvmppc_get_hasidle(CPUPPCState *env)
60 {
61 return 0;
62 }
63
64 static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
65 {
66 return -1;
67 }
68
69 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
70 {
71 return -1;
72 }
73
74 static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
75 {
76 return -1;
77 }
78
79 static inline void kvmppc_set_papr(PowerPCCPU *cpu)
80 {
81 }
82
83 static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
84 {
85 }
86
87 static inline int kvmppc_smt_threads(void)
88 {
89 return 1;
90 }
91
92 #ifndef CONFIG_USER_ONLY
93 static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
94 {
95 return 0;
96 }
97
98 static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
99 uint32_t window_size, int *fd)
100 {
101 return NULL;
102 }
103
104 static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
105 uint32_t window_size)
106 {
107 return -1;
108 }
109
110 static inline int kvmppc_reset_htab(int shift_hint)
111 {
112 return -1;
113 }
114
115 static inline uint64_t kvmppc_rma_size(uint64_t current_size,
116 unsigned int hash_shift)
117 {
118 return ram_size;
119 }
120
121 static inline int kvmppc_update_sdr1(CPUPPCState *env)
122 {
123 return 0;
124 }
125
126 #endif /* !CONFIG_USER_ONLY */
127
128 static inline int kvmppc_fixup_cpu(PowerPCCPU *cpu)
129 {
130 return -1;
131 }
132 #endif
133
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"); \
141 } \
142 } while (0)
143 #endif
144
145 #ifndef KVM_INTERRUPT_SET
146 #define KVM_INTERRUPT_SET -1
147 #endif
148
149 #ifndef KVM_INTERRUPT_UNSET
150 #define KVM_INTERRUPT_UNSET -2
151 #endif
152
153 #ifndef KVM_INTERRUPT_SET_LEVEL
154 #define KVM_INTERRUPT_SET_LEVEL -3
155 #endif
156
157 #endif /* __KVM_PPC_H__ */