Merge branch '3.14-fixes' into mips-for-linux-next
authorRalf Baechle <ralf@linux-mips.org>
Mon, 31 Mar 2014 16:17:33 +0000 (18:17 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 31 Mar 2014 16:17:33 +0000 (18:17 +0200)
1  2 
arch/mips/Kconfig
arch/mips/bcm47xx/board.c
arch/mips/include/asm/asmmacro.h
arch/mips/include/asm/fpu.h
arch/mips/include/asm/syscall.h
arch/mips/include/uapi/asm/inst.h
arch/mips/kernel/ftrace.c
arch/mips/kernel/r4k_fpu.S
arch/mips/math-emu/cp1emu.c
arch/mips/mti-malta/malta-int.c

diff --combined arch/mips/Kconfig
index 14aeb174e00f0f15dc13c8860ffa5f8c91313ea2,7111d74a01a0ecb378b0e82e86a1a18287d5ce7c..fc9be7c8c5aaf6d2baf57ff1b2ff37afec811f38
@@@ -10,7 -10,6 +10,7 @@@ config MIP
        select HAVE_PERF_EVENTS
        select PERF_USE_VMALLOC
        select HAVE_ARCH_KGDB
 +      select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select ARCH_HAVE_CUSTOM_GPIO_H
        select HAVE_FUNCTION_TRACER
@@@ -63,7 -62,6 +63,7 @@@ config MIPS_ALCHEM
        select CEVT_R4K
        select CSRC_R4K
        select IRQ_CPU
 +      select DMA_MAYBE_COHERENT       # Au1000,1500,1100 aren't, rest is
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_APM_EMULATION
@@@ -125,7 -123,7 +125,7 @@@ config BCM47X
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_HAS_EARLY_PRINTK
-       select EARLY_PRINTK_8250 if EARLY_PRINTK
+       select USE_GENERIC_EARLY_PRINTK_8250
        help
         Support for BCM47XX based boards
  
@@@ -152,7 -150,6 +152,6 @@@ config MIPS_COBAL
        select CSRC_R4K
        select CEVT_GT641XX
        select DMA_NONCOHERENT
-       select EARLY_PRINTK_8250 if EARLY_PRINTK
        select HW_HAS_PCI
        select I8253
        select I8259
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select USE_GENERIC_EARLY_PRINTK_8250
  
  config MACH_DECSTATION
        bool "DECstations"
@@@ -237,6 -235,7 +237,6 @@@ config MACH_JZ474
        select IRQ_CPU
        select ARCH_REQUIRE_GPIOLIB
        select SYS_HAS_EARLY_PRINTK
 -      select HAVE_PWM
        select HAVE_CLK
        select GENERIC_IRQ_CHIP
  
@@@ -321,7 -320,6 +321,7 @@@ config MIPS_MALT
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_HAS_CPU_MIPS32_R2
 +      select SYS_HAS_CPU_MIPS32_R3_5
        select SYS_HAS_CPU_MIPS64_R1
        select SYS_HAS_CPU_MIPS64_R2
        select SYS_HAS_CPU_NEVADA
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_MIPS_CMP
 +      select SYS_SUPPORTS_MIPS_CPS
        select SYS_SUPPORTS_MULTITHREADING
        select SYS_SUPPORTS_SMARTMIPS
        select SYS_SUPPORTS_ZBOOT
@@@ -677,6 -674,7 +677,7 @@@ config SNI_R
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select USE_GENERIC_EARLY_PRINTK_8250
        help
          The SNI RM200/300/400 are MIPS-based machines manufactured by
          Siemens Nixdorf Informationssysteme (SNI), parent company of Pyramid
@@@ -785,6 -783,7 +786,6 @@@ config NLM_XLP_BOAR
        select CEVT_R4K
        select CSRC_R4K
        select IRQ_CPU
 -      select ARCH_SUPPORTS_MSI
        select ZONE_DMA32 if 64BIT
        select SYNC_R4K
        select SYS_HAS_EARLY_PRINTK
@@@ -870,7 -869,6 +871,7 @@@ config CEVT_R4
        bool
  
  config CEVT_GIC
 +      select MIPS_CM
        bool
  
  config CEVT_SB1250
@@@ -889,7 -887,6 +890,7 @@@ config CSRC_R4
        bool
  
  config CSRC_GIC
 +      select MIPS_CM
        bool
  
  config CSRC_SB1250
@@@ -1034,7 -1031,6 +1035,7 @@@ config IRQ_GT641X
        bool
  
  config IRQ_GIC
 +      select MIPS_CM
        bool
  
  config PCI_GT64XXX_PCI0
@@@ -1153,18 -1149,6 +1154,18 @@@ choic
        prompt "CPU type"
        default CPU_R4X00
  
 +config CPU_LOONGSON3
 +      bool "Loongson 3 CPU"
 +      depends on SYS_HAS_CPU_LOONGSON3
 +      select CPU_SUPPORTS_64BIT_KERNEL
 +      select CPU_SUPPORTS_HIGHMEM
 +      select CPU_SUPPORTS_HUGEPAGES
 +      select WEAK_ORDERING
 +      select WEAK_REORDERING_BEYOND_LLSC
 +      help
 +              The Loongson 3 processor implements the MIPS64R2 instruction
 +              set with many extensions.
 +
  config CPU_LOONGSON2E
        bool "Loongson 2E"
        depends on SYS_HAS_CPU_LOONGSON2E
@@@ -1220,7 -1204,6 +1221,7 @@@ config CPU_MIPS32_R
        select CPU_HAS_PREFETCH
        select CPU_SUPPORTS_32BIT_KERNEL
        select CPU_SUPPORTS_HIGHMEM
 +      select CPU_SUPPORTS_MSA
        select HAVE_KVM
        help
          Choose this option to build a kernel for release 2 or later of the
@@@ -1256,7 -1239,6 +1257,7 @@@ config CPU_MIPS64_R
        select CPU_SUPPORTS_64BIT_KERNEL
        select CPU_SUPPORTS_HIGHMEM
        select CPU_SUPPORTS_HUGEPAGES
 +      select CPU_SUPPORTS_MSA
        help
          Choose this option to build a kernel for release 2 or later of the
          MIPS64 architecture.  Many modern embedded systems with a 64-bit
@@@ -1415,6 -1397,7 +1416,6 @@@ config CPU_CAVIUM_OCTEO
        select LIBFDT
        select USE_OF
        select USB_EHCI_BIG_ENDIAN_MMIO
 -      select SYS_HAS_DMA_OPS
        select MIPS_L1_CACHE_SHIFT_7
        help
          The Cavium Octeon processor is a highly integrated chip containing
@@@ -1466,26 -1449,6 +1467,26 @@@ config CPU_XL
          Netlogic Microsystems XLP processors.
  endchoice
  
 +config CPU_MIPS32_3_5_FEATURES
 +      bool "MIPS32 Release 3.5 Features"
 +      depends on SYS_HAS_CPU_MIPS32_R3_5
 +      depends on CPU_MIPS32_R2
 +      help
 +        Choose this option to build a kernel for release 2 or later of the
 +        MIPS32 architecture including features from the 3.5 release such as
 +        support for Enhanced Virtual Addressing (EVA).
 +
 +config CPU_MIPS32_3_5_EVA
 +      bool "Enhanced Virtual Addressing (EVA)"
 +      depends on CPU_MIPS32_3_5_FEATURES
 +      select EVA
 +      default y
 +      help
 +        Choose this option if you want to enable the Enhanced Virtual
 +        Addressing (EVA) on your MIPS32 core (such as proAptiv).
 +        One of its primary benefits is an increase in the maximum size
 +        of lowmem (up to 3GB). If unsure, say 'N' here.
 +
  if CPU_LOONGSON2F
  config CPU_NOP_WORKAROUNDS
        bool
@@@ -1561,10 -1524,6 +1562,10 @@@ config CPU_BMIPS500
        select SYS_SUPPORTS_SMP
        select SYS_SUPPORTS_HOTPLUG_CPU
  
 +config SYS_HAS_CPU_LOONGSON3
 +      bool
 +      select CPU_SUPPORTS_CPUFREQ
 +
  config SYS_HAS_CPU_LOONGSON2E
        bool
  
@@@ -1583,9 -1542,6 +1584,9 @@@ config SYS_HAS_CPU_MIPS32_R
  config SYS_HAS_CPU_MIPS32_R2
        bool
  
 +config SYS_HAS_CPU_MIPS32_R3_5
 +      bool
 +
  config SYS_HAS_CPU_MIPS64_R1
        bool
  
@@@ -1702,9 -1658,6 +1703,9 @@@ config CPU_MIPSR
        bool
        default y if CPU_MIPS32_R2 || CPU_MIPS64_R2 || CPU_CAVIUM_OCTEON
  
 +config EVA
 +      bool
 +
  config SYS_SUPPORTS_32BIT_KERNEL
        bool
  config SYS_SUPPORTS_64BIT_KERNEL
@@@ -1777,7 -1730,7 +1778,7 @@@ choic
  
  config PAGE_SIZE_4KB
        bool "4kB"
 -      depends on !CPU_LOONGSON2
 +      depends on !CPU_LOONGSON2 && !CPU_LOONGSON3
        help
         This option select the standard 4kB Linux page size.  On some
         R3000-family processors this is the only available page size.  Using
@@@ -1824,12 -1777,12 +1825,12 @@@ endchoic
  
  config FORCE_MAX_ZONEORDER
        int "Maximum zone order"
-       range 14 64 if HUGETLB_PAGE && PAGE_SIZE_64KB
-       default "14" if HUGETLB_PAGE && PAGE_SIZE_64KB
-       range 13 64 if HUGETLB_PAGE && PAGE_SIZE_32KB
-       default "13" if HUGETLB_PAGE && PAGE_SIZE_32KB
-       range 12 64 if HUGETLB_PAGE && PAGE_SIZE_16KB
-       default "12" if HUGETLB_PAGE && PAGE_SIZE_16KB
+       range 14 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB
+       default "14" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB
+       range 13 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB
+       default "13" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB
+       range 12 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB
+       default "12" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB
        range 11 64
        default "11"
        help
@@@ -1918,7 -1871,6 +1919,7 @@@ config MIPS_MT_SM
        select CPU_MIPSR2_IRQ_VI
        select CPU_MIPSR2_IRQ_EI
        select SYNC_R4K
 +      select MIPS_GIC_IPI
        select MIPS_MT
        select SMP
        select SMP_UP
@@@ -1936,7 -1888,6 +1937,7 @@@ config MIPS_MT_SMT
        bool "Use all TCs on all VPEs for SMP (DEPRECATED)"
        depends on CPU_MIPS32_R2
        depends on SYS_SUPPORTS_MULTITHREADING
 +      depends on !MIPS_CPS
        select CPU_MIPSR2_IRQ_VI
        select CPU_MIPSR2_IRQ_EI
        select MIPS_MT
@@@ -2044,45 -1995,13 +2045,45 @@@ config MIPS_VPE_APSP_API_M
        depends on MIPS_VPE_APSP_API && !MIPS_CMP
  
  config MIPS_CMP
 -      bool "MIPS CMP support"
 -      depends on SYS_SUPPORTS_MIPS_CMP && MIPS_MT_SMP
 +      bool "MIPS CMP framework support (DEPRECATED)"
 +      depends on SYS_SUPPORTS_MIPS_CMP && !MIPS_MT_SMTC
 +      select MIPS_GIC_IPI
        select SYNC_R4K
        select WEAK_ORDERING
        default n
        help
 -        Enable Coherency Manager processor (CMP) support.
 +        Select this if you are using a bootloader which implements the "CMP
 +        framework" protocol (ie. YAMON) and want your kernel to make use of
 +        its ability to start secondary CPUs.
 +
 +        Unless you have a specific need, you should use CONFIG_MIPS_CPS
 +        instead of this.
 +
 +config MIPS_CPS
 +      bool "MIPS Coherent Processing System support"
 +      depends on SYS_SUPPORTS_MIPS_CPS
 +      select MIPS_CM
 +      select MIPS_CPC
 +      select MIPS_GIC_IPI
 +      select SMP
 +      select SYNC_R4K if (CEVT_R4K || CSRC_R4K)
 +      select SYS_SUPPORTS_SMP
 +      select WEAK_ORDERING
 +      help
 +        Select this if you wish to run an SMP kernel across multiple cores
 +        within a MIPS Coherent Processing System. When this option is
 +        enabled the kernel will probe for other cores and boot them with
 +        no external assistance. It is safe to enable this when hardware
 +        support is unavailable.
 +
 +config MIPS_GIC_IPI
 +      bool
 +
 +config MIPS_CM
 +      bool
 +
 +config MIPS_CPC
 +      bool
  
  config SB1_PASS_1_WORKAROUNDS
        bool
@@@ -2125,21 -2044,6 +2126,21 @@@ config CPU_MICROMIP
          When this option is enabled the kernel will be built using the
          microMIPS ISA
  
 +config CPU_HAS_MSA
 +      bool "Support for the MIPS SIMD Architecture"
 +      depends on CPU_SUPPORTS_MSA
 +      default y
 +      help
 +        MIPS SIMD Architecture (MSA) introduces 128 bit wide vector registers
 +        and a set of SIMD instructions to operate on them. When this option
 +        is enabled the kernel will support allocating & switching MSA
 +        vector register contexts. If you know that your kernel will only be
 +        running on CPUs which do not support MSA or that your userland will
 +        not be making use of it then you may wish to say N here to reduce
 +        the size & complexity of your kernel.
 +
 +        If unsure, say Y.
 +
  config CPU_HAS_WB
        bool
  
@@@ -2191,7 -2095,7 +2192,7 @@@ config CPU_R4400_WORKAROUND
  #
  config HIGHMEM
        bool "High Memory Support"
 -      depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM
 +      depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM && !CPU_MIPS32_3_5_EVA
  
  config CPU_SUPPORTS_HIGHMEM
        bool
@@@ -2205,9 -2109,6 +2206,9 @@@ config SYS_SUPPORTS_SMARTMIP
  config SYS_SUPPORTS_MICROMIPS
        bool
  
 +config CPU_SUPPORTS_MSA
 +      bool
 +
  config ARCH_FLATMEM_ENABLE
        def_bool y
        depends on !NUMA && !CPU_LOONGSON2
@@@ -2281,9 -2182,6 +2282,9 @@@ config SMP_U
  config SYS_SUPPORTS_MIPS_CMP
        bool
  
 +config SYS_SUPPORTS_MIPS_CPS
 +      bool
 +
  config SYS_SUPPORTS_SMP
        bool
  
@@@ -2456,9 -2354,8 +2457,8 @@@ config SECCOM
          If unsure, say Y. Only embedded should say N here.
  
  config MIPS_O32_FP64_SUPPORT
-       bool "Support for O32 binaries using 64-bit FP"
+       bool "Support for O32 binaries using 64-bit FP (EXPERIMENTAL)"
        depends on 32BIT || MIPS32_O32
-       default y
        help
          When this is enabled, the kernel will support use of 64-bit floating
          point registers with binaries using the O32 ABI along with the
          of your kernel & potentially improve FP emulation performance by
          saying N here.
  
-         If unsure, say Y.
+         Although binutils currently supports use of this flag the details
+         concerning its effect upon the O32 ABI in userland are still being
+         worked on. In order to avoid userland becoming dependant upon current
+         behaviour before the details have been finalised, this option should
+         be considered experimental and only enabled by those working upon
+         said details.
+         If unsure, say N.
  
  config USE_OF
        bool
@@@ -2510,17 -2414,6 +2517,17 @@@ config PC
          your box. Other bus systems are ISA, EISA, or VESA. If you have PCI,
          say Y, otherwise N.
  
 +config HT_PCI
 +      bool "Support for HT-linked PCI"
 +      default y
 +      depends on CPU_LOONGSON3
 +      select PCI
 +      select PCI_DOMAINS
 +      help
 +        Loongson family machines use Hyper-Transport bus for inter-core
 +        connection and device connection. The PCI bus is a subordinate
 +        linked at HT. Choose Y for Loongson-3 based machines.
 +
  config PCI_DOMAINS
        bool
  
index adf1ca83f8003148fceb0e196522395bfbb84cc9,cdd8246f92b33f8494712247a16348a8b41f27f1..44ab1be68c3cda8d05111766d77ee5e5865b92bc
@@@ -1,3 -1,4 +1,4 @@@
+ #include <linux/errno.h>
  #include <linux/export.h>
  #include <linux/string.h>
  #include <bcm47xx_board.h>
@@@ -71,11 -72,7 +72,11 @@@ struct bcm47xx_board_type_list1 bcm47xx
        {{BCM47XX_BOARD_ASUS_WL500W, "Asus WL500W"}, "WL500gW-"},
        {{BCM47XX_BOARD_ASUS_WL520GC, "Asus WL520GC"}, "WL520GC-"},
        {{BCM47XX_BOARD_ASUS_WL520GU, "Asus WL520GU"}, "WL520GU-"},
 +      {{BCM47XX_BOARD_BELKIN_F7D3301, "Belkin F7D3301"}, "F7D3301"},
 +      {{BCM47XX_BOARD_BELKIN_F7D3302, "Belkin F7D3302"}, "F7D3302"},
        {{BCM47XX_BOARD_BELKIN_F7D4301, "Belkin F7D4301"}, "F7D4301"},
 +      {{BCM47XX_BOARD_BELKIN_F7D4302, "Belkin F7D4302"}, "F7D4302"},
 +      {{BCM47XX_BOARD_BELKIN_F7D4401, "Belkin F7D4401"}, "F7D4401"},
        { {0}, NULL},
  };
  
