1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2c3617f72SDavid Howells /* 3c3617f72SDavid Howells * This program is free software; you can redistribute it and/or modify 4c3617f72SDavid Howells * it under the terms of the GNU General Public License, version 2, as 5c3617f72SDavid Howells * published by the Free Software Foundation. 6c3617f72SDavid Howells * 7c3617f72SDavid Howells * This program is distributed in the hope that it will be useful, 8c3617f72SDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 9c3617f72SDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10c3617f72SDavid Howells * GNU General Public License for more details. 11c3617f72SDavid Howells * 12c3617f72SDavid Howells * You should have received a copy of the GNU General Public License 13c3617f72SDavid Howells * along with this program; if not, write to the Free Software 14c3617f72SDavid Howells * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15c3617f72SDavid Howells * 16c3617f72SDavid Howells * Copyright IBM Corp. 2007 17c3617f72SDavid Howells * 18c3617f72SDavid Howells * Authors: Hollis Blanchard <hollisb@us.ibm.com> 19c3617f72SDavid Howells */ 20c3617f72SDavid Howells 21c3617f72SDavid Howells #ifndef __LINUX_KVM_POWERPC_H 22c3617f72SDavid Howells #define __LINUX_KVM_POWERPC_H 23c3617f72SDavid Howells 24c3617f72SDavid Howells #include <linux/types.h> 25c3617f72SDavid Howells 26c3617f72SDavid Howells /* Select powerpc specific features in <linux/kvm.h> */ 27c3617f72SDavid Howells #define __KVM_HAVE_SPAPR_TCE 28c3617f72SDavid Howells #define __KVM_HAVE_PPC_SMT 29de9ba2f3SAlexander Graf #define __KVM_HAVE_IRQCHIP 305efdb4beSAlexander Graf #define __KVM_HAVE_IRQ_LINE 31ce11e48bSBharat Bhushan #define __KVM_HAVE_GUEST_DEBUG 32c3617f72SDavid Howells 334b4357e0SPaolo Bonzini /* Not always available, but if it is, this is the correct offset. */ 344b4357e0SPaolo Bonzini #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 354b4357e0SPaolo Bonzini 36c3617f72SDavid Howells struct kvm_regs { 37c3617f72SDavid Howells __u64 pc; 38c3617f72SDavid Howells __u64 cr; 39c3617f72SDavid Howells __u64 ctr; 40c3617f72SDavid Howells __u64 lr; 41c3617f72SDavid Howells __u64 xer; 42c3617f72SDavid Howells __u64 msr; 43c3617f72SDavid Howells __u64 srr0; 44c3617f72SDavid Howells __u64 srr1; 45c3617f72SDavid Howells __u64 pid; 46c3617f72SDavid Howells 47c3617f72SDavid Howells __u64 sprg0; 48c3617f72SDavid Howells __u64 sprg1; 49c3617f72SDavid Howells __u64 sprg2; 50c3617f72SDavid Howells __u64 sprg3; 51c3617f72SDavid Howells __u64 sprg4; 52c3617f72SDavid Howells __u64 sprg5; 53c3617f72SDavid Howells __u64 sprg6; 54c3617f72SDavid Howells __u64 sprg7; 55c3617f72SDavid Howells 56c3617f72SDavid Howells __u64 gpr[32]; 57c3617f72SDavid Howells }; 58c3617f72SDavid Howells 59c3617f72SDavid Howells #define KVM_SREGS_E_IMPL_NONE 0 60c3617f72SDavid Howells #define KVM_SREGS_E_IMPL_FSL 1 61c3617f72SDavid Howells 62c3617f72SDavid Howells #define KVM_SREGS_E_FSL_PIDn (1 << 0) /* PID1/PID2 */ 63c3617f72SDavid Howells 64e20bbd3dSAravinda Prasad /* flags for kvm_run.flags */ 65e20bbd3dSAravinda Prasad #define KVM_RUN_PPC_NMI_DISP_MASK (3 << 0) 66e20bbd3dSAravinda Prasad #define KVM_RUN_PPC_NMI_DISP_FULLY_RECOV (1 << 0) 67e20bbd3dSAravinda Prasad #define KVM_RUN_PPC_NMI_DISP_LIMITED_RECOV (2 << 0) 68e20bbd3dSAravinda Prasad #define KVM_RUN_PPC_NMI_DISP_NOT_RECOV (3 << 0) 69e20bbd3dSAravinda Prasad 70c3617f72SDavid Howells /* 71c3617f72SDavid Howells * Feature bits indicate which sections of the sregs struct are valid, 72c3617f72SDavid Howells * both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers 73c3617f72SDavid Howells * corresponding to unset feature bits will not be modified. This allows 74c3617f72SDavid Howells * restoring a checkpoint made without that feature, while keeping the 75c3617f72SDavid Howells * default values of the new registers. 76c3617f72SDavid Howells * 77c3617f72SDavid Howells * KVM_SREGS_E_BASE contains: 78c3617f72SDavid Howells * CSRR0/1 (refers to SRR2/3 on 40x) 79c3617f72SDavid Howells * ESR 80c3617f72SDavid Howells * DEAR 81c3617f72SDavid Howells * MCSR 82c3617f72SDavid Howells * TSR 83c3617f72SDavid Howells * TCR 84c3617f72SDavid Howells * DEC 85c3617f72SDavid Howells * TB 86c3617f72SDavid Howells * VRSAVE (USPRG0) 87c3617f72SDavid Howells */ 88c3617f72SDavid Howells #define KVM_SREGS_E_BASE (1 << 0) 89c3617f72SDavid Howells 90c3617f72SDavid Howells /* 91c3617f72SDavid Howells * KVM_SREGS_E_ARCH206 contains: 92c3617f72SDavid Howells * 93c3617f72SDavid Howells * PIR 94c3617f72SDavid Howells * MCSRR0/1 95c3617f72SDavid Howells * DECAR 96c3617f72SDavid Howells * IVPR 97c3617f72SDavid Howells */ 98c3617f72SDavid Howells #define KVM_SREGS_E_ARCH206 (1 << 1) 99c3617f72SDavid Howells 100c3617f72SDavid Howells /* 101c3617f72SDavid Howells * Contains EPCR, plus the upper half of 64-bit registers 102c3617f72SDavid Howells * that are 32-bit on 32-bit implementations. 103c3617f72SDavid Howells */ 104c3617f72SDavid Howells #define KVM_SREGS_E_64 (1 << 2) 105c3617f72SDavid Howells 106c3617f72SDavid Howells #define KVM_SREGS_E_SPRG8 (1 << 3) 107c3617f72SDavid Howells #define KVM_SREGS_E_MCIVPR (1 << 4) 108c3617f72SDavid Howells 109c3617f72SDavid Howells /* 110c3617f72SDavid Howells * IVORs are used -- contains IVOR0-15, plus additional IVORs 111c3617f72SDavid Howells * in combination with an appropriate feature bit. 112c3617f72SDavid Howells */ 113c3617f72SDavid Howells #define KVM_SREGS_E_IVOR (1 << 5) 114c3617f72SDavid Howells 115c3617f72SDavid Howells /* 116c3617f72SDavid Howells * Contains MAS0-4, MAS6-7, TLBnCFG, MMUCFG. 117c3617f72SDavid Howells * Also TLBnPS if MMUCFG[MAVN] = 1. 118c3617f72SDavid Howells */ 119c3617f72SDavid Howells #define KVM_SREGS_E_ARCH206_MMU (1 << 6) 120c3617f72SDavid Howells 121c3617f72SDavid Howells /* DBSR, DBCR, IAC, DAC, DVC */ 122c3617f72SDavid Howells #define KVM_SREGS_E_DEBUG (1 << 7) 123c3617f72SDavid Howells 124c3617f72SDavid Howells /* Enhanced debug -- DSRR0/1, SPRG9 */ 125c3617f72SDavid Howells #define KVM_SREGS_E_ED (1 << 8) 126c3617f72SDavid Howells 127c3617f72SDavid Howells /* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */ 128c3617f72SDavid Howells #define KVM_SREGS_E_SPE (1 << 9) 129c3617f72SDavid Howells 130324b3e63SAlexander Graf /* 131324b3e63SAlexander Graf * DEPRECATED! USE ONE_REG FOR THIS ONE! 132324b3e63SAlexander Graf * External Proxy (EXP) -- EPR 133324b3e63SAlexander Graf */ 134c3617f72SDavid Howells #define KVM_SREGS_EXP (1 << 10) 135c3617f72SDavid Howells 136c3617f72SDavid Howells /* External PID (E.PD) -- EPSC/EPLC */ 137c3617f72SDavid Howells #define KVM_SREGS_E_PD (1 << 11) 138c3617f72SDavid Howells 139c3617f72SDavid Howells /* Processor Control (E.PC) -- IVOR36-37 if KVM_SREGS_E_IVOR */ 140c3617f72SDavid Howells #define KVM_SREGS_E_PC (1 << 12) 141c3617f72SDavid Howells 142c3617f72SDavid Howells /* Page table (E.PT) -- EPTCFG */ 143c3617f72SDavid Howells #define KVM_SREGS_E_PT (1 << 13) 144c3617f72SDavid Howells 145c3617f72SDavid Howells /* Embedded Performance Monitor (E.PM) -- IVOR35 if KVM_SREGS_E_IVOR */ 146c3617f72SDavid Howells #define KVM_SREGS_E_PM (1 << 14) 147c3617f72SDavid Howells 148c3617f72SDavid Howells /* 149c3617f72SDavid Howells * Special updates: 150c3617f72SDavid Howells * 151c3617f72SDavid Howells * Some registers may change even while a vcpu is not running. 152c3617f72SDavid Howells * To avoid losing these changes, by default these registers are 153c3617f72SDavid Howells * not updated by KVM_SET_SREGS. To force an update, set the bit 154c3617f72SDavid Howells * in u.e.update_special corresponding to the register to be updated. 155c3617f72SDavid Howells * 156c3617f72SDavid Howells * The update_special field is zero on return from KVM_GET_SREGS. 157c3617f72SDavid Howells * 158c3617f72SDavid Howells * When restoring a checkpoint, the caller can set update_special 159c3617f72SDavid Howells * to 0xffffffff to ensure that everything is restored, even new features 160c3617f72SDavid Howells * that the caller doesn't know about. 161c3617f72SDavid Howells */ 162c3617f72SDavid Howells #define KVM_SREGS_E_UPDATE_MCSR (1 << 0) 163c3617f72SDavid Howells #define KVM_SREGS_E_UPDATE_TSR (1 << 1) 164c3617f72SDavid Howells #define KVM_SREGS_E_UPDATE_DEC (1 << 2) 165c3617f72SDavid Howells #define KVM_SREGS_E_UPDATE_DBSR (1 << 3) 166c3617f72SDavid Howells 167c3617f72SDavid Howells /* 168c3617f72SDavid Howells * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a 169c3617f72SDavid Howells * previous KVM_GET_REGS. 170c3617f72SDavid Howells * 171c3617f72SDavid Howells * Unless otherwise indicated, setting any register with KVM_SET_SREGS 172c3617f72SDavid Howells * directly sets its value. It does not trigger any special semantics such 173c3617f72SDavid Howells * as write-one-to-clear. Calling KVM_SET_SREGS on an unmodified struct 174c3617f72SDavid Howells * just received from KVM_GET_SREGS is always a no-op. 175c3617f72SDavid Howells */ 176c3617f72SDavid Howells struct kvm_sregs { 177c3617f72SDavid Howells __u32 pvr; 178c3617f72SDavid Howells union { 179c3617f72SDavid Howells struct { 180c3617f72SDavid Howells __u64 sdr1; 181c3617f72SDavid Howells struct { 182c3617f72SDavid Howells struct { 183c3617f72SDavid Howells __u64 slbe; 184c3617f72SDavid Howells __u64 slbv; 185c3617f72SDavid Howells } slb[64]; 186c3617f72SDavid Howells } ppc64; 187c3617f72SDavid Howells struct { 188c3617f72SDavid Howells __u32 sr[16]; 189c3617f72SDavid Howells __u64 ibat[8]; 190c3617f72SDavid Howells __u64 dbat[8]; 191c3617f72SDavid Howells } ppc32; 192c3617f72SDavid Howells } s; 193c3617f72SDavid Howells struct { 194c3617f72SDavid Howells union { 195c3617f72SDavid Howells struct { /* KVM_SREGS_E_IMPL_FSL */ 196c3617f72SDavid Howells __u32 features; /* KVM_SREGS_E_FSL_ */ 197c3617f72SDavid Howells __u32 svr; 198c3617f72SDavid Howells __u64 mcar; 199c3617f72SDavid Howells __u32 hid0; 200c3617f72SDavid Howells 201c3617f72SDavid Howells /* KVM_SREGS_E_FSL_PIDn */ 202c3617f72SDavid Howells __u32 pid1, pid2; 203c3617f72SDavid Howells } fsl; 204c3617f72SDavid Howells __u8 pad[256]; 205c3617f72SDavid Howells } impl; 206c3617f72SDavid Howells 207c3617f72SDavid Howells __u32 features; /* KVM_SREGS_E_ */ 208c3617f72SDavid Howells __u32 impl_id; /* KVM_SREGS_E_IMPL_ */ 209c3617f72SDavid Howells __u32 update_special; /* KVM_SREGS_E_UPDATE_ */ 210c3617f72SDavid Howells __u32 pir; /* read-only */ 211c3617f72SDavid Howells __u64 sprg8; 212c3617f72SDavid Howells __u64 sprg9; /* E.ED */ 213c3617f72SDavid Howells __u64 csrr0; 214c3617f72SDavid Howells __u64 dsrr0; /* E.ED */ 215c3617f72SDavid Howells __u64 mcsrr0; 216c3617f72SDavid Howells __u32 csrr1; 217c3617f72SDavid Howells __u32 dsrr1; /* E.ED */ 218c3617f72SDavid Howells __u32 mcsrr1; 219c3617f72SDavid Howells __u32 esr; 220c3617f72SDavid Howells __u64 dear; 221c3617f72SDavid Howells __u64 ivpr; 222c3617f72SDavid Howells __u64 mcivpr; 223c3617f72SDavid Howells __u64 mcsr; /* KVM_SREGS_E_UPDATE_MCSR */ 224c3617f72SDavid Howells 225c3617f72SDavid Howells __u32 tsr; /* KVM_SREGS_E_UPDATE_TSR */ 226c3617f72SDavid Howells __u32 tcr; 227c3617f72SDavid Howells __u32 decar; 228c3617f72SDavid Howells __u32 dec; /* KVM_SREGS_E_UPDATE_DEC */ 229c3617f72SDavid Howells 230c3617f72SDavid Howells /* 231c3617f72SDavid Howells * Userspace can read TB directly, but the 232c3617f72SDavid Howells * value reported here is consistent with "dec". 233c3617f72SDavid Howells * 234c3617f72SDavid Howells * Read-only. 235c3617f72SDavid Howells */ 236c3617f72SDavid Howells __u64 tb; 237c3617f72SDavid Howells 238c3617f72SDavid Howells __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */ 239c3617f72SDavid Howells __u32 dbcr[3]; 24019bf7f8aSMarcelo Tosatti /* 24119bf7f8aSMarcelo Tosatti * iac/dac registers are 64bit wide, while this API 24219bf7f8aSMarcelo Tosatti * interface provides only lower 32 bits on 64 bit 24319bf7f8aSMarcelo Tosatti * processors. ONE_REG interface is added for 64bit 24419bf7f8aSMarcelo Tosatti * iac/dac registers. 24519bf7f8aSMarcelo Tosatti */ 246c3617f72SDavid Howells __u32 iac[4]; 247c3617f72SDavid Howells __u32 dac[2]; 248c3617f72SDavid Howells __u32 dvc[2]; 249c3617f72SDavid Howells __u8 num_iac; /* read-only */ 250c3617f72SDavid Howells __u8 num_dac; /* read-only */ 251c3617f72SDavid Howells __u8 num_dvc; /* read-only */ 252c3617f72SDavid Howells __u8 pad; 253c3617f72SDavid Howells 254c3617f72SDavid Howells __u32 epr; /* EXP */ 255c3617f72SDavid Howells __u32 vrsave; /* a.k.a. USPRG0 */ 256c3617f72SDavid Howells __u32 epcr; /* KVM_SREGS_E_64 */ 257c3617f72SDavid Howells 258c3617f72SDavid Howells __u32 mas0; 259c3617f72SDavid Howells __u32 mas1; 260c3617f72SDavid Howells __u64 mas2; 261c3617f72SDavid Howells __u64 mas7_3; 262c3617f72SDavid Howells __u32 mas4; 263c3617f72SDavid Howells __u32 mas6; 264c3617f72SDavid Howells 265c3617f72SDavid Howells __u32 ivor_low[16]; /* IVOR0-15 */ 266c3617f72SDavid Howells __u32 ivor_high[18]; /* IVOR32+, plus room to expand */ 267c3617f72SDavid Howells 268c3617f72SDavid Howells __u32 mmucfg; /* read-only */ 269c3617f72SDavid Howells __u32 eptcfg; /* E.PT, read-only */ 270c3617f72SDavid Howells __u32 tlbcfg[4];/* read-only */ 271c3617f72SDavid Howells __u32 tlbps[4]; /* read-only */ 272c3617f72SDavid Howells 273c3617f72SDavid Howells __u32 eplc, epsc; /* E.PD */ 274c3617f72SDavid Howells } e; 275c3617f72SDavid Howells __u8 pad[1020]; 276c3617f72SDavid Howells } u; 277c3617f72SDavid Howells }; 278c3617f72SDavid Howells 279c3617f72SDavid Howells struct kvm_fpu { 280c3617f72SDavid Howells __u64 fpr[32]; 281c3617f72SDavid Howells }; 282c3617f72SDavid Howells 283b12c7841SBharat Bhushan /* 284b12c7841SBharat Bhushan * Defines for h/w breakpoint, watchpoint (read, write or both) and 285b12c7841SBharat Bhushan * software breakpoint. 286b12c7841SBharat Bhushan * These are used as "type" in KVM_SET_GUEST_DEBUG ioctl and "status" 287b12c7841SBharat Bhushan * for KVM_DEBUG_EXIT. 288b12c7841SBharat Bhushan */ 289b12c7841SBharat Bhushan #define KVMPPC_DEBUG_NONE 0x0 290b12c7841SBharat Bhushan #define KVMPPC_DEBUG_BREAKPOINT (1UL << 1) 291b12c7841SBharat Bhushan #define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2) 292b12c7841SBharat Bhushan #define KVMPPC_DEBUG_WATCH_READ (1UL << 3) 293c3617f72SDavid Howells struct kvm_debug_exit_arch { 294b12c7841SBharat Bhushan __u64 address; 295b12c7841SBharat Bhushan /* 296b12c7841SBharat Bhushan * exiting to userspace because of h/w breakpoint, watchpoint 297b12c7841SBharat Bhushan * (read, write or both) and software breakpoint. 298b12c7841SBharat Bhushan */ 299b12c7841SBharat Bhushan __u32 status; 300b12c7841SBharat Bhushan __u32 reserved; 301c3617f72SDavid Howells }; 302c3617f72SDavid Howells 303c3617f72SDavid Howells /* for KVM_SET_GUEST_DEBUG */ 304c3617f72SDavid Howells struct kvm_guest_debug_arch { 305092d62eeSBharat Bhushan struct { 306092d62eeSBharat Bhushan /* H/W breakpoint/watchpoint address */ 307092d62eeSBharat Bhushan __u64 addr; 308092d62eeSBharat Bhushan /* 309092d62eeSBharat Bhushan * Type denotes h/w breakpoint, read watchpoint, write 310092d62eeSBharat Bhushan * watchpoint or watchpoint (both read and write). 311092d62eeSBharat Bhushan */ 312092d62eeSBharat Bhushan __u32 type; 313092d62eeSBharat Bhushan __u32 reserved; 314092d62eeSBharat Bhushan } bp[16]; 315c3617f72SDavid Howells }; 316c3617f72SDavid Howells 317092d62eeSBharat Bhushan /* Debug related defines */ 318092d62eeSBharat Bhushan /* 319092d62eeSBharat Bhushan * kvm_guest_debug->control is a 32 bit field. The lower 16 bits are generic 320092d62eeSBharat Bhushan * and upper 16 bits are architecture specific. Architecture specific defines 321092d62eeSBharat Bhushan * that ioctl is for setting hardware breakpoint or software breakpoint. 322092d62eeSBharat Bhushan */ 323092d62eeSBharat Bhushan #define KVM_GUESTDBG_USE_SW_BP 0x00010000 324092d62eeSBharat Bhushan #define KVM_GUESTDBG_USE_HW_BP 0x00020000 325092d62eeSBharat Bhushan 326c3617f72SDavid Howells /* definition of registers in kvm_run */ 327c3617f72SDavid Howells struct kvm_sync_regs { 328c3617f72SDavid Howells }; 329c3617f72SDavid Howells 330c3617f72SDavid Howells #define KVM_INTERRUPT_SET -1U 331c3617f72SDavid Howells #define KVM_INTERRUPT_UNSET -2U 332c3617f72SDavid Howells #define KVM_INTERRUPT_SET_LEVEL -3U 333c3617f72SDavid Howells 334c3617f72SDavid Howells #define KVM_CPU_440 1 335c3617f72SDavid Howells #define KVM_CPU_E500V2 2 336c3617f72SDavid Howells #define KVM_CPU_3S_32 3 337c3617f72SDavid Howells #define KVM_CPU_3S_64 4 338c3617f72SDavid Howells #define KVM_CPU_E500MC 5 339c3617f72SDavid Howells 340c3617f72SDavid Howells /* for KVM_CAP_SPAPR_TCE */ 341c3617f72SDavid Howells struct kvm_create_spapr_tce { 342c3617f72SDavid Howells __u64 liobn; 343c3617f72SDavid Howells __u32 window_size; 344c3617f72SDavid Howells }; 345c3617f72SDavid Howells 34658ded420SAlexey Kardashevskiy /* for KVM_CAP_SPAPR_TCE_64 */ 34758ded420SAlexey Kardashevskiy struct kvm_create_spapr_tce_64 { 34858ded420SAlexey Kardashevskiy __u64 liobn; 34958ded420SAlexey Kardashevskiy __u32 page_shift; 35058ded420SAlexey Kardashevskiy __u32 flags; 35158ded420SAlexey Kardashevskiy __u64 offset; /* in pages */ 35258ded420SAlexey Kardashevskiy __u64 size; /* in pages */ 35358ded420SAlexey Kardashevskiy }; 35458ded420SAlexey Kardashevskiy 355c3617f72SDavid Howells /* for KVM_ALLOCATE_RMA */ 356c3617f72SDavid Howells struct kvm_allocate_rma { 357c3617f72SDavid Howells __u64 rma_size; 358c3617f72SDavid Howells }; 359c3617f72SDavid Howells 3608e591cb7SMichael Ellerman /* for KVM_CAP_PPC_RTAS */ 3618e591cb7SMichael Ellerman struct kvm_rtas_token_args { 3628e591cb7SMichael Ellerman char name[120]; 3638e591cb7SMichael Ellerman __u64 token; /* Use a token of 0 to undefine a mapping */ 3648e591cb7SMichael Ellerman }; 3658e591cb7SMichael Ellerman 366c3617f72SDavid Howells struct kvm_book3e_206_tlb_entry { 367c3617f72SDavid Howells __u32 mas8; 368c3617f72SDavid Howells __u32 mas1; 369c3617f72SDavid Howells __u64 mas2; 370c3617f72SDavid Howells __u64 mas7_3; 371c3617f72SDavid Howells }; 372c3617f72SDavid Howells 373c3617f72SDavid Howells struct kvm_book3e_206_tlb_params { 374c3617f72SDavid Howells /* 375c3617f72SDavid Howells * For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV: 376c3617f72SDavid Howells * 377c3617f72SDavid Howells * - The number of ways of TLB0 must be a power of two between 2 and 378c3617f72SDavid Howells * 16. 379c3617f72SDavid Howells * - TLB1 must be fully associative. 380c3617f72SDavid Howells * - The size of TLB0 must be a multiple of the number of ways, and 381c3617f72SDavid Howells * the number of sets must be a power of two. 382c3617f72SDavid Howells * - The size of TLB1 may not exceed 64 entries. 383c3617f72SDavid Howells * - TLB0 supports 4 KiB pages. 384c3617f72SDavid Howells * - The page sizes supported by TLB1 are as indicated by 385c3617f72SDavid Howells * TLB1CFG (if MMUCFG[MAVN] = 0) or TLB1PS (if MMUCFG[MAVN] = 1) 386c3617f72SDavid Howells * as returned by KVM_GET_SREGS. 387c3617f72SDavid Howells * - TLB2 and TLB3 are reserved, and their entries in tlb_sizes[] 388c3617f72SDavid Howells * and tlb_ways[] must be zero. 389c3617f72SDavid Howells * 390c3617f72SDavid Howells * tlb_ways[n] = tlb_sizes[n] means the array is fully associative. 391c3617f72SDavid Howells * 392c3617f72SDavid Howells * KVM will adjust TLBnCFG based on the sizes configured here, 393c3617f72SDavid Howells * though arrays greater than 2048 entries will have TLBnCFG[NENTRY] 394c3617f72SDavid Howells * set to zero. 395c3617f72SDavid Howells */ 396c3617f72SDavid Howells __u32 tlb_sizes[4]; 397c3617f72SDavid Howells __u32 tlb_ways[4]; 398c3617f72SDavid Howells __u32 reserved[8]; 399c3617f72SDavid Howells }; 400c3617f72SDavid Howells 401a2932923SPaul Mackerras /* For KVM_PPC_GET_HTAB_FD */ 402a2932923SPaul Mackerras struct kvm_get_htab_fd { 403a2932923SPaul Mackerras __u64 flags; 404a2932923SPaul Mackerras __u64 start_index; 405a2932923SPaul Mackerras __u64 reserved[2]; 406a2932923SPaul Mackerras }; 407a2932923SPaul Mackerras 408a2932923SPaul Mackerras /* Values for kvm_get_htab_fd.flags */ 409a2932923SPaul Mackerras #define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) 410a2932923SPaul Mackerras #define KVM_GET_HTAB_WRITE ((__u64)0x2) 411a2932923SPaul Mackerras 412a2932923SPaul Mackerras /* 413a2932923SPaul Mackerras * Data read on the file descriptor is formatted as a series of 414a2932923SPaul Mackerras * records, each consisting of a header followed by a series of 415a2932923SPaul Mackerras * `n_valid' HPTEs (16 bytes each), which are all valid. Following 416a2932923SPaul Mackerras * those valid HPTEs there are `n_invalid' invalid HPTEs, which 417a2932923SPaul Mackerras * are not represented explicitly in the stream. The same format 418a2932923SPaul Mackerras * is used for writing. 419a2932923SPaul Mackerras */ 420a2932923SPaul Mackerras struct kvm_get_htab_header { 421a2932923SPaul Mackerras __u32 index; 422a2932923SPaul Mackerras __u16 n_valid; 423a2932923SPaul Mackerras __u16 n_invalid; 424a2932923SPaul Mackerras }; 425a2932923SPaul Mackerras 426c9270132SPaul Mackerras /* For KVM_PPC_CONFIGURE_V3_MMU */ 427c9270132SPaul Mackerras struct kvm_ppc_mmuv3_cfg { 428c9270132SPaul Mackerras __u64 flags; 429c9270132SPaul Mackerras __u64 process_table; /* second doubleword of partition table entry */ 430c9270132SPaul Mackerras }; 431c9270132SPaul Mackerras 432c9270132SPaul Mackerras /* Flag values for KVM_PPC_CONFIGURE_V3_MMU */ 433c9270132SPaul Mackerras #define KVM_PPC_MMUV3_RADIX 1 /* 1 = radix mode, 0 = HPT */ 434c9270132SPaul Mackerras #define KVM_PPC_MMUV3_GTSE 2 /* global translation shootdown enb. */ 435c9270132SPaul Mackerras 436c9270132SPaul Mackerras /* For KVM_PPC_GET_RMMU_INFO */ 437c9270132SPaul Mackerras struct kvm_ppc_rmmu_info { 438c9270132SPaul Mackerras struct kvm_ppc_radix_geom { 439c9270132SPaul Mackerras __u8 page_shift; 440c9270132SPaul Mackerras __u8 level_bits[4]; 441c9270132SPaul Mackerras __u8 pad[3]; 442c9270132SPaul Mackerras } geometries[8]; 443c9270132SPaul Mackerras __u32 ap_encodings[8]; 444c9270132SPaul Mackerras }; 445c9270132SPaul Mackerras 4463214d01fSPaul Mackerras /* For KVM_PPC_GET_CPU_CHAR */ 4473214d01fSPaul Mackerras struct kvm_ppc_cpu_char { 4483214d01fSPaul Mackerras __u64 character; /* characteristics of the CPU */ 4493214d01fSPaul Mackerras __u64 behaviour; /* recommended software behaviour */ 4503214d01fSPaul Mackerras __u64 character_mask; /* valid bits in character */ 4513214d01fSPaul Mackerras __u64 behaviour_mask; /* valid bits in behaviour */ 4523214d01fSPaul Mackerras }; 4533214d01fSPaul Mackerras 4543214d01fSPaul Mackerras /* 4553214d01fSPaul Mackerras * Values for character and character_mask. 4563214d01fSPaul Mackerras * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. 4573214d01fSPaul Mackerras */ 4583214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 (1ULL << 63) 4593214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) 4603214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) 4613214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) 4623214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) 4633214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) 4643214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) 4653214d01fSPaul Mackerras #define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) 4662b57ecd0SSuraj Jitindar Singh #define KVM_PPC_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54) 4673214d01fSPaul Mackerras 4683214d01fSPaul Mackerras #define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) 4693214d01fSPaul Mackerras #define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) 4703214d01fSPaul Mackerras #define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) 4712b57ecd0SSuraj Jitindar Singh #define KVM_PPC_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58) 4723214d01fSPaul Mackerras 4738b78645cSPaul Mackerras /* Per-vcpu XICS interrupt controller state */ 4748b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) 4758b78645cSPaul Mackerras 4768b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_CPPR_SHIFT 56 /* current proc priority */ 4778b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_CPPR_MASK 0xff 4788b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_XISR_SHIFT 32 /* interrupt status field */ 4798b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_XISR_MASK 0xffffff 4808b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_MFRR_SHIFT 24 /* pending IPI priority */ 4818b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_MFRR_MASK 0xff 4828b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */ 4838b78645cSPaul Mackerras #define KVM_REG_PPC_ICP_PPRI_MASK 0xff 4848b78645cSPaul Mackerras 485e4945b9dSCédric Le Goater #define KVM_REG_PPC_VP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x8d) 486e4945b9dSCédric Le Goater 4875df554adSScott Wood /* Device control API: PPC-specific devices */ 4885df554adSScott Wood #define KVM_DEV_MPIC_GRP_MISC 1 4895df554adSScott Wood #define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */ 4905df554adSScott Wood 4915df554adSScott Wood #define KVM_DEV_MPIC_GRP_REGISTER 2 /* 32-bit */ 4925df554adSScott Wood #define KVM_DEV_MPIC_GRP_IRQ_ACTIVE 3 /* 32-bit */ 4935df554adSScott Wood 4945df554adSScott Wood /* One-Reg API: PPC-specific registers */ 495c3617f72SDavid Howells #define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1) 49619bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2) 49719bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3) 49819bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_IAC3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x4) 49919bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_IAC4 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5) 50019bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_DAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6) 50119bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_DAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7) 50219bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_DABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8) 50319bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_DSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9) 50419bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa) 50519bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_SPURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb) 50619bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_DAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc) 50719bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_DSISR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd) 50819bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_AMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe) 50919bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_UAMOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf) 51019bf7f8aSMarcelo Tosatti 51119bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10) 51219bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11) 51319bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12) 5143b783474SMichael Neuling #define KVM_REG_PPC_MMCR2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x13) 5153b783474SMichael Neuling #define KVM_REG_PPC_MMCRS (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x14) 5163b783474SMichael Neuling #define KVM_REG_PPC_SIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x15) 5173b783474SMichael Neuling #define KVM_REG_PPC_SDAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x16) 5183b783474SMichael Neuling #define KVM_REG_PPC_SIER (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x17) 51919bf7f8aSMarcelo Tosatti 52019bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18) 52119bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19) 52219bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC3 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a) 52319bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b) 52419bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC5 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c) 52519bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d) 52619bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC7 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e) 52719bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_PMC8 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f) 52819bf7f8aSMarcelo Tosatti 52919bf7f8aSMarcelo Tosatti /* 32 floating-point registers */ 53019bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_FPR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x20) 53119bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_FPR(n) (KVM_REG_PPC_FPR0 + (n)) 53219bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_FPR31 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3f) 53319bf7f8aSMarcelo Tosatti 53419bf7f8aSMarcelo Tosatti /* 32 VMX/Altivec vector registers */ 53519bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x40) 53619bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VR(n) (KVM_REG_PPC_VR0 + (n)) 53719bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x5f) 53819bf7f8aSMarcelo Tosatti 53919bf7f8aSMarcelo Tosatti /* 32 double-width FP registers for VSX */ 54019bf7f8aSMarcelo Tosatti /* High-order halves overlap with FP regs */ 54119bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VSR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x60) 54219bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VSR(n) (KVM_REG_PPC_VSR0 + (n)) 54319bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VSR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x7f) 54419bf7f8aSMarcelo Tosatti 54519bf7f8aSMarcelo Tosatti /* FP and vector status/control registers */ 54619bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80) 5473840edc8SMihai Caraman /* 5483840edc8SMihai Caraman * VSCR register is documented as a 32-bit register in the ISA, but it can 5493840edc8SMihai Caraman * only be accesses via a vector register. Expose VSCR as a 32-bit register 5503840edc8SMihai Caraman * even though the kernel represents it as a 128-bit vector. 5513840edc8SMihai Caraman */ 55219bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81) 55319bf7f8aSMarcelo Tosatti 55419bf7f8aSMarcelo Tosatti /* Virtual processor areas */ 55519bf7f8aSMarcelo Tosatti /* For SLB & DTL, address in high (first) half, length in low half */ 55619bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VPA_ADDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x82) 55719bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83) 55819bf7f8aSMarcelo Tosatti #define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84) 559c3617f72SDavid Howells 560352df1deSMihai Caraman #define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) 561324b3e63SAlexander Graf #define KVM_REG_PPC_EPR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x86) 562352df1deSMihai Caraman 56378accda4SBharat Bhushan /* Timer Status Register OR/CLEAR interface */ 56478accda4SBharat Bhushan #define KVM_REG_PPC_OR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x87) 56578accda4SBharat Bhushan #define KVM_REG_PPC_CLEAR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x88) 56678accda4SBharat Bhushan #define KVM_REG_PPC_TCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x89) 56778accda4SBharat Bhushan #define KVM_REG_PPC_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8a) 5688c32a2eaSBharat Bhushan 5698c32a2eaSBharat Bhushan /* Debugging: Special instruction for software breakpoint */ 5708c32a2eaSBharat Bhushan #define KVM_REG_PPC_DEBUG_INST (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8b) 5718c32a2eaSBharat Bhushan 572a85d2aa2SMihai Caraman /* MMU registers */ 573a85d2aa2SMihai Caraman #define KVM_REG_PPC_MAS0 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8c) 574a85d2aa2SMihai Caraman #define KVM_REG_PPC_MAS1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8d) 575a85d2aa2SMihai Caraman #define KVM_REG_PPC_MAS2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8e) 576a85d2aa2SMihai Caraman #define KVM_REG_PPC_MAS7_3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8f) 577a85d2aa2SMihai Caraman #define KVM_REG_PPC_MAS4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x90) 578a85d2aa2SMihai Caraman #define KVM_REG_PPC_MAS6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x91) 579a85d2aa2SMihai Caraman #define KVM_REG_PPC_MMUCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x92) 580a85d2aa2SMihai Caraman /* 581a85d2aa2SMihai Caraman * TLBnCFG fields TLBnCFG_N_ENTRY and TLBnCFG_ASSOC can be changed only using 582a85d2aa2SMihai Caraman * KVM_CAP_SW_TLB ioctl 583a85d2aa2SMihai Caraman */ 584a85d2aa2SMihai Caraman #define KVM_REG_PPC_TLB0CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x93) 585a85d2aa2SMihai Caraman #define KVM_REG_PPC_TLB1CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x94) 586a85d2aa2SMihai Caraman #define KVM_REG_PPC_TLB2CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x95) 587a85d2aa2SMihai Caraman #define KVM_REG_PPC_TLB3CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x96) 588307d9008SMihai Caraman #define KVM_REG_PPC_TLB0PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x97) 589307d9008SMihai Caraman #define KVM_REG_PPC_TLB1PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x98) 590307d9008SMihai Caraman #define KVM_REG_PPC_TLB2PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x99) 591307d9008SMihai Caraman #define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a) 5929a6061d7SMihai Caraman #define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b) 593a85d2aa2SMihai Caraman 59493b0f4dcSPaul Mackerras /* Timebase offset */ 59593b0f4dcSPaul Mackerras #define KVM_REG_PPC_TB_OFFSET (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9c) 59693b0f4dcSPaul Mackerras 5973b783474SMichael Neuling /* POWER8 registers */ 5983b783474SMichael Neuling #define KVM_REG_PPC_SPMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9d) 5993b783474SMichael Neuling #define KVM_REG_PPC_SPMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9e) 6003b783474SMichael Neuling #define KVM_REG_PPC_IAMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9f) 6013b783474SMichael Neuling #define KVM_REG_PPC_TFHAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa0) 6023b783474SMichael Neuling #define KVM_REG_PPC_TFIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa1) 6033b783474SMichael Neuling #define KVM_REG_PPC_TEXASR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa2) 6043b783474SMichael Neuling #define KVM_REG_PPC_FSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa3) 6053b783474SMichael Neuling #define KVM_REG_PPC_PSPB (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xa4) 6063b783474SMichael Neuling #define KVM_REG_PPC_EBBHR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa5) 6073b783474SMichael Neuling #define KVM_REG_PPC_EBBRR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa6) 6083b783474SMichael Neuling #define KVM_REG_PPC_BESCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa7) 6093b783474SMichael Neuling #define KVM_REG_PPC_TAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa8) 6103b783474SMichael Neuling #define KVM_REG_PPC_DPDES (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa9) 6113b783474SMichael Neuling #define KVM_REG_PPC_DAWR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaa) 6123b783474SMichael Neuling #define KVM_REG_PPC_DAWRX (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xab) 6133b783474SMichael Neuling #define KVM_REG_PPC_CIABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xac) 6143b783474SMichael Neuling #define KVM_REG_PPC_IC (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xad) 6153b783474SMichael Neuling #define KVM_REG_PPC_VTB (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xae) 6163b783474SMichael Neuling #define KVM_REG_PPC_CSIGR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaf) 6173b783474SMichael Neuling #define KVM_REG_PPC_TACR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb0) 6183b783474SMichael Neuling #define KVM_REG_PPC_TCSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb1) 6193b783474SMichael Neuling #define KVM_REG_PPC_PID (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb2) 6203b783474SMichael Neuling #define KVM_REG_PPC_ACOP (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb3) 6213b783474SMichael Neuling 622c0867fd5SPaul Mackerras #define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4) 623a0144e2aSPaul Mackerras #define KVM_REG_PPC_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5) 624a0840240SAlexey Kardashevskiy #define KVM_REG_PPC_LPCR_64 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb5) 6254b8473c9SPaul Mackerras #define KVM_REG_PPC_PPR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb6) 626c0867fd5SPaul Mackerras 627388cc6e1SPaul Mackerras /* Architecture compatibility level */ 628388cc6e1SPaul Mackerras #define KVM_REG_PPC_ARCH_COMPAT (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb7) 629388cc6e1SPaul Mackerras 6308563bf52SPaul Mackerras #define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8) 631e1d8a96dSPaul Mackerras #define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9) 63228d2f421SBharat Bhushan #define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba) 6332c509672SBharat Bhushan #define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb) 6348563bf52SPaul Mackerras 635e9cf1e08SPaul Mackerras /* POWER9 registers */ 636e9cf1e08SPaul Mackerras #define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc) 637e9cf1e08SPaul Mackerras #define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) 638e9cf1e08SPaul Mackerras 6395855564cSPaul Mackerras #define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe) 640a1f15826SPaul Mackerras #define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) 64130323418SPaul Mackerras #define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0) 6425855564cSPaul Mackerras 6435752fe0bSAthira Rajeev /* POWER10 registers */ 6445752fe0bSAthira Rajeev #define KVM_REG_PPC_MMCR3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc1) 6455752fe0bSAthira Rajeev #define KVM_REG_PPC_SIER2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc2) 6465752fe0bSAthira Rajeev #define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3) 647*bd1de1a0SRavi Bangoria #define KVM_REG_PPC_DAWR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4) 648*bd1de1a0SRavi Bangoria #define KVM_REG_PPC_DAWRX1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5) 6495752fe0bSAthira Rajeev 6503b783474SMichael Neuling /* Transactional Memory checkpointed state: 6513b783474SMichael Neuling * This is all GPRs, all VSX regs and a subset of SPRs 6523b783474SMichael Neuling */ 6533b783474SMichael Neuling #define KVM_REG_PPC_TM (KVM_REG_PPC | 0x80000000) 6543b783474SMichael Neuling /* TM GPRs */ 6553b783474SMichael Neuling #define KVM_REG_PPC_TM_GPR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0) 6563b783474SMichael Neuling #define KVM_REG_PPC_TM_GPR(n) (KVM_REG_PPC_TM_GPR0 + (n)) 6573b783474SMichael Neuling #define KVM_REG_PPC_TM_GPR31 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x1f) 6583b783474SMichael Neuling /* TM VSX */ 6593b783474SMichael Neuling #define KVM_REG_PPC_TM_VSR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x20) 6603b783474SMichael Neuling #define KVM_REG_PPC_TM_VSR(n) (KVM_REG_PPC_TM_VSR0 + (n)) 6613b783474SMichael Neuling #define KVM_REG_PPC_TM_VSR63 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x5f) 6623b783474SMichael Neuling /* TM SPRS */ 6633b783474SMichael Neuling #define KVM_REG_PPC_TM_CR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x60) 6643b783474SMichael Neuling #define KVM_REG_PPC_TM_LR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x61) 6653b783474SMichael Neuling #define KVM_REG_PPC_TM_CTR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x62) 6663b783474SMichael Neuling #define KVM_REG_PPC_TM_FPSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x63) 6673b783474SMichael Neuling #define KVM_REG_PPC_TM_AMR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x64) 6683b783474SMichael Neuling #define KVM_REG_PPC_TM_PPR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x65) 6693b783474SMichael Neuling #define KVM_REG_PPC_TM_VRSAVE (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x66) 6703b783474SMichael Neuling #define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67) 6713b783474SMichael Neuling #define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68) 6723b783474SMichael Neuling #define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) 6730d808df0SPaul Mackerras #define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a) 6743b783474SMichael Neuling 6755975a2e0SPaul Mackerras /* PPC64 eXternal Interrupt Controller Specification */ 6765975a2e0SPaul Mackerras #define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */ 677efe5ddcaSGreg Kurz #define KVM_DEV_XICS_GRP_CTRL 2 678efe5ddcaSGreg Kurz #define KVM_DEV_XICS_NR_SERVERS 1 6795975a2e0SPaul Mackerras 6805975a2e0SPaul Mackerras /* Layout of 64-bit source attribute values */ 6815975a2e0SPaul Mackerras #define KVM_XICS_DESTINATION_SHIFT 0 6825975a2e0SPaul Mackerras #define KVM_XICS_DESTINATION_MASK 0xffffffffULL 6835975a2e0SPaul Mackerras #define KVM_XICS_PRIORITY_SHIFT 32 6845975a2e0SPaul Mackerras #define KVM_XICS_PRIORITY_MASK 0xff 6855975a2e0SPaul Mackerras #define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40) 6865975a2e0SPaul Mackerras #define KVM_XICS_MASKED (1ULL << 41) 6875975a2e0SPaul Mackerras #define KVM_XICS_PENDING (1ULL << 42) 68817d48610SLi Zhong #define KVM_XICS_PRESENTED (1ULL << 43) 68917d48610SLi Zhong #define KVM_XICS_QUEUED (1ULL << 44) 6905975a2e0SPaul Mackerras 69190c73795SCédric Le Goater /* POWER9 XIVE Native Interrupt Controller */ 69290c73795SCédric Le Goater #define KVM_DEV_XIVE_GRP_CTRL 1 6935ca80647SCédric Le Goater #define KVM_DEV_XIVE_RESET 1 694e6714bd1SCédric Le Goater #define KVM_DEV_XIVE_EQ_SYNC 2 695efe5ddcaSGreg Kurz #define KVM_DEV_XIVE_NR_SERVERS 3 6964131f83cSCédric Le Goater #define KVM_DEV_XIVE_GRP_SOURCE 2 /* 64-bit source identifier */ 697e8676ce5SCédric Le Goater #define KVM_DEV_XIVE_GRP_SOURCE_CONFIG 3 /* 64-bit source identifier */ 69813ce3297SCédric Le Goater #define KVM_DEV_XIVE_GRP_EQ_CONFIG 4 /* 64-bit EQ identifier */ 6997b46b616SCédric Le Goater #define KVM_DEV_XIVE_GRP_SOURCE_SYNC 5 /* 64-bit source identifier */ 7004131f83cSCédric Le Goater 7014131f83cSCédric Le Goater /* Layout of 64-bit XIVE source attribute values */ 7024131f83cSCédric Le Goater #define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0) 7034131f83cSCédric Le Goater #define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1) 70490c73795SCédric Le Goater 705e8676ce5SCédric Le Goater /* Layout of 64-bit XIVE source configuration attribute values */ 706e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_PRIORITY_SHIFT 0 707e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_PRIORITY_MASK 0x7 708e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_SERVER_SHIFT 3 709e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_SERVER_MASK 0xfffffff8ULL 710e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_MASKED_SHIFT 32 711e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_MASKED_MASK 0x100000000ULL 712e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_EISN_SHIFT 33 713e8676ce5SCédric Le Goater #define KVM_XIVE_SOURCE_EISN_MASK 0xfffffffe00000000ULL 714e8676ce5SCédric Le Goater 71513ce3297SCédric Le Goater /* Layout of 64-bit EQ identifier */ 71613ce3297SCédric Le Goater #define KVM_XIVE_EQ_PRIORITY_SHIFT 0 71713ce3297SCédric Le Goater #define KVM_XIVE_EQ_PRIORITY_MASK 0x7 71813ce3297SCédric Le Goater #define KVM_XIVE_EQ_SERVER_SHIFT 3 71913ce3297SCédric Le Goater #define KVM_XIVE_EQ_SERVER_MASK 0xfffffff8ULL 72013ce3297SCédric Le Goater 72113ce3297SCédric Le Goater /* Layout of EQ configuration values (64 bytes) */ 72213ce3297SCédric Le Goater struct kvm_ppc_xive_eq { 72313ce3297SCédric Le Goater __u32 flags; 72413ce3297SCédric Le Goater __u32 qshift; 72513ce3297SCédric Le Goater __u64 qaddr; 72613ce3297SCédric Le Goater __u32 qtoggle; 72713ce3297SCédric Le Goater __u32 qindex; 72813ce3297SCédric Le Goater __u8 pad[40]; 72913ce3297SCédric Le Goater }; 73013ce3297SCédric Le Goater 73113ce3297SCédric Le Goater #define KVM_XIVE_EQ_ALWAYS_NOTIFY 0x00000001 73213ce3297SCédric Le Goater 73339e9af3dSCédric Le Goater #define KVM_XIVE_TIMA_PAGE_OFFSET 0 7346520ca64SCédric Le Goater #define KVM_XIVE_ESB_PAGE_OFFSET 4 73539e9af3dSCédric Le Goater 736c3617f72SDavid Howells #endif /* __LINUX_KVM_POWERPC_H */ 737