aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kvm/mips.c
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2015-02-06 05:56:27 -0500
committerJames Hogan <james.hogan@imgtec.com>2015-03-27 17:25:20 -0400
commitc2537ed9fb8e17d713e5e67fcede047699d25814 (patch)
tree1a4d37e5ddfa872efda4ae2ea42c1655a27ec3d0 /arch/mips/kvm/mips.c
parent2b6009d646887cac8888f1ce8694af0beefce88b (diff)
MIPS: KVM: Add MSA exception handling
Add guest exception handling for MIPS SIMD Architecture (MSA) floating point exceptions and MSA disabled exceptions. MSA floating point exceptions from the guest need passing to the guest kernel, so for these a guest MSAFPE is emulated. MSA disabled exceptions are normally handled by passing a reserved instruction exception to the guest (because no guest MSA was supported), but the hypervisor can now handle them if the guest has MSA by passing an MSA disabled exception to the guest, or if the guest has MSA enabled by transparently restoring the guest MSA context and enabling MSA and the FPU. 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: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org
Diffstat (limited to 'arch/mips/kvm/mips.c')
-rw-r--r--arch/mips/kvm/mips.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index a17f21015a0b..e02c7e5a12ff 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -50,7 +50,9 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
50 { "resvd_inst", VCPU_STAT(resvd_inst_exits), KVM_STAT_VCPU }, 50 { "resvd_inst", VCPU_STAT(resvd_inst_exits), KVM_STAT_VCPU },
51 { "break_inst", VCPU_STAT(break_inst_exits), KVM_STAT_VCPU }, 51 { "break_inst", VCPU_STAT(break_inst_exits), KVM_STAT_VCPU },
52 { "trap_inst", VCPU_STAT(trap_inst_exits), KVM_STAT_VCPU }, 52 { "trap_inst", VCPU_STAT(trap_inst_exits), KVM_STAT_VCPU },
53 { "msa_fpe", VCPU_STAT(msa_fpe_exits), KVM_STAT_VCPU },
53 { "fpe", VCPU_STAT(fpe_exits), KVM_STAT_VCPU }, 54 { "fpe", VCPU_STAT(fpe_exits), KVM_STAT_VCPU },
55 { "msa_disabled", VCPU_STAT(msa_disabled_exits), KVM_STAT_VCPU },
54 { "flush_dcache", VCPU_STAT(flush_dcache_exits), KVM_STAT_VCPU }, 56 { "flush_dcache", VCPU_STAT(flush_dcache_exits), KVM_STAT_VCPU },
55 { "halt_successful_poll", VCPU_STAT(halt_successful_poll), KVM_STAT_VCPU }, 57 { "halt_successful_poll", VCPU_STAT(halt_successful_poll), KVM_STAT_VCPU },
56 { "halt_wakeup", VCPU_STAT(halt_wakeup), KVM_STAT_VCPU }, 58 { "halt_wakeup", VCPU_STAT(halt_wakeup), KVM_STAT_VCPU },
@@ -1256,6 +1258,12 @@ int kvm_mips_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
1256 ret = kvm_mips_callbacks->handle_trap(vcpu); 1258 ret = kvm_mips_callbacks->handle_trap(vcpu);
1257 break; 1259 break;
1258 1260
1261 case T_MSAFPE:
1262 ++vcpu->stat.msa_fpe_exits;
1263 trace_kvm_exit(vcpu, MSA_FPE_EXITS);
1264 ret = kvm_mips_callbacks->handle_msa_fpe(vcpu);
1265 break;
1266
1259 case T_FPE: 1267 case T_FPE:
1260 ++vcpu->stat.fpe_exits; 1268 ++vcpu->stat.fpe_exits;
1261 trace_kvm_exit(vcpu, FPE_EXITS); 1269 trace_kvm_exit(vcpu, FPE_EXITS);
@@ -1263,6 +1271,8 @@ int kvm_mips_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
1263 break; 1271 break;
1264 1272
1265 case T_MSADIS: 1273 case T_MSADIS:
1274 ++vcpu->stat.msa_disabled_exits;
1275 trace_kvm_exit(vcpu, MSA_DISABLED_EXITS);
1266 ret = kvm_mips_callbacks->handle_msa_disabled(vcpu); 1276 ret = kvm_mips_callbacks->handle_msa_disabled(vcpu);
1267 break; 1277 break;
1268 1278