@@@ -179,16 -176,7 +180,16 @@@ struct bcm47xx_board_type_list3 bcm47xx
        {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"},
        {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"},
        {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "0x04CF", "3500", "02"},
 -      {{BCM47XX_BOARD_LINKSYS_WRT54GSV1, "Linksys WRT54GS V1"}, "0x0101", "42", "0x10"},
 +      {{BCM47XX_BOARD_LINKSYS_WRT54G, "Linksys WRT54G/GS/GL"}, "0x0101", "42", "0x10"},
 +      {{BCM47XX_BOARD_LINKSYS_WRT54G, "Linksys WRT54G/GS/GL"}, "0x0467", "42", "0x10"},
 +      {{BCM47XX_BOARD_LINKSYS_WRT54G, "Linksys WRT54G/GS/GL"}, "0x0708", "42", "0x10"},
 +      { {0}, NULL},
 +};
 +
 +/* boardtype, boardrev */
 +static const
 +struct bcm47xx_board_type_list2 bcm47xx_board_list_board_type_rev[] __initconst = {
 +      {{BCM47XX_BOARD_SIEMENS_SE505V2, "Siemens SE505 V2"}, "0x0101", "0x10"},
        { {0}, NULL},
  };
  
@@@ -285,16 -273,6 +286,16 @@@ static __init const struct bcm47xx_boar
                                return &e3->board;
                }
        }
 +
 +      if (bcm47xx_nvram_getenv("boardtype", buf1, sizeof(buf1)) >= 0 &&
 +          bcm47xx_nvram_getenv("boardrev", buf2, sizeof(buf2)) >= 0 &&
 +          bcm47xx_nvram_getenv("boardnum", buf3, sizeof(buf3)) ==  -ENOENT) {
 +              for (e2 = bcm47xx_board_list_board_type_rev; e2->value1; e2++) {
 +                      if (!strcmp(buf1, e2->value1) &&
 +                          !strcmp(buf2, e2->value2))
 +                              return &e2->board;
 +              }
 +      }
        return bcm47xx_board_unknown;
  }
  
