162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 462306a36Sopenharmony_ci * it under the terms of the GNU General Public License, version 2, as 562306a36Sopenharmony_ci * published by the Free Software Foundation. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, 862306a36Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 962306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1062306a36Sopenharmony_ci * GNU General Public License for more details. 1162306a36Sopenharmony_ci * 1262306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 1362306a36Sopenharmony_ci * along with this program; if not, write to the Free Software 1462306a36Sopenharmony_ci * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 1562306a36Sopenharmony_ci * 1662306a36Sopenharmony_ci * Copyright IBM Corp. 2007 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci * Authors: Hollis Blanchard <hollisb@us.ibm.com> 1962306a36Sopenharmony_ci */ 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#ifndef __LINUX_KVM_POWERPC_H 2262306a36Sopenharmony_ci#define __LINUX_KVM_POWERPC_H 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#include <linux/types.h> 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* Select powerpc specific features in <linux/kvm.h> */ 2762306a36Sopenharmony_ci#define __KVM_HAVE_SPAPR_TCE 2862306a36Sopenharmony_ci#define __KVM_HAVE_PPC_SMT 2962306a36Sopenharmony_ci#define __KVM_HAVE_IRQCHIP 3062306a36Sopenharmony_ci#define __KVM_HAVE_IRQ_LINE 3162306a36Sopenharmony_ci#define __KVM_HAVE_GUEST_DEBUG 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci/* Not always available, but if it is, this is the correct offset. */ 3462306a36Sopenharmony_ci#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_cistruct kvm_regs { 3762306a36Sopenharmony_ci __u64 pc; 3862306a36Sopenharmony_ci __u64 cr; 3962306a36Sopenharmony_ci __u64 ctr; 4062306a36Sopenharmony_ci __u64 lr; 4162306a36Sopenharmony_ci __u64 xer; 4262306a36Sopenharmony_ci __u64 msr; 4362306a36Sopenharmony_ci __u64 srr0; 4462306a36Sopenharmony_ci __u64 srr1; 4562306a36Sopenharmony_ci __u64 pid; 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci __u64 sprg0; 4862306a36Sopenharmony_ci __u64 sprg1; 4962306a36Sopenharmony_ci __u64 sprg2; 5062306a36Sopenharmony_ci __u64 sprg3; 5162306a36Sopenharmony_ci __u64 sprg4; 5262306a36Sopenharmony_ci __u64 sprg5; 5362306a36Sopenharmony_ci __u64 sprg6; 5462306a36Sopenharmony_ci __u64 sprg7; 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci __u64 gpr[32]; 5762306a36Sopenharmony_ci}; 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define KVM_SREGS_E_IMPL_NONE 0 6062306a36Sopenharmony_ci#define KVM_SREGS_E_IMPL_FSL 1 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define KVM_SREGS_E_FSL_PIDn (1 << 0) /* PID1/PID2 */ 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/* flags for kvm_run.flags */ 6562306a36Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_MASK (3 << 0) 6662306a36Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_FULLY_RECOV (1 << 0) 6762306a36Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_LIMITED_RECOV (2 << 0) 6862306a36Sopenharmony_ci#define KVM_RUN_PPC_NMI_DISP_NOT_RECOV (3 << 0) 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci/* 7162306a36Sopenharmony_ci * Feature bits indicate which sections of the sregs struct are valid, 7262306a36Sopenharmony_ci * both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers 7362306a36Sopenharmony_ci * corresponding to unset feature bits will not be modified. This allows 7462306a36Sopenharmony_ci * restoring a checkpoint made without that feature, while keeping the 7562306a36Sopenharmony_ci * default values of the new registers. 7662306a36Sopenharmony_ci * 7762306a36Sopenharmony_ci * KVM_SREGS_E_BASE contains: 7862306a36Sopenharmony_ci * CSRR0/1 (refers to SRR2/3 on 40x) 7962306a36Sopenharmony_ci * ESR 8062306a36Sopenharmony_ci * DEAR 8162306a36Sopenharmony_ci * MCSR 8262306a36Sopenharmony_ci * TSR 8362306a36Sopenharmony_ci * TCR 8462306a36Sopenharmony_ci * DEC 8562306a36Sopenharmony_ci * TB 8662306a36Sopenharmony_ci * VRSAVE (USPRG0) 8762306a36Sopenharmony_ci */ 8862306a36Sopenharmony_ci#define KVM_SREGS_E_BASE (1 << 0) 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci/* 9162306a36Sopenharmony_ci * KVM_SREGS_E_ARCH206 contains: 9262306a36Sopenharmony_ci * 9362306a36Sopenharmony_ci * PIR 9462306a36Sopenharmony_ci * MCSRR0/1 9562306a36Sopenharmony_ci * DECAR 9662306a36Sopenharmony_ci * IVPR 9762306a36Sopenharmony_ci */ 9862306a36Sopenharmony_ci#define KVM_SREGS_E_ARCH206 (1 << 1) 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci/* 10162306a36Sopenharmony_ci * Contains EPCR, plus the upper half of 64-bit registers 10262306a36Sopenharmony_ci * that are 32-bit on 32-bit implementations. 10362306a36Sopenharmony_ci */ 10462306a36Sopenharmony_ci#define KVM_SREGS_E_64 (1 << 2) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci#define KVM_SREGS_E_SPRG8 (1 << 3) 10762306a36Sopenharmony_ci#define KVM_SREGS_E_MCIVPR (1 << 4) 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci/* 11062306a36Sopenharmony_ci * IVORs are used -- contains IVOR0-15, plus additional IVORs 11162306a36Sopenharmony_ci * in combination with an appropriate feature bit. 11262306a36Sopenharmony_ci */ 11362306a36Sopenharmony_ci#define KVM_SREGS_E_IVOR (1 << 5) 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci/* 11662306a36Sopenharmony_ci * Contains MAS0-4, MAS6-7, TLBnCFG, MMUCFG. 11762306a36Sopenharmony_ci * Also TLBnPS if MMUCFG[MAVN] = 1. 11862306a36Sopenharmony_ci */ 11962306a36Sopenharmony_ci#define KVM_SREGS_E_ARCH206_MMU (1 << 6) 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci/* DBSR, DBCR, IAC, DAC, DVC */ 12262306a36Sopenharmony_ci#define KVM_SREGS_E_DEBUG (1 << 7) 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci/* Enhanced debug -- DSRR0/1, SPRG9 */ 12562306a36Sopenharmony_ci#define KVM_SREGS_E_ED (1 << 8) 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci/* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */ 12862306a36Sopenharmony_ci#define KVM_SREGS_E_SPE (1 << 9) 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* 13162306a36Sopenharmony_ci * DEPRECATED! USE ONE_REG FOR THIS ONE! 13262306a36Sopenharmony_ci * External Proxy (EXP) -- EPR 13362306a36Sopenharmony_ci */ 13462306a36Sopenharmony_ci#define KVM_SREGS_EXP (1 << 10) 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci/* External PID (E.PD) -- EPSC/EPLC */ 13762306a36Sopenharmony_ci#define KVM_SREGS_E_PD (1 << 11) 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci/* Processor Control (E.PC) -- IVOR36-37 if KVM_SREGS_E_IVOR */ 14062306a36Sopenharmony_ci#define KVM_SREGS_E_PC (1 << 12) 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci/* Page table (E.PT) -- EPTCFG */ 14362306a36Sopenharmony_ci#define KVM_SREGS_E_PT (1 << 13) 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci/* Embedded Performance Monitor (E.PM) -- IVOR35 if KVM_SREGS_E_IVOR */ 14662306a36Sopenharmony_ci#define KVM_SREGS_E_PM (1 << 14) 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci/* 14962306a36Sopenharmony_ci * Special updates: 15062306a36Sopenharmony_ci * 15162306a36Sopenharmony_ci * Some registers may change even while a vcpu is not running. 15262306a36Sopenharmony_ci * To avoid losing these changes, by default these registers are 15362306a36Sopenharmony_ci * not updated by KVM_SET_SREGS. To force an update, set the bit 15462306a36Sopenharmony_ci * in u.e.update_special corresponding to the register to be updated. 15562306a36Sopenharmony_ci * 15662306a36Sopenharmony_ci * The update_special field is zero on return from KVM_GET_SREGS. 15762306a36Sopenharmony_ci * 15862306a36Sopenharmony_ci * When restoring a checkpoint, the caller can set update_special 15962306a36Sopenharmony_ci * to 0xffffffff to ensure that everything is restored, even new features 16062306a36Sopenharmony_ci * that the caller doesn't know about. 16162306a36Sopenharmony_ci */ 16262306a36Sopenharmony_ci#define KVM_SREGS_E_UPDATE_MCSR (1 << 0) 16362306a36Sopenharmony_ci#define KVM_SREGS_E_UPDATE_TSR (1 << 1) 16462306a36Sopenharmony_ci#define KVM_SREGS_E_UPDATE_DEC (1 << 2) 16562306a36Sopenharmony_ci#define KVM_SREGS_E_UPDATE_DBSR (1 << 3) 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci/* 16862306a36Sopenharmony_ci * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a 16962306a36Sopenharmony_ci * previous KVM_GET_REGS. 17062306a36Sopenharmony_ci * 17162306a36Sopenharmony_ci * Unless otherwise indicated, setting any register with KVM_SET_SREGS 17262306a36Sopenharmony_ci * directly sets its value. It does not trigger any special semantics such 17362306a36Sopenharmony_ci * as write-one-to-clear. Calling KVM_SET_SREGS on an unmodified struct 17462306a36Sopenharmony_ci * just received from KVM_GET_SREGS is always a no-op. 17562306a36Sopenharmony_ci */ 17662306a36Sopenharmony_cistruct kvm_sregs { 17762306a36Sopenharmony_ci __u32 pvr; 17862306a36Sopenharmony_ci union { 17962306a36Sopenharmony_ci struct { 18062306a36Sopenharmony_ci __u64 sdr1; 18162306a36Sopenharmony_ci struct { 18262306a36Sopenharmony_ci struct { 18362306a36Sopenharmony_ci __u64 slbe; 18462306a36Sopenharmony_ci __u64 slbv; 18562306a36Sopenharmony_ci } slb[64]; 18662306a36Sopenharmony_ci } ppc64; 18762306a36Sopenharmony_ci struct { 18862306a36Sopenharmony_ci __u32 sr[16]; 18962306a36Sopenharmony_ci __u64 ibat[8]; 19062306a36Sopenharmony_ci __u64 dbat[8]; 19162306a36Sopenharmony_ci } ppc32; 19262306a36Sopenharmony_ci } s; 19362306a36Sopenharmony_ci struct { 19462306a36Sopenharmony_ci union { 19562306a36Sopenharmony_ci struct { /* KVM_SREGS_E_IMPL_FSL */ 19662306a36Sopenharmony_ci __u32 features; /* KVM_SREGS_E_FSL_ */ 19762306a36Sopenharmony_ci __u32 svr; 19862306a36Sopenharmony_ci __u64 mcar; 19962306a36Sopenharmony_ci __u32 hid0; 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci /* KVM_SREGS_E_FSL_PIDn */ 20262306a36Sopenharmony_ci __u32 pid1, pid2; 20362306a36Sopenharmony_ci } fsl; 20462306a36Sopenharmony_ci __u8 pad[256]; 20562306a36Sopenharmony_ci } impl; 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci __u32 features; /* KVM_SREGS_E_ */ 20862306a36Sopenharmony_ci __u32 impl_id; /* KVM_SREGS_E_IMPL_ */ 20962306a36Sopenharmony_ci __u32 update_special; /* KVM_SREGS_E_UPDATE_ */ 21062306a36Sopenharmony_ci __u32 pir; /* read-only */ 21162306a36Sopenharmony_ci __u64 sprg8; 21262306a36Sopenharmony_ci __u64 sprg9; /* E.ED */ 21362306a36Sopenharmony_ci __u64 csrr0; 21462306a36Sopenharmony_ci __u64 dsrr0; /* E.ED */ 21562306a36Sopenharmony_ci __u64 mcsrr0; 21662306a36Sopenharmony_ci __u32 csrr1; 21762306a36Sopenharmony_ci __u32 dsrr1; /* E.ED */ 21862306a36Sopenharmony_ci __u32 mcsrr1; 21962306a36Sopenharmony_ci __u32 esr; 22062306a36Sopenharmony_ci __u64 dear; 22162306a36Sopenharmony_ci __u64 ivpr; 22262306a36Sopenharmony_ci __u64 mcivpr; 22362306a36Sopenharmony_ci __u64 mcsr; /* KVM_SREGS_E_UPDATE_MCSR */ 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci __u32 tsr; /* KVM_SREGS_E_UPDATE_TSR */ 22662306a36Sopenharmony_ci __u32 tcr; 22762306a36Sopenharmony_ci __u32 decar; 22862306a36Sopenharmony_ci __u32 dec; /* KVM_SREGS_E_UPDATE_DEC */ 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci /* 23162306a36Sopenharmony_ci * Userspace can read TB directly, but the 23262306a36Sopenharmony_ci * value reported here is consistent with "dec". 23362306a36Sopenharmony_ci * 23462306a36Sopenharmony_ci * Read-only. 23562306a36Sopenharmony_ci */ 23662306a36Sopenharmony_ci __u64 tb; 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */ 23962306a36Sopenharmony_ci __u32 dbcr[3]; 24062306a36Sopenharmony_ci /* 24162306a36Sopenharmony_ci * iac/dac registers are 64bit wide, while this API 24262306a36Sopenharmony_ci * interface provides only lower 32 bits on 64 bit 24362306a36Sopenharmony_ci * processors. ONE_REG interface is added for 64bit 24462306a36Sopenharmony_ci * iac/dac registers. 24562306a36Sopenharmony_ci */ 24662306a36Sopenharmony_ci __u32 iac[4]; 24762306a36Sopenharmony_ci __u32 dac[2]; 24862306a36Sopenharmony_ci __u32 dvc[2]; 24962306a36Sopenharmony_ci __u8 num_iac; /* read-only */ 25062306a36Sopenharmony_ci __u8 num_dac; /* read-only */ 25162306a36Sopenharmony_ci __u8 num_dvc; /* read-only */ 25262306a36Sopenharmony_ci __u8 pad; 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci __u32 epr; /* EXP */ 25562306a36Sopenharmony_ci __u32 vrsave; /* a.k.a. USPRG0 */ 25662306a36Sopenharmony_ci __u32 epcr; /* KVM_SREGS_E_64 */ 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci __u32 mas0; 25962306a36Sopenharmony_ci __u32 mas1; 26062306a36Sopenharmony_ci __u64 mas2; 26162306a36Sopenharmony_ci __u64 mas7_3; 26262306a36Sopenharmony_ci __u32 mas4; 26362306a36Sopenharmony_ci __u32 mas6; 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci __u32 ivor_low[16]; /* IVOR0-15 */ 26662306a36Sopenharmony_ci __u32 ivor_high[18]; /* IVOR32+, plus room to expand */ 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci __u32 mmucfg; /* read-only */ 26962306a36Sopenharmony_ci __u32 eptcfg; /* E.PT, read-only */ 27062306a36Sopenharmony_ci __u32 tlbcfg[4];/* read-only */ 27162306a36Sopenharmony_ci __u32 tlbps[4]; /* read-only */ 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci __u32 eplc, epsc; /* E.PD */ 27462306a36Sopenharmony_ci } e; 27562306a36Sopenharmony_ci __u8 pad[1020]; 27662306a36Sopenharmony_ci } u; 27762306a36Sopenharmony_ci}; 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_cistruct kvm_fpu { 28062306a36Sopenharmony_ci __u64 fpr[32]; 28162306a36Sopenharmony_ci}; 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci/* 28462306a36Sopenharmony_ci * Defines for h/w breakpoint, watchpoint (read, write or both) and 28562306a36Sopenharmony_ci * software breakpoint. 28662306a36Sopenharmony_ci * These are used as "type" in KVM_SET_GUEST_DEBUG ioctl and "status" 28762306a36Sopenharmony_ci * for KVM_DEBUG_EXIT. 28862306a36Sopenharmony_ci */ 28962306a36Sopenharmony_ci#define KVMPPC_DEBUG_NONE 0x0 29062306a36Sopenharmony_ci#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1) 29162306a36Sopenharmony_ci#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2) 29262306a36Sopenharmony_ci#define KVMPPC_DEBUG_WATCH_READ (1UL << 3) 29362306a36Sopenharmony_cistruct kvm_debug_exit_arch { 29462306a36Sopenharmony_ci __u64 address; 29562306a36Sopenharmony_ci /* 29662306a36Sopenharmony_ci * exiting to userspace because of h/w breakpoint, watchpoint 29762306a36Sopenharmony_ci * (read, write or both) and software breakpoint. 29862306a36Sopenharmony_ci */ 29962306a36Sopenharmony_ci __u32 status; 30062306a36Sopenharmony_ci __u32 reserved; 30162306a36Sopenharmony_ci}; 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci/* for KVM_SET_GUEST_DEBUG */ 30462306a36Sopenharmony_cistruct kvm_guest_debug_arch { 30562306a36Sopenharmony_ci struct { 30662306a36Sopenharmony_ci /* H/W breakpoint/watchpoint address */ 30762306a36Sopenharmony_ci __u64 addr; 30862306a36Sopenharmony_ci /* 30962306a36Sopenharmony_ci * Type denotes h/w breakpoint, read watchpoint, write 31062306a36Sopenharmony_ci * watchpoint or watchpoint (both read and write). 31162306a36Sopenharmony_ci */ 31262306a36Sopenharmony_ci __u32 type; 31362306a36Sopenharmony_ci __u32 reserved; 31462306a36Sopenharmony_ci } bp[16]; 31562306a36Sopenharmony_ci}; 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci/* Debug related defines */ 31862306a36Sopenharmony_ci/* 31962306a36Sopenharmony_ci * kvm_guest_debug->control is a 32 bit field. The lower 16 bits are generic 32062306a36Sopenharmony_ci * and upper 16 bits are architecture specific. Architecture specific defines 32162306a36Sopenharmony_ci * that ioctl is for setting hardware breakpoint or software breakpoint. 32262306a36Sopenharmony_ci */ 32362306a36Sopenharmony_ci#define KVM_GUESTDBG_USE_SW_BP 0x00010000 32462306a36Sopenharmony_ci#define KVM_GUESTDBG_USE_HW_BP 0x00020000 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci/* definition of registers in kvm_run */ 32762306a36Sopenharmony_cistruct kvm_sync_regs { 32862306a36Sopenharmony_ci}; 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci#define KVM_INTERRUPT_SET -1U 33162306a36Sopenharmony_ci#define KVM_INTERRUPT_UNSET -2U 33262306a36Sopenharmony_ci#define KVM_INTERRUPT_SET_LEVEL -3U 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci#define KVM_CPU_440 1 33562306a36Sopenharmony_ci#define KVM_CPU_E500V2 2 33662306a36Sopenharmony_ci#define KVM_CPU_3S_32 3 33762306a36Sopenharmony_ci#define KVM_CPU_3S_64 4 33862306a36Sopenharmony_ci#define KVM_CPU_E500MC 5 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_ci/* for KVM_CAP_SPAPR_TCE */ 34162306a36Sopenharmony_cistruct kvm_create_spapr_tce { 34262306a36Sopenharmony_ci __u64 liobn; 34362306a36Sopenharmony_ci __u32 window_size; 34462306a36Sopenharmony_ci}; 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_ci/* for KVM_CAP_SPAPR_TCE_64 */ 34762306a36Sopenharmony_cistruct kvm_create_spapr_tce_64 { 34862306a36Sopenharmony_ci __u64 liobn; 34962306a36Sopenharmony_ci __u32 page_shift; 35062306a36Sopenharmony_ci __u32 flags; 35162306a36Sopenharmony_ci __u64 offset; /* in pages */ 35262306a36Sopenharmony_ci __u64 size; /* in pages */ 35362306a36Sopenharmony_ci}; 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci/* for KVM_ALLOCATE_RMA */ 35662306a36Sopenharmony_cistruct kvm_allocate_rma { 35762306a36Sopenharmony_ci __u64 rma_size; 35862306a36Sopenharmony_ci}; 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_ci/* for KVM_CAP_PPC_RTAS */ 36162306a36Sopenharmony_cistruct kvm_rtas_token_args { 36262306a36Sopenharmony_ci char name[120]; 36362306a36Sopenharmony_ci __u64 token; /* Use a token of 0 to undefine a mapping */ 36462306a36Sopenharmony_ci}; 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_cistruct kvm_book3e_206_tlb_entry { 36762306a36Sopenharmony_ci __u32 mas8; 36862306a36Sopenharmony_ci __u32 mas1; 36962306a36Sopenharmony_ci __u64 mas2; 37062306a36Sopenharmony_ci __u64 mas7_3; 37162306a36Sopenharmony_ci}; 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_cistruct kvm_book3e_206_tlb_params { 37462306a36Sopenharmony_ci /* 37562306a36Sopenharmony_ci * For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV: 37662306a36Sopenharmony_ci * 37762306a36Sopenharmony_ci * - The number of ways of TLB0 must be a power of two between 2 and 37862306a36Sopenharmony_ci * 16. 37962306a36Sopenharmony_ci * - TLB1 must be fully associative. 38062306a36Sopenharmony_ci * - The size of TLB0 must be a multiple of the number of ways, and 38162306a36Sopenharmony_ci * the number of sets must be a power of two. 38262306a36Sopenharmony_ci * - The size of TLB1 may not exceed 64 entries. 38362306a36Sopenharmony_ci * - TLB0 supports 4 KiB pages. 38462306a36Sopenharmony_ci * - The page sizes supported by TLB1 are as indicated by 38562306a36Sopenharmony_ci * TLB1CFG (if MMUCFG[MAVN] = 0) or TLB1PS (if MMUCFG[MAVN] = 1) 38662306a36Sopenharmony_ci * as returned by KVM_GET_SREGS. 38762306a36Sopenharmony_ci * - TLB2 and TLB3 are reserved, and their entries in tlb_sizes[] 38862306a36Sopenharmony_ci * and tlb_ways[] must be zero. 38962306a36Sopenharmony_ci * 39062306a36Sopenharmony_ci * tlb_ways[n] = tlb_sizes[n] means the array is fully associative. 39162306a36Sopenharmony_ci * 39262306a36Sopenharmony_ci * KVM will adjust TLBnCFG based on the sizes configured here, 39362306a36Sopenharmony_ci * though arrays greater than 2048 entries will have TLBnCFG[NENTRY] 39462306a36Sopenharmony_ci * set to zero. 39562306a36Sopenharmony_ci */ 39662306a36Sopenharmony_ci __u32 tlb_sizes[4]; 39762306a36Sopenharmony_ci __u32 tlb_ways[4]; 39862306a36Sopenharmony_ci __u32 reserved[8]; 39962306a36Sopenharmony_ci}; 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci/* For KVM_PPC_GET_HTAB_FD */ 40262306a36Sopenharmony_cistruct kvm_get_htab_fd { 40362306a36Sopenharmony_ci __u64 flags; 40462306a36Sopenharmony_ci __u64 start_index; 40562306a36Sopenharmony_ci __u64 reserved[2]; 40662306a36Sopenharmony_ci}; 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci/* Values for kvm_get_htab_fd.flags */ 40962306a36Sopenharmony_ci#define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) 41062306a36Sopenharmony_ci#define KVM_GET_HTAB_WRITE ((__u64)0x2) 41162306a36Sopenharmony_ci 41262306a36Sopenharmony_ci/* 41362306a36Sopenharmony_ci * Data read on the file descriptor is formatted as a series of 41462306a36Sopenharmony_ci * records, each consisting of a header followed by a series of 41562306a36Sopenharmony_ci * `n_valid' HPTEs (16 bytes each), which are all valid. Following 41662306a36Sopenharmony_ci * those valid HPTEs there are `n_invalid' invalid HPTEs, which 41762306a36Sopenharmony_ci * are not represented explicitly in the stream. The same format 41862306a36Sopenharmony_ci * is used for writing. 41962306a36Sopenharmony_ci */ 42062306a36Sopenharmony_cistruct kvm_get_htab_header { 42162306a36Sopenharmony_ci __u32 index; 42262306a36Sopenharmony_ci __u16 n_valid; 42362306a36Sopenharmony_ci __u16 n_invalid; 42462306a36Sopenharmony_ci}; 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_ci/* For KVM_PPC_CONFIGURE_V3_MMU */ 42762306a36Sopenharmony_cistruct kvm_ppc_mmuv3_cfg { 42862306a36Sopenharmony_ci __u64 flags; 42962306a36Sopenharmony_ci __u64 process_table; /* second doubleword of partition table entry */ 43062306a36Sopenharmony_ci}; 43162306a36Sopenharmony_ci 43262306a36Sopenharmony_ci/* Flag values for KVM_PPC_CONFIGURE_V3_MMU */ 43362306a36Sopenharmony_ci#define KVM_PPC_MMUV3_RADIX 1 /* 1 = radix mode, 0 = HPT */ 43462306a36Sopenharmony_ci#define KVM_PPC_MMUV3_GTSE 2 /* global translation shootdown enb. */ 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci/* For KVM_PPC_GET_RMMU_INFO */ 43762306a36Sopenharmony_cistruct kvm_ppc_rmmu_info { 43862306a36Sopenharmony_ci struct kvm_ppc_radix_geom { 43962306a36Sopenharmony_ci __u8 page_shift; 44062306a36Sopenharmony_ci __u8 level_bits[4]; 44162306a36Sopenharmony_ci __u8 pad[3]; 44262306a36Sopenharmony_ci } geometries[8]; 44362306a36Sopenharmony_ci __u32 ap_encodings[8]; 44462306a36Sopenharmony_ci}; 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci/* For KVM_PPC_GET_CPU_CHAR */ 44762306a36Sopenharmony_cistruct kvm_ppc_cpu_char { 44862306a36Sopenharmony_ci __u64 character; /* characteristics of the CPU */ 44962306a36Sopenharmony_ci __u64 behaviour; /* recommended software behaviour */ 45062306a36Sopenharmony_ci __u64 character_mask; /* valid bits in character */ 45162306a36Sopenharmony_ci __u64 behaviour_mask; /* valid bits in behaviour */ 45262306a36Sopenharmony_ci}; 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_ci/* 45562306a36Sopenharmony_ci * Values for character and character_mask. 45662306a36Sopenharmony_ci * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. 45762306a36Sopenharmony_ci */ 45862306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 (1ULL << 63) 45962306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) 46062306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) 46162306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) 46262306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) 46362306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) 46462306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) 46562306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) 46662306a36Sopenharmony_ci#define KVM_PPC_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54) 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) 46962306a36Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) 47062306a36Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) 47162306a36Sopenharmony_ci#define KVM_PPC_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58) 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/* Per-vcpu XICS interrupt controller state */ 47462306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) 47562306a36Sopenharmony_ci 47662306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_CPPR_SHIFT 56 /* current proc priority */ 47762306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_CPPR_MASK 0xff 47862306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_XISR_SHIFT 32 /* interrupt status field */ 47962306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_XISR_MASK 0xffffff 48062306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_MFRR_SHIFT 24 /* pending IPI priority */ 48162306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_MFRR_MASK 0xff 48262306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */ 48362306a36Sopenharmony_ci#define KVM_REG_PPC_ICP_PPRI_MASK 0xff 48462306a36Sopenharmony_ci 48562306a36Sopenharmony_ci#define KVM_REG_PPC_VP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x8d) 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_ci/* Device control API: PPC-specific devices */ 48862306a36Sopenharmony_ci#define KVM_DEV_MPIC_GRP_MISC 1 48962306a36Sopenharmony_ci#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */ 49062306a36Sopenharmony_ci 49162306a36Sopenharmony_ci#define KVM_DEV_MPIC_GRP_REGISTER 2 /* 32-bit */ 49262306a36Sopenharmony_ci#define KVM_DEV_MPIC_GRP_IRQ_ACTIVE 3 /* 32-bit */ 49362306a36Sopenharmony_ci 49462306a36Sopenharmony_ci/* One-Reg API: PPC-specific registers */ 49562306a36Sopenharmony_ci#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1) 49662306a36Sopenharmony_ci#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2) 49762306a36Sopenharmony_ci#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3) 49862306a36Sopenharmony_ci#define KVM_REG_PPC_IAC3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x4) 49962306a36Sopenharmony_ci#define KVM_REG_PPC_IAC4 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5) 50062306a36Sopenharmony_ci#define KVM_REG_PPC_DAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6) 50162306a36Sopenharmony_ci#define KVM_REG_PPC_DAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7) 50262306a36Sopenharmony_ci#define KVM_REG_PPC_DABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8) 50362306a36Sopenharmony_ci#define KVM_REG_PPC_DSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9) 50462306a36Sopenharmony_ci#define KVM_REG_PPC_PURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa) 50562306a36Sopenharmony_ci#define KVM_REG_PPC_SPURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb) 50662306a36Sopenharmony_ci#define KVM_REG_PPC_DAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc) 50762306a36Sopenharmony_ci#define KVM_REG_PPC_DSISR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd) 50862306a36Sopenharmony_ci#define KVM_REG_PPC_AMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe) 50962306a36Sopenharmony_ci#define KVM_REG_PPC_UAMOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf) 51062306a36Sopenharmony_ci 51162306a36Sopenharmony_ci#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10) 51262306a36Sopenharmony_ci#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11) 51362306a36Sopenharmony_ci#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12) 51462306a36Sopenharmony_ci#define KVM_REG_PPC_MMCR2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x13) 51562306a36Sopenharmony_ci#define KVM_REG_PPC_MMCRS (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x14) 51662306a36Sopenharmony_ci#define KVM_REG_PPC_SIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x15) 51762306a36Sopenharmony_ci#define KVM_REG_PPC_SDAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x16) 51862306a36Sopenharmony_ci#define KVM_REG_PPC_SIER (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x17) 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_ci#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18) 52162306a36Sopenharmony_ci#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19) 52262306a36Sopenharmony_ci#define KVM_REG_PPC_PMC3 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a) 52362306a36Sopenharmony_ci#define KVM_REG_PPC_PMC4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b) 52462306a36Sopenharmony_ci#define KVM_REG_PPC_PMC5 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c) 52562306a36Sopenharmony_ci#define KVM_REG_PPC_PMC6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d) 52662306a36Sopenharmony_ci#define KVM_REG_PPC_PMC7 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e) 52762306a36Sopenharmony_ci#define KVM_REG_PPC_PMC8 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f) 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci/* 32 floating-point registers */ 53062306a36Sopenharmony_ci#define KVM_REG_PPC_FPR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x20) 53162306a36Sopenharmony_ci#define KVM_REG_PPC_FPR(n) (KVM_REG_PPC_FPR0 + (n)) 53262306a36Sopenharmony_ci#define KVM_REG_PPC_FPR31 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3f) 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci/* 32 VMX/Altivec vector registers */ 53562306a36Sopenharmony_ci#define KVM_REG_PPC_VR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x40) 53662306a36Sopenharmony_ci#define KVM_REG_PPC_VR(n) (KVM_REG_PPC_VR0 + (n)) 53762306a36Sopenharmony_ci#define KVM_REG_PPC_VR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x5f) 53862306a36Sopenharmony_ci 53962306a36Sopenharmony_ci/* 32 double-width FP registers for VSX */ 54062306a36Sopenharmony_ci/* High-order halves overlap with FP regs */ 54162306a36Sopenharmony_ci#define KVM_REG_PPC_VSR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x60) 54262306a36Sopenharmony_ci#define KVM_REG_PPC_VSR(n) (KVM_REG_PPC_VSR0 + (n)) 54362306a36Sopenharmony_ci#define KVM_REG_PPC_VSR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x7f) 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_ci/* FP and vector status/control registers */ 54662306a36Sopenharmony_ci#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80) 54762306a36Sopenharmony_ci/* 54862306a36Sopenharmony_ci * VSCR register is documented as a 32-bit register in the ISA, but it can 54962306a36Sopenharmony_ci * only be accesses via a vector register. Expose VSCR as a 32-bit register 55062306a36Sopenharmony_ci * even though the kernel represents it as a 128-bit vector. 55162306a36Sopenharmony_ci */ 55262306a36Sopenharmony_ci#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81) 55362306a36Sopenharmony_ci 55462306a36Sopenharmony_ci/* Virtual processor areas */ 55562306a36Sopenharmony_ci/* For SLB & DTL, address in high (first) half, length in low half */ 55662306a36Sopenharmony_ci#define KVM_REG_PPC_VPA_ADDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x82) 55762306a36Sopenharmony_ci#define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83) 55862306a36Sopenharmony_ci#define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84) 55962306a36Sopenharmony_ci 56062306a36Sopenharmony_ci#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) 56162306a36Sopenharmony_ci#define KVM_REG_PPC_EPR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x86) 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci/* Timer Status Register OR/CLEAR interface */ 56462306a36Sopenharmony_ci#define KVM_REG_PPC_OR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x87) 56562306a36Sopenharmony_ci#define KVM_REG_PPC_CLEAR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x88) 56662306a36Sopenharmony_ci#define KVM_REG_PPC_TCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x89) 56762306a36Sopenharmony_ci#define KVM_REG_PPC_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8a) 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci/* Debugging: Special instruction for software breakpoint */ 57062306a36Sopenharmony_ci#define KVM_REG_PPC_DEBUG_INST (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8b) 57162306a36Sopenharmony_ci 57262306a36Sopenharmony_ci/* MMU registers */ 57362306a36Sopenharmony_ci#define KVM_REG_PPC_MAS0 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8c) 57462306a36Sopenharmony_ci#define KVM_REG_PPC_MAS1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8d) 57562306a36Sopenharmony_ci#define KVM_REG_PPC_MAS2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8e) 57662306a36Sopenharmony_ci#define KVM_REG_PPC_MAS7_3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8f) 57762306a36Sopenharmony_ci#define KVM_REG_PPC_MAS4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x90) 57862306a36Sopenharmony_ci#define KVM_REG_PPC_MAS6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x91) 57962306a36Sopenharmony_ci#define KVM_REG_PPC_MMUCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x92) 58062306a36Sopenharmony_ci/* 58162306a36Sopenharmony_ci * TLBnCFG fields TLBnCFG_N_ENTRY and TLBnCFG_ASSOC can be changed only using 58262306a36Sopenharmony_ci * KVM_CAP_SW_TLB ioctl 58362306a36Sopenharmony_ci */ 58462306a36Sopenharmony_ci#define KVM_REG_PPC_TLB0CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x93) 58562306a36Sopenharmony_ci#define KVM_REG_PPC_TLB1CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x94) 58662306a36Sopenharmony_ci#define KVM_REG_PPC_TLB2CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x95) 58762306a36Sopenharmony_ci#define KVM_REG_PPC_TLB3CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x96) 58862306a36Sopenharmony_ci#define KVM_REG_PPC_TLB0PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x97) 58962306a36Sopenharmony_ci#define KVM_REG_PPC_TLB1PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x98) 59062306a36Sopenharmony_ci#define KVM_REG_PPC_TLB2PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x99) 59162306a36Sopenharmony_ci#define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a) 59262306a36Sopenharmony_ci#define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b) 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_ci/* Timebase offset */ 59562306a36Sopenharmony_ci#define KVM_REG_PPC_TB_OFFSET (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9c) 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_ci/* POWER8 registers */ 59862306a36Sopenharmony_ci#define KVM_REG_PPC_SPMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9d) 59962306a36Sopenharmony_ci#define KVM_REG_PPC_SPMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9e) 60062306a36Sopenharmony_ci#define KVM_REG_PPC_IAMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9f) 60162306a36Sopenharmony_ci#define KVM_REG_PPC_TFHAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa0) 60262306a36Sopenharmony_ci#define KVM_REG_PPC_TFIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa1) 60362306a36Sopenharmony_ci#define KVM_REG_PPC_TEXASR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa2) 60462306a36Sopenharmony_ci#define KVM_REG_PPC_FSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa3) 60562306a36Sopenharmony_ci#define KVM_REG_PPC_PSPB (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xa4) 60662306a36Sopenharmony_ci#define KVM_REG_PPC_EBBHR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa5) 60762306a36Sopenharmony_ci#define KVM_REG_PPC_EBBRR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa6) 60862306a36Sopenharmony_ci#define KVM_REG_PPC_BESCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa7) 60962306a36Sopenharmony_ci#define KVM_REG_PPC_TAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa8) 61062306a36Sopenharmony_ci#define KVM_REG_PPC_DPDES (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa9) 61162306a36Sopenharmony_ci#define KVM_REG_PPC_DAWR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaa) 61262306a36Sopenharmony_ci#define KVM_REG_PPC_DAWRX (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xab) 61362306a36Sopenharmony_ci#define KVM_REG_PPC_CIABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xac) 61462306a36Sopenharmony_ci#define KVM_REG_PPC_IC (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xad) 61562306a36Sopenharmony_ci#define KVM_REG_PPC_VTB (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xae) 61662306a36Sopenharmony_ci#define KVM_REG_PPC_CSIGR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaf) 61762306a36Sopenharmony_ci#define KVM_REG_PPC_TACR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb0) 61862306a36Sopenharmony_ci#define KVM_REG_PPC_TCSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb1) 61962306a36Sopenharmony_ci#define KVM_REG_PPC_PID (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb2) 62062306a36Sopenharmony_ci#define KVM_REG_PPC_ACOP (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb3) 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci#define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4) 62362306a36Sopenharmony_ci#define KVM_REG_PPC_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5) 62462306a36Sopenharmony_ci#define KVM_REG_PPC_LPCR_64 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb5) 62562306a36Sopenharmony_ci#define KVM_REG_PPC_PPR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb6) 62662306a36Sopenharmony_ci 62762306a36Sopenharmony_ci/* Architecture compatibility level */ 62862306a36Sopenharmony_ci#define KVM_REG_PPC_ARCH_COMPAT (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb7) 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ci#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8) 63162306a36Sopenharmony_ci#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9) 63262306a36Sopenharmony_ci#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba) 63362306a36Sopenharmony_ci#define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb) 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci/* POWER9 registers */ 63662306a36Sopenharmony_ci#define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc) 63762306a36Sopenharmony_ci#define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_ci#define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe) 64062306a36Sopenharmony_ci#define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) 64162306a36Sopenharmony_ci#define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0) 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_ci/* POWER10 registers */ 64462306a36Sopenharmony_ci#define KVM_REG_PPC_MMCR3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc1) 64562306a36Sopenharmony_ci#define KVM_REG_PPC_SIER2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc2) 64662306a36Sopenharmony_ci#define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3) 64762306a36Sopenharmony_ci#define KVM_REG_PPC_DAWR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4) 64862306a36Sopenharmony_ci#define KVM_REG_PPC_DAWRX1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5) 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_ci/* Transactional Memory checkpointed state: 65162306a36Sopenharmony_ci * This is all GPRs, all VSX regs and a subset of SPRs 65262306a36Sopenharmony_ci */ 65362306a36Sopenharmony_ci#define KVM_REG_PPC_TM (KVM_REG_PPC | 0x80000000) 65462306a36Sopenharmony_ci/* TM GPRs */ 65562306a36Sopenharmony_ci#define KVM_REG_PPC_TM_GPR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0) 65662306a36Sopenharmony_ci#define KVM_REG_PPC_TM_GPR(n) (KVM_REG_PPC_TM_GPR0 + (n)) 65762306a36Sopenharmony_ci#define KVM_REG_PPC_TM_GPR31 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x1f) 65862306a36Sopenharmony_ci/* TM VSX */ 65962306a36Sopenharmony_ci#define KVM_REG_PPC_TM_VSR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x20) 66062306a36Sopenharmony_ci#define KVM_REG_PPC_TM_VSR(n) (KVM_REG_PPC_TM_VSR0 + (n)) 66162306a36Sopenharmony_ci#define KVM_REG_PPC_TM_VSR63 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x5f) 66262306a36Sopenharmony_ci/* TM SPRS */ 66362306a36Sopenharmony_ci#define KVM_REG_PPC_TM_CR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x60) 66462306a36Sopenharmony_ci#define KVM_REG_PPC_TM_LR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x61) 66562306a36Sopenharmony_ci#define KVM_REG_PPC_TM_CTR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x62) 66662306a36Sopenharmony_ci#define KVM_REG_PPC_TM_FPSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x63) 66762306a36Sopenharmony_ci#define KVM_REG_PPC_TM_AMR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x64) 66862306a36Sopenharmony_ci#define KVM_REG_PPC_TM_PPR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x65) 66962306a36Sopenharmony_ci#define KVM_REG_PPC_TM_VRSAVE (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x66) 67062306a36Sopenharmony_ci#define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67) 67162306a36Sopenharmony_ci#define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68) 67262306a36Sopenharmony_ci#define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) 67362306a36Sopenharmony_ci#define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a) 67462306a36Sopenharmony_ci 67562306a36Sopenharmony_ci/* PPC64 eXternal Interrupt Controller Specification */ 67662306a36Sopenharmony_ci#define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */ 67762306a36Sopenharmony_ci#define KVM_DEV_XICS_GRP_CTRL 2 67862306a36Sopenharmony_ci#define KVM_DEV_XICS_NR_SERVERS 1 67962306a36Sopenharmony_ci 68062306a36Sopenharmony_ci/* Layout of 64-bit source attribute values */ 68162306a36Sopenharmony_ci#define KVM_XICS_DESTINATION_SHIFT 0 68262306a36Sopenharmony_ci#define KVM_XICS_DESTINATION_MASK 0xffffffffULL 68362306a36Sopenharmony_ci#define KVM_XICS_PRIORITY_SHIFT 32 68462306a36Sopenharmony_ci#define KVM_XICS_PRIORITY_MASK 0xff 68562306a36Sopenharmony_ci#define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40) 68662306a36Sopenharmony_ci#define KVM_XICS_MASKED (1ULL << 41) 68762306a36Sopenharmony_ci#define KVM_XICS_PENDING (1ULL << 42) 68862306a36Sopenharmony_ci#define KVM_XICS_PRESENTED (1ULL << 43) 68962306a36Sopenharmony_ci#define KVM_XICS_QUEUED (1ULL << 44) 69062306a36Sopenharmony_ci 69162306a36Sopenharmony_ci/* POWER9 XIVE Native Interrupt Controller */ 69262306a36Sopenharmony_ci#define KVM_DEV_XIVE_GRP_CTRL 1 69362306a36Sopenharmony_ci#define KVM_DEV_XIVE_RESET 1 69462306a36Sopenharmony_ci#define KVM_DEV_XIVE_EQ_SYNC 2 69562306a36Sopenharmony_ci#define KVM_DEV_XIVE_NR_SERVERS 3 69662306a36Sopenharmony_ci#define KVM_DEV_XIVE_GRP_SOURCE 2 /* 64-bit source identifier */ 69762306a36Sopenharmony_ci#define KVM_DEV_XIVE_GRP_SOURCE_CONFIG 3 /* 64-bit source identifier */ 69862306a36Sopenharmony_ci#define KVM_DEV_XIVE_GRP_EQ_CONFIG 4 /* 64-bit EQ identifier */ 69962306a36Sopenharmony_ci#define KVM_DEV_XIVE_GRP_SOURCE_SYNC 5 /* 64-bit source identifier */ 70062306a36Sopenharmony_ci 70162306a36Sopenharmony_ci/* Layout of 64-bit XIVE source attribute values */ 70262306a36Sopenharmony_ci#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0) 70362306a36Sopenharmony_ci#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1) 70462306a36Sopenharmony_ci 70562306a36Sopenharmony_ci/* Layout of 64-bit XIVE source configuration attribute values */ 70662306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_PRIORITY_SHIFT 0 70762306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_PRIORITY_MASK 0x7 70862306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_SERVER_SHIFT 3 70962306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_SERVER_MASK 0xfffffff8ULL 71062306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_MASKED_SHIFT 32 71162306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_MASKED_MASK 0x100000000ULL 71262306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_EISN_SHIFT 33 71362306a36Sopenharmony_ci#define KVM_XIVE_SOURCE_EISN_MASK 0xfffffffe00000000ULL 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_ci/* Layout of 64-bit EQ identifier */ 71662306a36Sopenharmony_ci#define KVM_XIVE_EQ_PRIORITY_SHIFT 0 71762306a36Sopenharmony_ci#define KVM_XIVE_EQ_PRIORITY_MASK 0x7 71862306a36Sopenharmony_ci#define KVM_XIVE_EQ_SERVER_SHIFT 3 71962306a36Sopenharmony_ci#define KVM_XIVE_EQ_SERVER_MASK 0xfffffff8ULL 72062306a36Sopenharmony_ci 72162306a36Sopenharmony_ci/* Layout of EQ configuration values (64 bytes) */ 72262306a36Sopenharmony_cistruct kvm_ppc_xive_eq { 72362306a36Sopenharmony_ci __u32 flags; 72462306a36Sopenharmony_ci __u32 qshift; 72562306a36Sopenharmony_ci __u64 qaddr; 72662306a36Sopenharmony_ci __u32 qtoggle; 72762306a36Sopenharmony_ci __u32 qindex; 72862306a36Sopenharmony_ci __u8 pad[40]; 72962306a36Sopenharmony_ci}; 73062306a36Sopenharmony_ci 73162306a36Sopenharmony_ci#define KVM_XIVE_EQ_ALWAYS_NOTIFY 0x00000001 73262306a36Sopenharmony_ci 73362306a36Sopenharmony_ci#define KVM_XIVE_TIMA_PAGE_OFFSET 0 73462306a36Sopenharmony_ci#define KVM_XIVE_ESB_PAGE_OFFSET 4 73562306a36Sopenharmony_ci 73662306a36Sopenharmony_ci#endif /* __LINUX_KVM_POWERPC_H */ 737