xref: /qemu/target/ppc/kvm_ppc.h (revision 1b4b1bb5064dc08df6fd4ce9813b5f3370eda085)
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 
12597645ccSPhilippe Mathieu-Daudé #include "sysemu/kvm.h"
13308fd181SPhilippe Mathieu-Daudé #include "exec/hwaddr.h"
14308fd181SPhilippe Mathieu-Daudé #include "cpu.h"
15308fd181SPhilippe Mathieu-Daudé 
16c9137065SIgor Mammedov #define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host")
172985b86bSAndreas Färber 
18921e28dbSAlexander Graf #ifdef CONFIG_KVM
19921e28dbSAlexander Graf 
20dc333cd6SAlexander Graf uint32_t kvmppc_get_tbfreq(void);
21eadaada1SAlexander Graf uint64_t kvmppc_get_clockfreq(void);
22ef951443SNikunj A Dadhania bool kvmppc_get_host_model(char **buf);
23ef951443SNikunj A Dadhania bool kvmppc_get_host_serial(char **buf);
241a61a9aeSStuart Yoder int kvmppc_get_hasidle(CPUPPCState *env);
251328c2bfSAndreas Färber int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
261bc22652SAndreas Färber int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
27026bfd89SDavid Gibson void kvmppc_enable_logical_ci_hcalls(void);
28ef9971ddSAlexey Kardashevskiy void kvmppc_enable_set_mode_hcall(void);
295145ad4fSNathan Whitehorn void kvmppc_enable_clear_ref_mod_hcalls(void);
3068f9f708SSuraj Jitindar Singh void kvmppc_enable_h_page_init(void);
3182123b75SBharata B Rao void kvmppc_enable_h_rpt_invalidate(void);
321bc22652SAndreas Färber void kvmppc_set_papr(PowerPCCPU *cpu);
33d6e166c0SDavid Gibson int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr);
345b95b8b9SAlexander Graf void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
35ec010c00SNicholas Piggin bool kvmppc_get_fwnmi(void);
36aef92d87SLaurent Vivier int kvmppc_set_fwnmi(PowerPCCPU *cpu);
37e97c3636SDavid Gibson int kvmppc_smt_threads(void);
380c115681SVladimir Sementsov-Ogievskiy void kvmppc_error_append_smt_possible_hint(Error *const *errp);
39fa98fbfcSSam Bobroff int kvmppc_set_smt_threads(int smt);
4031f2cb8fSBharat Bhushan int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
4131f2cb8fSBharat Bhushan int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits);
4231f2cb8fSBharat Bhushan int kvmppc_set_tcr(PowerPCCPU *cpu);
4331f2cb8fSBharat Bhushan int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);
44b4db5413SSuraj Jitindar Singh target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
45b4db5413SSuraj Jitindar Singh                                      bool radix, bool gtse,
46b4db5413SSuraj Jitindar Singh                                      uint64_t proc_tbl);
4798efaf75SDavid Gibson #ifndef CONFIG_USER_ONLY
48da95324eSAlexey Kardashevskiy bool kvmppc_spapr_use_multitce(void);
493dc410aeSAlexey Kardashevskiy int kvmppc_spapr_enable_inkernel_multitce(void);
50d6ee2a7cSAlexey Kardashevskiy void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
51d6ee2a7cSAlexey Kardashevskiy                               uint64_t bus_offset, uint32_t nb_table,
52d6ee2a7cSAlexey Kardashevskiy                               int *pfd, bool need_vfio);
530f5cb298SDavid Gibson int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
547f763a5dSDavid Gibson int kvmppc_reset_htab(int shift_hint);
556a84737cSDavid Gibson uint64_t kvmppc_vrma_limit(unsigned int hash_shift);
569ded780cSAlexey Kardashevskiy bool kvmppc_has_cap_spapr_vfio(void);
5798efaf75SDavid Gibson #endif /* !CONFIG_USER_ONLY */
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);
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);
814d9392beSThomas Huth int kvmppc_enable_hwrng(void);
82e5c0d3ceSDavid Gibson int kvmppc_put_books_sregs(PowerPCCPU *cpu);
8352b2519cSThomas 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);
88c1385933SAneesh Kumar K.V 
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 
96*1b4b1bb5SPhilippe Mathieu-Daudé #define kvmppc_eieio() \
97*1b4b1bb5SPhilippe Mathieu-Daudé     do {                                          \
98*1b4b1bb5SPhilippe Mathieu-Daudé         if (kvm_enabled()) {                          \
99*1b4b1bb5SPhilippe Mathieu-Daudé             asm volatile("eieio" : : : "memory"); \
100*1b4b1bb5SPhilippe Mathieu-Daudé         } \
101*1b4b1bb5SPhilippe Mathieu-Daudé     } while (0)
102*1b4b1bb5SPhilippe Mathieu-Daudé 
103*1b4b1bb5SPhilippe Mathieu-Daudé /* Store data cache blocks back to memory */
104*1b4b1bb5SPhilippe Mathieu-Daudé static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
105*1b4b1bb5SPhilippe Mathieu-Daudé {
106*1b4b1bb5SPhilippe Mathieu-Daudé     uint8_t *p;
107*1b4b1bb5SPhilippe Mathieu-Daudé 
108*1b4b1bb5SPhilippe Mathieu-Daudé     for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) {
109*1b4b1bb5SPhilippe Mathieu-Daudé         asm volatile("dcbst 0,%0" : : "r"(p) : "memory");
110*1b4b1bb5SPhilippe Mathieu-Daudé     }
111*1b4b1bb5SPhilippe Mathieu-Daudé }
112*1b4b1bb5SPhilippe Mathieu-Daudé 
113*1b4b1bb5SPhilippe Mathieu-Daudé /* Invalidate instruction cache blocks */
114*1b4b1bb5SPhilippe Mathieu-Daudé static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
115*1b4b1bb5SPhilippe Mathieu-Daudé {
116*1b4b1bb5SPhilippe Mathieu-Daudé     uint8_t *p;
117*1b4b1bb5SPhilippe Mathieu-Daudé 
118*1b4b1bb5SPhilippe Mathieu-Daudé     for (p = addr; p < addr + len; p += cpu->env.icache_line_size) {
119*1b4b1bb5SPhilippe Mathieu-Daudé         asm volatile("icbi 0,%0" : : "r"(p));
120*1b4b1bb5SPhilippe Mathieu-Daudé     }
121*1b4b1bb5SPhilippe Mathieu-Daudé }
122*1b4b1bb5SPhilippe Mathieu-Daudé 
123*1b4b1bb5SPhilippe Mathieu-Daudé #else /* !CONFIG_KVM */
124921e28dbSAlexander Graf 
125921e28dbSAlexander Graf static inline uint32_t kvmppc_get_tbfreq(void)
126921e28dbSAlexander Graf {
127921e28dbSAlexander Graf     return 0;
128921e28dbSAlexander Graf }
129921e28dbSAlexander Graf 
130ef951443SNikunj A Dadhania static inline bool kvmppc_get_host_model(char **buf)
131ef951443SNikunj A Dadhania {
132ef951443SNikunj A Dadhania     return false;
133ef951443SNikunj A Dadhania }
134ef951443SNikunj A Dadhania 
135ef951443SNikunj A Dadhania static inline bool kvmppc_get_host_serial(char **buf)
136ef951443SNikunj A Dadhania {
137ef951443SNikunj A Dadhania     return false;
138ef951443SNikunj A Dadhania }
139ef951443SNikunj A Dadhania 
140921e28dbSAlexander Graf static inline uint64_t kvmppc_get_clockfreq(void)
141921e28dbSAlexander Graf {
142921e28dbSAlexander Graf     return 0;
143921e28dbSAlexander Graf }
144921e28dbSAlexander Graf 
1456659394fSDavid Gibson static inline uint32_t kvmppc_get_vmx(void)
1466659394fSDavid Gibson {
1476659394fSDavid Gibson     return 0;
1486659394fSDavid Gibson }
1496659394fSDavid Gibson 
1506659394fSDavid Gibson static inline uint32_t kvmppc_get_dfp(void)
1516659394fSDavid Gibson {
1526659394fSDavid Gibson     return 0;
1536659394fSDavid Gibson }
1546659394fSDavid Gibson 
1551a61a9aeSStuart Yoder static inline int kvmppc_get_hasidle(CPUPPCState *env)
1561a61a9aeSStuart Yoder {
1571a61a9aeSStuart Yoder     return 0;
1581a61a9aeSStuart Yoder }
1591a61a9aeSStuart Yoder 
160c995e942SDavid Gibson static inline int kvmppc_get_hypercall(CPUPPCState *env,
161c995e942SDavid Gibson                                        uint8_t *buf, int buf_len)
162921e28dbSAlexander Graf {
163921e28dbSAlexander Graf     return -1;
164921e28dbSAlexander Graf }
165921e28dbSAlexander Graf 
1661bc22652SAndreas Färber static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
167921e28dbSAlexander Graf {
168921e28dbSAlexander Graf     return -1;
169921e28dbSAlexander Graf }
170921e28dbSAlexander Graf 
171026bfd89SDavid Gibson static inline void kvmppc_enable_logical_ci_hcalls(void)
172026bfd89SDavid Gibson {
173026bfd89SDavid Gibson }
174026bfd89SDavid Gibson 
175ef9971ddSAlexey Kardashevskiy static inline void kvmppc_enable_set_mode_hcall(void)
176ef9971ddSAlexey Kardashevskiy {
177ef9971ddSAlexey Kardashevskiy }
178ef9971ddSAlexey Kardashevskiy 
1795145ad4fSNathan Whitehorn static inline void kvmppc_enable_clear_ref_mod_hcalls(void)
1805145ad4fSNathan Whitehorn {
1815145ad4fSNathan Whitehorn }
1825145ad4fSNathan Whitehorn 
18368f9f708SSuraj Jitindar Singh static inline void kvmppc_enable_h_page_init(void)
18468f9f708SSuraj Jitindar Singh {
18568f9f708SSuraj Jitindar Singh }
18668f9f708SSuraj Jitindar Singh 
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 
1921bc22652SAndreas Färber static inline void kvmppc_set_papr(PowerPCCPU *cpu)
193f61b4bedSAlexander Graf {
194f61b4bedSAlexander Graf }
195f61b4bedSAlexander Graf 
196d6e166c0SDavid Gibson static inline int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr)
1976db5bb0fSAlexey Kardashevskiy {
1986db5bb0fSAlexey Kardashevskiy     return 0;
1996db5bb0fSAlexey Kardashevskiy }
2006db5bb0fSAlexey Kardashevskiy 
2015b95b8b9SAlexander Graf static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
2025b95b8b9SAlexander Graf {
2035b95b8b9SAlexander Graf }
2045b95b8b9SAlexander Graf 
205ec010c00SNicholas Piggin static inline bool kvmppc_get_fwnmi(void)
206ec010c00SNicholas Piggin {
207ec010c00SNicholas Piggin     return false;
208ec010c00SNicholas Piggin }
209ec010c00SNicholas Piggin 
210aef92d87SLaurent Vivier static inline int kvmppc_set_fwnmi(PowerPCCPU *cpu)
2119d953ce4SAravinda Prasad {
2129d953ce4SAravinda Prasad     return -1;
2139d953ce4SAravinda Prasad }
2149d953ce4SAravinda Prasad 
215e97c3636SDavid Gibson static inline int kvmppc_smt_threads(void)
216e97c3636SDavid Gibson {
217e97c3636SDavid Gibson     return 1;
218e97c3636SDavid Gibson }
219e97c3636SDavid Gibson 
2200c115681SVladimir Sementsov-Ogievskiy static inline void kvmppc_error_append_smt_possible_hint(Error *const *errp)
221fa98fbfcSSam Bobroff {
222fa98fbfcSSam Bobroff     return;
223fa98fbfcSSam Bobroff }
224fa98fbfcSSam Bobroff 
225fa98fbfcSSam Bobroff static inline int kvmppc_set_smt_threads(int smt)
226fa98fbfcSSam Bobroff {
227fa98fbfcSSam Bobroff     return 0;
228fa98fbfcSSam Bobroff }
229fa98fbfcSSam Bobroff 
23031f2cb8fSBharat Bhushan static inline int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
23131f2cb8fSBharat Bhushan {
23231f2cb8fSBharat Bhushan     return 0;
23331f2cb8fSBharat Bhushan }
23431f2cb8fSBharat Bhushan 
23531f2cb8fSBharat Bhushan static inline int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
23631f2cb8fSBharat Bhushan {
23731f2cb8fSBharat Bhushan     return 0;
23831f2cb8fSBharat Bhushan }
23931f2cb8fSBharat Bhushan 
24031f2cb8fSBharat Bhushan static inline int kvmppc_set_tcr(PowerPCCPU *cpu)
24131f2cb8fSBharat Bhushan {
24231f2cb8fSBharat Bhushan     return 0;
24331f2cb8fSBharat Bhushan }
24431f2cb8fSBharat Bhushan 
24531f2cb8fSBharat Bhushan static inline int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu)
24631f2cb8fSBharat Bhushan {
24731f2cb8fSBharat Bhushan     return -1;
24831f2cb8fSBharat Bhushan }
24931f2cb8fSBharat Bhushan 
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 
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 
2639723295aSGreg Kurz static inline void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset)
2649723295aSGreg Kurz {
2659723295aSGreg Kurz }
2669723295aSGreg Kurz 
26798efaf75SDavid Gibson #ifndef CONFIG_USER_ONLY
268da95324eSAlexey Kardashevskiy static inline bool kvmppc_spapr_use_multitce(void)
269da95324eSAlexey Kardashevskiy {
270da95324eSAlexey Kardashevskiy     return false;
271da95324eSAlexey Kardashevskiy }
272da95324eSAlexey Kardashevskiy 
2733dc410aeSAlexey Kardashevskiy static inline int kvmppc_spapr_enable_inkernel_multitce(void)
2743dc410aeSAlexey Kardashevskiy {
2753dc410aeSAlexey Kardashevskiy     return -1;
2763dc410aeSAlexey Kardashevskiy }
2773dc410aeSAlexey Kardashevskiy 
278d6ee2a7cSAlexey Kardashevskiy static inline void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
279d6ee2a7cSAlexey Kardashevskiy                                             uint64_t bus_offset,
280d6ee2a7cSAlexey Kardashevskiy                                             uint32_t nb_table,
281d6ee2a7cSAlexey Kardashevskiy                                             int *pfd, bool need_vfio)
2820f5cb298SDavid Gibson {
2830f5cb298SDavid Gibson     return NULL;
2840f5cb298SDavid Gibson }
2850f5cb298SDavid Gibson 
2860f5cb298SDavid Gibson static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
287523e7b8aSAlexey Kardashevskiy                                           uint32_t nb_table)
2880f5cb298SDavid Gibson {
2890f5cb298SDavid Gibson     return -1;
2900f5cb298SDavid Gibson }
2917f763a5dSDavid Gibson 
2927f763a5dSDavid Gibson static inline int kvmppc_reset_htab(int shift_hint)
2937f763a5dSDavid Gibson {
294a3166f8fSBharata B Rao     return 0;
2957f763a5dSDavid Gibson }
2967f763a5dSDavid Gibson 
2976a84737cSDavid Gibson static inline uint64_t kvmppc_vrma_limit(unsigned int hash_shift)
2987f763a5dSDavid Gibson {
2996a84737cSDavid Gibson     g_assert_not_reached();
3007f763a5dSDavid Gibson }
3017f763a5dSDavid Gibson 
30224c6863cSDavid Gibson static inline bool kvmppc_hpt_needs_host_contiguous_pages(void)
30324c6863cSDavid Gibson {
30424c6863cSDavid Gibson     return false;
30524c6863cSDavid Gibson }
30624c6863cSDavid Gibson 
307e5ca28ecSDavid Gibson static inline void kvm_check_mmu(PowerPCCPU *cpu, Error **errp)
308e5ca28ecSDavid Gibson {
309e5ca28ecSDavid Gibson }
310e5ca28ecSDavid Gibson 
3119ded780cSAlexey Kardashevskiy static inline bool kvmppc_has_cap_spapr_vfio(void)
3129ded780cSAlexey Kardashevskiy {
3139ded780cSAlexey Kardashevskiy     return false;
3149ded780cSAlexey Kardashevskiy }
3159ded780cSAlexey Kardashevskiy 
316e89aac1aSPhilippe Mathieu-Daudé static inline void kvmppc_read_hptes(ppc_hash_pte64_t *hptes,
317e89aac1aSPhilippe Mathieu-Daudé                                      hwaddr ptex, int n)
318e89aac1aSPhilippe Mathieu-Daudé {
319e89aac1aSPhilippe Mathieu-Daudé     abort();
320e89aac1aSPhilippe Mathieu-Daudé }
321e89aac1aSPhilippe Mathieu-Daudé 
322e89aac1aSPhilippe Mathieu-Daudé static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1)
323e89aac1aSPhilippe Mathieu-Daudé {
324e89aac1aSPhilippe Mathieu-Daudé     abort();
325e89aac1aSPhilippe Mathieu-Daudé }
326e89aac1aSPhilippe Mathieu-Daudé 
32798efaf75SDavid Gibson #endif /* !CONFIG_USER_ONLY */
3280f5cb298SDavid Gibson 
3293b961124SStuart Yoder static inline bool kvmppc_has_cap_epr(void)
3303b961124SStuart Yoder {
3313b961124SStuart Yoder     return false;
3323b961124SStuart Yoder }
333e68cb8b4SAlexey Kardashevskiy 
334feaa64c4SDavid Gibson static inline int kvmppc_define_rtas_kernel_token(uint32_t token,
335feaa64c4SDavid Gibson                                                   const char *function)
336feaa64c4SDavid Gibson {
337feaa64c4SDavid Gibson     return -1;
338feaa64c4SDavid Gibson }
339feaa64c4SDavid Gibson 
34014b0d748SGreg Kurz static inline int kvmppc_get_htab_fd(bool write, uint64_t index, Error **errp)
341e68cb8b4SAlexey Kardashevskiy {
342e68cb8b4SAlexey Kardashevskiy     return -1;
343e68cb8b4SAlexey Kardashevskiy }
344e68cb8b4SAlexey Kardashevskiy 
345e68cb8b4SAlexey Kardashevskiy static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
346e68cb8b4SAlexey Kardashevskiy                                    int64_t max_ns)
347e68cb8b4SAlexey Kardashevskiy {
348e68cb8b4SAlexey Kardashevskiy     abort();
349e68cb8b4SAlexey Kardashevskiy }
350e68cb8b4SAlexey Kardashevskiy 
351e68cb8b4SAlexey Kardashevskiy static inline int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
3520a06e4d6SGreg Kurz                                          uint16_t n_valid, uint16_t n_invalid,
3530a06e4d6SGreg Kurz                                          Error **errp)
354e68cb8b4SAlexey Kardashevskiy {
355e68cb8b4SAlexey Kardashevskiy     abort();
356e68cb8b4SAlexey Kardashevskiy }
357e68cb8b4SAlexey Kardashevskiy 
35887a91de6SAlexander Graf static inline bool kvmppc_has_cap_fixup_hcalls(void)
35987a91de6SAlexander Graf {
36087a91de6SAlexander Graf     abort();
36187a91de6SAlexander Graf }
36287a91de6SAlexander Graf 
363bac3bf28SThomas Huth static inline bool kvmppc_has_cap_htm(void)
364bac3bf28SThomas Huth {
365bac3bf28SThomas Huth     return false;
366bac3bf28SThomas Huth }
367bac3bf28SThomas Huth 
368cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_radix(void)
369cf1c4cceSSam Bobroff {
370cf1c4cceSSam Bobroff     return false;
371cf1c4cceSSam Bobroff }
372cf1c4cceSSam Bobroff 
373cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_hash_v3(void)
374cf1c4cceSSam Bobroff {
375cf1c4cceSSam Bobroff     return false;
376cf1c4cceSSam Bobroff }
377cf1c4cceSSam Bobroff 
37838afd772SCédric Le Goater static inline bool kvmppc_has_cap_xive(void)
37938afd772SCédric Le Goater {
38038afd772SCédric Le Goater     return false;
38138afd772SCédric Le Goater }
38238afd772SCédric Le Goater 
3838acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_cache(void)
3848acc2ae5SSuraj Jitindar Singh {
3858acc2ae5SSuraj Jitindar Singh     return 0;
3868acc2ae5SSuraj Jitindar Singh }
3878acc2ae5SSuraj Jitindar Singh 
3888acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_bounds_check(void)
3898acc2ae5SSuraj Jitindar Singh {
3908acc2ae5SSuraj Jitindar Singh     return 0;
3918acc2ae5SSuraj Jitindar Singh }
3928acc2ae5SSuraj Jitindar Singh 
3938acc2ae5SSuraj Jitindar Singh static inline int kvmppc_get_cap_safe_indirect_branch(void)
3948acc2ae5SSuraj Jitindar Singh {
3958acc2ae5SSuraj Jitindar Singh     return 0;
3968acc2ae5SSuraj Jitindar Singh }
3978acc2ae5SSuraj Jitindar Singh 
3988ff43ee4SSuraj Jitindar Singh static inline int kvmppc_get_cap_count_cache_flush_assist(void)
3998ff43ee4SSuraj Jitindar Singh {
4008ff43ee4SSuraj Jitindar Singh     return 0;
4018ff43ee4SSuraj Jitindar Singh }
4028ff43ee4SSuraj Jitindar Singh 
403b9a477b7SSuraj Jitindar Singh static inline bool kvmppc_has_cap_nested_kvm_hv(void)
404b9a477b7SSuraj Jitindar Singh {
405b9a477b7SSuraj Jitindar Singh     return false;
406b9a477b7SSuraj Jitindar Singh }
407b9a477b7SSuraj Jitindar Singh 
408b9a477b7SSuraj Jitindar Singh static inline int kvmppc_set_cap_nested_kvm_hv(int enable)
409b9a477b7SSuraj Jitindar Singh {
410b9a477b7SSuraj Jitindar Singh     return -1;
411b9a477b7SSuraj Jitindar Singh }
412b9a477b7SSuraj Jitindar Singh 
4137d050527SSuraj Jitindar Singh static inline int kvmppc_get_cap_large_decr(void)
4147d050527SSuraj Jitindar Singh {
4157d050527SSuraj Jitindar Singh     return 0;
4167d050527SSuraj Jitindar Singh }
4177d050527SSuraj Jitindar Singh 
4187d050527SSuraj Jitindar Singh static inline int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable)
4197d050527SSuraj Jitindar Singh {
4207d050527SSuraj Jitindar Singh     return -1;
4217d050527SSuraj Jitindar Singh }
4227d050527SSuraj Jitindar Singh 
42382123b75SBharata B Rao static inline int kvmppc_has_cap_rpt_invalidate(void)
42482123b75SBharata B Rao {
42582123b75SBharata B Rao     return false;
42682123b75SBharata B Rao }
42782123b75SBharata B Rao 
428ccc5a4c5SNicholas Piggin static inline bool kvmppc_supports_ail_3(void)
429ccc5a4c5SNicholas Piggin {
430ccc5a4c5SNicholas Piggin     return false;
431ccc5a4c5SNicholas Piggin }
432ccc5a4c5SNicholas Piggin 
4334d9392beSThomas Huth static inline int kvmppc_enable_hwrng(void)
4344d9392beSThomas Huth {
4354d9392beSThomas Huth     return -1;
4364d9392beSThomas Huth }
437e5c0d3ceSDavid Gibson 
438e5c0d3ceSDavid Gibson static inline int kvmppc_put_books_sregs(PowerPCCPU *cpu)
439e5c0d3ceSDavid Gibson {
440e5c0d3ceSDavid Gibson     abort();
441e5c0d3ceSDavid Gibson }
44252b2519cSThomas Huth 
44352b2519cSThomas Huth static inline PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
44452b2519cSThomas Huth {
44552b2519cSThomas Huth     return NULL;
44652b2519cSThomas Huth }
44752b2519cSThomas Huth 
44830f4b05bSDavid Gibson static inline void kvmppc_check_papr_resize_hpt(Error **errp)
44930f4b05bSDavid Gibson {
45030f4b05bSDavid Gibson     return;
45130f4b05bSDavid Gibson }
452b55d295eSDavid Gibson 
453b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu,
454b55d295eSDavid Gibson                                             target_ulong flags, int shift)
455b55d295eSDavid Gibson {
456b55d295eSDavid Gibson     return -ENOSYS;
457b55d295eSDavid Gibson }
458b55d295eSDavid Gibson 
459b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_commit(PowerPCCPU *cpu,
460b55d295eSDavid Gibson                                            target_ulong flags, int shift)
461b55d295eSDavid Gibson {
462b55d295eSDavid Gibson     return -ENOSYS;
463b55d295eSDavid Gibson }
464b55d295eSDavid Gibson 
465001d235cSGreg Kurz static inline bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu)
466001d235cSGreg Kurz {
467001d235cSGreg Kurz     return false;
468001d235cSGreg Kurz }
469001d235cSGreg Kurz 
470b45d63b6SBen Herrenschmidt #define kvmppc_eieio() do { } while (0)
4713240dd9aSThomas Huth 
4723240dd9aSThomas Huth static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len)
4733240dd9aSThomas Huth {
4743240dd9aSThomas Huth }
4753240dd9aSThomas Huth 
4763240dd9aSThomas Huth static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len)
4773240dd9aSThomas Huth {
4783240dd9aSThomas Huth }
4793240dd9aSThomas Huth 
4803240dd9aSThomas Huth #endif  /* CONFIG_KVM */
481b45d63b6SBen Herrenschmidt 
4822a6a4076SMarkus Armbruster #endif /* KVM_PPC_H */
483