Statistics
| Branch: | Revision:

root / target-ppc / kvm_ppc.h @ dc364f4c

History | View | Annotate | Download (4.8 kB)

1 d76d1650 aurel32
/*
2 d76d1650 aurel32
 * Copyright 2008 IBM Corporation.
3 d76d1650 aurel32
 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
4 d76d1650 aurel32
 *
5 d76d1650 aurel32
 * This work is licensed under the GNU GPL license version 2 or later.
6 d76d1650 aurel32
 *
7 d76d1650 aurel32
 */
8 d76d1650 aurel32
9 d76d1650 aurel32
#ifndef __KVM_PPC_H__
10 d76d1650 aurel32
#define __KVM_PPC_H__
11 d76d1650 aurel32
12 2985b86b Andreas Färber
#define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
13 2985b86b Andreas Färber
14 d76d1650 aurel32
void kvmppc_init(void);
15 d76d1650 aurel32
16 921e28db Alexander Graf
#ifdef CONFIG_KVM
17 921e28db Alexander Graf
18 dc333cd6 Alexander Graf
uint32_t kvmppc_get_tbfreq(void);
19 eadaada1 Alexander Graf
uint64_t kvmppc_get_clockfreq(void);
20 6659394f David Gibson
uint32_t kvmppc_get_vmx(void);
21 6659394f David Gibson
uint32_t kvmppc_get_dfp(void);
22 1a61a9ae Stuart Yoder
int kvmppc_get_hasidle(CPUPPCState *env);
23 1328c2bf Andreas Färber
int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
24 1bc22652 Andreas Färber
int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
25 1bc22652 Andreas Färber
void kvmppc_set_papr(PowerPCCPU *cpu);
26 5b95b8b9 Alexander Graf
void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
27 e97c3636 David Gibson
int kvmppc_smt_threads(void);
28 31f2cb8f Bharat Bhushan
int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
29 31f2cb8f Bharat Bhushan
int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
30 31f2cb8f Bharat Bhushan
int kvmppc_set_tcr(PowerPCCPU *cpu);
31 31f2cb8f Bharat Bhushan
int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);
32 98efaf75 David Gibson
#ifndef CONFIG_USER_ONLY
33 354ac20a David Gibson
off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
34 0f5cb298 David Gibson
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
35 0f5cb298 David Gibson
int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
36 7f763a5d David Gibson
int kvmppc_reset_htab(int shift_hint);
37 7f763a5d David Gibson
uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
38 98efaf75 David Gibson
#endif /* !CONFIG_USER_ONLY */
39 55e5c285 Andreas Färber
int kvmppc_fixup_cpu(PowerPCCPU *cpu);
40 3b961124 Stuart Yoder
bool kvmppc_has_cap_epr(void);
41 feaa64c4 David Gibson
int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function);
42 e68cb8b4 Alexey Kardashevskiy
int kvmppc_get_htab_fd(bool write);
43 e68cb8b4 Alexey Kardashevskiy
int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns);
44 e68cb8b4 Alexey Kardashevskiy
int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
45 e68cb8b4 Alexey Kardashevskiy
                           uint16_t n_valid, uint16_t n_invalid);
