summaryrefslogtreecommitdiffstats
path: root/arch/mips/kvm/entry.c
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2016-07-04 19:35:11 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-07-05 16:09:14 +0200
commit70e92c7ee94094d2db8bfe225a8c9b1bde89c26d (patch)
treebe4f2ba4705ed81862392378fb220d6d0b840fd1 /arch/mips/kvm/entry.c
parentd85ebff0073c783f0c74dc0e08c348f6f2d807c7 (diff)
downloadlinux-70e92c7ee94094d2db8bfe225a8c9b1bde89c26d.tar.gz
linux-70e92c7ee94094d2db8bfe225a8c9b1bde89c26d.tar.bz2
linux-70e92c7ee94094d2db8bfe225a8c9b1bde89c26d.zip
MIPS: KVM: Don't save/restore lo/hi for r6
MIPSr6 doesn't have lo/hi registers, so don't bother saving or restoring them, and don't expose them to userland with the KVM ioctl interface either. In fact the lo/hi registers aren't callee saved in the MIPS ABIs anyway, so there is no need to preserve the host lo/hi values at all when transitioning to and from the guest (which happens via a function call). Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Radim KrÄmář <rkrcmar@redhat.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/mips/kvm/entry.c')
-rw-r--r--arch/mips/kvm/entry.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/arch/mips/kvm/entry.c b/arch/mips/kvm/entry.c
index de8b6ec5573f..75ba7c2ecb3d 100644
--- a/arch/mips/kvm/entry.c
+++ b/arch/mips/kvm/entry.c
@@ -178,12 +178,6 @@ void *kvm_mips_build_vcpu_run(void *addr)
UASM_i_SW(&p, i, offsetof(struct pt_regs, regs[i]), K1);
}
- /* Save hi/lo */
- uasm_i_mflo(&p, V0);
- UASM_i_SW(&p, V0, offsetof(struct pt_regs, lo), K1);
- uasm_i_mfhi(&p, V1);
- UASM_i_SW(&p, V1, offsetof(struct pt_regs, hi), K1);
-
/* Save host status */
uasm_i_mfc0(&p, V0, C0_STATUS);
UASM_i_SW(&p, V0, offsetof(struct pt_regs, cp0_status), K1);
@@ -307,12 +301,14 @@ static void *kvm_mips_build_enter_guest(void *addr)
UASM_i_LW(&p, i, offsetof(struct kvm_vcpu_arch, gprs[i]), K1);
}
+#ifndef CONFIG_CPU_MIPSR6
/* Restore hi/lo */
UASM_i_LW(&p, K0, offsetof(struct kvm_vcpu_arch, hi), K1);
uasm_i_mthi(&p, K0);
UASM_i_LW(&p, K0, offsetof(struct kvm_vcpu_arch, lo), K1);
uasm_i_mtlo(&p, K0);
+#endif
/* Restore the guest's k0/k1 registers */
UASM_i_LW(&p, K0, offsetof(struct kvm_vcpu_arch, gprs[K0]), K1);
@@ -408,12 +404,14 @@ void *kvm_mips_build_exit(void *addr)
UASM_i_SW(&p, i, offsetof(struct kvm_vcpu_arch, gprs[i]), K1);
}
+#ifndef CONFIG_CPU_MIPSR6
/* We need to save hi/lo and restore them on the way out */
uasm_i_mfhi(&p, T0);
UASM_i_SW(&p, T0, offsetof(struct kvm_vcpu_arch, hi), K1);
uasm_i_mflo(&p, T0);
UASM_i_SW(&p, T0, offsetof(struct kvm_vcpu_arch, lo), K1);
+#endif
/* Finally save guest k1 to VCPU */
uasm_i_ehb(&p);
@@ -663,12 +661,6 @@ static void *kvm_mips_build_ret_to_host(void *addr)
UASM_i_LW(&p, i, offsetof(struct pt_regs, regs[i]), K1);
}
- UASM_i_LW(&p, K0, offsetof(struct pt_regs, hi), K1);
- uasm_i_mthi(&p, K0);
-
- UASM_i_LW(&p, K0, offsetof(struct pt_regs, lo), K1);
- uasm_i_mtlo(&p, K0);
-
/* Restore RDHWR access */
UASM_i_LA_mostly(&p, K0, (long)&hwrena);
uasm_i_lw(&p, K0, uasm_rel_lo((long)&hwrena), K0);