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 122985b86bSAndreas Färber #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU 132985b86bSAndreas Färber 14921e28dbSAlexander Graf #ifdef CONFIG_KVM 15921e28dbSAlexander Graf 16dc333cd6SAlexander Graf uint32_t kvmppc_get_tbfreq(void); 17eadaada1SAlexander Graf uint64_t kvmppc_get_clockfreq(void); 186659394fSDavid Gibson uint32_t kvmppc_get_vmx(void); 196659394fSDavid Gibson uint32_t kvmppc_get_dfp(void); 20ef951443SNikunj A Dadhania bool kvmppc_get_host_model(char **buf); 21ef951443SNikunj A Dadhania bool kvmppc_get_host_serial(char **buf); 221a61a9aeSStuart Yoder int kvmppc_get_hasidle(CPUPPCState *env); 231328c2bfSAndreas Färber int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len); 241bc22652SAndreas Färber int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level); 25026bfd89SDavid Gibson void kvmppc_enable_logical_ci_hcalls(void); 26ef9971ddSAlexey Kardashevskiy void kvmppc_enable_set_mode_hcall(void); 275145ad4fSNathan Whitehorn void kvmppc_enable_clear_ref_mod_hcalls(void); 281bc22652SAndreas Färber void kvmppc_set_papr(PowerPCCPU *cpu); 29d6e166c0SDavid Gibson int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr); 305b95b8b9SAlexander Graf void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy); 31e97c3636SDavid Gibson int kvmppc_smt_threads(void); 32*fa98fbfcSSam Bobroff void kvmppc_hint_smt_possible(Error **errp); 33*fa98fbfcSSam Bobroff int kvmppc_set_smt_threads(int smt); 3431f2cb8fSBharat Bhushan int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits); 3531f2cb8fSBharat Bhushan int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits); 3631f2cb8fSBharat Bhushan int kvmppc_set_tcr(PowerPCCPU *cpu); 3731f2cb8fSBharat Bhushan int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu); 38b4db5413SSuraj Jitindar Singh target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu, 39b4db5413SSuraj Jitindar Singh bool radix, bool gtse, 40b4db5413SSuraj Jitindar Singh uint64_t proc_tbl); 4198efaf75SDavid Gibson #ifndef CONFIG_USER_ONLY 42658fa66bSAlexey Kardashevskiy off_t kvmppc_alloc_rma(void **rma); 43da95324eSAlexey Kardashevskiy bool kvmppc_spapr_use_multitce(void); 443dc410aeSAlexey Kardashevskiy int kvmppc_spapr_enable_inkernel_multitce(void); 45d6ee2a7cSAlexey Kardashevskiy void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, 46d6ee2a7cSAlexey Kardashevskiy uint64_t bus_offset, uint32_t nb_table, 47d6ee2a7cSAlexey Kardashevskiy int *pfd, bool need_vfio); 480f5cb298SDavid Gibson int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size); 497f763a5dSDavid Gibson int kvmppc_reset_htab(int shift_hint); 507f763a5dSDavid Gibson uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift); 5198efaf75SDavid Gibson #endif /* !CONFIG_USER_ONLY */ 523b961124SStuart Yoder bool kvmppc_has_cap_epr(void); 53feaa64c4SDavid Gibson int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function); 547c43bca0SAneesh Kumar K.V bool kvmppc_has_cap_htab_fd(void); 55e68cb8b4SAlexey Kardashevskiy int kvmppc_get_htab_fd(bool write); 56e68cb8b4SAlexey Kardashevskiy int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns); 57e68cb8b4SAlexey Kardashevskiy int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, 58e68cb8b4SAlexey Kardashevskiy uint16_t n_valid, uint16_t n_invalid); 591ad9f0a4SDavid Gibson void kvmppc_read_hptes(ppc_hash_pte64_t *hptes, hwaddr ptex, int n); 601ad9f0a4SDavid Gibson void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1); 6187a91de6SAlexander Graf bool kvmppc_has_cap_fixup_hcalls(void); 62bac3bf28SThomas Huth bool kvmppc_has_cap_htm(void); 63cf1c4cceSSam Bobroff bool kvmppc_has_cap_mmu_radix(void); 64cf1c4cceSSam Bobroff bool kvmppc_has_cap_mmu_hash_v3(void); 654d9392beSThomas Huth int kvmppc_enable_hwrng(void); 66e5c0d3ceSDavid Gibson int kvmppc_put_books_sregs(PowerPCCPU *cpu); 6752b2519cSThomas Huth PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void); 6830f4b05bSDavid Gibson void kvmppc_check_papr_resize_hpt(Error **errp); 69b55d295eSDavid Gibson int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu, target_ulong flags, int shift); 70b55d295eSDavid Gibson int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, target_ulong flags, int shift); 71b55d295eSDavid Gibson void kvmppc_update_sdr1(target_ulong sdr1); 72c363a37aSDaniel Henrique Barboza bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu); 73c1385933SAneesh Kumar K.V 74ec69355bSGreg Kurz bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path); 75df587133SThomas Huth 76921e28dbSAlexander Graf #else 77921e28dbSAlexander Graf 78921e28dbSAlexander Graf static inline uint32_t kvmppc_get_tbfreq(void) 79921e28dbSAlexander Graf { 80921e28dbSAlexander Graf return 0; 81921e28dbSAlexander Graf } 82921e28dbSAlexander Graf 83ef951443SNikunj A Dadhania static inline bool kvmppc_get_host_model(char **buf) 84ef951443SNikunj A Dadhania { 85ef951443SNikunj A Dadhania return false; 86ef951443SNikunj A Dadhania } 87ef951443SNikunj A Dadhania 88ef951443SNikunj A Dadhania static inline bool kvmppc_get_host_serial(char **buf) 89ef951443SNikunj A Dadhania { 90ef951443SNikunj A Dadhania return false; 91ef951443SNikunj A Dadhania } 92ef951443SNikunj A Dadhania 93921e28dbSAlexander Graf static inline uint64_t kvmppc_get_clockfreq(void) 94921e28dbSAlexander Graf { 95921e28dbSAlexander Graf return 0; 96921e28dbSAlexander Graf } 97921e28dbSAlexander Graf 986659394fSDavid Gibson static inline uint32_t kvmppc_get_vmx(void) 996659394fSDavid Gibson { 1006659394fSDavid Gibson return 0; 1016659394fSDavid Gibson } 1026659394fSDavid Gibson 1036659394fSDavid Gibson static inline uint32_t kvmppc_get_dfp(void) 1046659394fSDavid Gibson { 1056659394fSDavid Gibson return 0; 1066659394fSDavid Gibson } 1076659394fSDavid Gibson 1081a61a9aeSStuart Yoder static inline int kvmppc_get_hasidle(CPUPPCState *env) 1091a61a9aeSStuart Yoder { 1101a61a9aeSStuart Yoder return 0; 1111a61a9aeSStuart Yoder } 1121a61a9aeSStuart Yoder 1131328c2bfSAndreas Färber static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len) 114921e28dbSAlexander Graf { 115921e28dbSAlexander Graf return -1; 116921e28dbSAlexander Graf } 117921e28dbSAlexander Graf 1181bc22652SAndreas Färber static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level) 119921e28dbSAlexander Graf { 120921e28dbSAlexander Graf return -1; 121921e28dbSAlexander Graf } 122921e28dbSAlexander Graf 123026bfd89SDavid Gibson static inline void kvmppc_enable_logical_ci_hcalls(void) 124026bfd89SDavid Gibson { 125026bfd89SDavid Gibson } 126026bfd89SDavid Gibson 127ef9971ddSAlexey Kardashevskiy static inline void kvmppc_enable_set_mode_hcall(void) 128ef9971ddSAlexey Kardashevskiy { 129ef9971ddSAlexey Kardashevskiy } 130ef9971ddSAlexey Kardashevskiy 1315145ad4fSNathan Whitehorn static inline void kvmppc_enable_clear_ref_mod_hcalls(void) 1325145ad4fSNathan Whitehorn { 1335145ad4fSNathan Whitehorn } 1345145ad4fSNathan Whitehorn 1351bc22652SAndreas Färber static inline void kvmppc_set_papr(PowerPCCPU *cpu) 136f61b4bedSAlexander Graf { 137f61b4bedSAlexander Graf } 138f61b4bedSAlexander Graf 139d6e166c0SDavid Gibson static inline int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr) 1406db5bb0fSAlexey Kardashevskiy { 1416db5bb0fSAlexey Kardashevskiy return 0; 1426db5bb0fSAlexey Kardashevskiy } 1436db5bb0fSAlexey Kardashevskiy 1445b95b8b9SAlexander Graf static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy) 1455b95b8b9SAlexander Graf { 1465b95b8b9SAlexander Graf } 1475b95b8b9SAlexander Graf 148e97c3636SDavid Gibson static inline int kvmppc_smt_threads(void) 149e97c3636SDavid Gibson { 150e97c3636SDavid Gibson return 1; 151e97c3636SDavid Gibson } 152e97c3636SDavid Gibson 153*fa98fbfcSSam Bobroff static inline void kvmppc_hint_smt_possible(Error **errp) 154*fa98fbfcSSam Bobroff { 155*fa98fbfcSSam Bobroff return; 156*fa98fbfcSSam Bobroff } 157*fa98fbfcSSam Bobroff 158*fa98fbfcSSam Bobroff static inline int kvmppc_set_smt_threads(int smt) 159*fa98fbfcSSam Bobroff { 160*fa98fbfcSSam Bobroff return 0; 161*fa98fbfcSSam Bobroff } 162*fa98fbfcSSam Bobroff 16331f2cb8fSBharat Bhushan static inline int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits) 16431f2cb8fSBharat Bhushan { 16531f2cb8fSBharat Bhushan return 0; 16631f2cb8fSBharat Bhushan } 16731f2cb8fSBharat Bhushan 16831f2cb8fSBharat Bhushan static inline int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits) 16931f2cb8fSBharat Bhushan { 17031f2cb8fSBharat Bhushan return 0; 17131f2cb8fSBharat Bhushan } 17231f2cb8fSBharat Bhushan 17331f2cb8fSBharat Bhushan static inline int kvmppc_set_tcr(PowerPCCPU *cpu) 17431f2cb8fSBharat Bhushan { 17531f2cb8fSBharat Bhushan return 0; 17631f2cb8fSBharat Bhushan } 17731f2cb8fSBharat Bhushan 17831f2cb8fSBharat Bhushan static inline int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu) 17931f2cb8fSBharat Bhushan { 18031f2cb8fSBharat Bhushan return -1; 18131f2cb8fSBharat Bhushan } 18231f2cb8fSBharat Bhushan 183b4db5413SSuraj Jitindar Singh static inline target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu, 184b4db5413SSuraj Jitindar Singh bool radix, bool gtse, 185b4db5413SSuraj Jitindar Singh uint64_t proc_tbl) 186b4db5413SSuraj Jitindar Singh { 187b4db5413SSuraj Jitindar Singh return 0; 188b4db5413SSuraj Jitindar Singh } 189b4db5413SSuraj Jitindar Singh 19098efaf75SDavid Gibson #ifndef CONFIG_USER_ONLY 191658fa66bSAlexey Kardashevskiy static inline off_t kvmppc_alloc_rma(void **rma) 192354ac20aSDavid Gibson { 193354ac20aSDavid Gibson return 0; 194354ac20aSDavid Gibson } 195354ac20aSDavid Gibson 196da95324eSAlexey Kardashevskiy static inline bool kvmppc_spapr_use_multitce(void) 197da95324eSAlexey Kardashevskiy { 198da95324eSAlexey Kardashevskiy return false; 199da95324eSAlexey Kardashevskiy } 200da95324eSAlexey Kardashevskiy 2013dc410aeSAlexey Kardashevskiy static inline int kvmppc_spapr_enable_inkernel_multitce(void) 2023dc410aeSAlexey Kardashevskiy { 2033dc410aeSAlexey Kardashevskiy return -1; 2043dc410aeSAlexey Kardashevskiy } 2053dc410aeSAlexey Kardashevskiy 206d6ee2a7cSAlexey Kardashevskiy static inline void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift, 207d6ee2a7cSAlexey Kardashevskiy uint64_t bus_offset, 208d6ee2a7cSAlexey Kardashevskiy uint32_t nb_table, 209d6ee2a7cSAlexey Kardashevskiy int *pfd, bool need_vfio) 2100f5cb298SDavid Gibson { 2110f5cb298SDavid Gibson return NULL; 2120f5cb298SDavid Gibson } 2130f5cb298SDavid Gibson 2140f5cb298SDavid Gibson static inline int kvmppc_remove_spapr_tce(void *table, int pfd, 215523e7b8aSAlexey Kardashevskiy uint32_t nb_table) 2160f5cb298SDavid Gibson { 2170f5cb298SDavid Gibson return -1; 2180f5cb298SDavid Gibson } 2197f763a5dSDavid Gibson 2207f763a5dSDavid Gibson static inline int kvmppc_reset_htab(int shift_hint) 2217f763a5dSDavid Gibson { 222a3166f8fSBharata B Rao return 0; 2237f763a5dSDavid Gibson } 2247f763a5dSDavid Gibson 2257f763a5dSDavid Gibson static inline uint64_t kvmppc_rma_size(uint64_t current_size, 2267f763a5dSDavid Gibson unsigned int hash_shift) 2277f763a5dSDavid Gibson { 2287f763a5dSDavid Gibson return ram_size; 2297f763a5dSDavid Gibson } 2307f763a5dSDavid Gibson 231ec69355bSGreg Kurz static inline bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path) 232df587133SThomas Huth { 233df587133SThomas Huth return true; 234df587133SThomas Huth } 235df587133SThomas Huth 23698efaf75SDavid Gibson #endif /* !CONFIG_USER_ONLY */ 2370f5cb298SDavid Gibson 2383b961124SStuart Yoder static inline bool kvmppc_has_cap_epr(void) 2393b961124SStuart Yoder { 2403b961124SStuart Yoder return false; 2413b961124SStuart Yoder } 242e68cb8b4SAlexey Kardashevskiy 243feaa64c4SDavid Gibson static inline int kvmppc_define_rtas_kernel_token(uint32_t token, 244feaa64c4SDavid Gibson const char *function) 245feaa64c4SDavid Gibson { 246feaa64c4SDavid Gibson return -1; 247feaa64c4SDavid Gibson } 248feaa64c4SDavid Gibson 2497c43bca0SAneesh Kumar K.V static inline bool kvmppc_has_cap_htab_fd(void) 2507c43bca0SAneesh Kumar K.V { 2517c43bca0SAneesh Kumar K.V return false; 2527c43bca0SAneesh Kumar K.V } 2537c43bca0SAneesh Kumar K.V 254e68cb8b4SAlexey Kardashevskiy static inline int kvmppc_get_htab_fd(bool write) 255e68cb8b4SAlexey Kardashevskiy { 256e68cb8b4SAlexey Kardashevskiy return -1; 257e68cb8b4SAlexey Kardashevskiy } 258e68cb8b4SAlexey Kardashevskiy 259e68cb8b4SAlexey Kardashevskiy static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, 260e68cb8b4SAlexey Kardashevskiy int64_t max_ns) 261e68cb8b4SAlexey Kardashevskiy { 262e68cb8b4SAlexey Kardashevskiy abort(); 263e68cb8b4SAlexey Kardashevskiy } 264e68cb8b4SAlexey Kardashevskiy 265e68cb8b4SAlexey Kardashevskiy static inline int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, 266e68cb8b4SAlexey Kardashevskiy uint16_t n_valid, uint16_t n_invalid) 267e68cb8b4SAlexey Kardashevskiy { 268e68cb8b4SAlexey Kardashevskiy abort(); 269e68cb8b4SAlexey Kardashevskiy } 270e68cb8b4SAlexey Kardashevskiy 2711ad9f0a4SDavid Gibson static inline void kvmppc_read_hptes(ppc_hash_pte64_t *hptes, 2721ad9f0a4SDavid Gibson hwaddr ptex, int n) 2737c43bca0SAneesh Kumar K.V { 2747c43bca0SAneesh Kumar K.V abort(); 2757c43bca0SAneesh Kumar K.V } 2767c43bca0SAneesh Kumar K.V 2771ad9f0a4SDavid Gibson static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1) 278c1385933SAneesh Kumar K.V { 279c1385933SAneesh Kumar K.V abort(); 280c1385933SAneesh Kumar K.V } 281c1385933SAneesh Kumar K.V 28287a91de6SAlexander Graf static inline bool kvmppc_has_cap_fixup_hcalls(void) 28387a91de6SAlexander Graf { 28487a91de6SAlexander Graf abort(); 28587a91de6SAlexander Graf } 28687a91de6SAlexander Graf 287bac3bf28SThomas Huth static inline bool kvmppc_has_cap_htm(void) 288bac3bf28SThomas Huth { 289bac3bf28SThomas Huth return false; 290bac3bf28SThomas Huth } 291bac3bf28SThomas Huth 292cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_radix(void) 293cf1c4cceSSam Bobroff { 294cf1c4cceSSam Bobroff return false; 295cf1c4cceSSam Bobroff } 296cf1c4cceSSam Bobroff 297cf1c4cceSSam Bobroff static inline bool kvmppc_has_cap_mmu_hash_v3(void) 298cf1c4cceSSam Bobroff { 299cf1c4cceSSam Bobroff return false; 300cf1c4cceSSam Bobroff } 301cf1c4cceSSam Bobroff 3024d9392beSThomas Huth static inline int kvmppc_enable_hwrng(void) 3034d9392beSThomas Huth { 3044d9392beSThomas Huth return -1; 3054d9392beSThomas Huth } 306e5c0d3ceSDavid Gibson 307e5c0d3ceSDavid Gibson static inline int kvmppc_put_books_sregs(PowerPCCPU *cpu) 308e5c0d3ceSDavid Gibson { 309e5c0d3ceSDavid Gibson abort(); 310e5c0d3ceSDavid Gibson } 31152b2519cSThomas Huth 31252b2519cSThomas Huth static inline PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) 31352b2519cSThomas Huth { 31452b2519cSThomas Huth return NULL; 31552b2519cSThomas Huth } 31652b2519cSThomas Huth 31730f4b05bSDavid Gibson static inline void kvmppc_check_papr_resize_hpt(Error **errp) 31830f4b05bSDavid Gibson { 31930f4b05bSDavid Gibson return; 32030f4b05bSDavid Gibson } 321b55d295eSDavid Gibson 322b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu, 323b55d295eSDavid Gibson target_ulong flags, int shift) 324b55d295eSDavid Gibson { 325b55d295eSDavid Gibson return -ENOSYS; 326b55d295eSDavid Gibson } 327b55d295eSDavid Gibson 328b55d295eSDavid Gibson static inline int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, 329b55d295eSDavid Gibson target_ulong flags, int shift) 330b55d295eSDavid Gibson { 331b55d295eSDavid Gibson return -ENOSYS; 332b55d295eSDavid Gibson } 333b55d295eSDavid Gibson 334b55d295eSDavid Gibson static inline void kvmppc_update_sdr1(target_ulong sdr1) 335b55d295eSDavid Gibson { 336b55d295eSDavid Gibson abort(); 337b55d295eSDavid Gibson } 338b55d295eSDavid Gibson 339921e28dbSAlexander Graf #endif 340921e28dbSAlexander Graf 341b45d63b6SBen Herrenschmidt #ifndef CONFIG_KVM 3423240dd9aSThomas Huth 343b45d63b6SBen Herrenschmidt #define kvmppc_eieio() do { } while (0) 3443240dd9aSThomas Huth 3453240dd9aSThomas Huth static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len) 3463240dd9aSThomas Huth { 3473240dd9aSThomas Huth } 3483240dd9aSThomas Huth 3493240dd9aSThomas Huth static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) 3503240dd9aSThomas Huth { 3513240dd9aSThomas Huth } 3523240dd9aSThomas Huth 3533240dd9aSThomas Huth #else /* CONFIG_KVM */ 3543240dd9aSThomas Huth 355b45d63b6SBen Herrenschmidt #define kvmppc_eieio() \ 356b45d63b6SBen Herrenschmidt do { \ 357b45d63b6SBen Herrenschmidt if (kvm_enabled()) { \ 358b45d63b6SBen Herrenschmidt asm volatile("eieio" : : : "memory"); \ 359b45d63b6SBen Herrenschmidt } \ 360b45d63b6SBen Herrenschmidt } while (0) 3613240dd9aSThomas Huth 3623240dd9aSThomas Huth /* Store data cache blocks back to memory */ 3633240dd9aSThomas Huth static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len) 3643240dd9aSThomas Huth { 3653240dd9aSThomas Huth uint8_t *p; 3663240dd9aSThomas Huth 3673240dd9aSThomas Huth for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { 3683240dd9aSThomas Huth asm volatile("dcbst 0,%0" : : "r"(p) : "memory"); 3693240dd9aSThomas Huth } 3703240dd9aSThomas Huth } 3713240dd9aSThomas Huth 3723240dd9aSThomas Huth /* Invalidate instruction cache blocks */ 3733240dd9aSThomas Huth static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) 3743240dd9aSThomas Huth { 3753240dd9aSThomas Huth uint8_t *p; 3763240dd9aSThomas Huth 3773240dd9aSThomas Huth for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { 3783240dd9aSThomas Huth asm volatile("icbi 0,%0" : : "r"(p)); 3793240dd9aSThomas Huth } 3803240dd9aSThomas Huth } 3813240dd9aSThomas Huth 3823240dd9aSThomas Huth #endif /* CONFIG_KVM */ 383b45d63b6SBen Herrenschmidt 3842a6a4076SMarkus Armbruster #endif /* KVM_PPC_H */ 385