2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License, version 2, as
4
* published by the Free Software Foundation.
6
* This program is distributed in the hope that it will be useful,
7
* but WITHOUT ANY WARRANTY; without even the implied warranty of
8
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
* GNU General Public License for more details.
11
* You should have received a copy of the GNU General Public License
12
* along with this program; if not, write to the Free Software
13
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
* Copyright IBM Corp. 2007
17
* Authors: Hollis Blanchard <hollisb@us.ibm.com>
20
#ifndef __LINUX_KVM_POWERPC_H
21
#define __LINUX_KVM_POWERPC_H
23
#include <linux/types.h>
25
/* Select powerpc specific features in <linux/kvm.h> */
26
#define __KVM_HAVE_SPAPR_TCE
27
#define __KVM_HAVE_PPC_SMT
52
#define KVM_SREGS_E_IMPL_NONE 0
53
#define KVM_SREGS_E_IMPL_FSL 1
55
#define KVM_SREGS_E_FSL_PIDn (1 << 0) /* PID1/PID2 */
58
* Feature bits indicate which sections of the sregs struct are valid,
59
* both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers
60
* corresponding to unset feature bits will not be modified. This allows
61
* restoring a checkpoint made without that feature, while keeping the
62
* default values of the new registers.
64
* KVM_SREGS_E_BASE contains:
65
* CSRR0/1 (refers to SRR2/3 on 40x)
75
#define KVM_SREGS_E_BASE (1 << 0)
78
* KVM_SREGS_E_ARCH206 contains:
85
#define KVM_SREGS_E_ARCH206 (1 << 1)
88
* Contains EPCR, plus the upper half of 64-bit registers
89
* that are 32-bit on 32-bit implementations.
91
#define KVM_SREGS_E_64 (1 << 2)
93
#define KVM_SREGS_E_SPRG8 (1 << 3)
94
#define KVM_SREGS_E_MCIVPR (1 << 4)
97
* IVORs are used -- contains IVOR0-15, plus additional IVORs
98
* in combination with an appropriate feature bit.
100
#define KVM_SREGS_E_IVOR (1 << 5)
103
* Contains MAS0-4, MAS6-7, TLBnCFG, MMUCFG.
104
* Also TLBnPS if MMUCFG[MAVN] = 1.
106
#define KVM_SREGS_E_ARCH206_MMU (1 << 6)
108
/* DBSR, DBCR, IAC, DAC, DVC */
109
#define KVM_SREGS_E_DEBUG (1 << 7)
111
/* Enhanced debug -- DSRR0/1, SPRG9 */
112
#define KVM_SREGS_E_ED (1 << 8)
114
/* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */
115
#define KVM_SREGS_E_SPE (1 << 9)
117
/* External Proxy (EXP) -- EPR */
118
#define KVM_SREGS_EXP (1 << 10)
120
/* External PID (E.PD) -- EPSC/EPLC */
121
#define KVM_SREGS_E_PD (1 << 11)
123
/* Processor Control (E.PC) -- IVOR36-37 if KVM_SREGS_E_IVOR */
124
#define KVM_SREGS_E_PC (1 << 12)
126
/* Page table (E.PT) -- EPTCFG */
127
#define KVM_SREGS_E_PT (1 << 13)
129
/* Embedded Performance Monitor (E.PM) -- IVOR35 if KVM_SREGS_E_IVOR */
130
#define KVM_SREGS_E_PM (1 << 14)
135
* Some registers may change even while a vcpu is not running.
136
* To avoid losing these changes, by default these registers are
137
* not updated by KVM_SET_SREGS. To force an update, set the bit
138
* in u.e.update_special corresponding to the register to be updated.
140
* The update_special field is zero on return from KVM_GET_SREGS.
142
* When restoring a checkpoint, the caller can set update_special
143
* to 0xffffffff to ensure that everything is restored, even new features
144
* that the caller doesn't know about.
146
#define KVM_SREGS_E_UPDATE_MCSR (1 << 0)
147
#define KVM_SREGS_E_UPDATE_TSR (1 << 1)
148
#define KVM_SREGS_E_UPDATE_DEC (1 << 2)
149
#define KVM_SREGS_E_UPDATE_DBSR (1 << 3)
152
* In KVM_SET_SREGS, reserved/pad fields must be left untouched from a
153
* previous KVM_GET_REGS.
155
* Unless otherwise indicated, setting any register with KVM_SET_SREGS
156
* directly sets its value. It does not trigger any special semantics such
157
* as write-one-to-clear. Calling KVM_SET_SREGS on an unmodified struct
158
* just received from KVM_GET_SREGS is always a no-op.
179
struct { /* KVM_SREGS_E_IMPL_FSL */
180
__u32 features; /* KVM_SREGS_E_FSL_ */
185
/* KVM_SREGS_E_FSL_PIDn */
191
__u32 features; /* KVM_SREGS_E_ */
192
__u32 impl_id; /* KVM_SREGS_E_IMPL_ */
193
__u32 update_special; /* KVM_SREGS_E_UPDATE_ */
194
__u32 pir; /* read-only */
196
__u64 sprg9; /* E.ED */
198
__u64 dsrr0; /* E.ED */
201
__u32 dsrr1; /* E.ED */
207
__u64 mcsr; /* KVM_SREGS_E_UPDATE_MCSR */
209
__u32 tsr; /* KVM_SREGS_E_UPDATE_TSR */
212
__u32 dec; /* KVM_SREGS_E_UPDATE_DEC */
215
* Userspace can read TB directly, but the
216
* value reported here is consistent with "dec".
222
__u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */
227
__u8 num_iac; /* read-only */
228
__u8 num_dac; /* read-only */
229
__u8 num_dvc; /* read-only */
233
__u32 vrsave; /* a.k.a. USPRG0 */
234
__u32 epcr; /* KVM_SREGS_E_64 */
243
__u32 ivor_low[16]; /* IVOR0-15 */
244
__u32 ivor_high[18]; /* IVOR32+, plus room to expand */
246
__u32 mmucfg; /* read-only */
247
__u32 eptcfg; /* E.PT, read-only */
248
__u32 tlbcfg[4];/* read-only */
249
__u32 tlbps[4]; /* read-only */
251
__u32 eplc, epsc; /* E.PD */
261
struct kvm_debug_exit_arch {
264
/* for KVM_SET_GUEST_DEBUG */
265
struct kvm_guest_debug_arch {
268
#define KVM_REG_MASK 0x001f
269
#define KVM_REG_EXT_MASK 0xffe0
270
#define KVM_REG_GPR 0x0000
271
#define KVM_REG_FPR 0x0020
272
#define KVM_REG_QPR 0x0040
273
#define KVM_REG_FQPR 0x0060
275
#define KVM_INTERRUPT_SET -1U
276
#define KVM_INTERRUPT_UNSET -2U
277
#define KVM_INTERRUPT_SET_LEVEL -3U
279
#define KVM_CPU_440 1
280
#define KVM_CPU_E500V2 2
281
#define KVM_CPU_3S_32 3
282
#define KVM_CPU_3S_64 4
284
/* for KVM_CAP_SPAPR_TCE */
285
struct kvm_create_spapr_tce {
290
/* for KVM_ALLOCATE_RMA */
291
struct kvm_allocate_rma {
295
#endif /* __LINUX_KVM_POWERPC_H */