index fe3b03c793e5fcdbaa96ef434e3734208de5f1c4,4225e99bd7bfdbe75b0e47cd8b974c2dd92e1ddc..b464b8b1147a175fd9315ffa5afaab0c75d2c63a
@@@ -9,6 -9,7 +9,7 @@@
  #define _ASM_ASMMACRO_H
  
  #include <asm/hazards.h>
+ #include <asm/asm-offsets.h>
  
  #ifdef CONFIG_32BIT
  #include <asm/asmmacro-32.h>
        .endm
  
        .macro  local_irq_disable reg=t0
+ #ifdef CONFIG_PREEMPT
+       lw      \reg, TI_PRE_COUNT($28)
+       addi    \reg, \reg, 1
+       sw      \reg, TI_PRE_COUNT($28)
+ #endif
        mfc0    \reg, CP0_STATUS
        ori     \reg, \reg, 1
        xori    \reg, \reg, 1
        mtc0    \reg, CP0_STATUS
        irq_disable_hazard
+ #ifdef CONFIG_PREEMPT
+       lw      \reg, TI_PRE_COUNT($28)
+       addi    \reg, \reg, -1
+       sw      \reg, TI_PRE_COUNT($28)
+ #endif
        .endm
  #endif /* CONFIG_MIPS_MT_SMTC */
  
        .macro  fpu_save_16even thread tmp=t0
        cfc1    \tmp, fcr31
 -      sdc1    $f0,  THREAD_FPR0(\thread)
 -      sdc1    $f2,  THREAD_FPR2(\thread)
 -      sdc1    $f4,  THREAD_FPR4(\thread)
 -      sdc1    $f6,  THREAD_FPR6(\thread)
 -      sdc1    $f8,  THREAD_FPR8(\thread)
 -      sdc1    $f10, THREAD_FPR10(\thread)
 -      sdc1    $f12, THREAD_FPR12(\thread)
 -      sdc1    $f14, THREAD_FPR14(\thread)
 -      sdc1    $f16, THREAD_FPR16(\thread)
 -      sdc1    $f18, THREAD_FPR18(\thread)
 -      sdc1    $f20, THREAD_FPR20(\thread)
 -      sdc1    $f22, THREAD_FPR22(\thread)
 -      sdc1    $f24, THREAD_FPR24(\thread)
 -      sdc1    $f26, THREAD_FPR26(\thread)
 -      sdc1    $f28, THREAD_FPR28(\thread)
 -      sdc1    $f30, THREAD_FPR30(\thread)
 +      sdc1    $f0,  THREAD_FPR0_LS64(\thread)
 +      sdc1    $f2,  THREAD_FPR2_LS64(\thread)
 +      sdc1    $f4,  THREAD_FPR4_LS64(\thread)
 +      sdc1    $f6,  THREAD_FPR6_LS64(\thread)
 +      sdc1    $f8,  THREAD_FPR8_LS64(\thread)
 +      sdc1    $f10, THREAD_FPR10_LS64(\thread)
 +      sdc1    $f12, THREAD_FPR12_LS64(\thread)
 +      sdc1    $f14, THREAD_FPR14_LS64(\thread)
 +      sdc1    $f16, THREAD_FPR16_LS64(\thread)
 +      sdc1    $f18, THREAD_FPR18_LS64(\thread)
 +      sdc1    $f20, THREAD_FPR20_LS64(\thread)
 +      sdc1    $f22, THREAD_FPR22_LS64(\thread)
 +      sdc1    $f24, THREAD_FPR24_LS64(\thread)
 +      sdc1    $f26, THREAD_FPR26_LS64(\thread)
 +      sdc1    $f28, THREAD_FPR28_LS64(\thread)
 +      sdc1    $f30, THREAD_FPR30_LS64(\thread)
        sw      \tmp, THREAD_FCR31(\thread)
        .endm
  
        .macro  fpu_save_16odd thread
        .set    push
        .set    mips64r2
 -      sdc1    $f1,  THREAD_FPR1(\thread)
 -      sdc1    $f3,  THREAD_FPR3(\thread)
 -      sdc1    $f5,  THREAD_FPR5(\thread)
 -      sdc1    $f7,  THREAD_FPR7(\thread)
 -      sdc1    $f9,  THREAD_FPR9(\thread)
 -      sdc1    $f11, THREAD_FPR11(\thread)
 -      sdc1    $f13, THREAD_FPR13(\thread)
 -      sdc1    $f15, THREAD_FPR15(\thread)
 -      sdc1    $f17, THREAD_FPR17(\thread)
 -      sdc1    $f19, THREAD_FPR19(\thread)
 -      sdc1    $f21, THREAD_FPR21(\thread)
 -      sdc1    $f23, THREAD_FPR23(\thread)
 -      sdc1    $f25, THREAD_FPR25(\thread)
 -      sdc1    $f27, THREAD_FPR27(\thread)
 -      sdc1    $f29, THREAD_FPR29(\thread)
 -      sdc1    $f31, THREAD_FPR31(\thread)
 +      sdc1    $f1,  THREAD_FPR1_LS64(\thread)
 +      sdc1    $f3,  THREAD_FPR3_LS64(\thread)
 +      sdc1    $f5,  THREAD_FPR5_LS64(\thread)
 +      sdc1    $f7,  THREAD_FPR7_LS64(\thread)
 +      sdc1    $f9,  THREAD_FPR9_LS64(\thread)
 +      sdc1    $f11, THREAD_FPR11_LS64(\thread)
 +      sdc1    $f13, THREAD_FPR13_LS64(\thread)
 +      sdc1    $f15, THREAD_FPR15_LS64(\thread)
 +      sdc1    $f17, THREAD_FPR17_LS64(\thread)
 +      sdc1    $f19, THREAD_FPR19_LS64(\thread)
 +      sdc1    $f21, THREAD_FPR21_LS64(\thread)
 +      sdc1    $f23, THREAD_FPR23_LS64(\thread)
 +      sdc1    $f25, THREAD_FPR25_LS64(\thread)
 +      sdc1    $f27, THREAD_FPR27_LS64(\thread)
 +      sdc1    $f29, THREAD_FPR29_LS64(\thread)
 +      sdc1    $f31, THREAD_FPR31_LS64(\thread)
        .set    pop
        .endm
  
        .macro  fpu_save_double thread status tmp
