xref: /openbmc/qemu/target/ppc/mmu-book3s-v3.c (revision 083fab02)
1 /*
2  *  PowerPC ISAV3 BookS emulation generic mmu helpers 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 #include "qemu/osdep.h"
21 #include "qapi/error.h"
22 #include "cpu.h"
23 #include "mmu-hash64.h"
24 #include "mmu-book3s-v3.h"
25 #include "mmu-radix64.h"
26 
27 int ppc64_v3_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr, int rwx,
28                               int mmu_idx)
29 {
30     if (ppc64_radix_guest(cpu)) { /* Guest uses radix */
31         return ppc_radix64_handle_mmu_fault(cpu, eaddr, rwx, mmu_idx);
32     } else { /* Guest uses hash */
33         return ppc_hash64_handle_mmu_fault(cpu, eaddr, rwx, mmu_idx);
34     }
35 }
36