1 /* 2 * PowerPC ISAV3 BookS emulation generic mmu definitions for qemu. 3 * 4 * Copyright (c) 2017 Suraj Jitindar Singh, IBM Corporation 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef MMU_H 21 #define MMU_H 22 23 #ifndef CONFIG_USER_ONLY 24 25 /* 26 * Partition table definitions 27 */ 28 #define PTCR_PATB 0x0FFFFFFFFFFFF000ULL /* Partition Table Base */ 29 #define PTCR_PATS 0x000000000000001FULL /* Partition Table Size */ 30 31 /* Partition Table Entry Fields */ 32 #define PATBE1_GR 0x8000000000000000 33 34 /* Process Table Entry */ 35 struct prtb_entry { 36 uint64_t prtbe0, prtbe1; 37 }; 38 39 #ifdef TARGET_PPC64 40 41 static inline bool ppc64_use_proc_tbl(PowerPCCPU *cpu) 42 { 43 return !!(cpu->env.spr[SPR_LPCR] & LPCR_UPRT); 44 } 45 46 static inline bool ppc64_radix_guest(PowerPCCPU *cpu) 47 { 48 PPCVirtualHypervisorClass *vhc = 49 PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); 50 51 return !!(vhc->get_patbe(cpu->vhyp) & PATBE1_GR); 52 } 53 54 int ppc64_v3_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr, int rwx, 55 int mmu_idx); 56 57 #endif /* TARGET_PPC64 */ 58 59 #endif /* CONFIG_USER_ONLY */ 60 61 #endif /* MMU_H */ 62