- #if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2)
+ #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
        sll     \tmp, \status, 5
        bgez    \tmp, 10f
        fpu_save_16odd \thread
  
        .macro  fpu_restore_16even thread tmp=t0
        lw      \tmp, THREAD_FCR31(\thread)
 -      ldc1    $f0,  THREAD_FPR0(\thread)
 -      ldc1    $f2,  THREAD_FPR2(\thread)
 -      ldc1    $f4,  THREAD_FPR4(\thread)
 -      ldc1    $f6,  THREAD_FPR6(\thread)
 -      ldc1    $f8,  THREAD_FPR8(\thread)
 -      ldc1    $f10, THREAD_FPR10(\thread)
 -      ldc1    $f12, THREAD_FPR12(\thread)
 -      ldc1    $f14, THREAD_FPR14(\thread)
 -      ldc1    $f16, THREAD_FPR16(\thread)
 -      ldc1    $f18, THREAD_FPR18(\thread)
 -      ldc1    $f20, THREAD_FPR20(\thread)
 -      ldc1    $f22, THREAD_FPR22(\thread)
 -      ldc1    $f24, THREAD_FPR24(\thread)
 -      ldc1    $f26, THREAD_FPR26(\thread)
 -      ldc1    $f28, THREAD_FPR28(\thread)
 -      ldc1    $f30, THREAD_FPR30(\thread)
 +      ldc1    $f0,  THREAD_FPR0_LS64(\thread)
 +      ldc1    $f2,  THREAD_FPR2_LS64(\thread)
 +      ldc1    $f4,  THREAD_FPR4_LS64(\thread)
 +      ldc1    $f6,  THREAD_FPR6_LS64(\thread)
 +      ldc1    $f8,  THREAD_FPR8_LS64(\thread)
 +      ldc1    $f10, THREAD_FPR10_LS64(\thread)
 +      ldc1    $f12, THREAD_FPR12_LS64(\thread)
 +      ldc1    $f14, THREAD_FPR14_LS64(\thread)
 +      ldc1    $f16, THREAD_FPR16_LS64(\thread)
 +      ldc1    $f18, THREAD_FPR18_LS64(\thread)
 +      ldc1    $f20, THREAD_FPR20_LS64(\thread)
 +      ldc1    $f22, THREAD_FPR22_LS64(\thread)
 +      ldc1    $f24, THREAD_FPR24_LS64(\thread)
 +      ldc1    $f26, THREAD_FPR26_LS64(\thread)
 +      ldc1    $f28, THREAD_FPR28_LS64(\thread)
 +      ldc1    $f30, THREAD_FPR30_LS64(\thread)
        ctc1    \tmp, fcr31
        .endm
  
        .macro  fpu_restore_16odd thread
        .set    push
        .set    mips64r2
 -      ldc1    $f1,  THREAD_FPR1(\thread)
 -      ldc1    $f3,  THREAD_FPR3(\thread)
 -      ldc1    $f5,  THREAD_FPR5(\thread)
 -      ldc1    $f7,  THREAD_FPR7(\thread)
 -      ldc1    $f9,  THREAD_FPR9(\thread)
 -      ldc1    $f11, THREAD_FPR11(\thread)
 -      ldc1    $f13, THREAD_FPR13(\thread)
 -      ldc1    $f15, THREAD_FPR15(\thread)
 -      ldc1    $f17, THREAD_FPR17(\thread)
 -      ldc1    $f19, THREAD_FPR19(\thread)
 -      ldc1    $f21, THREAD_FPR21(\thread)
 -      ldc1    $f23, THREAD_FPR23(\thread)
 -      ldc1    $f25, THREAD_FPR25(\thread)
 -      ldc1    $f27, THREAD_FPR27(\thread)
 -      ldc1    $f29, THREAD_FPR29(\thread)
 -      ldc1    $f31, THREAD_FPR31(\thread)
 +      ldc1    $f1,  THREAD_FPR1_LS64(\thread)
 +      ldc1    $f3,  THREAD_FPR3_LS64(\thread)
 +      ldc1    $f5,  THREAD_FPR5_LS64(\thread)
 +      ldc1    $f7,  THREAD_FPR7_LS64(\thread)
 +      ldc1    $f9,  THREAD_FPR9_LS64(\thread)
 +      ldc1    $f11, THREAD_FPR11_LS64(\thread)
 +      ldc1    $f13, THREAD_FPR13_LS64(\thread)
 +      ldc1    $f15, THREAD_FPR15_LS64(\thread)
 +      ldc1    $f17, THREAD_FPR17_LS64(\thread)
 +      ldc1    $f19, THREAD_FPR19_LS64(\thread)
 +      ldc1    $f21, THREAD_FPR21_LS64(\thread)
 +      ldc1    $f23, THREAD_FPR23_LS64(\thread)
 +      ldc1    $f25, THREAD_FPR25_LS64(\thread)
 +      ldc1    $f27, THREAD_FPR27_LS64(\thread)
 +      ldc1    $f29, THREAD_FPR29_LS64(\thread)
 +      ldc1    $f31, THREAD_FPR31_LS64(\thread)
        .set    pop
        .endm
  
        .macro  fpu_restore_double thread status tmp
- #if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2)
+ #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
        sll     \tmp, \status, 5
        bgez    \tmp, 10f                               # 16 register mode?
  
        fpu_restore_16even \thread \tmp
        .endm
  
 +#ifdef CONFIG_CPU_MIPSR2
 +      .macro  _EXT    rd, rs, p, s
 +      ext     \rd, \rs, \p, \s
 +      .endm
 +#else /* !CONFIG_CPU_MIPSR2 */
 +      .macro  _EXT    rd, rs, p, s
 +      srl     \rd, \rs, \p
 +      andi    \rd, \rd, (1 << \s) - 1
 +      .endm
 +#endif /* !CONFIG_CPU_MIPSR2 */
 +
  /*
   * Temporary until all gas have MT ASE support
   */
         .word  0x41800000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
        .endm
  
 +#ifdef TOOLCHAIN_SUPPORTS_MSA
 +      .macro  ld_d    wd, off, base
 +      .set    push
 +      .set    mips32r2
 +      .set    msa
 +      ld.d    $w\wd, \off(\base)
 +      .set    pop
 +      .endm
 +
 +      .macro  st_d    wd, off, base
 +      .set    push
 +      .set    mips32r2
 +      .set    msa
 +      st.d    $w\wd, \off(\base)
 +      .set    pop
 +      .endm
 +
 +      .macro  copy_u_w        rd, ws, n
 +      .set    push
 +      .set    mips32r2
 +      .set    msa
 +      copy_u.w \rd, $w\ws[\n]
 +      .set    pop
 +      .endm
 +
 +      .macro  copy_u_d        rd, ws, n
 +      .set    push
 +      .set    mips64r2
 +      .set    msa
 +      copy_u.d \rd, $w\ws[\n]
 +      .set    pop
 +      .endm
 +
 +      .macro  insert_w        wd, n, rs
 +      .set    push
 +      .set    mips32r2
 +      .set    msa
 +      insert.w $w\wd[\n], \rs
 +      .set    pop
 +      .endm
 +
 +      .macro  insert_d        wd, n, rs
 +      .set    push
 +      .set    mips64r2
 +      .set    msa
 +      insert.d $w\wd[\n], \rs
 +      .set    pop
 +      .endm
 +#else
 +      /*
 +       * Temporary until all toolchains in use include MSA support.
 +       */
 +      .macro  cfcmsa  rd, cs
 +      .set    push
 +      .set    noat
 +      .word   0x787e0059 | (\cs << 11)
 +      move    \rd, $1
 +      .set    pop
 +      .endm
 +
 +      .macro  ctcmsa  cd, rs
 +      .set    push
 +      .set    noat
 +      move    $1, \rs
 +      .word   0x783e0819 | (\cd << 6)
 +      .set    pop
 +      .endm
 +
 +      .macro  ld_d    wd, off, base
 +      .set    push
 +      .set    noat
 +      add     $1, \base, \off
 +      .word   0x78000823 | (\wd << 6)
 +      .set    pop
 +      .endm
 +
 +      .macro  st_d    wd, off, base
 +      .set    push
 +      .set    noat
 +      add     $1, \base, \off
 +      .word   0x78000827 | (\wd << 6)
 +      .set    pop
 +      .endm
 +
 +      .macro  copy_u_w        rd, ws, n
 +      .set    push
 +      .set    noat
 +      .word   0x78f00059 | (\n << 16) | (\ws << 11)
 +      /* move triggers an assembler bug... */
 +      or      \rd, $1, zero
 +      .set    pop
 +      .endm
 +
 +      .macro  copy_u_d        rd, ws, n
 +      .set    push
 +      .set    noat
 +      .word   0x78f80059 | (\n << 16) | (\ws << 11)
 +      /* move triggers an assembler bug... */
 +      or      \rd, $1, zero
 +      .set    pop
 +      .endm
 +
 +      .macro  insert_w        wd, n, rs
 +      .set    push
 +      .set    noat
 +      /* move triggers an assembler bug... */
 +      or      $1, \rs, zero
 +      .word   0x79300819 | (\n << 16) | (\wd << 6)
 +      .set    pop
 +      .endm
 +
 +      .macro  insert_d        wd, n, rs
 +      .set    push
 +      .set    noat
 +      /* move triggers an assembler bug... */
 +      or      $1, \rs, zero
 +      .word   0x79380819 | (\n << 16) | (\wd << 6)
 +      .set    pop
 +      .endm
 +#endif
 +
 +      .macro  msa_save_all    thread
 +      st_d    0, THREAD_FPR0, \thread
 +      st_d    1, THREAD_FPR1, \thread
 +      st_d    2, THREAD_FPR2, \thread
 +      st_d    3, THREAD_FPR3, \thread
 +      st_d    4, THREAD_FPR4, \thread
 +      st_d    5, THREAD_FPR5, \thread
 +      st_d    6, THREAD_FPR6, \thread
 +      st_d    7, THREAD_FPR7, \thread
 +      st_d    8, THREAD_FPR8, \thread
 +      st_d    9, THREAD_FPR9, \thread
 +      st_d    10, THREAD_FPR10, \thread
 +      st_d    11, THREAD_FPR11, \thread
 +      st_d    12, THREAD_FPR12, \thread
 +      st_d    13, THREAD_FPR13, \thread
 +      st_d    14, THREAD_FPR14, \thread
 +      st_d    15, THREAD_FPR15, \thread
 +      st_d    16, THREAD_FPR16, \thread
 +      st_d    17, THREAD_FPR17, \thread
 +      st_d    18, THREAD_FPR18, \thread
 +      st_d    19, THREAD_FPR19, \thread
 +      st_d    20, THREAD_FPR20, \thread
 +      st_d    21, THREAD_FPR21, \thread
 +      st_d    22, THREAD_FPR22, \thread
 +      st_d    23, THREAD_FPR23, \thread
 +      st_d    24, THREAD_FPR24, \thread
 +      st_d    25, THREAD_FPR25, \thread
 +      st_d    26, THREAD_FPR26, \thread
 +      st_d    27, THREAD_FPR27, \thread
 +      st_d    28, THREAD_FPR28, \thread
 +      st_d    29, THREAD_FPR29, \thread
 +      st_d    30, THREAD_FPR30, \thread
 +      st_d    31, THREAD_FPR31, \thread
 +      .endm
 +
 +      .macro  msa_restore_all thread
 +      ld_d    0, THREAD_FPR0, \thread
 +      ld_d    1, THREAD_FPR1, \thread
 +      ld_d    2, THREAD_FPR2, \thread
 +      ld_d    3, THREAD_FPR3, \thread
 +      ld_d    4, THREAD_FPR4, \thread
 +      ld_d    5, THREAD_FPR5, \thread
 +      ld_d    6, THREAD_FPR6, \thread
 +      ld_d    7, THREAD_FPR7, \thread
 +      ld_d    8, THREAD_FPR8, \thread
 +      ld_d    9, THREAD_FPR9, \thread
 +      ld_d    10, THREAD_FPR10, \thread
 +      ld_d    11, THREAD_FPR11, \thread
 +      ld_d    12, THREAD_FPR12, \thread
 +      ld_d    13, THREAD_FPR13, \thread
 +      ld_d    14, THREAD_FPR14, \thread
 +      ld_d    15, THREAD_FPR15, \thread
 +      ld_d    16, THREAD_FPR16, \thread
 +      ld_d    17, THREAD_FPR17, \thread
 +      ld_d    18, THREAD_FPR18, \thread
 +      ld_d    19, THREAD_FPR19, \thread
 +      ld_d    20, THREAD_FPR20, \thread
 +      ld_d    21, THREAD_FPR21, \thread
 +      ld_d    22, THREAD_FPR22, \thread
 +      ld_d    23, THREAD_FPR23, \thread
 +      ld_d    24, THREAD_FPR24, \thread
 +      ld_d    25, THREAD_FPR25, \thread
 +      ld_d    26, THREAD_FPR26, \thread
 +      ld_d    27, THREAD_FPR27, \thread
 +      ld_d    28, THREAD_FPR28, \thread
 +      ld_d    29, THREAD_FPR29, \thread
 +      ld_d    30, THREAD_FPR30, \thread
 +      ld_d    31, THREAD_FPR31, \thread
 +      .endm
 +
  #endif /* _ASM_ASMMACRO_H */