46 fc87e185 Alexander Graf
47 921e28db Alexander Graf
#else
48 921e28db Alexander Graf
49 921e28db Alexander Graf
static inline uint32_t kvmppc_get_tbfreq(void)
50 921e28db Alexander Graf
{
51 921e28db Alexander Graf
    return 0;
52 921e28db Alexander Graf
}
53 921e28db Alexander Graf
54 921e28db Alexander Graf
static inline uint64_t kvmppc_get_clockfreq(void)
55 921e28db Alexander Graf
{
56 921e28db Alexander Graf
    return 0;
57 921e28db Alexander Graf
}
58 921e28db Alexander Graf
59 6659394f David Gibson
static inline uint32_t kvmppc_get_vmx(void)
60 6659394f David Gibson
{
61 6659394f David Gibson
    return 0;
62 6659394f David Gibson
}
63 6659394f David Gibson
64 6659394f David Gibson
static inline uint32_t kvmppc_get_dfp(void)
65 6659394f David Gibson
{
66 6659394f David Gibson
    return 0;
67 6659394f David Gibson
}
68 6659394f David Gibson
69 1a61a9ae Stuart Yoder
static inline int kvmppc_get_hasidle(CPUPPCState *env)
70 1a61a9ae Stuart Yoder
{
71 1a61a9ae Stuart Yoder
    return 0;
72 1a61a9ae Stuart Yoder
}
73 1a61a9ae Stuart Yoder
74 1328c2bf Andreas Färber
static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
75 921e28db Alexander Graf
{
76 921e28db Alexander Graf
    return -1;
77 921e28db Alexander Graf
}
78 921e28db Alexander Graf
79 4656e1f0 Benjamin Herrenschmidt
static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
80 4656e1f0 Benjamin Herrenschmidt
{
81 4656e1f0 Benjamin Herrenschmidt
    return -1;
82 4656e1f0 Benjamin Herrenschmidt
}
83 4656e1f0 Benjamin Herrenschmidt
84 1bc22652 Andreas Färber
static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
85 921e28db Alexander Graf
{
86 921e28db Alexander Graf
    return -1;
87 921e28db Alexander Graf
}
88 921e28db Alexander Graf
89 1bc22652 Andreas Färber
static inline void kvmppc_set_papr(PowerPCCPU *cpu)
90 f61b4bed Alexander Graf
{
91 f61b4bed Alexander Graf
}
92 f61b4bed Alexander Graf
93 5b95b8b9 Alexander Graf
static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
94 5b95b8b9 Alexander Graf
{
95 5b95b8b9 Alexander Graf
}
96 5b95b8b9 Alexander Graf
97 e97c3636 David Gibson
static inline int kvmppc_smt_threads(void)
98 e97c3636 David Gibson
{
99 e97c3636 David Gibson
    return 1;
100 e97c3636 David Gibson
}
101 e97c3636 David Gibson
102 31f2cb8f Bharat Bhushan
static inline int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
103 31f2cb8f Bharat Bhushan
{
104 31f2cb8f Bharat Bhushan
    return 0;
105 31f2cb8f Bharat Bhushan
}
106 31f2cb8f Bharat Bhushan
107 31f2cb8f Bharat Bhushan
static inline int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
108 31f2cb8f Bharat Bhushan
{
109 31f2cb8f Bharat Bhushan
    return 0;
110 31f2cb8f Bharat Bhushan
}
111 31f2cb8f Bharat Bhushan
112 31f2cb8f Bharat Bhushan
static inline int kvmppc_set_tcr(PowerPCCPU *cpu)
113 31f2cb8f Bharat Bhushan
{
114 31f2cb8f Bharat Bhushan
    return 0;
115 31f2cb8f Bharat Bhushan
}
116 31f2cb8f Bharat Bhushan
117 31f2cb8f Bharat Bhushan
static inline int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu)
118 31f2cb8f Bharat Bhushan
{
119 31f2cb8f Bharat Bhushan
    return -1;
120 31f2cb8f Bharat Bhushan
}
121 31f2cb8f Bharat Bhushan
122 98efaf75 David Gibson
#ifndef CONFIG_USER_ONLY
123 354ac20a David Gibson
static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
124 354ac20a David Gibson
{
125 354ac20a David Gibson
    return 0;
126 354ac20a David Gibson
}
127 354ac20a David Gibson
128 0f5cb298 David Gibson
static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
129 0f5cb298 David Gibson
                                            uint32_t window_size, int *fd)
130 0f5cb298 David Gibson
{
131 0f5cb298 David Gibson
    return NULL;
132 0f5cb298 David Gibson
}
133 0f5cb298 David Gibson
134 0f5cb298 David Gibson
static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
135 0f5cb298 David Gibson
                                          uint32_t window_size)
136 0f5cb298 David Gibson
{
137 0f5cb298 David Gibson
    return -1;
138 0f5cb298 David Gibson
}
139 7f763a5d David Gibson
140 7f763a5d David Gibson
static inline int kvmppc_reset_htab(int shift_hint)
141 7f763a5d David Gibson
{
142 7f763a5d David Gibson
    return -1;
143 7f763a5d David Gibson
}
144 7f763a5d David Gibson
145 7f763a5d David Gibson
static inline uint64_t kvmppc_rma_size(uint64_t current_size,
146 7f763a5d David Gibson
                                       unsigned int hash_shift)
