MIPS: Add Octeon III register accessors & definitions
authorJames Hogan <james.hogan@imgtec.com>
Tue, 14 Mar 2017 10:25:44 +0000 (10:25 +0000)
committerJames Hogan <james.hogan@imgtec.com>
Tue, 28 Mar 2017 14:36:04 +0000 (15:36 +0100)
Add accessors for some VZ related Cavium Octeon III specific COP0
registers, along with field definitions. These will mostly be used by
KVM to set up interrupt routing and partition the TLB between root and
guest.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
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/mipsregs.h

index c6b8f96b80f96330370be98c7d4a66769de3bbcd..ebe608d21d7e5df6dc96855084d636411c3d61da 100644 (file)
 /* Flush FTLB */
 #define LOONGSON_DIAG_FTLB     (_ULCAST_(1) << 13)
 
+/* CvmCtl register field definitions */
+#define CVMCTL_IPPCI_SHIFT     7
+#define CVMCTL_IPPCI           (_U64CAST_(0x7) << CVMCTL_IPPCI_SHIFT)
+#define CVMCTL_IPTI_SHIFT      4
+#define CVMCTL_IPTI            (_U64CAST_(0x7) << CVMCTL_IPTI_SHIFT)
+
+/* CvmMemCtl2 register field definitions */
+#define CVMMEMCTL2_INHIBITTS   (_U64CAST_(1) << 17)
+
+/* CvmVMConfig register field definitions */
+#define CVMVMCONF_DGHT         (_U64CAST_(1) << 60)
+#define CVMVMCONF_MMUSIZEM1_S  12
+#define CVMVMCONF_MMUSIZEM1    (_U64CAST_(0xff) << CVMVMCONF_MMUSIZEM1_S)
+#define CVMVMCONF_RMMUSIZEM1_S 0
+#define CVMVMCONF_RMMUSIZEM1   (_U64CAST_(0xff) << CVMVMCONF_RMMUSIZEM1_S)
+
 /*
  * Coprocessor 1 (FPU) register names
  */
@@ -1733,6 +1749,13 @@ do {                                                                     \
 
 #define read_c0_cvmmemctl()    __read_64bit_c0_register($11, 7)
 #define write_c0_cvmmemctl(val) __write_64bit_c0_register($11, 7, val)
+
+#define read_c0_cvmmemctl2()   __read_64bit_c0_register($16, 6)
+#define write_c0_cvmmemctl2(val) __write_64bit_c0_register($16, 6, val)
+
+#define read_c0_cvmvmconfig()  __read_64bit_c0_register($16, 7)
+#define write_c0_cvmvmconfig(val) __write_64bit_c0_register($16, 7, val)
+
 /*
  * The cacheerr registers are not standardized.         On OCTEON, they are
  * 64 bits wide.
@@ -2106,6 +2129,19 @@ do {                                                                     \
 #define write_gc0_kscratch5(val)       __write_ulong_gc0_register(31, 6, val)
 #define write_gc0_kscratch6(val)       __write_ulong_gc0_register(31, 7, val)
 
+/* Cavium OCTEON (cnMIPS) */
+#define read_gc0_cvmcount()            __read_ulong_gc0_register(9, 6)
+#define write_gc0_cvmcount(val)                __write_ulong_gc0_register(9, 6, val)
+
+#define read_gc0_cvmctl()              __read_64bit_gc0_register(9, 7)
+#define write_gc0_cvmctl(val)          __write_64bit_gc0_register(9, 7, val)
+
+#define read_gc0_cvmmemctl()           __read_64bit_gc0_register(11, 7)
+#define write_gc0_cvmmemctl(val)       __write_64bit_gc0_register(11, 7, val)
+
+#define read_gc0_cvmmemctl2()          __read_64bit_gc0_register(16, 6)
+#define write_gc0_cvmmemctl2(val)      __write_64bit_gc0_register(16, 6, val)
+
 /*
  * Macros to access the floating point coprocessor control registers
  */