xref: /qemu/target/ppc/kvm_ppc.h (revision b55d295e)
1fcf5ef2aSThomas Huth /*
2fcf5ef2aSThomas Huth  * Copyright 2008 IBM Corporation.
3fcf5ef2aSThomas Huth  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
4fcf5ef2aSThomas Huth  *
5fcf5ef2aSThomas Huth  * This work is licensed under the GNU GPL license version 2 or later.
6fcf5ef2aSThomas Huth  *
7fcf5ef2aSThomas Huth  */
8fcf5ef2aSThomas Huth 
9fcf5ef2aSThomas Huth #ifndef KVM_PPC_H
10fcf5ef2aSThomas Huth #define KVM_PPC_H
11fcf5ef2aSThomas Huth 
12fcf5ef2aSThomas Huth #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
13fcf5ef2aSThomas Huth 
14fcf5ef2aSThomas Huth #ifdef CONFIG_KVM
15fcf5ef2aSThomas Huth 
16fcf5ef2aSThomas Huth uint32_t kvmppc_get_tbfreq(void);
17fcf5ef2aSThomas Huth uint64_t kvmppc_get_clockfreq(void);
18fcf5ef2aSThomas Huth uint32_t kvmppc_get_vmx(void);
19fcf5ef2aSThomas Huth uint32_t kvmppc_get_dfp(void);
20fcf5ef2aSThomas Huth bool kvmppc_get_host_model(char **buf);
21fcf5ef2aSThomas Huth bool kvmppc_get_host_serial(char **buf);
22fcf5ef2aSThomas Huth int kvmppc_get_hasidle(CPUPPCState *env);
23fcf5ef2aSThomas Huth int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
24fcf5ef2aSThomas Huth int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
25fcf5ef2aSThomas Huth void kvmppc_enable_logical_ci_hcalls(void);
26fcf5ef2aSThomas Huth void kvmppc_enable_set_mode_hcall(void);
27fcf5ef2aSThomas Huth void kvmppc_enable_clear_ref_mod_hcalls(void);
28fcf5ef2aSThomas Huth void kvmppc_set_papr(PowerPCCPU *cpu);
29d6e166c0SDavid Gibson int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr);
30fcf5ef2aSThomas Huth void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
31fcf5ef2aSThomas Huth int kvmppc_smt_threads(void);
32fcf5ef2aSThomas Huth int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
33fcf5ef2aSThomas Huth int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
34fcf5ef2aSThomas Huth int kvmppc_set_tcr(PowerPCCPU *cpu);
35fcf5ef2aSThomas Huth int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);
36b4db5413SSuraj Jitindar Singh target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
37b4db5413SSuraj Jitindar Singh                                      bool radix, bool gtse,
38b4db5413SSuraj Jitindar Singh                                      uint64_t proc_tbl);
39fcf5ef2aSThomas Huth #ifndef CONFIG_USER_ONLY
40fcf5ef2aSThomas Huth off_t kvmppc_alloc_rma(void **rma);
41fcf5ef2aSThomas Huth bool kvmppc_spapr_use_multitce(void);
423dc410aeSAlexey Kardashevskiy int kvmppc_spapr_enable_inkernel_multitce(void);
43d6ee2a7cSAlexey Kardashevskiy void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
44d6ee2a7cSAlexey Kardashevskiy                               uint64_t bus_offset, uint32_t nb_table,
45d6ee2a7cSAlexey Kardashevskiy                               int *pfd, bool need_vfio);
46fcf5ef2aSThomas Huth int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
47fcf5ef2aSThomas Huth int kvmppc_reset_htab(int shift_hint);
48fcf5ef2aSThomas Huth uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
49fcf5ef2aSThomas Huth #endif /* !CONFIG_USER_ONLY */
50fcf5ef2aSThomas Huth bool kvmppc_has_cap_epr(void);
51fcf5ef2aSThomas Huth int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function);
52fcf5ef2aSThomas Huth bool kvmppc_has_cap_htab_fd(void);
53fcf5ef2aSThomas Huth int kvmppc_get_htab_fd(bool write);
54fcf5ef2aSThomas Huth int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns);
55fcf5ef2aSThomas Huth int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
56fcf5ef2aSThomas Huth                            uint16_t n_valid, uint16_t n_invalid);
571ad9f0a4SDavid Gibson void kvmppc_read_hptes(ppc_hash_pte64_t *hptes, hwaddr ptex, int n);
581ad9f0a4SDavid Gibson void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1);
59fcf5ef2aSThomas Huth bool kvmppc_has_cap_fixup_hcalls(void);
60fcf5ef2aSThomas Huth bool kvmppc_has_cap_htm(void);
61cf1c4cceSSam Bobroff bool kvmppc_has_cap_mmu_radix(void);
62cf1c4cceSSam Bobroff bool kvmppc_has_cap_mmu_hash_v3(void);
63fcf5ef2aSThomas Huth int kvmppc_enable_hwrng(void);
64fcf5ef2aSThomas Huth int kvmppc_put_books_sregs(PowerPCCPU *cpu);
65fcf5ef2aSThomas Huth PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void);
6630f4b05bSDavid Gibson void kvmppc_check_papr_resize_hpt(Error **errp);
67*b55d295eSDavid Gibson int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu, target_ulong flags, int shift);
68*b55d295eSDavid Gibson int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, target_ulong flags, int shift);
69*b55d295eSDavid Gibson void kvmppc_update_sdr1(target_ulong sdr1);
70fcf5ef2aSThomas Huth 
71ec69355bSGreg Kurz bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path);
72df587133SThomas Huth 
73fcf5ef2aSThomas Huth #else
74fcf5ef2aSThomas Huth 
75fcf5ef2aSThomas Huth static inline uint32_t kvmppc_get_tbfreq(void)
76fcf5ef2aSThomas Huth {
77fcf5ef2aSThomas Huth     return 0;
78fcf5ef2aSThomas Huth }
79fcf5ef2aSThomas Huth 
80fcf5ef2aSThomas Huth static inline bool kvmppc_get_host_model(char **buf)
81fcf5ef2aSThomas Huth {
82fcf5ef2aSThomas Huth     return false;
83fcf5ef2aSThomas Huth }
84fcf5ef2aSThomas Huth 
85fcf5ef2aSThomas Huth static inline bool kvmppc_get_host_serial(char **buf)
86fcf5ef2aSThomas Huth {
87fcf5ef2aSThomas Huth     return false;
88fcf5ef2aSThomas Huth }
89fcf5ef2aSThomas Huth 
90fcf5ef2aSThomas Huth static inline uint64_t kvmppc_get_clockfreq(void)
91fcf5ef2aSThomas Huth {
92fcf5ef2aSThomas Huth     return 0;
93fcf5ef2aSThomas Huth }
94fcf5ef2aSThomas Huth 
95fcf5ef2aSThomas Huth static inline uint32_t kvmppc_get_vmx(void)
96fcf5ef2aSThomas Huth {
97fcf5ef2aSThomas Huth     return 0;
98fcf5ef2aSThomas Huth }
99fcf5ef2aSThomas Huth 
100fcf5ef2aSThomas Huth static inline uint32_t kvmppc_get_dfp(void)
101fcf5ef2aSThomas Huth {
102fcf5ef2aSThomas Huth     return 0;
103fcf5ef2aSThomas Huth }
104fcf5ef2aSThomas Huth 
105fcf5ef2aSThomas Huth static inline int kvmppc_get_hasidle(CPUPPCState *env)
106fcf5ef2aSThomas Huth {
107fcf5ef2aSThomas Huth     return 0;
108fcf5ef2aSThomas Huth }
109fcf5ef2aSThomas Huth 
110fcf5ef2aSThomas Huth static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
111fcf5ef2aSThomas Huth {
112fcf5ef2aSThomas Huth     return -1;
113fcf5ef2aSThomas Huth }
114fcf5ef2aSThomas Huth 
115fcf5ef2aSThomas Huth static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
116fcf5ef2aSThomas Huth {
117fcf5ef2aSThomas Huth     return -1;
118fcf5ef2aSThomas Huth }
119fcf5ef2aSThomas Huth 
120fcf5ef2aSThomas Huth static inline void kvmppc_enable_logical_ci_hcalls(void)
121fcf5ef2aSThomas Huth {
122fcf5ef2aSThomas Huth }
123fcf5ef2aSThomas Huth 
124fcf5ef2aSThomas Huth static inline void kvmppc_enable_set_mode_hcall(void)
125fcf5ef2aSThomas Huth {
126fcf5ef2aSThomas Huth }
127fcf5ef2aSThomas Huth 
128fcf5ef2aSThomas Huth static inline void kvmppc_enable_clear_ref_mod_hcalls(void)
129fcf5ef2aSThomas Huth {
130fcf5ef2aSThomas Huth }
131fcf5ef2aSThomas Huth 
132fcf5ef2aSThomas Huth static inline void kvmppc_set_papr(PowerPCCPU *cpu)
133fcf5ef2aSThomas Huth {
134fcf5ef2aSThomas Huth }
135fcf5ef2aSThomas Huth 
136d6e166c0SDavid Gibson static inline int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr)
137fcf5ef2aSThomas Huth {
138fcf5ef2aSThomas Huth     return 0;
139fcf5ef2aSThomas Huth }
140fcf5ef2aSThomas Huth 
141fcf5ef2aSThomas Huth static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
142fcf5ef2aSThomas Huth {
143fcf5ef2aSThomas Huth }
144fcf5ef2aSThomas Huth 
145fcf5ef2aSThomas Huth static inline int kvmppc_smt_threads(void)
146fcf5ef2aSThomas Huth {
147fcf5ef2aSThomas Huth     return 1;
148fcf5ef2aSThomas Huth }
149fcf5ef2aSThomas Huth 
150fcf5ef2aSThomas Huth static inline int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
151fcf5ef2aSThomas Huth {
152fcf5ef2aSThomas Huth     return 0;
153fcf5ef2aSThomas Huth }
154fcf5ef2aSThomas Huth 
155fcf5ef2aSThomas Huth static inline int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
156fcf5ef2aSThomas Huth {
157fcf5ef2aSThomas Huth     return 0;
158fcf5ef2aSThomas Huth }
159fcf5ef2aSThomas Huth 
160fcf5ef2aSThomas Huth static inline int kvmppc_set_tcr(PowerPCCPU *cpu)
161fcf5ef2aSThomas Huth {
162fcf5ef2aSThomas Huth     return 0;
163fcf5ef2aSThomas Huth }
164fcf5ef2aSThomas Huth 
165fcf5ef2aSThomas Huth static inline int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu)
166fcf5ef2aSThomas Huth {
167fcf5ef2aSThomas Huth     return -1;
168fcf5ef2aSThomas Huth }
169fcf5ef2aSThomas Huth 
170b4db5413SSuraj Jitindar Singh static inline target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
171b4db5413SSuraj Jitindar Singh                                      bool radix, bool gtse,
172b4db5413SSuraj Jitindar Singh                                      uint64_t proc_tbl)
173b4db5413SSuraj Jitindar Singh {
174b4db5413SSuraj Jitindar Singh     return 0;
175b4db5413SSuraj Jitindar Singh }
176b4db5413SSuraj Jitindar Singh 
177fcf5ef2aSThomas Huth #ifndef CONFIG_USER_ONLY
178fcf5ef2aSThomas Huth static inline off_t kvmppc_alloc_rma(void **rma)
179fcf5ef2aSThomas Huth {
180fcf5ef2aSThomas Huth     return 0;
181fcf5ef2aSThomas Huth }
182fcf5ef2aSThomas Huth 
183fcf5ef2aSThomas Huth static inline bool kvmppc_spapr_use_multitce(void)
184fcf5ef2aSThomas Huth {
185fcf5ef2aSThomas Huth     return false;
186fcf5ef2aSThomas Huth }
187fcf5ef2aSThomas Huth 
1883dc410aeSAlexey Kardashevskiy static inline int kvmppc_spapr_enable_inkernel_multitce(void)
1893dc410aeSAlexey Kardashevskiy {
1903dc410aeSAlexey Kardashevskiy     return -1;
1913dc410aeSAlexey Kardashevskiy }
1923dc410aeSAlexey Kardashevskiy 
193d6ee2a7cSAlexey Kardashevskiy static inline void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
194d6ee2a7cSAlexey Kardashevskiy                                             uint64_t bus_offset,
195d6ee2a7cSAlexey Kardashevskiy                                             uint32_t nb_table,
196d6ee2a7cSAlexey Kardashevskiy                                             int *pfd, bool need_vfio)
197fcf5ef2aSThomas Huth {
198fcf5ef2aSThomas Huth     return NULL;
199fcf5ef2aSThomas Huth }
200fcf5ef2aSThomas Huth 
201fcf5ef2aSThomas Huth static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
202fcf5ef2aSThomas Huth                                           uint32_t nb_table)
203fcf5ef2aSThomas Huth {
204fcf5ef2aSThomas Huth     return -1;
205fcf5ef2aSThomas Huth }
206fcf5ef2aSThomas Huth 
207fcf5ef2aSThomas Huth static inline int kvmppc_reset_htab(int shift_hint)
208fcf5ef2aSThomas Huth {
209fcf5ef2aSThomas Huth     return 0;
210fcf5ef2aSThomas Huth }
211fcf5ef2aSThomas Huth 
212fcf5ef2aSThomas Huth static inline uint64_t kvmppc_rma_size(uint64_t current_size,
213fcf5ef2aSThomas Huth                                        unsigned int hash_shift)
214fcf5ef2aSThomas Huth {
215fcf5ef2aSThomas Huth     return ram_size;
216fcf5ef2aSThomas Huth }
217fcf5ef2aSThomas Huth 
218ec69355bSGreg Kurz static inline bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path)
219df587133SThomas Huth {
220df587133SThomas Huth     return true;
221df587133SThomas Huth }
222df587133SThomas Huth 
223fcf5ef2aSThomas Huth #endif /* !CONFIG_USER_ONLY */
224fcf5ef2aSThomas Huth 
225fcf5ef2aSThomas Huth static inline bool kvmppc_has_cap_epr(void)
226fcf5ef2aSThomas Huth {
227fcf5ef2aSThomas Huth     return false;
228fcf5ef2aSThomas Huth }
229fcf5ef2aSThomas Huth 
230fcf5ef2aSThomas Huth static inline int kvmppc_define_rtas_kernel_token(uint32_t token,
231fcf5ef2aSThomas Huth                                                   const char *function)
232fcf5ef2aSThomas Huth {
233fcf5ef2aSThomas Huth     return -1;
234fcf5ef2aSThomas Huth }
235fcf5ef2aSThomas Huth 
236fcf5ef2aSThomas Huth static inline bool kvmppc_has_cap_htab_fd(void)
237fcf5ef2aSThomas Huth {
238fcf5ef2aSThomas Huth     return false;
239fcf5ef2aSThomas Huth }
240fcf5ef2aSThomas Huth 
241fcf5ef2aSThomas Huth static inline int kvmppc_get_htab_fd(bool write)
242fcf5ef2aSThomas Huth {
243fcf5ef2aSThomas Huth     return -1;
244fcf5ef2aSThomas Huth }
245fcf5ef2aSThomas Huth 
246fcf5ef2aSThomas Huth static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
247fcf5ef2aSThomas Huth                                    int64_t max_ns)
248fcf5ef2aSThomas Huth {
249fcf5ef2aSThomas Huth     abort();
250fcf5ef2aSThomas Huth }
251fcf5ef2aSThomas Huth 
252fcf5ef2aSThomas Huth static inline int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
253fcf5ef2aSThomas Huth                                          uint16_t n_valid, uint16_t n_invalid)
254fcf5ef2aSThomas Huth {
255fcf5ef2aSThomas Huth     abort();
256fcf5ef2aSThomas Huth }
257fcf5ef2aSThomas Huth 
2581ad9f0a4SDavid Gibson static inline void kvmppc_read_hptes(ppc_hash_pte64_t *hptes,
2591ad9f0a4SDavid Gibson                                      hwaddr ptex, int n)
260fcf5ef2aSThomas Huth {
261fcf5ef2aSThomas Huth     abort();
262fcf5ef2aSThomas Huth }
263fcf5ef2aSThomas Huth 
2641ad9f0a4SDavid Gibson static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1)
265fcf5ef2aSThomas Huth {
266fcf5ef2aSThomas Huth     abort();
267fcf5ef2aSThomas Huth }
268fcf5ef2aSThomas Huth 
269fcf5ef2aSThomas Huth static inline bool kvmppc_has_cap_fixup_hcalls(void)
270fcf5ef2aSThomas Huth {
271fcf5ef2aSThomas Huth     abort();
272fcf5ef2aSThomas Huth }
273fcf5ef2aSThomas Huth 
274fcf5ef2aSThomas Huth static inline bool kvmppc_has_cap_htm(void)
275fcf5ef2aSThomas Huth {
276fcf5ef2aSThomas Huth     return false;
277fcf5ef2aSThomas Huth }
278fcf5ef2aSThomas Huth 
279cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_radix(void)
280cf1c4cceSSam Bobroff {
281cf1c4cceSSam Bobroff     return false;
282cf1c4cceSSam Bobroff }
283cf1c4cceSSam Bobroff 
284cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_hash_v3(void)
285cf1c4cceSSam Bobroff {
286cf1c4cceSSam Bobroff     return false;
287cf1c4cceSSam Bobroff }
288cf1c4cceSSam Bobroff 
289fcf5ef2aSThomas Huth static inline int kvmppc_enable_hwrng(void)
290fcf5ef2aSThomas Huth {
291fcf5ef2aSThomas Huth     return -1;
292fcf5ef2aSThomas Huth }
293fcf5ef2aSThomas Huth 
294fcf5ef2aSThomas Huth static inline int kvmppc_put_books_sregs(PowerPCCPU *cpu)
295fcf5ef2aSThomas Huth {
296fcf5ef2aSThomas Huth     abort();
297fcf5ef2aSThomas Huth }
298fcf5ef2aSThomas Huth 
299fcf5ef2aSThomas Huth static inline PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
300fcf5ef2aSThomas Huth {
301fcf5ef2aSThomas Huth     return NULL;
302fcf5ef2aSThomas Huth }
303fcf5ef2aSThomas Huth 
30430f4b05bSDavid Gibson static inline void kvmppc_check_papr_resize_hpt(Error **errp)
30530f4b05bSDavid Gibson {
30630f4b05bSDavid Gibson     return;
30730f4b05bSDavid Gibson }
308*b55d295eSDavid Gibson 
309*b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu,
310*b55d295eSDavid Gibson                                             target_ulong flags, int shift)
311*b55d295eSDavid Gibson {
312*b55d295eSDavid Gibson     return -ENOSYS;
313*b55d295eSDavid Gibson }
314*b55d295eSDavid Gibson 
315*b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_commit(PowerPCCPU *cpu,
316*b55d295eSDavid Gibson                                            target_ulong flags, int shift)
317*b55d295eSDavid Gibson {
318*b55d295eSDavid Gibson     return -ENOSYS;
319*b55d295eSDavid Gibson }
320*b55d295eSDavid Gibson 
321*b55d295eSDavid Gibson static inline void kvmppc_update_sdr1(target_ulong sdr1)
322*b55d295eSDavid Gibson {
323*b55d295eSDavid Gibson     abort();
324*b55d295eSDavid Gibson }
325*b55d295eSDavid Gibson 
326fcf5ef2aSThomas Huth #endif
327fcf5ef2aSThomas Huth 
328fcf5ef2aSThomas Huth #ifndef CONFIG_KVM
329fcf5ef2aSThomas Huth 
330fcf5ef2aSThomas Huth #define kvmppc_eieio() do { } while (0)
331fcf5ef2aSThomas Huth 
332fcf5ef2aSThomas Huth static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
333fcf5ef2aSThomas Huth {
334fcf5ef2aSThomas Huth }
335fcf5ef2aSThomas Huth 
336fcf5ef2aSThomas Huth static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
337fcf5ef2aSThomas Huth {
338fcf5ef2aSThomas Huth }
339fcf5ef2aSThomas Huth 
340fcf5ef2aSThomas Huth #else   /* CONFIG_KVM */
341fcf5ef2aSThomas Huth 
342fcf5ef2aSThomas Huth #define kvmppc_eieio() \
343fcf5ef2aSThomas Huth     do {                                          \
344fcf5ef2aSThomas Huth         if (kvm_enabled()) {                          \
345fcf5ef2aSThomas Huth             asm volatile("eieio" : : : "memory"); \
346fcf5ef2aSThomas Huth         } \
347fcf5ef2aSThomas Huth     } while (0)
348fcf5ef2aSThomas Huth 
349fcf5ef2aSThomas Huth /* Store data cache blocks back to memory */
350fcf5ef2aSThomas Huth static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
351fcf5ef2aSThomas Huth {
352fcf5ef2aSThomas Huth     uint8_t *p;
353fcf5ef2aSThomas Huth 
354fcf5ef2aSThomas Huth     for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) {
355fcf5ef2aSThomas Huth         asm volatile("dcbst 0,%0" : : "r"(p) : "memory");
356fcf5ef2aSThomas Huth     }
357fcf5ef2aSThomas Huth }
358fcf5ef2aSThomas Huth 
359fcf5ef2aSThomas Huth /* Invalidate instruction cache blocks */
360fcf5ef2aSThomas Huth static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
361fcf5ef2aSThomas Huth {
362fcf5ef2aSThomas Huth     uint8_t *p;
363fcf5ef2aSThomas Huth 
364fcf5ef2aSThomas Huth     for (p = addr; p < addr + len; p += cpu->env.icache_line_size) {
365fcf5ef2aSThomas Huth         asm volatile("icbi 0,%0" : : "r"(p));
366fcf5ef2aSThomas Huth     }
367fcf5ef2aSThomas Huth }
368fcf5ef2aSThomas Huth 
369fcf5ef2aSThomas Huth #endif  /* CONFIG_KVM */
370fcf5ef2aSThomas Huth 
371fcf5ef2aSThomas Huth #endif /* KVM_PPC_H */
372