]> git.proxmox.com Git - qemu.git/blob - target-ppc/kvm_ppc.h
mmu-hash*: Add hash pte load/store helpers
[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 #include "exec/memory.h"
13
14 #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
15
16 void kvmppc_init(void);
17
18 #ifdef CONFIG_KVM
19
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);
38
39 #else
40
41 static inline uint32_t kvmppc_get_tbfreq(void)
42 {
43 return 0;
44 }
45
46 static inline uint64_t kvmppc_get_clockfreq(void)
47 {
48 return 0;
49 }
50
51 static inline uint32_t kvmppc_get_vmx(void)
52 {
53 return 0;
54 }
55
56 static inline uint32_t kvmppc_get_dfp(void)
57 {
58 return 0;
59 }
60
61 static inline int kvmppc_get_hasidle(CPUPPCState *env)
62 {
63 return 0;
64 }
65
66 static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
67 {
68 return -1;
69 }
70
71 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
72 {
73 return -1;
74 }
75
76 static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
77 {
78 return -1;
79 }
80
81 static inline void kvmppc_set_papr(PowerPCCPU *cpu)
82 {
83 }
84
85 static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
86 {
87 }
88
89 static inline int kvmppc_smt_threads(void)
90 {
91 return 1;
92 }
93
94 #ifndef CONFIG_USER_ONLY
95 static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
96 {
97 return 0;
98 }
99
100 static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
101 uint32_t window_size, int *fd)
102 {
103 return NULL;
104 }
105
106 static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
107 uint32_t window_size)
108 {
109 return -1;
110 }
111
112 static inline int kvmppc_reset_htab(int shift_hint)
113 {
114 return -1;
115 }
116
117 static inline uint64_t kvmppc_rma_size(uint64_t current_size,
118 unsigned int hash_shift)
119 {
120 return ram_size;
121 }
122
123 static inline int kvmppc_update_sdr1(CPUPPCState *env)
124 {
125 return 0;
126 }
127
128 #endif /* !CONFIG_USER_ONLY */
129
130 static inline int kvmppc_fixup_cpu(PowerPCCPU *cpu)
131 {
132 return -1;
133 }
134 #endif
135
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"); \
143 } \
144 } while (0)
145 #endif
146
147 #ifndef KVM_INTERRUPT_SET
148 #define KVM_INTERRUPT_SET -1
149 #endif
150
151 #ifndef KVM_INTERRUPT_UNSET
152 #define KVM_INTERRUPT_UNSET -2
153 #endif
154
155 #ifndef KVM_INTERRUPT_SET_LEVEL
156 #define KVM_INTERRUPT_SET_LEVEL -3
157 #endif
158
159 #endif /* __KVM_PPC_H__ */