xref: /qemu/target/ppc/kvm_ppc.h (revision 019fbfa4bcd2d3a835c241295e22ab2b5b56129b)
1d76d1650Saurel32 /*
2d76d1650Saurel32  * Copyright 2008 IBM Corporation.
3d76d1650Saurel32  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
4d76d1650Saurel32  *
5d76d1650Saurel32  * This work is licensed under the GNU GPL license version 2 or later.
6d76d1650Saurel32  *
7d76d1650Saurel32  */
8d76d1650Saurel32 
92a6a4076SMarkus Armbruster #ifndef KVM_PPC_H
102a6a4076SMarkus Armbruster #define KVM_PPC_H
11d76d1650Saurel32 
1232cad1ffSPhilippe Mathieu-Daudé #include "system/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é 
20921e28dbSAlexander Graf #ifdef CONFIG_KVM
21921e28dbSAlexander Graf 
22dc333cd6SAlexander Graf uint32_t kvmppc_get_tbfreq(void);
23eadaada1SAlexander Graf uint64_t kvmppc_get_clockfreq(void);
24ef951443SNikunj A Dadhania bool kvmppc_get_host_model(char **buf);
25ef951443SNikunj A Dadhania bool kvmppc_get_host_serial(char **buf);
261a61a9aeSStuart Yoder int kvmppc_get_hasidle(CPUPPCState *env);
271328c2bfSAndreas Färber int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
281bc22652SAndreas Färber int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
29026bfd89SDavid Gibson void kvmppc_enable_logical_ci_hcalls(void);
30ef9971ddSAlexey Kardashevskiy void kvmppc_enable_set_mode_hcall(void);
315145ad4fSNathan Whitehorn 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);
341bc22652SAndreas Färber void kvmppc_set_papr(PowerPCCPU *cpu);
35d6e166c0SDavid Gibson int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr);
365b95b8b9SAlexander Graf 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);
39e97c3636SDavid Gibson 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);
4231f2cb8fSBharat Bhushan int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
4331f2cb8fSBharat Bhushan int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
4431f2cb8fSBharat Bhushan int kvmppc_set_tcr(PowerPCCPU *cpu);
4531f2cb8fSBharat Bhushan 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);
49da95324eSAlexey Kardashevskiy 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);
540f5cb298SDavid Gibson int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
557f763a5dSDavid Gibson 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);
583b961124SStuart Yoder bool kvmppc_has_cap_epr(void);
59feaa64c4SDavid Gibson 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);
61e68cb8b4SAlexey Kardashevskiy int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns);
62e68cb8b4SAlexey Kardashevskiy 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);
6687a91de6SAlexander Graf bool kvmppc_has_cap_fixup_hcalls(void);
67bac3bf28SThomas 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);
71*5f361ea1SShivaprasad G Bhat bool kvmppc_has_cap_dawr1(void);
72*5f361ea1SShivaprasad G Bhat int kvmppc_set_cap_dawr1(int enable);
738acc2ae5SSuraj Jitindar Singh int kvmppc_get_cap_safe_cache(void);
748acc2ae5SSuraj Jitindar Singh int kvmppc_get_cap_safe_bounds_check(void);
758acc2ae5SSuraj Jitindar Singh int kvmppc_get_cap_safe_indirect_branch(void);
768ff43ee4SSuraj Jitindar Singh int kvmppc_get_cap_count_cache_flush_assist(void);
77b9a477b7SSuraj Jitindar Singh bool kvmppc_has_cap_nested_kvm_hv(void);
78b9a477b7SSuraj Jitindar Singh int kvmppc_set_cap_nested_kvm_hv(int enable);
797d050527SSuraj Jitindar Singh int kvmppc_get_cap_large_decr(void);
807d050527SSuraj Jitindar Singh int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable);
8182123b75SBharata B Rao int kvmppc_has_cap_rpt_invalidate(void);
82ccc5a4c5SNicholas Piggin bool kvmppc_supports_ail_3(void);
834d9392beSThomas Huth int kvmppc_enable_hwrng(void);
84e5c0d3ceSDavid Gibson int kvmppc_put_books_sregs(PowerPCCPU *cpu);
8552b2519cSThomas Huth PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void);
8630f4b05bSDavid Gibson void kvmppc_check_papr_resize_hpt(Error **errp);
87b55d295eSDavid Gibson int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu, target_ulong flags, int shift);
88b55d295eSDavid Gibson int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, target_ulong flags, int shift);
89c363a37aSDaniel Henrique Barboza bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu);
90c1385933SAneesh Kumar K.V 
9124c6863cSDavid Gibson bool kvmppc_hpt_needs_host_contiguous_pages(void);
92e5ca28ecSDavid Gibson void kvm_check_mmu(PowerPCCPU *cpu, Error **errp);
93a84f7179SNikunj A Dadhania void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online);
949723295aSGreg Kurz void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);
95df587133SThomas Huth 
969ac703acSAravinda Prasad int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);
979ac703acSAravinda Prasad 
981b4b1bb5SPhilippe Mathieu-Daudé #define kvmppc_eieio() \
991b4b1bb5SPhilippe Mathieu-Daudé     do {                                          \
1001b4b1bb5SPhilippe Mathieu-Daudé         if (kvm_enabled()) {                          \
1011b4b1bb5SPhilippe Mathieu-Daudé             asm volatile("eieio" : : : "memory"); \
1021b4b1bb5SPhilippe Mathieu-Daudé         } \
1031b4b1bb5SPhilippe Mathieu-Daudé     } while (0)
1041b4b1bb5SPhilippe Mathieu-Daudé 
1051b4b1bb5SPhilippe Mathieu-Daudé /* Store data cache blocks back to memory */
kvmppc_dcbst_range(PowerPCCPU * cpu,uint8_t * addr,int len)1061b4b1bb5SPhilippe Mathieu-Daudé static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
1071b4b1bb5SPhilippe Mathieu-Daudé {
1081b4b1bb5SPhilippe Mathieu-Daudé     uint8_t *p;
1091b4b1bb5SPhilippe Mathieu-Daudé 
1101b4b1bb5SPhilippe Mathieu-Daudé     for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) {
1111b4b1bb5SPhilippe Mathieu-Daudé         asm volatile("dcbst 0,%0" : : "r"(p) : "memory");
1121b4b1bb5SPhilippe Mathieu-Daudé     }
1131b4b1bb5SPhilippe Mathieu-Daudé }
1141b4b1bb5SPhilippe Mathieu-Daudé 
1151b4b1bb5SPhilippe Mathieu-Daudé /* Invalidate instruction cache blocks */
kvmppc_icbi_range(PowerPCCPU * cpu,uint8_t * addr,int len)1161b4b1bb5SPhilippe Mathieu-Daudé static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
1171b4b1bb5SPhilippe Mathieu-Daudé {
1181b4b1bb5SPhilippe Mathieu-Daudé     uint8_t *p;
1191b4b1bb5SPhilippe Mathieu-Daudé 
1201b4b1bb5SPhilippe Mathieu-Daudé     for (p = addr; p < addr + len; p += cpu->env.icache_line_size) {
1211b4b1bb5SPhilippe Mathieu-Daudé         asm volatile("icbi 0,%0" : : "r"(p));
1221b4b1bb5SPhilippe Mathieu-Daudé     }
1231b4b1bb5SPhilippe Mathieu-Daudé }
1241b4b1bb5SPhilippe Mathieu-Daudé 
1251b4b1bb5SPhilippe Mathieu-Daudé #else /* !CONFIG_KVM */
126921e28dbSAlexander Graf 
kvmppc_get_tbfreq(void)127921e28dbSAlexander Graf static inline uint32_t kvmppc_get_tbfreq(void)
128921e28dbSAlexander Graf {
129921e28dbSAlexander Graf     return 0;
130921e28dbSAlexander Graf }
131921e28dbSAlexander Graf 
kvmppc_get_host_model(char ** buf)132ef951443SNikunj A Dadhania static inline bool kvmppc_get_host_model(char **buf)
133ef951443SNikunj A Dadhania {
134ef951443SNikunj A Dadhania     return false;
135ef951443SNikunj A Dadhania }
136ef951443SNikunj A Dadhania 
kvmppc_get_host_serial(char ** buf)137ef951443SNikunj A Dadhania static inline bool kvmppc_get_host_serial(char **buf)
138ef951443SNikunj A Dadhania {
139ef951443SNikunj A Dadhania     return false;
140ef951443SNikunj A Dadhania }
141ef951443SNikunj A Dadhania 
kvmppc_get_clockfreq(void)142921e28dbSAlexander Graf static inline uint64_t kvmppc_get_clockfreq(void)
143921e28dbSAlexander Graf {
144921e28dbSAlexander Graf     return 0;
145921e28dbSAlexander Graf }
146921e28dbSAlexander Graf 
kvmppc_get_vmx(void)1476659394fSDavid Gibson static inline uint32_t kvmppc_get_vmx(void)
1486659394fSDavid Gibson {
1496659394fSDavid Gibson     return 0;
1506659394fSDavid Gibson }
1516659394fSDavid Gibson 
kvmppc_get_dfp(void)1526659394fSDavid Gibson static inline uint32_t kvmppc_get_dfp(void)
1536659394fSDavid Gibson {
1546659394fSDavid Gibson     return 0;
1556659394fSDavid Gibson }
1566659394fSDavid Gibson 
kvmppc_get_hasidle(CPUPPCState * env)1571a61a9aeSStuart Yoder static inline int kvmppc_get_hasidle(CPUPPCState *env)
1581a61a9aeSStuart Yoder {
1591a61a9aeSStuart Yoder     return 0;
1601a61a9aeSStuart Yoder }
1611a61a9aeSStuart Yoder 
kvmppc_get_hypercall(CPUPPCState * env,uint8_t * buf,int buf_len)162c995e942SDavid Gibson static inline int kvmppc_get_hypercall(CPUPPCState *env,
163c995e942SDavid Gibson                                        uint8_t *buf, int buf_len)
164921e28dbSAlexander Graf {
165921e28dbSAlexander Graf     return -1;
166921e28dbSAlexander Graf }
167921e28dbSAlexander Graf 
kvmppc_set_interrupt(PowerPCCPU * cpu,int irq,int level)1681bc22652SAndreas Färber static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
169921e28dbSAlexander Graf {
170921e28dbSAlexander Graf     return -1;
171921e28dbSAlexander Graf }
172921e28dbSAlexander Graf 
kvmppc_enable_logical_ci_hcalls(void)173026bfd89SDavid Gibson static inline void kvmppc_enable_logical_ci_hcalls(void)
174026bfd89SDavid Gibson {
175026bfd89SDavid Gibson }
176026bfd89SDavid Gibson 
kvmppc_enable_set_mode_hcall(void)177ef9971ddSAlexey Kardashevskiy static inline void kvmppc_enable_set_mode_hcall(void)
178ef9971ddSAlexey Kardashevskiy {
179ef9971ddSAlexey Kardashevskiy }
180ef9971ddSAlexey Kardashevskiy 
kvmppc_enable_clear_ref_mod_hcalls(void)1815145ad4fSNathan Whitehorn static inline void kvmppc_enable_clear_ref_mod_hcalls(void)
1825145ad4fSNathan Whitehorn {
1835145ad4fSNathan Whitehorn }
1845145ad4fSNathan Whitehorn 
kvmppc_enable_h_page_init(void)18568f9f708SSuraj Jitindar Singh static inline void kvmppc_enable_h_page_init(void)
18668f9f708SSuraj Jitindar Singh {
18768f9f708SSuraj Jitindar Singh }
18868f9f708SSuraj Jitindar Singh 
kvmppc_enable_h_rpt_invalidate(void)18982123b75SBharata B Rao static inline void kvmppc_enable_h_rpt_invalidate(void)
19082123b75SBharata B Rao {
19182123b75SBharata B Rao     g_assert_not_reached();
19282123b75SBharata B Rao }
19382123b75SBharata B Rao 
kvmppc_set_papr(PowerPCCPU * cpu)1941bc22652SAndreas Färber static inline void kvmppc_set_papr(PowerPCCPU *cpu)
195f61b4bedSAlexander Graf {
196f61b4bedSAlexander Graf }
197f61b4bedSAlexander Graf 
kvmppc_set_compat(PowerPCCPU * cpu,uint32_t compat_pvr)198d6e166c0SDavid Gibson static inline int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr)
1996db5bb0fSAlexey Kardashevskiy {
2006db5bb0fSAlexey Kardashevskiy     return 0;
2016db5bb0fSAlexey Kardashevskiy }
2026db5bb0fSAlexey Kardashevskiy 
kvmppc_set_mpic_proxy(PowerPCCPU * cpu,int mpic_proxy)2035b95b8b9SAlexander Graf static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
2045b95b8b9SAlexander Graf {
2055b95b8b9SAlexander Graf }
2065b95b8b9SAlexander Graf 
kvmppc_get_fwnmi(void)207ec010c00SNicholas Piggin static inline bool kvmppc_get_fwnmi(void)
208ec010c00SNicholas Piggin {
209ec010c00SNicholas Piggin     return false;
210ec010c00SNicholas Piggin }
211ec010c00SNicholas Piggin 
kvmppc_set_fwnmi(PowerPCCPU * cpu)212aef92d87SLaurent Vivier static inline int kvmppc_set_fwnmi(PowerPCCPU *cpu)
2139d953ce4SAravinda Prasad {
2149d953ce4SAravinda Prasad     return -1;
2159d953ce4SAravinda Prasad }
2169d953ce4SAravinda Prasad 
kvmppc_smt_threads(void)217e97c3636SDavid Gibson static inline int kvmppc_smt_threads(void)
218e97c3636SDavid Gibson {
219e97c3636SDavid Gibson     return 1;
220e97c3636SDavid Gibson }
221e97c3636SDavid Gibson 
kvmppc_error_append_smt_possible_hint(Error * const * errp)2220c115681SVladimir Sementsov-Ogievskiy static inline void kvmppc_error_append_smt_possible_hint(Error *const *errp)
223fa98fbfcSSam Bobroff {
224fa98fbfcSSam Bobroff }
225fa98fbfcSSam Bobroff 
kvmppc_set_smt_threads(int smt)226fa98fbfcSSam Bobroff static inline int kvmppc_set_smt_threads(int smt)
227fa98fbfcSSam Bobroff {
228fa98fbfcSSam Bobroff     return 0;
229fa98fbfcSSam Bobroff }
230fa98fbfcSSam Bobroff 
kvmppc_or_tsr_bits(PowerPCCPU * cpu,uint32_t tsr_bits)23131f2cb8fSBharat Bhushan static inline int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
23231f2cb8fSBharat Bhushan {
23331f2cb8fSBharat Bhushan     return 0;
23431f2cb8fSBharat Bhushan }
23531f2cb8fSBharat Bhushan 
kvmppc_clear_tsr_bits(PowerPCCPU * cpu,uint32_t tsr_bits)23631f2cb8fSBharat Bhushan static inline int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
23731f2cb8fSBharat Bhushan {
23831f2cb8fSBharat Bhushan     return 0;
23931f2cb8fSBharat Bhushan }
24031f2cb8fSBharat Bhushan 
kvmppc_set_tcr(PowerPCCPU * cpu)24131f2cb8fSBharat Bhushan static inline int kvmppc_set_tcr(PowerPCCPU *cpu)
24231f2cb8fSBharat Bhushan {
24331f2cb8fSBharat Bhushan     return 0;
24431f2cb8fSBharat Bhushan }
24531f2cb8fSBharat Bhushan 
kvmppc_booke_watchdog_enable(PowerPCCPU * cpu)24631f2cb8fSBharat Bhushan static inline int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu)
24731f2cb8fSBharat Bhushan {
24831f2cb8fSBharat Bhushan     return -1;
24931f2cb8fSBharat Bhushan }
25031f2cb8fSBharat Bhushan 
kvmppc_configure_v3_mmu(PowerPCCPU * cpu,bool radix,bool gtse,uint64_t proc_tbl)251b4db5413SSuraj Jitindar Singh static inline target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
252b4db5413SSuraj Jitindar Singh                                      bool radix, bool gtse,
253b4db5413SSuraj Jitindar Singh                                      uint64_t proc_tbl)
254b4db5413SSuraj Jitindar Singh {
255b4db5413SSuraj Jitindar Singh     return 0;
256b4db5413SSuraj Jitindar Singh }
257b4db5413SSuraj Jitindar Singh 
kvmppc_set_reg_ppc_online(PowerPCCPU * cpu,unsigned int online)258a84f7179SNikunj A Dadhania static inline void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu,
259a84f7179SNikunj A Dadhania                                              unsigned int online)
260a84f7179SNikunj A Dadhania {
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)267da95324eSAlexey Kardashevskiy static inline bool kvmppc_spapr_use_multitce(void)
268da95324eSAlexey Kardashevskiy {
269da95324eSAlexey Kardashevskiy     return false;
270da95324eSAlexey Kardashevskiy }
271da95324eSAlexey Kardashevskiy 
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)
2810f5cb298SDavid Gibson {
2820f5cb298SDavid Gibson     return NULL;
2830f5cb298SDavid Gibson }
2840f5cb298SDavid Gibson 
kvmppc_remove_spapr_tce(void * table,int pfd,uint32_t nb_table)2850f5cb298SDavid Gibson static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
286523e7b8aSAlexey Kardashevskiy                                           uint32_t nb_table)
2870f5cb298SDavid Gibson {
2880f5cb298SDavid Gibson     return -1;
2890f5cb298SDavid Gibson }
2907f763a5dSDavid Gibson 
kvmppc_reset_htab(int shift_hint)2917f763a5dSDavid Gibson static inline int kvmppc_reset_htab(int shift_hint)
2927f763a5dSDavid Gibson {
293a3166f8fSBharata B Rao     return 0;
2947f763a5dSDavid Gibson }
2957f763a5dSDavid Gibson 
kvmppc_vrma_limit(unsigned int hash_shift)2966a84737cSDavid Gibson static inline uint64_t kvmppc_vrma_limit(unsigned int hash_shift)
2977f763a5dSDavid Gibson {
2986a84737cSDavid Gibson     g_assert_not_reached();
2997f763a5dSDavid Gibson }
3007f763a5dSDavid Gibson 
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)3263b961124SStuart Yoder static inline bool kvmppc_has_cap_epr(void)
3273b961124SStuart Yoder {
3283b961124SStuart Yoder     return false;
3293b961124SStuart Yoder }
330e68cb8b4SAlexey Kardashevskiy 
kvmppc_define_rtas_kernel_token(uint32_t token,const char * function)331feaa64c4SDavid Gibson static inline int kvmppc_define_rtas_kernel_token(uint32_t token,
332feaa64c4SDavid Gibson                                                   const char *function)
333feaa64c4SDavid Gibson {
334feaa64c4SDavid Gibson     return -1;
335feaa64c4SDavid Gibson }
336feaa64c4SDavid Gibson 
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)
338e68cb8b4SAlexey Kardashevskiy {
339e68cb8b4SAlexey Kardashevskiy     return -1;
340e68cb8b4SAlexey Kardashevskiy }
341e68cb8b4SAlexey Kardashevskiy 
kvmppc_save_htab(QEMUFile * f,int fd,size_t bufsize,int64_t max_ns)342e68cb8b4SAlexey Kardashevskiy static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
343e68cb8b4SAlexey Kardashevskiy                                    int64_t max_ns)
344e68cb8b4SAlexey Kardashevskiy {
345e68cb8b4SAlexey Kardashevskiy     abort();
346e68cb8b4SAlexey Kardashevskiy }
347e68cb8b4SAlexey Kardashevskiy 
kvmppc_load_htab_chunk(QEMUFile * f,int fd,uint32_t index,uint16_t n_valid,uint16_t n_invalid,Error ** errp)348e68cb8b4SAlexey Kardashevskiy 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)
351e68cb8b4SAlexey Kardashevskiy {
352e68cb8b4SAlexey Kardashevskiy     abort();
353e68cb8b4SAlexey Kardashevskiy }
354e68cb8b4SAlexey Kardashevskiy 
kvmppc_has_cap_fixup_hcalls(void)35587a91de6SAlexander Graf static inline bool kvmppc_has_cap_fixup_hcalls(void)
35687a91de6SAlexander Graf {
35787a91de6SAlexander Graf     abort();
35887a91de6SAlexander Graf }
35987a91de6SAlexander Graf 
kvmppc_has_cap_htm(void)360bac3bf28SThomas Huth static inline bool kvmppc_has_cap_htm(void)
361bac3bf28SThomas Huth {
362bac3bf28SThomas Huth     return false;
363bac3bf28SThomas Huth }
364bac3bf28SThomas 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_has_cap_dawr1(void)380*5f361ea1SShivaprasad G Bhat static inline bool kvmppc_has_cap_dawr1(void)
381*5f361ea1SShivaprasad G Bhat {
382*5f361ea1SShivaprasad G Bhat     return false;
383*5f361ea1SShivaprasad G Bhat }
384*5f361ea1SShivaprasad G Bhat 
kvmppc_set_cap_dawr1(int enable)385*5f361ea1SShivaprasad G Bhat static inline int kvmppc_set_cap_dawr1(int enable)
386*5f361ea1SShivaprasad G Bhat {
387*5f361ea1SShivaprasad G Bhat     abort();
388*5f361ea1SShivaprasad G Bhat }
389*5f361ea1SShivaprasad G Bhat 
kvmppc_get_cap_safe_cache(void)3908acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_cache(void)
3918acc2ae5SSuraj Jitindar Singh {
3928acc2ae5SSuraj Jitindar Singh     return 0;
3938acc2ae5SSuraj Jitindar Singh }
3948acc2ae5SSuraj Jitindar Singh 
kvmppc_get_cap_safe_bounds_check(void)3958acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_bounds_check(void)
3968acc2ae5SSuraj Jitindar Singh {
3978acc2ae5SSuraj Jitindar Singh     return 0;
3988acc2ae5SSuraj Jitindar Singh }
3998acc2ae5SSuraj Jitindar Singh 
kvmppc_get_cap_safe_indirect_branch(void)4008acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_indirect_branch(void)
4018acc2ae5SSuraj Jitindar Singh {
4028acc2ae5SSuraj Jitindar Singh     return 0;
4038acc2ae5SSuraj Jitindar Singh }
4048acc2ae5SSuraj Jitindar Singh 
kvmppc_get_cap_count_cache_flush_assist(void)4058ff43ee4SSuraj Jitindar Singh static inline int kvmppc_get_cap_count_cache_flush_assist(void)
4068ff43ee4SSuraj Jitindar Singh {
4078ff43ee4SSuraj Jitindar Singh     return 0;
4088ff43ee4SSuraj Jitindar Singh }
4098ff43ee4SSuraj Jitindar Singh 
kvmppc_has_cap_nested_kvm_hv(void)410b9a477b7SSuraj Jitindar Singh static inline bool kvmppc_has_cap_nested_kvm_hv(void)
411b9a477b7SSuraj Jitindar Singh {
412b9a477b7SSuraj Jitindar Singh     return false;
413b9a477b7SSuraj Jitindar Singh }
414b9a477b7SSuraj Jitindar Singh 
kvmppc_set_cap_nested_kvm_hv(int enable)415b9a477b7SSuraj Jitindar Singh static inline int kvmppc_set_cap_nested_kvm_hv(int enable)
416b9a477b7SSuraj Jitindar Singh {
417b9a477b7SSuraj Jitindar Singh     return -1;
418b9a477b7SSuraj Jitindar Singh }
419b9a477b7SSuraj Jitindar Singh 
kvmppc_get_cap_large_decr(void)4207d050527SSuraj Jitindar Singh static inline int kvmppc_get_cap_large_decr(void)
4217d050527SSuraj Jitindar Singh {
4227d050527SSuraj Jitindar Singh     return 0;
4237d050527SSuraj Jitindar Singh }
4247d050527SSuraj Jitindar Singh 
kvmppc_enable_cap_large_decr(PowerPCCPU * cpu,int enable)4257d050527SSuraj Jitindar Singh static inline int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable)
4267d050527SSuraj Jitindar Singh {
4277d050527SSuraj Jitindar Singh     return -1;
4287d050527SSuraj Jitindar Singh }
4297d050527SSuraj Jitindar Singh 
kvmppc_has_cap_rpt_invalidate(void)43082123b75SBharata B Rao static inline int kvmppc_has_cap_rpt_invalidate(void)
43182123b75SBharata B Rao {
43282123b75SBharata B Rao     return false;
43382123b75SBharata B Rao }
43482123b75SBharata B Rao 
kvmppc_supports_ail_3(void)435ccc5a4c5SNicholas Piggin static inline bool kvmppc_supports_ail_3(void)
436ccc5a4c5SNicholas Piggin {
437ccc5a4c5SNicholas Piggin     return false;
438ccc5a4c5SNicholas Piggin }
439ccc5a4c5SNicholas Piggin 
kvmppc_enable_hwrng(void)4404d9392beSThomas Huth static inline int kvmppc_enable_hwrng(void)
4414d9392beSThomas Huth {
4424d9392beSThomas Huth     return -1;
4434d9392beSThomas Huth }
444e5c0d3ceSDavid Gibson 
kvmppc_put_books_sregs(PowerPCCPU * cpu)445e5c0d3ceSDavid Gibson static inline int kvmppc_put_books_sregs(PowerPCCPU *cpu)
446e5c0d3ceSDavid Gibson {
447e5c0d3ceSDavid Gibson     abort();
448e5c0d3ceSDavid Gibson }
44952b2519cSThomas Huth 
kvm_ppc_get_host_cpu_class(void)45052b2519cSThomas Huth static inline PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
45152b2519cSThomas Huth {
45252b2519cSThomas Huth     return NULL;
45352b2519cSThomas Huth }
45452b2519cSThomas Huth 
kvmppc_check_papr_resize_hpt(Error ** errp)45530f4b05bSDavid Gibson static inline void kvmppc_check_papr_resize_hpt(Error **errp)
45630f4b05bSDavid Gibson {
45730f4b05bSDavid Gibson }
458b55d295eSDavid Gibson 
kvmppc_resize_hpt_prepare(PowerPCCPU * cpu,target_ulong flags,int shift)459b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu,
460b55d295eSDavid Gibson                                             target_ulong flags, int shift)
461b55d295eSDavid Gibson {
462b55d295eSDavid Gibson     return -ENOSYS;
463b55d295eSDavid Gibson }
464b55d295eSDavid Gibson 
kvmppc_resize_hpt_commit(PowerPCCPU * cpu,target_ulong flags,int shift)465b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_commit(PowerPCCPU *cpu,
466b55d295eSDavid Gibson                                            target_ulong flags, int shift)
467b55d295eSDavid Gibson {
468b55d295eSDavid Gibson     return -ENOSYS;
469b55d295eSDavid Gibson }
470b55d295eSDavid Gibson 
kvmppc_pvr_workaround_required(PowerPCCPU * cpu)471001d235cSGreg Kurz static inline bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu)
472001d235cSGreg Kurz {
473001d235cSGreg Kurz     return false;
474001d235cSGreg Kurz }
475001d235cSGreg Kurz 
476b45d63b6SBen Herrenschmidt #define kvmppc_eieio() do { } while (0)
4773240dd9aSThomas Huth 
kvmppc_dcbst_range(PowerPCCPU * cpu,uint8_t * addr,int len)4783240dd9aSThomas Huth static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
4793240dd9aSThomas Huth {
4803240dd9aSThomas Huth }
4813240dd9aSThomas Huth 
kvmppc_icbi_range(PowerPCCPU * cpu,uint8_t * addr,int len)4823240dd9aSThomas Huth static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
4833240dd9aSThomas Huth {
4843240dd9aSThomas Huth }
4853240dd9aSThomas Huth 
4863240dd9aSThomas Huth #endif  /* CONFIG_KVM */
487b45d63b6SBen Herrenschmidt 
4882a6a4076SMarkus Armbruster #endif /* KVM_PPC_H */
489