index 8a3d61f0017ff158163391ce882a250461a2b7fa,58e50cbdb1a6d577ef6ffbac115efcd593b6dedc..4d86b72750c701701f597387cce73b2a274f5bbf
@@@ -57,7 -57,7 +57,7 @@@ static inline int __enable_fpu(enum fpu
                return 0;
  
        case FPU_64BIT:
- #if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_MIPS64))
+ #if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_64BIT))
                /* we only have a 32-bit FPU */
                return SIGFPE;
  #endif
@@@ -180,7 -180,7 +180,7 @@@ static inline void restore_fp(struct ta
                _restore_fp(tsk);
  }
  
 -static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
 +static inline union fpureg *get_fpu_regs(struct task_struct *tsk)
  {
        if (tsk == current) {
                preempt_disable();
index 9031745cec1bbb5bfed5caa9012afb5ffcdcf64d,f35b131977e62a3ef0d81c47da6827f47d527b71..6c488c85d79141b385d1d6c0c394aa4400518fbf
  #ifndef __ASM_MIPS_SYSCALL_H
  #define __ASM_MIPS_SYSCALL_H
  
+ #include <linux/compiler.h>
  #include <linux/audit.h>
  #include <linux/elf-em.h>
  #include <linux/kernel.h>
  #include <linux/sched.h>
  #include <linux/uaccess.h>
  #include <asm/ptrace.h>
 +#include <asm/unistd.h>
 +
 +#ifndef __NR_syscall /* Only defined if _MIPS_SIM == _MIPS_SIM_ABI32 */
 +#define __NR_syscall 4000
 +#endif
  
  static inline long syscall_get_nr(struct task_struct *task,
                                  struct pt_regs *regs)
  {
 -      return regs->regs[2];
 +      /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
 +      if ((config_enabled(CONFIG_32BIT) ||
 +          test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
 +          (regs->regs[2] == __NR_syscall))
 +              return regs->regs[4];
 +      else
 +              return regs->regs[2];
  }
  
  static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
  
  #ifdef CONFIG_32BIT
        case 4: case 5: case 6: case 7:
-               return get_user(*arg, (int *)usp + 4 * n);
+               return get_user(*arg, (int *)usp + n);
  #endif
  
  #ifdef CONFIG_64BIT
        case 4: case 5: case 6: case 7:
  #ifdef CONFIG_MIPS32_O32
                if (test_thread_flag(TIF_32BIT_REGS))
-                       return get_user(*arg, (int *)usp + 4 * n);
+                       return get_user(*arg, (int *)usp + n);
                else
  #endif
                        *arg = regs->regs[4 + n];
@@@ -68,6 -58,8 +69,8 @@@
        default:
                BUG();
        }
+       unreachable();
  }
  
  static inline long syscall_get_return_value(struct task_struct *task,
        return regs->regs[2];
  }
  
 +static inline void syscall_rollback(struct task_struct *task,
 +                                  struct pt_regs *regs)
 +{
 +      /* Do nothing */
 +}
 +
  static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
@@@ -100,18 -86,10 +103,17 @@@ static inline void syscall_get_argument
                                         unsigned int i, unsigned int n,
                                         unsigned long *args)
  {
-       unsigned long arg;
        int ret;
 +      /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
 +      if ((config_enabled(CONFIG_32BIT) ||
 +          test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
 +          (regs->regs[2] == __NR_syscall)) {
 +              i++;
 +              n++;
 +      }
  
        while (n--)
-               ret |= mips_get_syscall_arg(&arg, task, regs, i++);
+               ret |= mips_get_syscall_arg(args++, task, regs, i++);
  
        /*
         * No way to communicate an error because this is a void function.
@@@ -125,13 -103,11 +127,13 @@@ extern const unsigned long sys_call_tab
  extern const unsigned long sys32_call_table[];
  extern const unsigned long sysn32_call_table[];
  
 -static inline int __syscall_get_arch(void)
 +static inline int syscall_get_arch(struct task_struct *task,
 +                                 struct pt_regs *regs)
  {
        int arch = EM_MIPS;
  #ifdef CONFIG_64BIT
 -      arch |=  __AUDIT_ARCH_64BIT;
 +      if (!test_tsk_thread_flag(task, TIF_32BIT_REGS))
 +              arch |= __AUDIT_ARCH_64BIT;
  #endif
  #if defined(__LITTLE_ENDIAN)
        arch |=  __AUDIT_ARCH_LE;
index 1a44c5ac6f4f994a490deead2c4167a424b3b672,f25181b19941db0544dc8e98187827343df99238..df6e775f3fef524e8d049c24433eff06dade0fd7
@@@ -8,7 -8,6 +8,7 @@@
   * Copyright (C) 1996, 2000 by Ralf Baechle
   * Copyright (C) 2006 by Thiemo Seufer
   * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
 + * Copyright (C) 2014 Imagination Technologies Ltd.
   */
  #ifndef _UAPI_ASM_INST_H
  #define _UAPI_ASM_INST_H
@@@ -74,16 -73,10 +74,16 @@@ enum spec2_op 
  enum spec3_op {
        ext_op, dextm_op, dextu_op, dext_op,
        ins_op, dinsm_op, dinsu_op, dins_op,
 -      lx_op = 0x0a,
 -      bshfl_op = 0x20,
 -      dbshfl_op = 0x24,
 -      rdhwr_op = 0x3b
 +      lx_op     = 0x0a, lwle_op   = 0x19,
 +      lwre_op   = 0x1a, cachee_op = 0x1b,
 +      sbe_op    = 0x1c, she_op    = 0x1d,
 +      sce_op    = 0x1e, swe_op    = 0x1f,
 +      bshfl_op  = 0x20, swle_op   = 0x21,
 +      swre_op   = 0x22, prefe_op  = 0x23,
 +      dbshfl_op = 0x24, lbue_op   = 0x28,
 +      lhue_op   = 0x29, lbe_op    = 0x2c,
 +      lhe_op    = 0x2d, lle_op    = 0x2e,
 +      lwe_op    = 0x2f, rdhwr_op  = 0x3b
  };
  
  /*
@@@ -170,8 -163,8 +170,8 @@@ enum cop1_sdw_func 
   */
  enum cop1x_func {
        lwxc1_op     =  0x00, ldxc1_op     =  0x01,
-       pfetch_op    =  0x07, swxc1_op     =  0x08,
-       sdxc1_op     =  0x09, madd_s_op    =  0x20,
+       swxc1_op     =  0x08, sdxc1_op     =  0x09,
+       pfetch_op    =  0x0f, madd_s_op    =  0x20,
        madd_d_op    =  0x21, madd_e_op    =  0x22,
        msub_s_op    =  0x28, msub_d_op    =  0x29,
        msub_e_op    =  0x2a, nmadd_s_op   =  0x30,
@@@ -599,15 -592,6 +599,15 @@@ struct v_format {                                /* MDMX vector for
        ;)))))))
  };
  
 +struct spec3_format {   /* SPEC3 */
 +      BITFIELD_FIELD(unsigned int opcode:6,
 +      BITFIELD_FIELD(unsigned int rs:5,
 +      BITFIELD_FIELD(unsigned int rt:5,
 +      BITFIELD_FIELD(signed int simmediate:9,
 +      BITFIELD_FIELD(unsigned int func:7,
 +      ;)))))
 +};
 +
  /*
   * microMIPS instruction formats (32-bit length)
   *
@@@ -879,7 -863,6 +879,7 @@@ union mips_instruction 
        struct b_format b_format;
        struct ps_format ps_format;
        struct v_format v_format;
 +      struct spec3_format spec3_format;
        struct fb_format fb_format;
        struct fp0_format fp0_format;
        struct mm_fp0_format mm_fp0_format;
index ddcc3500248d5e3721251a7c89a751412b3ccdfb,374ed74cd516d91e27638ce12e4c3c731a191ef4..74fe73506d8f9ce8a1eb5f3536df282829f02c7e
@@@ -90,7 -90,6 +90,7 @@@ static inline void ftrace_dyn_arch_init
  static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
  {
        int faulted;
 +      mm_segment_t old_fs;
  
        /* *(unsigned int *)ip = new_code; */
        safe_store_code(new_code, ip, faulted);
        if (unlikely(faulted))
                return -EFAULT;
  
 +      old_fs = get_fs();
 +      set_fs(get_ds());
        flush_icache_range(ip, ip + 8);
 +      set_fs(old_fs);
  
        return 0;
  }
@@@ -115,11 -111,10 +115,10 @@@ static int ftrace_modify_code_2(unsigne
        safe_store_code(new_code1, ip, faulted);
        if (unlikely(faulted))
                return -EFAULT;
-       ip += 4;
-       safe_store_code(new_code2, ip, faulted);
+       safe_store_code(new_code2, ip + 4, faulted);
        if (unlikely(faulted))
                return -EFAULT;
-       flush_icache_range(ip, ip + 8); /* original ip + 12 */
+       flush_icache_range(ip, ip + 8);
        return 0;
  }
  #endif
index 0cfa7a56a15383f4ddfcd1729f1e24020d6564a8,73b0ddf910d41b08dd1bacd97f862e97f94f4c95..71814272d148e18e11d00a80392ddcdefd1cfe07
@@@ -13,7 -13,6 +13,7 @@@
   * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
   */
  #include <asm/asm.h>
 +#include <asm/asmmacro.h>
  #include <asm/errno.h>
  #include <asm/fpregdef.h>
  #include <asm/mipsregs.h>
        .endm
  
        .set    noreorder
 -      .set    mips3
 +      .set    arch=r4000
  
  LEAF(_save_fp_context)
        cfc1    t1, fcr31
  
- #if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2)
+ #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
        .set    push
- #ifdef CONFIG_MIPS32_R2
+ #ifdef CONFIG_CPU_MIPS32_R2
        .set    mips64r2
        mfc0    t0, CP0_STATUS
        sll     t0, t0, 5
@@@ -147,11 -146,11 +147,11 @@@ LEAF(_save_fp_context32
   *  - cp1 status/control register
   */
  LEAF(_restore_fp_context)
-       EX      lw t0, SC_FPC_CSR(a0)
+       EX      lw t1, SC_FPC_CSR(a0)
  
- #if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2)
+ #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
        .set    push
- #ifdef CONFIG_MIPS32_R2
+ #ifdef CONFIG_CPU_MIPS32_R2
        .set    mips64r2
        mfc0    t0, CP0_STATUS
        sll     t0, t0, 5
        EX      ldc1 $f26, SC_FPREGS+208(a0)
        EX      ldc1 $f28, SC_FPREGS+224(a0)
        EX      ldc1 $f30, SC_FPREGS+240(a0)
-       ctc1    t0, fcr31
+       ctc1    t1, fcr31
        jr      ra
         li     v0, 0                                   # success
        END(_restore_fp_context)
  #ifdef CONFIG_MIPS32_COMPAT
  LEAF(_restore_fp_context32)
        /* Restore an o32 sigcontext.  */
-       EX      lw t0, SC32_FPC_CSR(a0)
+       EX      lw t1, SC32_FPC_CSR(a0)
  
        mfc0    t0, CP0_STATUS
        sll     t0, t0, 5
        EX      ldc1 $f26, SC32_FPREGS+208(a0)
        EX      ldc1 $f28, SC32_FPREGS+224(a0)
        EX      ldc1 $f30, SC32_FPREGS+240(a0)
-       ctc1    t0, fcr31
+       ctc1    t1, fcr31
        jr      ra
         li     v0, 0                                   # success
        END(_restore_fp_context32)
  #endif
  
 +#ifdef CONFIG_CPU_HAS_MSA
 +
 +      .macro  save_sc_msareg  wr, off, sc, tmp
 +#ifdef CONFIG_64BIT
 +      copy_u_d \tmp, \wr, 1
 +      EX sd   \tmp, (\off+(\wr*8))(\sc)
 +#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
 +      copy_u_w \tmp, \wr, 2
 +      EX sw   \tmp, (\off+(\wr*8)+0)(\sc)
 +      copy_u_w \tmp, \wr, 3
 +      EX sw   \tmp, (\off+(\wr*8)+4)(\sc)
 +#else /* CONFIG_CPU_BIG_ENDIAN */
 +      copy_u_w \tmp, \wr, 2
 +      EX sw   \tmp, (\off+(\wr*8)+4)(\sc)
 +      copy_u_w \tmp, \wr, 3
 +      EX sw   \tmp, (\off+(\wr*8)+0)(\sc)
 +#endif
 +      .endm
 +
 +/*
 + * int _save_msa_context(struct sigcontext *sc)
 + *
 + * Save the upper 64 bits of each vector register along with the MSA_CSR
 + * register into sc. Returns zero on success, else non-zero.
 + */
 +LEAF(_save_msa_context)
 +      save_sc_msareg  0, SC_MSAREGS, a0, t0
 +      save_sc_msareg  1, SC_MSAREGS, a0, t0
 +      save_sc_msareg  2, SC_MSAREGS, a0, t0
 +      save_sc_msareg  3, SC_MSAREGS, a0, t0
 +      save_sc_msareg  4, SC_MSAREGS, a0, t0
 +      save_sc_msareg  5, SC_MSAREGS, a0, t0
 +      save_sc_msareg  6, SC_MSAREGS, a0, t0
 +      save_sc_msareg  7, SC_MSAREGS, a0, t0
 +      save_sc_msareg  8, SC_MSAREGS, a0, t0
 +      save_sc_msareg  9, SC_MSAREGS, a0, t0
 +      save_sc_msareg  10, SC_MSAREGS, a0, t0
 +      save_sc_msareg  11, SC_MSAREGS, a0, t0
 +      save_sc_msareg  12, SC_MSAREGS, a0, t0
 +      save_sc_msareg  13, SC_MSAREGS, a0, t0
 +      save_sc_msareg  14, SC_MSAREGS, a0, t0
 +      save_sc_msareg  15, SC_MSAREGS, a0, t0
 +      save_sc_msareg  16, SC_MSAREGS, a0, t0
 +      save_sc_msareg  17, SC_MSAREGS, a0, t0
 +      save_sc_msareg  18, SC_MSAREGS, a0, t0
 +      save_sc_msareg  19, SC_MSAREGS, a0, t0
 +      save_sc_msareg  20, SC_MSAREGS, a0, t0
 +      save_sc_msareg  21, SC_MSAREGS, a0, t0
 +      save_sc_msareg  22, SC_MSAREGS, a0, t0
 +      save_sc_msareg  23, SC_MSAREGS, a0, t0
 +      save_sc_msareg  24, SC_MSAREGS, a0, t0
 +      save_sc_msareg  25, SC_MSAREGS, a0, t0
 +      save_sc_msareg  26, SC_MSAREGS, a0, t0
 +      save_sc_msareg  27, SC_MSAREGS, a0, t0
 +      save_sc_msareg  28, SC_MSAREGS, a0, t0
 +      save_sc_msareg  29, SC_MSAREGS, a0, t0
 +      save_sc_msareg  30, SC_MSAREGS, a0, t0
 +      save_sc_msareg  31, SC_MSAREGS, a0, t0
 +      jr      ra
 +       li     v0, 0
 +      END(_save_msa_context)
 +
 +#ifdef CONFIG_MIPS32_COMPAT
 +
 +/*
 + * int _save_msa_context32(struct sigcontext32 *sc)
 + *
 + * Save the upper 64 bits of each vector register along with the MSA_CSR
 + * register into sc. Returns zero on success, else non-zero.
 + */
 +LEAF(_save_msa_context32)
 +      save_sc_msareg  0, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  1, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  2, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  3, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  4, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  5, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  6, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  7, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  8, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  9, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  10, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  11, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  12, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  13, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  14, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  15, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  16, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  17, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  18, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  19, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  20, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  21, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  22, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  23, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  24, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  25, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  26, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  27, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  28, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  29, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  30, SC32_MSAREGS, a0, t0
 +      save_sc_msareg  31, SC32_MSAREGS, a0, t0
 +      jr      ra
 +       li     v0, 0
 +      END(_save_msa_context32)
 +
 +#endif /* CONFIG_MIPS32_COMPAT */
 +
 +      .macro restore_sc_msareg        wr, off, sc, tmp
 +#ifdef CONFIG_64BIT
 +      EX ld   \tmp, (\off+(\wr*8))(\sc)
 +      insert_d \wr, 1, \tmp
 +#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
 +      EX lw   \tmp, (\off+(\wr*8)+0)(\sc)
 +      insert_w \wr, 2, \tmp
 +      EX lw   \tmp, (\off+(\wr*8)+4)(\sc)
 +      insert_w \wr, 3, \tmp
 +#else /* CONFIG_CPU_BIG_ENDIAN */
 +      EX lw   \tmp, (\off+(\wr*8)+4)(\sc)
 +      insert_w \wr, 2, \tmp
 +      EX lw   \tmp, (\off+(\wr*8)+0)(\sc)
 +      insert_w \wr, 3, \tmp
 +#endif
 +      .endm
 +
 +/*
 + * int _restore_msa_context(struct sigcontext *sc)
 + */
 +LEAF(_restore_msa_context)
 +      restore_sc_msareg       0, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       1, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       2, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       3, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       4, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       5, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       6, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       7, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       8, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       9, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       10, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       11, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       12, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       13, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       14, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       15, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       16, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       17, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       18, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       19, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       20, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       21, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       22, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       23, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       24, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       25, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       26, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       27, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       28, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       29, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       30, SC_MSAREGS, a0, t0
 +      restore_sc_msareg       31, SC_MSAREGS, a0, t0
 +      jr      ra
 +       li     v0, 0
 +      END(_restore_msa_context)
 +
 +#ifdef CONFIG_MIPS32_COMPAT
 +
 +/*
 + * int _restore_msa_context32(struct sigcontext32 *sc)
 + */
 +LEAF(_restore_msa_context32)
 +      restore_sc_msareg       0, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       1, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       2, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       3, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       4, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       5, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       6, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       7, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       8, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       9, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       10, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       11, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       12, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       13, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       14, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       15, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       16, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       17, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       18, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       19, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       20, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       21, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       22, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       23, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       24, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       25, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       26, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       27, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       28, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       29, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       30, SC32_MSAREGS, a0, t0
 +      restore_sc_msareg       31, SC32_MSAREGS, a0, t0
 +      jr      ra
 +       li     v0, 0
 +      END(_restore_msa_context32)
 +
 +#endif /* CONFIG_MIPS32_COMPAT */
 +
 +#endif /* CONFIG_CPU_HAS_MSA */
 +
        .set    reorder
  
        .type   fault@function
index 71a697c9d385b855fda6629a2bb786be5d1e4b1a,0b4e2e38294bf174132fcb4036cc958a370cfbec..7b3c9acae6895120e751dc4efe19b7ee8a6572ea
@@@ -876,43 -876,20 +876,43 @@@ static inline int cop1_64bit(struct pt_
  #endif
  }
  
 -#define SIFROMREG(si, x) ((si) = cop1_64bit(xcp) || !(x & 1) ? \
 -                      (int)ctx->fpr[x] : (int)(ctx->fpr[x & ~1] >> 32))
 -
 -#define SITOREG(si, x)        (ctx->fpr[x & ~(cop1_64bit(xcp) == 0)] = \
 -                      cop1_64bit(xcp) || !(x & 1) ? \
 -                      ctx->fpr[x & ~1] >> 32 << 32 | (u32)(si) : \
 -                      ctx->fpr[x & ~1] << 32 >> 32 | (u64)(si) << 32)
 -
 -#define SIFROMHREG(si, x)     ((si) = (int)(ctx->fpr[x] >> 32))
 -#define SITOHREG(si, x)               (ctx->fpr[x] = \
 -                              ctx->fpr[x] << 32 >> 32 | (u64)(si) << 32)
 -
 -#define DIFROMREG(di, x) ((di) = ctx->fpr[x & ~(cop1_64bit(xcp) == 0)])
 -#define DITOREG(di, x)        (ctx->fpr[x & ~(cop1_64bit(xcp) == 0)] = (di))
 +#define SIFROMREG(si, x) do {                                         \
 +      if (cop1_64bit(xcp))                                            \
 +              (si) = get_fpr32(&ctx->fpr[x], 0);                      \
 +      else                                                            \
 +              (si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1);         \
 +} while (0)
 +
 +#define SITOREG(si, x) do {                                           \
 +      if (cop1_64bit(xcp)) {                                          \
 +              unsigned i;                                             \
 +              set_fpr32(&ctx->fpr[x], 0, si);                         \
 +              for (i = 1; i < ARRAY_SIZE(ctx->fpr[x].val32); i++)     \
 +                      set_fpr32(&ctx->fpr[x], i, 0);                  \
 +      } else {                                                        \
 +              set_fpr32(&ctx->fpr[(x) & ~1], (x) & 1, si);            \
 +      }                                                               \
 +} while (0)
 +
 +#define SIFROMHREG(si, x)     ((si) = get_fpr32(&ctx->fpr[x], 1))
 +
 +#define SITOHREG(si, x) do {                                          \
 +      unsigned i;                                                     \
 +      set_fpr32(&ctx->fpr[x], 1, si);                                 \
 +      for (i = 2; i < ARRAY_SIZE(ctx->fpr[x].val32); i++)             \
 +              set_fpr32(&ctx->fpr[x], i, 0);                          \
 +} while (0)
 +
 +#define DIFROMREG(di, x) \
 +      ((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) == 0)], 0))
 +
 +#define DITOREG(di, x) do {                                           \
 +      unsigned fpr, i;                                                \
 +      fpr = (x) & ~(cop1_64bit(xcp) == 0);                            \
 +      set_fpr64(&ctx->fpr[fpr], 0, di);                               \
 +      for (i = 1; i < ARRAY_SIZE(ctx->fpr[x].val64); i++)             \
 +              set_fpr64(&ctx->fpr[fpr], i, 0);                        \
 +} while (0)
  
  #define SPFROMREG(sp, x) SIFROMREG((sp).bits, x)
  #define SPTOREG(sp, x)        SITOREG((sp).bits, x)
