]> git.proxmox.com Git - qemu.git/blob - target-ppc/kvm_ppc.h
cpu: Move cpu_index field to CPUState
[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 int kvmppc_smt_threads(void);
29 #ifndef CONFIG_USER_ONLY
30 off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
31 void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
32 int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
33 int kvmppc_reset_htab(int shift_hint);
34 uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
35 #endif /* !CONFIG_USER_ONLY */
36 int kvmppc_fixup_cpu(PowerPCCPU *cpu);
37
38 #else
39
40 static inline uint32_t kvmppc_get_tbfreq(void)
41 {
42 return 0;
43 }
44
45 static inline uint64_t kvmppc_get_clockfreq(void)
46 {
47 return 0;
48 }
49
50 static inline uint32_t kvmppc_get_vmx(void)
51 {
52 return 0;
53 }
54
55 static inline uint32_t kvmppc_get_dfp(void)
56 {
57 return 0;
58 }
59
60 static inline int kvmppc_get_hasidle(CPUPPCState *env)
61 {
62 return 0;
63 }
64
65 static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
66 {
67 return -1;
68 }
69
70 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
71 {
72 return -1;
73 }
74
75 static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
76 {
77 return -1;
78 }
79
80 static inline void kvmppc_set_papr(PowerPCCPU *cpu)
81 {
82 }
83
84 static inline int kvmppc_smt_threads(void)
85 {
86 return 1;
87 }
88
89 #ifndef CONFIG_USER_ONLY
90 static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
91 {
92 return 0;
93 }
94
95 static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
96 uint32_t window_size, int *fd)
97 {
98 return NULL;
99 }
100
101 static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
102 uint32_t window_size)
103 {
104 return -1;
105 }
106
107 static inline int kvmppc_reset_htab(int shift_hint)
108 {
109 return -1;
110 }
111
112 static inline uint64_t kvmppc_rma_size(uint64_t current_size,
113 unsigned int hash_shift)
114 {
115 return ram_size;
116 }
117
118 static inline int kvmppc_update_sdr1(CPUPPCState *env)
119 {
120 return 0;
121 }
122
123 #endif /* !CONFIG_USER_ONLY */
124
125 static inline int kvmppc_fixup_cpu(PowerPCCPU *cpu)
126 {
127 return -1;
128 }
129 #endif
130
131 #ifndef CONFIG_KVM
132 #define kvmppc_eieio() do { } while (0)
133 #else
134 #define kvmppc_eieio() \
135 do { \
136 if (kvm_enabled()) { \
137 asm volatile("eieio" : : : "memory"); \
138 } \
139 } while (0)
140 #endif
141
142 #ifndef KVM_INTERRUPT_SET
143 #define KVM_INTERRUPT_SET -1
144 #endif
145
146 #ifndef KVM_INTERRUPT_UNSET
147 #define KVM_INTERRUPT_UNSET -2
148 #endif
149
150 #ifndef KVM_INTERRUPT_SET_LEVEL
151 #define KVM_INTERRUPT_SET_LEVEL -3
152 #endif
153
154 #endif /* __KVM_PPC_H__ */