147 7f763a5d David Gibson
{
148 7f763a5d David Gibson
    return ram_size;
149 7f763a5d David Gibson
}
150 7f763a5d David Gibson
151 7f763a5d David Gibson
static inline int kvmppc_update_sdr1(CPUPPCState *env)
152 7f763a5d David Gibson
{
153 7f763a5d David Gibson
    return 0;
154 7f763a5d David Gibson
}
155 7f763a5d David Gibson
156 98efaf75 David Gibson
#endif /* !CONFIG_USER_ONLY */
157 0f5cb298 David Gibson
158 55e5c285 Andreas Färber
static inline int kvmppc_fixup_cpu(PowerPCCPU *cpu)
159 12b1143b David Gibson
{
160 12b1143b David Gibson
    return -1;
161 12b1143b David Gibson
}
162 3b961124 Stuart Yoder
163 3b961124 Stuart Yoder
static inline bool kvmppc_has_cap_epr(void)
164 3b961124 Stuart Yoder
{
165 3b961124 Stuart Yoder
    return false;
166 3b961124 Stuart Yoder
}
167 e68cb8b4 Alexey Kardashevskiy
168 feaa64c4 David Gibson
static inline int kvmppc_define_rtas_kernel_token(uint32_t token,
169 feaa64c4 David Gibson
                                                  const char *function)
170 feaa64c4 David Gibson
{
171 feaa64c4 David Gibson
    return -1;
172 feaa64c4 David Gibson
}
173 feaa64c4 David Gibson
174 e68cb8b4 Alexey Kardashevskiy
static inline int kvmppc_get_htab_fd(bool write)
175 e68cb8b4 Alexey Kardashevskiy
{
176 e68cb8b4 Alexey Kardashevskiy
    return -1;
177 e68cb8b4 Alexey Kardashevskiy
}
178 e68cb8b4 Alexey Kardashevskiy
179 e68cb8b4 Alexey Kardashevskiy
static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
180 e68cb8b4 Alexey Kardashevskiy
                                   int64_t max_ns)
181 e68cb8b4 Alexey Kardashevskiy
{
182 e68cb8b4 Alexey Kardashevskiy
    abort();
183 e68cb8b4 Alexey Kardashevskiy
}
184 e68cb8b4 Alexey Kardashevskiy
185 e68cb8b4 Alexey Kardashevskiy
static inline int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
186 e68cb8b4 Alexey Kardashevskiy
                                         uint16_t n_valid, uint16_t n_invalid)
187 e68cb8b4 Alexey Kardashevskiy
{
188 e68cb8b4 Alexey Kardashevskiy
    abort();
189 e68cb8b4 Alexey Kardashevskiy
}
190 e68cb8b4 Alexey Kardashevskiy
191 921e28db Alexander Graf
#endif
192 921e28db Alexander Graf
193 b45d63b6 Ben Herrenschmidt
#ifndef CONFIG_KVM
194 b45d63b6 Ben Herrenschmidt
#define kvmppc_eieio() do { } while (0)
195 b45d63b6 Ben Herrenschmidt
#else
196 b45d63b6 Ben Herrenschmidt
#define kvmppc_eieio() \
197 b45d63b6 Ben Herrenschmidt
    do {                                          \
198 b45d63b6 Ben Herrenschmidt
        if (kvm_enabled()) {                          \
199 b45d63b6 Ben Herrenschmidt
            asm volatile("eieio" : : : "memory"); \
200 b45d63b6 Ben Herrenschmidt
        } \
201 b45d63b6 Ben Herrenschmidt
    } while (0)
202 b45d63b6 Ben Herrenschmidt
#endif
203 b45d63b6 Ben Herrenschmidt
204 fc87e185 Alexander Graf
#ifndef KVM_INTERRUPT_SET
205 fc87e185 Alexander Graf
#define KVM_INTERRUPT_SET -1
206 fc87e185 Alexander Graf
#endif
207 fc87e185 Alexander Graf
208 fc87e185 Alexander Graf
#ifndef KVM_INTERRUPT_UNSET
209 fc87e185 Alexander Graf
#define KVM_INTERRUPT_UNSET -2
210 fc87e185 Alexander Graf
#endif
211 fc87e185 Alexander Graf
212 fc87e185 Alexander Graf
#ifndef KVM_INTERRUPT_SET_LEVEL
213 fc87e185 Alexander Graf
#define KVM_INTERRUPT_SET_LEVEL -3
214 fc87e185 Alexander Graf
#endif
215 dc333cd6 Alexander Graf
216 d76d1650 aurel32
#endif /* __KVM_PPC_H__ */