MIPS: Probe guest CP0_UserLocal
authorJames Hogan <james.hogan@imgtec.com>
Tue, 14 Mar 2017 10:15:10 +0000 (10:15 +0000)
committerJames Hogan <james.hogan@imgtec.com>
Tue, 28 Mar 2017 13:49:11 +0000 (14:49 +0100)
Probe for presence of guest CP0_UserLocal register and expose via
cpu_guest_has_userlocal. This register is optional pre-r6, so this will
allow KVM to only save/restore/expose the guest CP0_UserLocal register
if it exists.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
arch/mips/include/asm/cpu-features.h
arch/mips/kernel/cpu-probe.c

index e12d4ec6854d604ef4f43b3f197fc2d608f64f63..e898f441cc2227562ecae8fe5347c3c32a0781c2 100644 (file)
 #ifndef cpu_guest_has_maar
 #define cpu_guest_has_maar     (cpu_data[0].guest.options & MIPS_CPU_MAAR)
 #endif
+#ifndef cpu_guest_has_userlocal
+#define cpu_guest_has_userlocal        (cpu_data[0].guest.options & MIPS_CPU_ULRI)
+#endif
 
 /*
  * Guest dynamic capabilities
index 708f5913a8fe6a25ed65d46d7d2bd41b2495fac4..29dfdb64ad0b636705491fee8e3931484a30a8b0 100644 (file)
@@ -1005,7 +1005,8 @@ static inline unsigned int decode_guest_config3(struct cpuinfo_mips *c)
        unsigned int config3, config3_dyn;
 
        probe_gc0_config_dyn(config3, config3, config3_dyn,
-                            MIPS_CONF_M | MIPS_CONF3_MSA | MIPS_CONF3_CTXTC);
+                            MIPS_CONF_M | MIPS_CONF3_MSA | MIPS_CONF3_ULRI |
+                            MIPS_CONF3_CTXTC);
 
        if (config3 & MIPS_CONF3_CTXTC)
                c->guest.options |= MIPS_CPU_CTXTC;
@@ -1015,6 +1016,9 @@ static inline unsigned int decode_guest_config3(struct cpuinfo_mips *c)
        if (config3 & MIPS_CONF3_PW)
                c->guest.options |= MIPS_CPU_HTW;
 
+       if (config3 & MIPS_CONF3_ULRI)
+               c->guest.options |= MIPS_CPU_ULRI;
+
        if (config3 & MIPS_CONF3_SC)
                c->guest.options |= MIPS_CPU_SEGMENTS;