@@@ -1561,10 -1538,10 +1561,10 @@@ static int fpux_emu(struct pt_regs *xcp
                break;
        }
  
-       case 0x7:               /* 7 */
-               if (MIPSInst_FUNC(ir) != pfetch_op) {
+       case 0x3:
+               if (MIPSInst_FUNC(ir) != pfetch_op)
                        return SIGILL;
-               }
                /* ignore prefx operation */
                break;
  
@@@ -1983,18 -1960,15 +1983,18 @@@ static int fpu_emu(struct pt_regs *xcp
  
  #if defined(__mips64)
        case l_fmt:{
 +              u64 bits;
 +              DIFROMREG(bits, MIPSInst_FS(ir));
 +
                switch (MIPSInst_FUNC(ir)) {
                case fcvts_op:
                        /* convert long to single precision real */
 -                      rv.s = ieee754sp_flong(ctx->fpr[MIPSInst_FS(ir)]);
 +                      rv.s = ieee754sp_flong(bits);
                        rfmt = s_fmt;
                        goto copcsr;
                case fcvtd_op:
                        /* convert long to double precision real */
 -                      rv.d = ieee754dp_flong(ctx->fpr[MIPSInst_FS(ir)]);
 +                      rv.d = ieee754dp_flong(bits);
                        rfmt = d_fmt;
                        goto copcsr;
                default:
index c6cbfebcac9b04b8b4c54e8b4d9b7d527a56b86e,2242181a62841e2c86cd87ab3859bee35ca91099..b71ee809191a2f3beaf8734b727decb634a39bdf
@@@ -26,7 -26,6 +26,7 @@@
  #include <asm/i8259.h>
  #include <asm/irq_cpu.h>
  #include <asm/irq_regs.h>
 +#include <asm/mips-cm.h>
  #include <asm/mips-boards/malta.h>
  #include <asm/mips-boards/maltaint.h>
  #include <asm/gt64120.h>
  #include <asm/mips-boards/msc01_pci.h>
  #include <asm/msc01_ic.h>
  #include <asm/gic.h>
 -#include <asm/gcmpregs.h>
  #include <asm/setup.h>
  #include <asm/rtlx.h>
  
 -int gcmp_present = -1;
  static unsigned long _msc01_biu_base;
 -static unsigned long _gcmp_base;
  static unsigned int ipi_map[NR_CPUS];
  
  static DEFINE_RAW_SPINLOCK(mips_irq_lock);
@@@ -117,7 -119,7 +117,7 @@@ static void malta_hw0_irqdispatch(void
  
        do_IRQ(MALTA_INT_BASE + irq);
  
- #ifdef MIPS_VPE_APSP_API
+ #ifdef CONFIG_MIPS_VPE_APSP_API_MT
        if (aprp_hook)
                aprp_hook();
  #endif
@@@ -286,6 -288,10 +286,6 @@@ asmlinkage void plat_irq_dispatch(void
  
  #ifdef CONFIG_MIPS_MT_SMP
  
 -
 -#define GIC_MIPS_CPU_IPI_RESCHED_IRQ  3
 -#define GIC_MIPS_CPU_IPI_CALL_IRQ     4
 -
  #define MIPS_CPU_IPI_RESCHED_IRQ 0    /* SW int 0 for resched */
  #define C_RESCHED C_SW0
  #define MIPS_CPU_IPI_CALL_IRQ 1               /* SW int 1 for resched */
@@@ -302,16 -308,9 +302,16 @@@ static void ipi_call_dispatch(void
        do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ);
  }
  
 +#endif /* CONFIG_MIPS_MT_SMP */
 +
 +#ifdef CONFIG_MIPS_GIC_IPI
 +
 +#define GIC_MIPS_CPU_IPI_RESCHED_IRQ  3
 +#define GIC_MIPS_CPU_IPI_CALL_IRQ     4
 +
  static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
  {
- #ifdef MIPS_VPE_APSP_API
+ #ifdef CONFIG_MIPS_VPE_APSP_API_CMP
        if (aprp_hook)
                aprp_hook();
  #endif
@@@ -339,7 -338,7 +339,7 @@@ static struct irqaction irq_call = 
        .flags          = IRQF_PERCPU,
        .name           = "IPI_call"
  };
 -#endif /* CONFIG_MIPS_MT_SMP */
 +#endif /* CONFIG_MIPS_GIC_IPI */
  
  static int gic_resched_int_base;
  static int gic_call_int_base;
@@@ -419,7 -418,49 +419,7 @@@ static struct gic_intr_map gic_intr_map
  };
  #undef X
  
 -/*
 - * GCMP needs to be detected before any SMP initialisation
 - */
 -int __init gcmp_probe(unsigned long addr, unsigned long size)
 -{
 -      if ((mips_revision_sconid != MIPS_REVISION_SCON_ROCIT)  &&
 -          (mips_revision_sconid != MIPS_REVISION_SCON_GT64120)) {
 -              gcmp_present = 0;
 -              pr_debug("GCMP NOT present\n");
 -              return gcmp_present;
 -      }
 -
 -      if (gcmp_present >= 0)
 -              return gcmp_present;
 -
 -      _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR,
 -              GCMP_ADDRSPACE_SZ);
 -      _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE,
 -              MSC01_BIU_ADDRSPACE_SZ);
 -      gcmp_present = ((GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) ==
 -              GCMP_BASE_ADDR);
 -
 -      if (gcmp_present)
 -              pr_debug("GCMP present\n");
 -      return gcmp_present;
 -}
 -
 -/* Return the number of IOCU's present */
 -int __init gcmp_niocu(void)
 -{
 -      return gcmp_present ? ((GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >>
 -              GCMP_GCB_GC_NUMIOCU_SHF) : 0;
 -}
 -
 -/* Set GCMP region attributes */
 -void __init gcmp_setregion(int region, unsigned long base,
 -                         unsigned long mask, int type)
 -{
 -      GCMPGCBn(CMxBASE, region) = base;
 -      GCMPGCBn(CMxMASK, region) = mask | type;
 -}
 -
 -#if defined(CONFIG_MIPS_MT_SMP)
 +#ifdef CONFIG_MIPS_GIC_IPI
  static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin)
  {
        int intr = baseintr + cpu;
@@@ -455,8 -496,8 +455,8 @@@ void __init arch_init_irq(void
        if (!cpu_has_veic)
                mips_cpu_irq_init();
  
 -      if (gcmp_present)  {
 -              GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK;
 +      if (mips_cm_present()) {
 +              write_gcr_gic_base(GIC_BASE_ADDR | CM_GCR_GIC_BASE_GICEN_MSK);
                gic_present = 1;
        } else {
                if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) {
        if (gic_present) {
                /* FIXME */
                int i;
 -#if defined(CONFIG_MIPS_MT_SMP)
 +#if defined(CONFIG_MIPS_GIC_IPI)
                gic_call_int_base = GIC_NUM_INTRS -
                        (NR_CPUS - nr_cpu_ids) * 2 - nr_cpu_ids;
                gic_resched_int_base = gic_call_int_base - nr_cpu_ids;
  #endif
                gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map,
                                ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE);
 -              if (!gcmp_present) {
 +              if (!mips_cm_present()) {
                        /* Enable the GIC */
                        i = REG(_msc01_biu_base, MSC01_SC_CFG);
                        REG(_msc01_biu_base, MSC01_SC_CFG) =
                                (i | (0x1 << MSC01_SC_CFG_GICENA_SHF));
                        pr_debug("GIC Enabled\n");
                }
 -#if defined(CONFIG_MIPS_MT_SMP)
 +#if defined(CONFIG_MIPS_GIC_IPI)
                /* set up ipi interrupts */
                if (cpu_has_vint) {
                        set_vi_handler(MIPSCPU_INT_IPI0, malta_ipi_irqdispatch);
@@@ -667,16 -708,16 +667,16 @@@ int malta_be_handler(struct pt_regs *re
        /* This duplicates the handling in do_be which seems wrong */
        int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
  
 -      if (gcmp_present) {
 -              unsigned long cm_error = GCMPGCB(GCMEC);
 -              unsigned long cm_addr = GCMPGCB(GCMEA);
 -              unsigned long cm_other = GCMPGCB(GCMEO);
 +      if (mips_cm_present()) {
 +              unsigned long cm_error = read_gcr_error_cause();
 +              unsigned long cm_addr = read_gcr_error_addr();
 +              unsigned long cm_other = read_gcr_error_mult();
                unsigned long cause, ocause;
                char buf[256];
  
 -              cause = (cm_error & GCMP_GCB_GMEC_ERROR_TYPE_MSK);
 +              cause = cm_error & CM_GCR_ERROR_CAUSE_ERRTYPE_MSK;
                if (cause != 0) {
 -                      cause >>= GCMP_GCB_GMEC_ERROR_TYPE_SHF;
 +                      cause >>= CM_GCR_ERROR_CAUSE_ERRTYPE_SHF;
                        if (cause < 16) {
                                unsigned long cca_bits = (cm_error >> 15) & 7;
                                unsigned long tr_bits = (cm_error >> 12) & 7;
                                         mcmd[cmd_bits], sport_bits);
                        }
  
 -                      ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >>
 -                               GCMP_GCB_GMEO_ERROR_2ND_SHF;
 +                      ocause = (cm_other & CM_GCR_ERROR_MULT_ERR2ND_MSK) >>
 +                               CM_GCR_ERROR_MULT_ERR2ND_SHF;
  
                        pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error,
                               causes[cause], buf);
                        pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]);
  
                        /* reprime cause register */
 -                      GCMPGCB(GCMEC) = 0;
 +                      write_gcr_error_cause(0);
                }
        }