18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 48c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, version 2, as 58c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 88c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 98c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 108c2ecf20Sopenharmony_ci * GNU General Public License for more details. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 138c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software 148c2ecf20Sopenharmony_ci * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2007 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * Authors: Hollis Blanchard <hollisb@us.ibm.com> 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#ifndef __LINUX_KVM_POWERPC_H 228c2ecf20Sopenharmony_ci#define __LINUX_KVM_POWERPC_H 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#include <linux/types.h> 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Select powerpc specific features in <linux/kvm.h> */ 278c2ecf20Sopenharmony_ci#define __KVM_HAVE_SPAPR_TCE 288c2ecf20Sopenharmony_ci#define __KVM_HAVE_PPC_SMT 298c2ecf20Sopenharmony_ci#define __KVM_HAVE_IRQCHIP 308c2ecf20Sopenharmony_ci#define __KVM_HAVE_IRQ_LINE 318c2ecf20Sopenharmony_ci#define __KVM_HAVE_GUEST_DEBUG 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* Not always available, but if it is, this is the correct offset. */ 348c2ecf20Sopenharmony_ci#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistruct kvm_regs { 378c2ecf20Sopenharmony_ci __u64 pc; 388c2ecf20Sopenharmony_ci __u64 cr; 398c2ecf20Sopenharmony_ci __u64 ctr; 408c2ecf20Sopenharmony_ci __u64 lr; 418c2ecf20Sopenharmony_ci __u64 xer; 428c2ecf20Sopenharmony_ci __u64 msr; 438c2ecf20Sopenharmony_ci __u64 srr0; 448c2ecf20Sopenharmony_ci __u64 srr1; 458c2ecf20Sopenharmony_ci __u64 pid; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci __u64 sprg0; 488c2ecf20Sopenharmony_ci __u64 sprg1; 498c2ecf20Sopenharmony_ci __u64 sprg2; 508c2ecf20Sopenharmony_ci __u64 sprg3; 518c2ecf20Sopenharmony_ci __u64 sprg4; 528c2ecf20Sopenharmony_ci __u64 sprg5; 538c2ecf20Sopenharmony_ci __u64 sprg6; 548c2ecf20Sopenharmony_ci __u64 sprg7; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci __u64 gpr[32]; 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define KVM_SREGS_E_IMPL_NONE 0 608c2ecf20Sopenharmony_ci#define KVM_SREGS_E_IMPL_FSL 1 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define KVM_SREGS_E_FSL_PIDn (1 << 0) /* PID1/PID2 */ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* flags for kvm_run.flags */ 658c2ecf20Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_MASK (3 << 0) 668c2ecf20Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_FULLY_RECOV (1 << 0) 678c2ecf20Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_LIMITED_RECOV (2 << 0) 688c2ecf20Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_NOT_RECOV (3 << 0) 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* 718c2ecf20Sopenharmony_ci * Feature bits indicate which sections of the sregs struct are valid, 728c2ecf20Sopenharmony_ci * both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers 738c2ecf20Sopenharmony_ci * corresponding to unset feature bits will not be modified. This allows 748c2ecf20Sopenharmony_ci * restoring a checkpoint made without that feature, while keeping the 758c2ecf20Sopenharmony_ci * default values of the new registers. 768c2ecf20Sopenharmony_ci * 778c2ecf20Sopenharmony_ci * KVM_SREGS_E_BASE contains: 788c2ecf20Sopenharmony_ci * CSRR0/1 (refers to SRR2/3 on 40x) 798c2ecf20Sopenharmony_ci * ESR 808c2ecf20Sopenharmony_ci * DEAR 818c2ecf20Sopenharmony_ci * MCSR 828c2ecf20Sopenharmony_ci * TSR 838c2ecf20Sopenharmony_ci * TCR 848c2ecf20Sopenharmony_ci * DEC 858c2ecf20Sopenharmony_ci * TB 868c2ecf20Sopenharmony_ci * VRSAVE (USPRG0) 878c2ecf20Sopenharmony_ci */ 888c2ecf20Sopenharmony_ci#define KVM_SREGS_E_BASE (1 << 0) 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci/* 918c2ecf20Sopenharmony_ci * KVM_SREGS_E_ARCH206 contains: 928c2ecf20Sopenharmony_ci * 938c2ecf20Sopenharmony_ci * PIR 948c2ecf20Sopenharmony_ci * MCSRR0/1 958c2ecf20Sopenharmony_ci * DECAR 968c2ecf20Sopenharmony_ci * IVPR 978c2ecf20Sopenharmony_ci */ 988c2ecf20Sopenharmony_ci#define KVM_SREGS_E_ARCH206 (1 << 1) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci/* 1018c2ecf20Sopenharmony_ci * Contains EPCR, plus the upper half of 64-bit registers 1028c2ecf20Sopenharmony_ci * that are 32-bit on 32-bit implementations. 1038c2ecf20Sopenharmony_ci */ 1048c2ecf20Sopenharmony_ci#define KVM_SREGS_E_64 (1 << 2) 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define KVM_SREGS_E_SPRG8 (1 << 3) 1078c2ecf20Sopenharmony_ci#define KVM_SREGS_E_MCIVPR (1 << 4) 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci/* 1108c2ecf20Sopenharmony_ci * IVORs are used -- contains IVOR0-15, plus additional IVORs 1118c2ecf20Sopenharmony_ci * in combination with an appropriate feature bit. 1128c2ecf20Sopenharmony_ci */ 1138c2ecf20Sopenharmony_ci#define KVM_SREGS_E_IVOR (1 << 5) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* 1168c2ecf20Sopenharmony_ci * Contains MAS0-4, MAS6-7, TLBnCFG, MMUCFG. 1178c2ecf20Sopenharmony_ci * Also TLBnPS if MMUCFG[MAVN] = 1. 1188c2ecf20Sopenharmony_ci */ 1198c2ecf20Sopenharmony_ci#define KVM_SREGS_E_ARCH206_MMU (1 << 6) 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* DBSR, DBCR, IAC, DAC, DVC */ 1228c2ecf20Sopenharmony_ci#define KVM_SREGS_E_DEBUG (1 << 7) 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci/* Enhanced debug -- DSRR0/1, SPRG9 */ 1258c2ecf20Sopenharmony_ci#define KVM_SREGS_E_ED (1 << 8) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */ 1288c2ecf20Sopenharmony_ci#define KVM_SREGS_E_SPE (1 << 9) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/* 1318c2ecf20Sopenharmony_ci * DEPRECATED! USE ONE_REG FOR THIS ONE! 1328c2ecf20Sopenharmony_ci * External Proxy (EXP) -- EPR 1338c2ecf20Sopenharmony_ci */ 1348c2ecf20Sopenharmony_ci#define KVM_SREGS_EXP (1 << 10) 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci/* External PID (E.PD) -- EPSC/EPLC */ 1378c2ecf20Sopenharmony_ci#define KVM_SREGS_E_PD (1 << 11) 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci/* Processor Control (E.PC) -- IVOR36-37 if KVM_SREGS_E_IVOR */ 1408c2ecf20Sopenharmony_ci#define KVM_SREGS_E_PC (1 << 12) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci/* Page table (E.PT) -- EPTCFG */ 1438c2ecf20Sopenharmony_ci#define KVM_SREGS_E_PT (1 << 13) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci/* Embedded Performance Monitor (E.PM) -- IVOR35 if KVM_SREGS_E_IVOR */ 1468c2ecf20Sopenharmony_ci#define KVM_SREGS_E_PM (1 << 14) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/* 1498c2ecf20Sopenharmony_ci * Special updates: 1508c2ecf20Sopenharmony_ci * 1518c2ecf20Sopenharmony_ci * Some registers may change even while a vcpu is not running. 1528c2ecf20Sopenharmony_ci * To avoid losing these changes, by default these registers are 1538c2ecf20Sopenharmony_ci * not updated by KVM_SET_SREGS. To force an update, set the bit 1548c2ecf20Sopenharmony_ci * in u.e.update_special corresponding to the register to be updated. 1558c2ecf20Sopenharmony_ci * 1568c2ecf20Sopenharmony_ci * The update_special field is zero on return from KVM_GET_SREGS. 1578c2ecf20Sopenharmony_ci * 1588c2ecf20Sopenharmony_ci * When restoring a checkpoint, the caller can set update_special 1598c2ecf20Sopenharmony_ci * to 0xffffffff to ensure that everything is restored, even new features 1608c2ecf20Sopenharmony_ci * that the caller doesn't know about. 1618c2ecf20Sopenharmony_ci */ 1628c2ecf20Sopenharmony_ci#define KVM_SREGS_E_UPDATE_MCSR (1 << 0) 1638c2ecf20Sopenharmony_ci#define KVM_SREGS_E_UPDATE_TSR (1 << 1) 1648c2ecf20Sopenharmony_ci#define KVM_SREGS_E_UPDATE_DEC (1 << 2) 1658c2ecf20Sopenharmony_ci#define KVM_SREGS_E_UPDATE_DBSR (1 << 3) 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci/* 1688c2ecf20Sopenharmony_ci * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a 1698c2ecf20Sopenharmony_ci * previous KVM_GET_REGS. 1708c2ecf20Sopenharmony_ci * 1718c2ecf20Sopenharmony_ci * Unless otherwise indicated, setting any register with KVM_SET_SREGS 1728c2ecf20Sopenharmony_ci * directly sets its value. It does not trigger any special semantics such 1738c2ecf20Sopenharmony_ci * as write-one-to-clear. Calling KVM_SET_SREGS on an unmodified struct 1748c2ecf20Sopenharmony_ci * just received from KVM_GET_SREGS is always a no-op. 1758c2ecf20Sopenharmony_ci */ 1768c2ecf20Sopenharmony_cistruct kvm_sregs { 1778c2ecf20Sopenharmony_ci __u32 pvr; 1788c2ecf20Sopenharmony_ci union { 1798c2ecf20Sopenharmony_ci struct { 1808c2ecf20Sopenharmony_ci __u64 sdr1; 1818c2ecf20Sopenharmony_ci struct { 1828c2ecf20Sopenharmony_ci struct { 1838c2ecf20Sopenharmony_ci __u64 slbe; 1848c2ecf20Sopenharmony_ci __u64 slbv; 1858c2ecf20Sopenharmony_ci } slb[64]; 1868c2ecf20Sopenharmony_ci } ppc64; 1878c2ecf20Sopenharmony_ci struct { 1888c2ecf20Sopenharmony_ci __u32 sr[16]; 1898c2ecf20Sopenharmony_ci __u64 ibat[8]; 1908c2ecf20Sopenharmony_ci __u64 dbat[8]; 1918c2ecf20Sopenharmony_ci } ppc32; 1928c2ecf20Sopenharmony_ci } s; 1938c2ecf20Sopenharmony_ci struct { 1948c2ecf20Sopenharmony_ci union { 1958c2ecf20Sopenharmony_ci struct { /* KVM_SREGS_E_IMPL_FSL */ 1968c2ecf20Sopenharmony_ci __u32 features; /* KVM_SREGS_E_FSL_ */ 1978c2ecf20Sopenharmony_ci __u32 svr; 1988c2ecf20Sopenharmony_ci __u64 mcar; 1998c2ecf20Sopenharmony_ci __u32 hid0; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci /* KVM_SREGS_E_FSL_PIDn */ 2028c2ecf20Sopenharmony_ci __u32 pid1, pid2; 2038c2ecf20Sopenharmony_ci } fsl; 2048c2ecf20Sopenharmony_ci __u8 pad[256]; 2058c2ecf20Sopenharmony_ci } impl; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci __u32 features; /* KVM_SREGS_E_ */ 2088c2ecf20Sopenharmony_ci __u32 impl_id; /* KVM_SREGS_E_IMPL_ */ 2098c2ecf20Sopenharmony_ci __u32 update_special; /* KVM_SREGS_E_UPDATE_ */ 2108c2ecf20Sopenharmony_ci __u32 pir; /* read-only */ 2118c2ecf20Sopenharmony_ci __u64 sprg8; 2128c2ecf20Sopenharmony_ci __u64 sprg9; /* E.ED */ 2138c2ecf20Sopenharmony_ci __u64 csrr0; 2148c2ecf20Sopenharmony_ci __u64 dsrr0; /* E.ED */ 2158c2ecf20Sopenharmony_ci __u64 mcsrr0; 2168c2ecf20Sopenharmony_ci __u32 csrr1; 2178c2ecf20Sopenharmony_ci __u32 dsrr1; /* E.ED */ 2188c2ecf20Sopenharmony_ci __u32 mcsrr1; 2198c2ecf20Sopenharmony_ci __u32 esr; 2208c2ecf20Sopenharmony_ci __u64 dear; 2218c2ecf20Sopenharmony_ci __u64 ivpr; 2228c2ecf20Sopenharmony_ci __u64 mcivpr; 2238c2ecf20Sopenharmony_ci __u64 mcsr; /* KVM_SREGS_E_UPDATE_MCSR */ 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci __u32 tsr; /* KVM_SREGS_E_UPDATE_TSR */ 2268c2ecf20Sopenharmony_ci __u32 tcr; 2278c2ecf20Sopenharmony_ci __u32 decar; 2288c2ecf20Sopenharmony_ci __u32 dec; /* KVM_SREGS_E_UPDATE_DEC */ 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci /* 2318c2ecf20Sopenharmony_ci * Userspace can read TB directly, but the 2328c2ecf20Sopenharmony_ci * value reported here is consistent with "dec". 2338c2ecf20Sopenharmony_ci * 2348c2ecf20Sopenharmony_ci * Read-only. 2358c2ecf20Sopenharmony_ci */ 2368c2ecf20Sopenharmony_ci __u64 tb; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */ 2398c2ecf20Sopenharmony_ci __u32 dbcr[3]; 2408c2ecf20Sopenharmony_ci /* 2418c2ecf20Sopenharmony_ci * iac/dac registers are 64bit wide, while this API 2428c2ecf20Sopenharmony_ci * interface provides only lower 32 bits on 64 bit 2438c2ecf20Sopenharmony_ci * processors. ONE_REG interface is added for 64bit 2448c2ecf20Sopenharmony_ci * iac/dac registers. 2458c2ecf20Sopenharmony_ci */ 2468c2ecf20Sopenharmony_ci __u32 iac[4]; 2478c2ecf20Sopenharmony_ci __u32 dac[2]; 2488c2ecf20Sopenharmony_ci __u32 dvc[2]; 2498c2ecf20Sopenharmony_ci __u8 num_iac; /* read-only */ 2508c2ecf20Sopenharmony_ci __u8 num_dac; /* read-only */ 2518c2ecf20Sopenharmony_ci __u8 num_dvc; /* read-only */ 2528c2ecf20Sopenharmony_ci __u8 pad; 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci __u32 epr; /* EXP */ 2558c2ecf20Sopenharmony_ci __u32 vrsave; /* a.k.a. USPRG0 */ 2568c2ecf20Sopenharmony_ci __u32 epcr; /* KVM_SREGS_E_64 */ 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci __u32 mas0; 2598c2ecf20Sopenharmony_ci __u32 mas1; 2608c2ecf20Sopenharmony_ci __u64 mas2; 2618c2ecf20Sopenharmony_ci __u64 mas7_3; 2628c2ecf20Sopenharmony_ci __u32 mas4; 2638c2ecf20Sopenharmony_ci __u32 mas6; 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci __u32 ivor_low[16]; /* IVOR0-15 */ 2668c2ecf20Sopenharmony_ci __u32 ivor_high[18]; /* IVOR32+, plus room to expand */ 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci __u32 mmucfg; /* read-only */ 2698c2ecf20Sopenharmony_ci __u32 eptcfg; /* E.PT, read-only */ 2708c2ecf20Sopenharmony_ci __u32 tlbcfg[4];/* read-only */ 2718c2ecf20Sopenharmony_ci __u32 tlbps[4]; /* read-only */ 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci __u32 eplc, epsc; /* E.PD */ 2748c2ecf20Sopenharmony_ci } e; 2758c2ecf20Sopenharmony_ci __u8 pad[1020]; 2768c2ecf20Sopenharmony_ci } u; 2778c2ecf20Sopenharmony_ci}; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_cistruct kvm_fpu { 2808c2ecf20Sopenharmony_ci __u64 fpr[32]; 2818c2ecf20Sopenharmony_ci}; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci/* 2848c2ecf20Sopenharmony_ci * Defines for h/w breakpoint, watchpoint (read, write or both) and 2858c2ecf20Sopenharmony_ci * software breakpoint. 2868c2ecf20Sopenharmony_ci * These are used as "type" in KVM_SET_GUEST_DEBUG ioctl and "status" 2878c2ecf20Sopenharmony_ci * for KVM_DEBUG_EXIT. 2888c2ecf20Sopenharmony_ci */ 2898c2ecf20Sopenharmony_ci#define KVMPPC_DEBUG_NONE 0x0 2908c2ecf20Sopenharmony_ci#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1) 2918c2ecf20Sopenharmony_ci#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2) 2928c2ecf20Sopenharmony_ci#define KVMPPC_DEBUG_WATCH_READ (1UL << 3) 2938c2ecf20Sopenharmony_cistruct kvm_debug_exit_arch { 2948c2ecf20Sopenharmony_ci __u64 address; 2958c2ecf20Sopenharmony_ci /* 2968c2ecf20Sopenharmony_ci * exiting to userspace because of h/w breakpoint, watchpoint 2978c2ecf20Sopenharmony_ci * (read, write or both) and software breakpoint. 2988c2ecf20Sopenharmony_ci */ 2998c2ecf20Sopenharmony_ci __u32 status; 3008c2ecf20Sopenharmony_ci __u32 reserved; 3018c2ecf20Sopenharmony_ci}; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci/* for KVM_SET_GUEST_DEBUG */ 3048c2ecf20Sopenharmony_cistruct kvm_guest_debug_arch { 3058c2ecf20Sopenharmony_ci struct { 3068c2ecf20Sopenharmony_ci /* H/W breakpoint/watchpoint address */ 3078c2ecf20Sopenharmony_ci __u64 addr; 3088c2ecf20Sopenharmony_ci /* 3098c2ecf20Sopenharmony_ci * Type denotes h/w breakpoint, read watchpoint, write 3108c2ecf20Sopenharmony_ci * watchpoint or watchpoint (both read and write). 3118c2ecf20Sopenharmony_ci */ 3128c2ecf20Sopenharmony_ci __u32 type; 3138c2ecf20Sopenharmony_ci __u32 reserved; 3148c2ecf20Sopenharmony_ci } bp[16]; 3158c2ecf20Sopenharmony_ci}; 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci/* Debug related defines */ 3188c2ecf20Sopenharmony_ci/* 3198c2ecf20Sopenharmony_ci * kvm_guest_debug->control is a 32 bit field. The lower 16 bits are generic 3208c2ecf20Sopenharmony_ci * and upper 16 bits are architecture specific. Architecture specific defines 3218c2ecf20Sopenharmony_ci * that ioctl is for setting hardware breakpoint or software breakpoint. 3228c2ecf20Sopenharmony_ci */ 3238c2ecf20Sopenharmony_ci#define KVM_GUESTDBG_USE_SW_BP 0x00010000 3248c2ecf20Sopenharmony_ci#define KVM_GUESTDBG_USE_HW_BP 0x00020000 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci/* definition of registers in kvm_run */ 3278c2ecf20Sopenharmony_cistruct kvm_sync_regs { 3288c2ecf20Sopenharmony_ci}; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci#define KVM_INTERRUPT_SET -1U 3318c2ecf20Sopenharmony_ci#define KVM_INTERRUPT_UNSET -2U 3328c2ecf20Sopenharmony_ci#define KVM_INTERRUPT_SET_LEVEL -3U 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci#define KVM_CPU_440 1 3358c2ecf20Sopenharmony_ci#define KVM_CPU_E500V2 2 3368c2ecf20Sopenharmony_ci#define KVM_CPU_3S_32 3 3378c2ecf20Sopenharmony_ci#define KVM_CPU_3S_64 4 3388c2ecf20Sopenharmony_ci#define KVM_CPU_E500MC 5 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci/* for KVM_CAP_SPAPR_TCE */ 3418c2ecf20Sopenharmony_cistruct kvm_create_spapr_tce { 3428c2ecf20Sopenharmony_ci __u64 liobn; 3438c2ecf20Sopenharmony_ci __u32 window_size; 3448c2ecf20Sopenharmony_ci}; 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci/* for KVM_CAP_SPAPR_TCE_64 */ 3478c2ecf20Sopenharmony_cistruct kvm_create_spapr_tce_64 { 3488c2ecf20Sopenharmony_ci __u64 liobn; 3498c2ecf20Sopenharmony_ci __u32 page_shift; 3508c2ecf20Sopenharmony_ci __u32 flags; 3518c2ecf20Sopenharmony_ci __u64 offset; /* in pages */ 3528c2ecf20Sopenharmony_ci __u64 size; /* in pages */ 3538c2ecf20Sopenharmony_ci}; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci/* for KVM_ALLOCATE_RMA */ 3568c2ecf20Sopenharmony_cistruct kvm_allocate_rma { 3578c2ecf20Sopenharmony_ci __u64 rma_size; 3588c2ecf20Sopenharmony_ci}; 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci/* for KVM_CAP_PPC_RTAS */ 3618c2ecf20Sopenharmony_cistruct kvm_rtas_token_args { 3628c2ecf20Sopenharmony_ci char name[120]; 3638c2ecf20Sopenharmony_ci __u64 token; /* Use a token of 0 to undefine a mapping */ 3648c2ecf20Sopenharmony_ci}; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_cistruct kvm_book3e_206_tlb_entry { 3678c2ecf20Sopenharmony_ci __u32 mas8; 3688c2ecf20Sopenharmony_ci __u32 mas1; 3698c2ecf20Sopenharmony_ci __u64 mas2; 3708c2ecf20Sopenharmony_ci __u64 mas7_3; 3718c2ecf20Sopenharmony_ci}; 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_cistruct kvm_book3e_206_tlb_params { 3748c2ecf20Sopenharmony_ci /* 3758c2ecf20Sopenharmony_ci * For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV: 3768c2ecf20Sopenharmony_ci * 3778c2ecf20Sopenharmony_ci * - The number of ways of TLB0 must be a power of two between 2 and 3788c2ecf20Sopenharmony_ci * 16. 3798c2ecf20Sopenharmony_ci * - TLB1 must be fully associative. 3808c2ecf20Sopenharmony_ci * - The size of TLB0 must be a multiple of the number of ways, and 3818c2ecf20Sopenharmony_ci * the number of sets must be a power of two. 3828c2ecf20Sopenharmony_ci * - The size of TLB1 may not exceed 64 entries. 3838c2ecf20Sopenharmony_ci * - TLB0 supports 4 KiB pages. 3848c2ecf20Sopenharmony_ci * - The page sizes supported by TLB1 are as indicated by 3858c2ecf20Sopenharmony_ci * TLB1CFG (if MMUCFG[MAVN] = 0) or TLB1PS (if MMUCFG[MAVN] = 1) 3868c2ecf20Sopenharmony_ci * as returned by KVM_GET_SREGS. 3878c2ecf20Sopenharmony_ci * - TLB2 and TLB3 are reserved, and their entries in tlb_sizes[] 3888c2ecf20Sopenharmony_ci * and tlb_ways[] must be zero. 3898c2ecf20Sopenharmony_ci * 3908c2ecf20Sopenharmony_ci * tlb_ways[n] = tlb_sizes[n] means the array is fully associative. 3918c2ecf20Sopenharmony_ci * 3928c2ecf20Sopenharmony_ci * KVM will adjust TLBnCFG based on the sizes configured here, 3938c2ecf20Sopenharmony_ci * though arrays greater than 2048 entries will have TLBnCFG[NENTRY] 3948c2ecf20Sopenharmony_ci * set to zero. 3958c2ecf20Sopenharmony_ci */ 3968c2ecf20Sopenharmony_ci __u32 tlb_sizes[4]; 3978c2ecf20Sopenharmony_ci __u32 tlb_ways[4]; 3988c2ecf20Sopenharmony_ci __u32 reserved[8]; 3998c2ecf20Sopenharmony_ci}; 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_ci/* For KVM_PPC_GET_HTAB_FD */ 4028c2ecf20Sopenharmony_cistruct kvm_get_htab_fd { 4038c2ecf20Sopenharmony_ci __u64 flags; 4048c2ecf20Sopenharmony_ci __u64 start_index; 4058c2ecf20Sopenharmony_ci __u64 reserved[2]; 4068c2ecf20Sopenharmony_ci}; 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci/* Values for kvm_get_htab_fd.flags */ 4098c2ecf20Sopenharmony_ci#define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) 4108c2ecf20Sopenharmony_ci#define KVM_GET_HTAB_WRITE ((__u64)0x2) 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ci/* 4138c2ecf20Sopenharmony_ci * Data read on the file descriptor is formatted as a series of 4148c2ecf20Sopenharmony_ci * records, each consisting of a header followed by a series of 4158c2ecf20Sopenharmony_ci * `n_valid' HPTEs (16 bytes each), which are all valid. Following 4168c2ecf20Sopenharmony_ci * those valid HPTEs there are `n_invalid' invalid HPTEs, which 4178c2ecf20Sopenharmony_ci * are not represented explicitly in the stream. The same format 4188c2ecf20Sopenharmony_ci * is used for writing. 4198c2ecf20Sopenharmony_ci */ 4208c2ecf20Sopenharmony_cistruct kvm_get_htab_header { 4218c2ecf20Sopenharmony_ci __u32 index; 4228c2ecf20Sopenharmony_ci __u16 n_valid; 4238c2ecf20Sopenharmony_ci __u16 n_invalid; 4248c2ecf20Sopenharmony_ci}; 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci/* For KVM_PPC_CONFIGURE_V3_MMU */ 4278c2ecf20Sopenharmony_cistruct kvm_ppc_mmuv3_cfg { 4288c2ecf20Sopenharmony_ci __u64 flags; 4298c2ecf20Sopenharmony_ci __u64 process_table; /* second doubleword of partition table entry */ 4308c2ecf20Sopenharmony_ci}; 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci/* Flag values for KVM_PPC_CONFIGURE_V3_MMU */ 4338c2ecf20Sopenharmony_ci#define KVM_PPC_MMUV3_RADIX 1 /* 1 = radix mode, 0 = HPT */ 4348c2ecf20Sopenharmony_ci#define KVM_PPC_MMUV3_GTSE 2 /* global translation shootdown enb. */ 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_ci/* For KVM_PPC_GET_RMMU_INFO */ 4378c2ecf20Sopenharmony_cistruct kvm_ppc_rmmu_info { 4388c2ecf20Sopenharmony_ci struct kvm_ppc_radix_geom { 4398c2ecf20Sopenharmony_ci __u8 page_shift; 4408c2ecf20Sopenharmony_ci __u8 level_bits[4]; 4418c2ecf20Sopenharmony_ci __u8 pad[3]; 4428c2ecf20Sopenharmony_ci } geometries[8]; 4438c2ecf20Sopenharmony_ci __u32 ap_encodings[8]; 4448c2ecf20Sopenharmony_ci}; 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci/* For KVM_PPC_GET_CPU_CHAR */ 4478c2ecf20Sopenharmony_cistruct kvm_ppc_cpu_char { 4488c2ecf20Sopenharmony_ci __u64 character; /* characteristics of the CPU */ 4498c2ecf20Sopenharmony_ci __u64 behaviour; /* recommended software behaviour */ 4508c2ecf20Sopenharmony_ci __u64 character_mask; /* valid bits in character */ 4518c2ecf20Sopenharmony_ci __u64 behaviour_mask; /* valid bits in behaviour */ 4528c2ecf20Sopenharmony_ci}; 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_ci/* 4558c2ecf20Sopenharmony_ci * Values for character and character_mask. 4568c2ecf20Sopenharmony_ci * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. 4578c2ecf20Sopenharmony_ci */ 4588c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 (1ULL << 63) 4598c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) 4608c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) 4618c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) 4628c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) 4638c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) 4648c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) 4658c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) 4668c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54) 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) 4698c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) 4708c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) 4718c2ecf20Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58) 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_ci/* Per-vcpu XICS interrupt controller state */ 4748c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_CPPR_SHIFT 56 /* current proc priority */ 4778c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_CPPR_MASK 0xff 4788c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_XISR_SHIFT 32 /* interrupt status field */ 4798c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_XISR_MASK 0xffffff 4808c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_MFRR_SHIFT 24 /* pending IPI priority */ 4818c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_MFRR_MASK 0xff 4828c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */ 4838c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ICP_PPRI_MASK 0xff 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x8d) 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ci/* Device control API: PPC-specific devices */ 4888c2ecf20Sopenharmony_ci#define KVM_DEV_MPIC_GRP_MISC 1 4898c2ecf20Sopenharmony_ci#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */ 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci#define KVM_DEV_MPIC_GRP_REGISTER 2 /* 32-bit */ 4928c2ecf20Sopenharmony_ci#define KVM_DEV_MPIC_GRP_IRQ_ACTIVE 3 /* 32-bit */ 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_ci/* One-Reg API: PPC-specific registers */ 4958c2ecf20Sopenharmony_ci#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1) 4968c2ecf20Sopenharmony_ci#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2) 4978c2ecf20Sopenharmony_ci#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3) 4988c2ecf20Sopenharmony_ci#define KVM_REG_PPC_IAC3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x4) 4998c2ecf20Sopenharmony_ci#define KVM_REG_PPC_IAC4 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5) 5008c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6) 5018c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7) 5028c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8) 5038c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9) 5048c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa) 5058c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SPURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb) 5068c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc) 5078c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DSISR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd) 5088c2ecf20Sopenharmony_ci#define KVM_REG_PPC_AMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe) 5098c2ecf20Sopenharmony_ci#define KVM_REG_PPC_UAMOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf) 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10) 5128c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11) 5138c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12) 5148c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MMCR2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x13) 5158c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MMCRS (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x14) 5168c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x15) 5178c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SDAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x16) 5188c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SIER (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x17) 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18) 5218c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19) 5228c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC3 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a) 5238c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b) 5248c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC5 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c) 5258c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d) 5268c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC7 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e) 5278c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PMC8 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f) 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci/* 32 floating-point registers */ 5308c2ecf20Sopenharmony_ci#define KVM_REG_PPC_FPR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x20) 5318c2ecf20Sopenharmony_ci#define KVM_REG_PPC_FPR(n) (KVM_REG_PPC_FPR0 + (n)) 5328c2ecf20Sopenharmony_ci#define KVM_REG_PPC_FPR31 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3f) 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_ci/* 32 VMX/Altivec vector registers */ 5358c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x40) 5368c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VR(n) (KVM_REG_PPC_VR0 + (n)) 5378c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x5f) 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci/* 32 double-width FP registers for VSX */ 5408c2ecf20Sopenharmony_ci/* High-order halves overlap with FP regs */ 5418c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VSR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x60) 5428c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VSR(n) (KVM_REG_PPC_VSR0 + (n)) 5438c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VSR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x7f) 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci/* FP and vector status/control registers */ 5468c2ecf20Sopenharmony_ci#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80) 5478c2ecf20Sopenharmony_ci/* 5488c2ecf20Sopenharmony_ci * VSCR register is documented as a 32-bit register in the ISA, but it can 5498c2ecf20Sopenharmony_ci * only be accesses via a vector register. Expose VSCR as a 32-bit register 5508c2ecf20Sopenharmony_ci * even though the kernel represents it as a 128-bit vector. 5518c2ecf20Sopenharmony_ci */ 5528c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81) 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_ci/* Virtual processor areas */ 5558c2ecf20Sopenharmony_ci/* For SLB & DTL, address in high (first) half, length in low half */ 5568c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VPA_ADDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x82) 5578c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83) 5588c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84) 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) 5618c2ecf20Sopenharmony_ci#define KVM_REG_PPC_EPR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x86) 5628c2ecf20Sopenharmony_ci 5638c2ecf20Sopenharmony_ci/* Timer Status Register OR/CLEAR interface */ 5648c2ecf20Sopenharmony_ci#define KVM_REG_PPC_OR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x87) 5658c2ecf20Sopenharmony_ci#define KVM_REG_PPC_CLEAR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x88) 5668c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x89) 5678c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8a) 5688c2ecf20Sopenharmony_ci 5698c2ecf20Sopenharmony_ci/* Debugging: Special instruction for software breakpoint */ 5708c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DEBUG_INST (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8b) 5718c2ecf20Sopenharmony_ci 5728c2ecf20Sopenharmony_ci/* MMU registers */ 5738c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MAS0 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8c) 5748c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MAS1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8d) 5758c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MAS2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8e) 5768c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MAS7_3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8f) 5778c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MAS4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x90) 5788c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MAS6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x91) 5798c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MMUCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x92) 5808c2ecf20Sopenharmony_ci/* 5818c2ecf20Sopenharmony_ci * TLBnCFG fields TLBnCFG_N_ENTRY and TLBnCFG_ASSOC can be changed only using 5828c2ecf20Sopenharmony_ci * KVM_CAP_SW_TLB ioctl 5838c2ecf20Sopenharmony_ci */ 5848c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB0CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x93) 5858c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB1CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x94) 5868c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB2CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x95) 5878c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB3CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x96) 5888c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB0PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x97) 5898c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB1PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x98) 5908c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB2PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x99) 5918c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a) 5928c2ecf20Sopenharmony_ci#define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b) 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_ci/* Timebase offset */ 5958c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TB_OFFSET (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9c) 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci/* POWER8 registers */ 5988c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SPMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9d) 5998c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SPMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9e) 6008c2ecf20Sopenharmony_ci#define KVM_REG_PPC_IAMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9f) 6018c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TFHAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa0) 6028c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TFIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa1) 6038c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TEXASR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa2) 6048c2ecf20Sopenharmony_ci#define KVM_REG_PPC_FSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa3) 6058c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PSPB (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xa4) 6068c2ecf20Sopenharmony_ci#define KVM_REG_PPC_EBBHR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa5) 6078c2ecf20Sopenharmony_ci#define KVM_REG_PPC_EBBRR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa6) 6088c2ecf20Sopenharmony_ci#define KVM_REG_PPC_BESCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa7) 6098c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa8) 6108c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DPDES (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa9) 6118c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DAWR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaa) 6128c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DAWRX (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xab) 6138c2ecf20Sopenharmony_ci#define KVM_REG_PPC_CIABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xac) 6148c2ecf20Sopenharmony_ci#define KVM_REG_PPC_IC (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xad) 6158c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VTB (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xae) 6168c2ecf20Sopenharmony_ci#define KVM_REG_PPC_CSIGR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaf) 6178c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TACR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb0) 6188c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TCSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb1) 6198c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PID (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb2) 6208c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ACOP (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb3) 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_ci#define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4) 6238c2ecf20Sopenharmony_ci#define KVM_REG_PPC_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5) 6248c2ecf20Sopenharmony_ci#define KVM_REG_PPC_LPCR_64 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb5) 6258c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PPR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb6) 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci/* Architecture compatibility level */ 6288c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ARCH_COMPAT (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb7) 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8) 6318c2ecf20Sopenharmony_ci#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9) 6328c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba) 6338c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb) 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_ci/* POWER9 registers */ 6368c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc) 6378c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci#define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe) 6408c2ecf20Sopenharmony_ci#define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) 6418c2ecf20Sopenharmony_ci#define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0) 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci/* POWER10 registers */ 6448c2ecf20Sopenharmony_ci#define KVM_REG_PPC_MMCR3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc1) 6458c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SIER2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc2) 6468c2ecf20Sopenharmony_ci#define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3) 6478c2ecf20Sopenharmony_ci 6488c2ecf20Sopenharmony_ci/* Transactional Memory checkpointed state: 6498c2ecf20Sopenharmony_ci * This is all GPRs, all VSX regs and a subset of SPRs 6508c2ecf20Sopenharmony_ci */ 6518c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM (KVM_REG_PPC | 0x80000000) 6528c2ecf20Sopenharmony_ci/* TM GPRs */ 6538c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_GPR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0) 6548c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_GPR(n) (KVM_REG_PPC_TM_GPR0 + (n)) 6558c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_GPR31 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x1f) 6568c2ecf20Sopenharmony_ci/* TM VSX */ 6578c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_VSR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x20) 6588c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_VSR(n) (KVM_REG_PPC_TM_VSR0 + (n)) 6598c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_VSR63 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x5f) 6608c2ecf20Sopenharmony_ci/* TM SPRS */ 6618c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_CR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x60) 6628c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_LR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x61) 6638c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_CTR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x62) 6648c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_FPSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x63) 6658c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_AMR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x64) 6668c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_PPR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x65) 6678c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_VRSAVE (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x66) 6688c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67) 6698c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68) 6708c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) 6718c2ecf20Sopenharmony_ci#define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a) 6728c2ecf20Sopenharmony_ci 6738c2ecf20Sopenharmony_ci/* PPC64 eXternal Interrupt Controller Specification */ 6748c2ecf20Sopenharmony_ci#define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */ 6758c2ecf20Sopenharmony_ci#define KVM_DEV_XICS_GRP_CTRL 2 6768c2ecf20Sopenharmony_ci#define KVM_DEV_XICS_NR_SERVERS 1 6778c2ecf20Sopenharmony_ci 6788c2ecf20Sopenharmony_ci/* Layout of 64-bit source attribute values */ 6798c2ecf20Sopenharmony_ci#define KVM_XICS_DESTINATION_SHIFT 0 6808c2ecf20Sopenharmony_ci#define KVM_XICS_DESTINATION_MASK 0xffffffffULL 6818c2ecf20Sopenharmony_ci#define KVM_XICS_PRIORITY_SHIFT 32 6828c2ecf20Sopenharmony_ci#define KVM_XICS_PRIORITY_MASK 0xff 6838c2ecf20Sopenharmony_ci#define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40) 6848c2ecf20Sopenharmony_ci#define KVM_XICS_MASKED (1ULL << 41) 6858c2ecf20Sopenharmony_ci#define KVM_XICS_PENDING (1ULL << 42) 6868c2ecf20Sopenharmony_ci#define KVM_XICS_PRESENTED (1ULL << 43) 6878c2ecf20Sopenharmony_ci#define KVM_XICS_QUEUED (1ULL << 44) 6888c2ecf20Sopenharmony_ci 6898c2ecf20Sopenharmony_ci/* POWER9 XIVE Native Interrupt Controller */ 6908c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_GRP_CTRL 1 6918c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_RESET 1 6928c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_EQ_SYNC 2 6938c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_NR_SERVERS 3 6948c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_GRP_SOURCE 2 /* 64-bit source identifier */ 6958c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_GRP_SOURCE_CONFIG 3 /* 64-bit source identifier */ 6968c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_GRP_EQ_CONFIG 4 /* 64-bit EQ identifier */ 6978c2ecf20Sopenharmony_ci#define KVM_DEV_XIVE_GRP_SOURCE_SYNC 5 /* 64-bit source identifier */ 6988c2ecf20Sopenharmony_ci 6998c2ecf20Sopenharmony_ci/* Layout of 64-bit XIVE source attribute values */ 7008c2ecf20Sopenharmony_ci#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0) 7018c2ecf20Sopenharmony_ci#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1) 7028c2ecf20Sopenharmony_ci 7038c2ecf20Sopenharmony_ci/* Layout of 64-bit XIVE source configuration attribute values */ 7048c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_PRIORITY_SHIFT 0 7058c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_PRIORITY_MASK 0x7 7068c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_SERVER_SHIFT 3 7078c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_SERVER_MASK 0xfffffff8ULL 7088c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_MASKED_SHIFT 32 7098c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_MASKED_MASK 0x100000000ULL 7108c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_EISN_SHIFT 33 7118c2ecf20Sopenharmony_ci#define KVM_XIVE_SOURCE_EISN_MASK 0xfffffffe00000000ULL 7128c2ecf20Sopenharmony_ci 7138c2ecf20Sopenharmony_ci/* Layout of 64-bit EQ identifier */ 7148c2ecf20Sopenharmony_ci#define KVM_XIVE_EQ_PRIORITY_SHIFT 0 7158c2ecf20Sopenharmony_ci#define KVM_XIVE_EQ_PRIORITY_MASK 0x7 7168c2ecf20Sopenharmony_ci#define KVM_XIVE_EQ_SERVER_SHIFT 3 7178c2ecf20Sopenharmony_ci#define KVM_XIVE_EQ_SERVER_MASK 0xfffffff8ULL 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci/* Layout of EQ configuration values (64 bytes) */ 7208c2ecf20Sopenharmony_cistruct kvm_ppc_xive_eq { 7218c2ecf20Sopenharmony_ci __u32 flags; 7228c2ecf20Sopenharmony_ci __u32 qshift; 7238c2ecf20Sopenharmony_ci __u64 qaddr; 7248c2ecf20Sopenharmony_ci __u32 qtoggle; 7258c2ecf20Sopenharmony_ci __u32 qindex; 7268c2ecf20Sopenharmony_ci __u8 pad[40]; 7278c2ecf20Sopenharmony_ci}; 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_ci#define KVM_XIVE_EQ_ALWAYS_NOTIFY 0x00000001 7308c2ecf20Sopenharmony_ci 7318c2ecf20Sopenharmony_ci#define KVM_XIVE_TIMA_PAGE_OFFSET 0 7328c2ecf20Sopenharmony_ci#define KVM_XIVE_ESB_PAGE_OFFSET 4 7338c2ecf20Sopenharmony_ci 7348c2ecf20Sopenharmony_ci#endif /* __LINUX_KVM_POWERPC_H */ 735