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
12597645ccSPhilippe Mathieu-Daudé #include "sysemu/kvm.h"
13308fd181SPhilippe Mathieu-Daudé #include "exec/hwaddr.h"
14308fd181SPhilippe Mathieu-Daudé #include "cpu.h"
15308fd181SPhilippe Mathieu-Daudé
16c6b8252cSPhilippe Mathieu-Daudé #ifdef CONFIG_USER_ONLY
17c6b8252cSPhilippe Mathieu-Daudé #error Cannot include kvm_ppc.h from user emulation
18c6b8252cSPhilippe Mathieu-Daudé #endif
19c6b8252cSPhilippe Mathieu-Daudé
20fcf5ef2aSThomas Huth #ifdef CONFIG_KVM
21fcf5ef2aSThomas Huth
22fcf5ef2aSThomas Huth uint32_t kvmppc_get_tbfreq(void);
23fcf5ef2aSThomas Huth uint64_t kvmppc_get_clockfreq(void);
24fcf5ef2aSThomas Huth bool kvmppc_get_host_model(char **buf);
25fcf5ef2aSThomas Huth bool kvmppc_get_host_serial(char **buf);
26fcf5ef2aSThomas Huth int kvmppc_get_hasidle(CPUPPCState *env);
27fcf5ef2aSThomas Huth int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
28fcf5ef2aSThomas Huth int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
29fcf5ef2aSThomas Huth void kvmppc_enable_logical_ci_hcalls(void);
30fcf5ef2aSThomas Huth void kvmppc_enable_set_mode_hcall(void);
31fcf5ef2aSThomas Huth void kvmppc_enable_clear_ref_mod_hcalls(void);
3268f9f708SSuraj Jitindar Singh void kvmppc_enable_h_page_init(void);
3382123b75SBharata B Rao void kvmppc_enable_h_rpt_invalidate(void);
34fcf5ef2aSThomas Huth void kvmppc_set_papr(PowerPCCPU *cpu);
35d6e166c0SDavid Gibson int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr);
36fcf5ef2aSThomas Huth void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
37ec010c00SNicholas Piggin bool kvmppc_get_fwnmi(void);
38aef92d87SLaurent Vivier int kvmppc_set_fwnmi(PowerPCCPU *cpu);
39fcf5ef2aSThomas Huth int kvmppc_smt_threads(void);
400c115681SVladimir Sementsov-Ogievskiy void kvmppc_error_append_smt_possible_hint(Error *const *errp);
41fa98fbfcSSam Bobroff int kvmppc_set_smt_threads(int smt);
42fcf5ef2aSThomas Huth int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
43fcf5ef2aSThomas Huth int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
44fcf5ef2aSThomas Huth int kvmppc_set_tcr(PowerPCCPU *cpu);
45fcf5ef2aSThomas Huth int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);
46b4db5413SSuraj Jitindar Singh target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
47b4db5413SSuraj Jitindar Singh bool radix, bool gtse,
48b4db5413SSuraj Jitindar Singh uint64_t proc_tbl);
49fcf5ef2aSThomas Huth bool kvmppc_spapr_use_multitce(void);
503dc410aeSAlexey Kardashevskiy int kvmppc_spapr_enable_inkernel_multitce(void);
51d6ee2a7cSAlexey Kardashevskiy void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
52d6ee2a7cSAlexey Kardashevskiy uint64_t bus_offset, uint32_t nb_table,
53d6ee2a7cSAlexey Kardashevskiy int *pfd, bool need_vfio);
54fcf5ef2aSThomas Huth int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
55fcf5ef2aSThomas Huth int kvmppc_reset_htab(int shift_hint);
566a84737cSDavid Gibson uint64_t kvmppc_vrma_limit(unsigned int hash_shift);
579ded780cSAlexey Kardashevskiy bool kvmppc_has_cap_spapr_vfio(void);
58fcf5ef2aSThomas Huth bool kvmppc_has_cap_epr(void);
59fcf5ef2aSThomas Huth int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function);
6014b0d748SGreg Kurz int kvmppc_get_htab_fd(bool write, uint64_t index, Error **errp);
61fcf5ef2aSThomas Huth int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns);
62fcf5ef2aSThomas Huth int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
630a06e4d6SGreg Kurz uint16_t n_valid, uint16_t n_invalid, Error **errp);
641ad9f0a4SDavid Gibson void kvmppc_read_hptes(ppc_hash_pte64_t *hptes, hwaddr ptex, int n);
651ad9f0a4SDavid Gibson void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1);
66fcf5ef2aSThomas Huth bool kvmppc_has_cap_fixup_hcalls(void);
67fcf5ef2aSThomas Huth bool kvmppc_has_cap_htm(void);
68cf1c4cceSSam Bobroff bool kvmppc_has_cap_mmu_radix(void);
69cf1c4cceSSam Bobroff bool kvmppc_has_cap_mmu_hash_v3(void);
7038afd772SCédric Le Goater bool kvmppc_has_cap_xive(void);
718acc2ae5SSuraj Jitindar Singh int kvmppc_get_cap_safe_cache(void);
728acc2ae5SSuraj Jitindar Singh int kvmppc_get_cap_safe_bounds_check(void);
738acc2ae5SSuraj Jitindar Singh int kvmppc_get_cap_safe_indirect_branch(void);
748ff43ee4SSuraj Jitindar Singh int kvmppc_get_cap_count_cache_flush_assist(void);
75b9a477b7SSuraj Jitindar Singh bool kvmppc_has_cap_nested_kvm_hv(void);
76b9a477b7SSuraj Jitindar Singh int kvmppc_set_cap_nested_kvm_hv(int enable);
777d050527SSuraj Jitindar Singh int kvmppc_get_cap_large_decr(void);
787d050527SSuraj Jitindar Singh int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable);
7982123b75SBharata B Rao int kvmppc_has_cap_rpt_invalidate(void);
80ccc5a4c5SNicholas Piggin bool kvmppc_supports_ail_3(void);
81fcf5ef2aSThomas Huth int kvmppc_enable_hwrng(void);
82fcf5ef2aSThomas Huth int kvmppc_put_books_sregs(PowerPCCPU *cpu);
83fcf5ef2aSThomas Huth PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void);
8430f4b05bSDavid Gibson void kvmppc_check_papr_resize_hpt(Error **errp);
85b55d295eSDavid Gibson int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu, target_ulong flags, int shift);
86b55d295eSDavid Gibson int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, target_ulong flags, int shift);
87c363a37aSDaniel Henrique Barboza bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu);
88fcf5ef2aSThomas Huth
8924c6863cSDavid Gibson bool kvmppc_hpt_needs_host_contiguous_pages(void);
90e5ca28ecSDavid Gibson void kvm_check_mmu(PowerPCCPU *cpu, Error **errp);
91a84f7179SNikunj A Dadhania void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online);
929723295aSGreg Kurz void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);
93df587133SThomas Huth
949ac703acSAravinda Prasad int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);
959ac703acSAravinda Prasad
961b4b1bb5SPhilippe Mathieu-Daudé #define kvmppc_eieio() \
971b4b1bb5SPhilippe Mathieu-Daudé do { \
981b4b1bb5SPhilippe Mathieu-Daudé if (kvm_enabled()) { \
991b4b1bb5SPhilippe Mathieu-Daudé asm volatile("eieio" : : : "memory"); \
1001b4b1bb5SPhilippe Mathieu-Daudé } \
1011b4b1bb5SPhilippe Mathieu-Daudé } while (0)
1021b4b1bb5SPhilippe Mathieu-Daudé
1031b4b1bb5SPhilippe Mathieu-Daudé /* Store data cache blocks back to memory */
kvmppc_dcbst_range(PowerPCCPU * cpu,uint8_t * addr,int len)1041b4b1bb5SPhilippe Mathieu-Daudé static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
1051b4b1bb5SPhilippe Mathieu-Daudé {
1061b4b1bb5SPhilippe Mathieu-Daudé uint8_t *p;
1071b4b1bb5SPhilippe Mathieu-Daudé
1081b4b1bb5SPhilippe Mathieu-Daudé for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) {
1091b4b1bb5SPhilippe Mathieu-Daudé asm volatile("dcbst 0,%0" : : "r"(p) : "memory");
1101b4b1bb5SPhilippe Mathieu-Daudé }
1111b4b1bb5SPhilippe Mathieu-Daudé }
1121b4b1bb5SPhilippe Mathieu-Daudé
1131b4b1bb5SPhilippe Mathieu-Daudé /* Invalidate instruction cache blocks */
kvmppc_icbi_range(PowerPCCPU * cpu,uint8_t * addr,int len)1141b4b1bb5SPhilippe Mathieu-Daudé static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
1151b4b1bb5SPhilippe Mathieu-Daudé {
1161b4b1bb5SPhilippe Mathieu-Daudé uint8_t *p;
1171b4b1bb5SPhilippe Mathieu-Daudé
1181b4b1bb5SPhilippe Mathieu-Daudé for (p = addr; p < addr + len; p += cpu->env.icache_line_size) {
1191b4b1bb5SPhilippe Mathieu-Daudé asm volatile("icbi 0,%0" : : "r"(p));
1201b4b1bb5SPhilippe Mathieu-Daudé }
1211b4b1bb5SPhilippe Mathieu-Daudé }
1221b4b1bb5SPhilippe Mathieu-Daudé
1231b4b1bb5SPhilippe Mathieu-Daudé #else /* !CONFIG_KVM */
124fcf5ef2aSThomas Huth
kvmppc_get_tbfreq(void)125fcf5ef2aSThomas Huth static inline uint32_t kvmppc_get_tbfreq(void)
126fcf5ef2aSThomas Huth {
127fcf5ef2aSThomas Huth return 0;
128fcf5ef2aSThomas Huth }
129fcf5ef2aSThomas Huth
kvmppc_get_host_model(char ** buf)130fcf5ef2aSThomas Huth static inline bool kvmppc_get_host_model(char **buf)
131fcf5ef2aSThomas Huth {
132fcf5ef2aSThomas Huth return false;
133fcf5ef2aSThomas Huth }
134fcf5ef2aSThomas Huth
kvmppc_get_host_serial(char ** buf)135fcf5ef2aSThomas Huth static inline bool kvmppc_get_host_serial(char **buf)
136fcf5ef2aSThomas Huth {
137fcf5ef2aSThomas Huth return false;
138fcf5ef2aSThomas Huth }
139fcf5ef2aSThomas Huth
kvmppc_get_clockfreq(void)140fcf5ef2aSThomas Huth static inline uint64_t kvmppc_get_clockfreq(void)
141fcf5ef2aSThomas Huth {
142fcf5ef2aSThomas Huth return 0;
143fcf5ef2aSThomas Huth }
144fcf5ef2aSThomas Huth
kvmppc_get_vmx(void)145fcf5ef2aSThomas Huth static inline uint32_t kvmppc_get_vmx(void)
146fcf5ef2aSThomas Huth {
147fcf5ef2aSThomas Huth return 0;
148fcf5ef2aSThomas Huth }
149fcf5ef2aSThomas Huth
kvmppc_get_dfp(void)150fcf5ef2aSThomas Huth static inline uint32_t kvmppc_get_dfp(void)
151fcf5ef2aSThomas Huth {
152fcf5ef2aSThomas Huth return 0;
153fcf5ef2aSThomas Huth }
154fcf5ef2aSThomas Huth
kvmppc_get_hasidle(CPUPPCState * env)155fcf5ef2aSThomas Huth static inline int kvmppc_get_hasidle(CPUPPCState *env)
156fcf5ef2aSThomas Huth {
157fcf5ef2aSThomas Huth return 0;
158fcf5ef2aSThomas Huth }
159fcf5ef2aSThomas Huth
kvmppc_get_hypercall(CPUPPCState * env,uint8_t * buf,int buf_len)160c995e942SDavid Gibson static inline int kvmppc_get_hypercall(CPUPPCState *env,
161c995e942SDavid Gibson uint8_t *buf, int buf_len)
162fcf5ef2aSThomas Huth {
163fcf5ef2aSThomas Huth return -1;
164fcf5ef2aSThomas Huth }
165fcf5ef2aSThomas Huth
kvmppc_set_interrupt(PowerPCCPU * cpu,int irq,int level)166fcf5ef2aSThomas Huth static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
167fcf5ef2aSThomas Huth {
168fcf5ef2aSThomas Huth return -1;
169fcf5ef2aSThomas Huth }
170fcf5ef2aSThomas Huth
kvmppc_enable_logical_ci_hcalls(void)171fcf5ef2aSThomas Huth static inline void kvmppc_enable_logical_ci_hcalls(void)
172fcf5ef2aSThomas Huth {
173fcf5ef2aSThomas Huth }
174fcf5ef2aSThomas Huth
kvmppc_enable_set_mode_hcall(void)175fcf5ef2aSThomas Huth static inline void kvmppc_enable_set_mode_hcall(void)
176fcf5ef2aSThomas Huth {
177fcf5ef2aSThomas Huth }
178fcf5ef2aSThomas Huth
kvmppc_enable_clear_ref_mod_hcalls(void)179fcf5ef2aSThomas Huth static inline void kvmppc_enable_clear_ref_mod_hcalls(void)
180fcf5ef2aSThomas Huth {
181fcf5ef2aSThomas Huth }
182fcf5ef2aSThomas Huth
kvmppc_enable_h_page_init(void)18368f9f708SSuraj Jitindar Singh static inline void kvmppc_enable_h_page_init(void)
18468f9f708SSuraj Jitindar Singh {
18568f9f708SSuraj Jitindar Singh }
18668f9f708SSuraj Jitindar Singh
kvmppc_enable_h_rpt_invalidate(void)18782123b75SBharata B Rao static inline void kvmppc_enable_h_rpt_invalidate(void)
18882123b75SBharata B Rao {
18982123b75SBharata B Rao g_assert_not_reached();
19082123b75SBharata B Rao }
19182123b75SBharata B Rao
kvmppc_set_papr(PowerPCCPU * cpu)192fcf5ef2aSThomas Huth static inline void kvmppc_set_papr(PowerPCCPU *cpu)
193fcf5ef2aSThomas Huth {
194fcf5ef2aSThomas Huth }
195fcf5ef2aSThomas Huth
kvmppc_set_compat(PowerPCCPU * cpu,uint32_t compat_pvr)196d6e166c0SDavid Gibson static inline int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr)
197fcf5ef2aSThomas Huth {
198fcf5ef2aSThomas Huth return 0;
199fcf5ef2aSThomas Huth }
200fcf5ef2aSThomas Huth
kvmppc_set_mpic_proxy(PowerPCCPU * cpu,int mpic_proxy)201fcf5ef2aSThomas Huth static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
202fcf5ef2aSThomas Huth {
203fcf5ef2aSThomas Huth }
204fcf5ef2aSThomas Huth
kvmppc_get_fwnmi(void)205ec010c00SNicholas Piggin static inline bool kvmppc_get_fwnmi(void)
206ec010c00SNicholas Piggin {
207ec010c00SNicholas Piggin return false;
208ec010c00SNicholas Piggin }
209ec010c00SNicholas Piggin
kvmppc_set_fwnmi(PowerPCCPU * cpu)210aef92d87SLaurent Vivier static inline int kvmppc_set_fwnmi(PowerPCCPU *cpu)
2119d953ce4SAravinda Prasad {
2129d953ce4SAravinda Prasad return -1;
2139d953ce4SAravinda Prasad }
2149d953ce4SAravinda Prasad
kvmppc_smt_threads(void)215fcf5ef2aSThomas Huth static inline int kvmppc_smt_threads(void)
216fcf5ef2aSThomas Huth {
217fcf5ef2aSThomas Huth return 1;
218fcf5ef2aSThomas Huth }
219fcf5ef2aSThomas Huth
kvmppc_error_append_smt_possible_hint(Error * const * errp)2200c115681SVladimir Sementsov-Ogievskiy static inline void kvmppc_error_append_smt_possible_hint(Error *const *errp)
221fa98fbfcSSam Bobroff {
222fa98fbfcSSam Bobroff return;
223fa98fbfcSSam Bobroff }
224fa98fbfcSSam Bobroff
kvmppc_set_smt_threads(int smt)225fa98fbfcSSam Bobroff static inline int kvmppc_set_smt_threads(int smt)
226fa98fbfcSSam Bobroff {
227fa98fbfcSSam Bobroff return 0;
228fa98fbfcSSam Bobroff }
229fa98fbfcSSam Bobroff
kvmppc_or_tsr_bits(PowerPCCPU * cpu,uint32_t tsr_bits)230fcf5ef2aSThomas Huth static inline int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
231fcf5ef2aSThomas Huth {
232fcf5ef2aSThomas Huth return 0;
233fcf5ef2aSThomas Huth }
234fcf5ef2aSThomas Huth
kvmppc_clear_tsr_bits(PowerPCCPU * cpu,uint32_t tsr_bits)235fcf5ef2aSThomas Huth static inline int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
236fcf5ef2aSThomas Huth {
237fcf5ef2aSThomas Huth return 0;
238fcf5ef2aSThomas Huth }
239fcf5ef2aSThomas Huth
kvmppc_set_tcr(PowerPCCPU * cpu)240fcf5ef2aSThomas Huth static inline int kvmppc_set_tcr(PowerPCCPU *cpu)
241fcf5ef2aSThomas Huth {
242fcf5ef2aSThomas Huth return 0;
243fcf5ef2aSThomas Huth }
244fcf5ef2aSThomas Huth
kvmppc_booke_watchdog_enable(PowerPCCPU * cpu)245fcf5ef2aSThomas Huth static inline int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu)
246fcf5ef2aSThomas Huth {
247fcf5ef2aSThomas Huth return -1;
248fcf5ef2aSThomas Huth }
249fcf5ef2aSThomas Huth
kvmppc_configure_v3_mmu(PowerPCCPU * cpu,bool radix,bool gtse,uint64_t proc_tbl)250b4db5413SSuraj Jitindar Singh static inline target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
251b4db5413SSuraj Jitindar Singh bool radix, bool gtse,
252b4db5413SSuraj Jitindar Singh uint64_t proc_tbl)
253b4db5413SSuraj Jitindar Singh {
254b4db5413SSuraj Jitindar Singh return 0;
255b4db5413SSuraj Jitindar Singh }
256b4db5413SSuraj Jitindar Singh
kvmppc_set_reg_ppc_online(PowerPCCPU * cpu,unsigned int online)257a84f7179SNikunj A Dadhania static inline void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu,
258a84f7179SNikunj A Dadhania unsigned int online)
259a84f7179SNikunj A Dadhania {
260a84f7179SNikunj A Dadhania return;
261a84f7179SNikunj A Dadhania }
262a84f7179SNikunj A Dadhania
kvmppc_set_reg_tb_offset(PowerPCCPU * cpu,int64_t tb_offset)2639723295aSGreg Kurz static inline void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset)
2649723295aSGreg Kurz {
2659723295aSGreg Kurz }
2669723295aSGreg Kurz
kvmppc_spapr_use_multitce(void)267fcf5ef2aSThomas Huth static inline bool kvmppc_spapr_use_multitce(void)
268fcf5ef2aSThomas Huth {
269fcf5ef2aSThomas Huth return false;
270fcf5ef2aSThomas Huth }
271fcf5ef2aSThomas Huth
kvmppc_spapr_enable_inkernel_multitce(void)2723dc410aeSAlexey Kardashevskiy static inline int kvmppc_spapr_enable_inkernel_multitce(void)
2733dc410aeSAlexey Kardashevskiy {
2743dc410aeSAlexey Kardashevskiy return -1;
2753dc410aeSAlexey Kardashevskiy }
2763dc410aeSAlexey Kardashevskiy
kvmppc_create_spapr_tce(uint32_t liobn,uint32_t page_shift,uint64_t bus_offset,uint32_t nb_table,int * pfd,bool need_vfio)277d6ee2a7cSAlexey Kardashevskiy static inline void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
278d6ee2a7cSAlexey Kardashevskiy uint64_t bus_offset,
279d6ee2a7cSAlexey Kardashevskiy uint32_t nb_table,
280d6ee2a7cSAlexey Kardashevskiy int *pfd, bool need_vfio)
281fcf5ef2aSThomas Huth {
282fcf5ef2aSThomas Huth return NULL;
283fcf5ef2aSThomas Huth }
284fcf5ef2aSThomas Huth
kvmppc_remove_spapr_tce(void * table,int pfd,uint32_t nb_table)285fcf5ef2aSThomas Huth static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
286fcf5ef2aSThomas Huth uint32_t nb_table)
287fcf5ef2aSThomas Huth {
288fcf5ef2aSThomas Huth return -1;
289fcf5ef2aSThomas Huth }
290fcf5ef2aSThomas Huth
kvmppc_reset_htab(int shift_hint)291fcf5ef2aSThomas Huth static inline int kvmppc_reset_htab(int shift_hint)
292fcf5ef2aSThomas Huth {
293fcf5ef2aSThomas Huth return 0;
294fcf5ef2aSThomas Huth }
295fcf5ef2aSThomas Huth
kvmppc_vrma_limit(unsigned int hash_shift)2966a84737cSDavid Gibson static inline uint64_t kvmppc_vrma_limit(unsigned int hash_shift)
297fcf5ef2aSThomas Huth {
2986a84737cSDavid Gibson g_assert_not_reached();
299fcf5ef2aSThomas Huth }
300fcf5ef2aSThomas Huth
kvmppc_hpt_needs_host_contiguous_pages(void)30124c6863cSDavid Gibson static inline bool kvmppc_hpt_needs_host_contiguous_pages(void)
30224c6863cSDavid Gibson {
30324c6863cSDavid Gibson return false;
30424c6863cSDavid Gibson }
30524c6863cSDavid Gibson
kvm_check_mmu(PowerPCCPU * cpu,Error ** errp)306e5ca28ecSDavid Gibson static inline void kvm_check_mmu(PowerPCCPU *cpu, Error **errp)
307e5ca28ecSDavid Gibson {
308e5ca28ecSDavid Gibson }
309e5ca28ecSDavid Gibson
kvmppc_has_cap_spapr_vfio(void)3109ded780cSAlexey Kardashevskiy static inline bool kvmppc_has_cap_spapr_vfio(void)
3119ded780cSAlexey Kardashevskiy {
3129ded780cSAlexey Kardashevskiy return false;
3139ded780cSAlexey Kardashevskiy }
3149ded780cSAlexey Kardashevskiy
kvmppc_read_hptes(ppc_hash_pte64_t * hptes,hwaddr ptex,int n)315e89aac1aSPhilippe Mathieu-Daudé static inline void kvmppc_read_hptes(ppc_hash_pte64_t *hptes,
316e89aac1aSPhilippe Mathieu-Daudé hwaddr ptex, int n)
317e89aac1aSPhilippe Mathieu-Daudé {
318e89aac1aSPhilippe Mathieu-Daudé abort();
319e89aac1aSPhilippe Mathieu-Daudé }
320e89aac1aSPhilippe Mathieu-Daudé
kvmppc_write_hpte(hwaddr ptex,uint64_t pte0,uint64_t pte1)321e89aac1aSPhilippe Mathieu-Daudé static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1)
322e89aac1aSPhilippe Mathieu-Daudé {
323e89aac1aSPhilippe Mathieu-Daudé abort();
324e89aac1aSPhilippe Mathieu-Daudé }
325e89aac1aSPhilippe Mathieu-Daudé
kvmppc_has_cap_epr(void)326fcf5ef2aSThomas Huth static inline bool kvmppc_has_cap_epr(void)
327fcf5ef2aSThomas Huth {
328fcf5ef2aSThomas Huth return false;
329fcf5ef2aSThomas Huth }
330fcf5ef2aSThomas Huth
kvmppc_define_rtas_kernel_token(uint32_t token,const char * function)331fcf5ef2aSThomas Huth static inline int kvmppc_define_rtas_kernel_token(uint32_t token,
332fcf5ef2aSThomas Huth const char *function)
333fcf5ef2aSThomas Huth {
334fcf5ef2aSThomas Huth return -1;
335fcf5ef2aSThomas Huth }
336fcf5ef2aSThomas Huth
kvmppc_get_htab_fd(bool write,uint64_t index,Error ** errp)33714b0d748SGreg Kurz static inline int kvmppc_get_htab_fd(bool write, uint64_t index, Error **errp)
338fcf5ef2aSThomas Huth {
339fcf5ef2aSThomas Huth return -1;
340fcf5ef2aSThomas Huth }
341fcf5ef2aSThomas Huth
kvmppc_save_htab(QEMUFile * f,int fd,size_t bufsize,int64_t max_ns)342fcf5ef2aSThomas Huth static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
343fcf5ef2aSThomas Huth int64_t max_ns)
344fcf5ef2aSThomas Huth {
345fcf5ef2aSThomas Huth abort();
346fcf5ef2aSThomas Huth }
347fcf5ef2aSThomas Huth
kvmppc_load_htab_chunk(QEMUFile * f,int fd,uint32_t index,uint16_t n_valid,uint16_t n_invalid,Error ** errp)348fcf5ef2aSThomas Huth static inline int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
3490a06e4d6SGreg Kurz uint16_t n_valid, uint16_t n_invalid,
3500a06e4d6SGreg Kurz Error **errp)
351fcf5ef2aSThomas Huth {
352fcf5ef2aSThomas Huth abort();
353fcf5ef2aSThomas Huth }
354fcf5ef2aSThomas Huth
kvmppc_has_cap_fixup_hcalls(void)355fcf5ef2aSThomas Huth static inline bool kvmppc_has_cap_fixup_hcalls(void)
356fcf5ef2aSThomas Huth {
357fcf5ef2aSThomas Huth abort();
358fcf5ef2aSThomas Huth }
359fcf5ef2aSThomas Huth
kvmppc_has_cap_htm(void)360fcf5ef2aSThomas Huth static inline bool kvmppc_has_cap_htm(void)
361fcf5ef2aSThomas Huth {
362fcf5ef2aSThomas Huth return false;
363fcf5ef2aSThomas Huth }
364fcf5ef2aSThomas Huth
kvmppc_has_cap_mmu_radix(void)365cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_radix(void)
366cf1c4cceSSam Bobroff {
367cf1c4cceSSam Bobroff return false;
368cf1c4cceSSam Bobroff }
369cf1c4cceSSam Bobroff
kvmppc_has_cap_mmu_hash_v3(void)370cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_hash_v3(void)
371cf1c4cceSSam Bobroff {
372cf1c4cceSSam Bobroff return false;
373cf1c4cceSSam Bobroff }
374cf1c4cceSSam Bobroff
kvmppc_has_cap_xive(void)37538afd772SCédric Le Goater static inline bool kvmppc_has_cap_xive(void)
37638afd772SCédric Le Goater {
37738afd772SCédric Le Goater return false;
37838afd772SCédric Le Goater }
37938afd772SCédric Le Goater
kvmppc_get_cap_safe_cache(void)3808acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_cache(void)
3818acc2ae5SSuraj Jitindar Singh {
3828acc2ae5SSuraj Jitindar Singh return 0;
3838acc2ae5SSuraj Jitindar Singh }
3848acc2ae5SSuraj Jitindar Singh
kvmppc_get_cap_safe_bounds_check(void)3858acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_bounds_check(void)
3868acc2ae5SSuraj Jitindar Singh {
3878acc2ae5SSuraj Jitindar Singh return 0;
3888acc2ae5SSuraj Jitindar Singh }
3898acc2ae5SSuraj Jitindar Singh
kvmppc_get_cap_safe_indirect_branch(void)3908acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_indirect_branch(void)
3918acc2ae5SSuraj Jitindar Singh {
3928acc2ae5SSuraj Jitindar Singh return 0;
3938acc2ae5SSuraj Jitindar Singh }
3948acc2ae5SSuraj Jitindar Singh
kvmppc_get_cap_count_cache_flush_assist(void)3958ff43ee4SSuraj Jitindar Singh static inline int kvmppc_get_cap_count_cache_flush_assist(void)
3968ff43ee4SSuraj Jitindar Singh {
3978ff43ee4SSuraj Jitindar Singh return 0;
3988ff43ee4SSuraj Jitindar Singh }
3998ff43ee4SSuraj Jitindar Singh
kvmppc_has_cap_nested_kvm_hv(void)400b9a477b7SSuraj Jitindar Singh static inline bool kvmppc_has_cap_nested_kvm_hv(void)
401b9a477b7SSuraj Jitindar Singh {
402b9a477b7SSuraj Jitindar Singh return false;
403b9a477b7SSuraj Jitindar Singh }
404b9a477b7SSuraj Jitindar Singh
kvmppc_set_cap_nested_kvm_hv(int enable)405b9a477b7SSuraj Jitindar Singh static inline int kvmppc_set_cap_nested_kvm_hv(int enable)
406b9a477b7SSuraj Jitindar Singh {
407b9a477b7SSuraj Jitindar Singh return -1;
408b9a477b7SSuraj Jitindar Singh }
409b9a477b7SSuraj Jitindar Singh
kvmppc_get_cap_large_decr(void)4107d050527SSuraj Jitindar Singh static inline int kvmppc_get_cap_large_decr(void)
4117d050527SSuraj Jitindar Singh {
4127d050527SSuraj Jitindar Singh return 0;
4137d050527SSuraj Jitindar Singh }
4147d050527SSuraj Jitindar Singh
kvmppc_enable_cap_large_decr(PowerPCCPU * cpu,int enable)4157d050527SSuraj Jitindar Singh static inline int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable)
4167d050527SSuraj Jitindar Singh {
4177d050527SSuraj Jitindar Singh return -1;
4187d050527SSuraj Jitindar Singh }
4197d050527SSuraj Jitindar Singh
kvmppc_has_cap_rpt_invalidate(void)42082123b75SBharata B Rao static inline int kvmppc_has_cap_rpt_invalidate(void)
42182123b75SBharata B Rao {
42282123b75SBharata B Rao return false;
42382123b75SBharata B Rao }
42482123b75SBharata B Rao
kvmppc_supports_ail_3(void)425ccc5a4c5SNicholas Piggin static inline bool kvmppc_supports_ail_3(void)
426ccc5a4c5SNicholas Piggin {
427ccc5a4c5SNicholas Piggin return false;
428ccc5a4c5SNicholas Piggin }
429ccc5a4c5SNicholas Piggin
kvmppc_enable_hwrng(void)430fcf5ef2aSThomas Huth static inline int kvmppc_enable_hwrng(void)
431fcf5ef2aSThomas Huth {
432fcf5ef2aSThomas Huth return -1;
433fcf5ef2aSThomas Huth }
434fcf5ef2aSThomas Huth
kvmppc_put_books_sregs(PowerPCCPU * cpu)435fcf5ef2aSThomas Huth static inline int kvmppc_put_books_sregs(PowerPCCPU *cpu)
436fcf5ef2aSThomas Huth {
437fcf5ef2aSThomas Huth abort();
438fcf5ef2aSThomas Huth }
439fcf5ef2aSThomas Huth
kvm_ppc_get_host_cpu_class(void)440fcf5ef2aSThomas Huth static inline PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
441fcf5ef2aSThomas Huth {
442fcf5ef2aSThomas Huth return NULL;
443fcf5ef2aSThomas Huth }
444fcf5ef2aSThomas Huth
kvmppc_check_papr_resize_hpt(Error ** errp)44530f4b05bSDavid Gibson static inline void kvmppc_check_papr_resize_hpt(Error **errp)
44630f4b05bSDavid Gibson {
44730f4b05bSDavid Gibson return;
44830f4b05bSDavid Gibson }
449b55d295eSDavid Gibson
kvmppc_resize_hpt_prepare(PowerPCCPU * cpu,target_ulong flags,int shift)450b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu,
451b55d295eSDavid Gibson target_ulong flags, int shift)
452b55d295eSDavid Gibson {
453b55d295eSDavid Gibson return -ENOSYS;
454b55d295eSDavid Gibson }
455b55d295eSDavid Gibson
kvmppc_resize_hpt_commit(PowerPCCPU * cpu,target_ulong flags,int shift)456b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_commit(PowerPCCPU *cpu,
457b55d295eSDavid Gibson target_ulong flags, int shift)
458b55d295eSDavid Gibson {
459b55d295eSDavid Gibson return -ENOSYS;
460b55d295eSDavid Gibson }
461b55d295eSDavid Gibson
kvmppc_pvr_workaround_required(PowerPCCPU * cpu)462001d235cSGreg Kurz static inline bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu)
463001d235cSGreg Kurz {
464001d235cSGreg Kurz return false;
465001d235cSGreg Kurz }
466001d235cSGreg Kurz
467fcf5ef2aSThomas Huth #define kvmppc_eieio() do { } while (0)
468fcf5ef2aSThomas Huth
kvmppc_dcbst_range(PowerPCCPU * cpu,uint8_t * addr,int len)469fcf5ef2aSThomas Huth static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
470fcf5ef2aSThomas Huth {
471fcf5ef2aSThomas Huth }
472fcf5ef2aSThomas Huth
kvmppc_icbi_range(PowerPCCPU * cpu,uint8_t * addr,int len)473fcf5ef2aSThomas Huth static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
474fcf5ef2aSThomas Huth {
475fcf5ef2aSThomas Huth }
476fcf5ef2aSThomas Huth
477fcf5ef2aSThomas Huth #endif /* CONFIG_KVM */
478fcf5ef2aSThomas Huth
479fcf5ef2aSThomas Huth #endif /* KVM_PPC_H */
480