aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/uapi/asm
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2014-12-02 10:48:24 -0500
committerJames Hogan <james.hogan@imgtec.com>2015-03-27 17:25:21 -0400
commitab86bd600400357ffa0dfdb1797f587476d01352 (patch)
tree265d24436dc03ac0e1ff2fa3a1652feb3346b6ff /arch/mips/include/uapi/asm
parentc2537ed9fb8e17d713e5e67fcede047699d25814 (diff)
MIPS: KVM: Expose MSA registers
Add KVM register numbers for the MIPS SIMD Architecture (MSA) registers, and implement access to them with the KVM_GET_ONE_REG / KVM_SET_ONE_REG ioctls when the MSA capability is enabled (exposed in a later patch) and present in the guest according to its Config3.MSAP bit. The MSA vector registers use the same register numbers as the FPU registers except with a different size (128bits). Since MSA depends on Status.FR=1, these registers are inaccessible when Status.FR=0. These registers are returned as a single native endian 128bit value, rather than least significant half first with each 64-bit half native endian as the kernel uses internally. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Gleb Natapov <gleb@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Cc: linux-api@vger.kernel.org Cc: linux-doc@vger.kernel.org
Diffstat (limited to 'arch/mips/include/uapi/asm')
-rw-r--r--arch/mips/include/uapi/asm/kvm.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/mips/include/uapi/asm/kvm.h b/arch/mips/include/uapi/asm/kvm.h
index 401e6a6f8bb8..6985eb59b085 100644
--- a/arch/mips/include/uapi/asm/kvm.h
+++ b/arch/mips/include/uapi/asm/kvm.h
@@ -58,7 +58,7 @@ struct kvm_fpu {
58 * 58 *
59 * Register set = 2: KVM specific registers (see definitions below). 59 * Register set = 2: KVM specific registers (see definitions below).
60 * 60 *
61 * Register set = 3: FPU registers (see definitions below). 61 * Register set = 3: FPU / MSA registers (see definitions below).
62 * 62 *
63 * Other sets registers may be added in the future. Each set would 63 * Other sets registers may be added in the future. Each set would
64 * have its own identifier in bits[31..16]. 64 * have its own identifier in bits[31..16].
@@ -148,7 +148,7 @@ struct kvm_fpu {
148 148
149 149
150/* 150/*
151 * KVM_REG_MIPS_FPU - Floating Point registers. 151 * KVM_REG_MIPS_FPU - Floating Point and MIPS SIMD Architecture (MSA) registers.
152 * 152 *
153 * bits[15..8] - Register subset (see definitions below). 153 * bits[15..8] - Register subset (see definitions below).
154 * bits[7..5] - Must be zero. 154 * bits[7..5] - Must be zero.
@@ -157,12 +157,14 @@ struct kvm_fpu {
157 157
158#define KVM_REG_MIPS_FPR (KVM_REG_MIPS_FPU | 0x0000000000000000ULL) 158#define KVM_REG_MIPS_FPR (KVM_REG_MIPS_FPU | 0x0000000000000000ULL)
159#define KVM_REG_MIPS_FCR (KVM_REG_MIPS_FPU | 0x0000000000000100ULL) 159#define KVM_REG_MIPS_FCR (KVM_REG_MIPS_FPU | 0x0000000000000100ULL)
160#define KVM_REG_MIPS_MSACR (KVM_REG_MIPS_FPU | 0x0000000000000200ULL)
160 161
161/* 162/*
162 * KVM_REG_MIPS_FPR - Floating point / Vector registers. 163 * KVM_REG_MIPS_FPR - Floating point / Vector registers.
163 */ 164 */
164#define KVM_REG_MIPS_FPR_32(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U32 | (n)) 165#define KVM_REG_MIPS_FPR_32(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U32 | (n))
165#define KVM_REG_MIPS_FPR_64(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U64 | (n)) 166#define KVM_REG_MIPS_FPR_64(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U64 | (n))
167#define KVM_REG_MIPS_VEC_128(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U128 | (n))
166 168
167/* 169/*
168 * KVM_REG_MIPS_FCR - Floating point control registers. 170 * KVM_REG_MIPS_FCR - Floating point control registers.
@@ -170,6 +172,12 @@ struct kvm_fpu {
170#define KVM_REG_MIPS_FCR_IR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 0) 172#define KVM_REG_MIPS_FCR_IR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 0)
171#define KVM_REG_MIPS_FCR_CSR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 31) 173#define KVM_REG_MIPS_FCR_CSR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 31)
172 174
175/*
176 * KVM_REG_MIPS_MSACR - MIPS SIMD Architecture (MSA) control registers.
177 */
178#define KVM_REG_MIPS_MSA_IR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 0)
179#define KVM_REG_MIPS_MSA_CSR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 1)
180
173 181
174/* 182/*
175 * KVM MIPS specific structures and definitions 183 * KVM MIPS specific structures and definitions