]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
10 years agoMIPS: Regenerate malta defconfigs
Paul Burton [Thu, 20 Feb 2014 14:00:24 +0000 (14:00 +0000)]
MIPS: Regenerate malta defconfigs

This patch simply regenerates the malta defconfigs such that they don't
change after being used & saved as a defconfig again. ie. it is the
result of running the following:

for cfg in arch/mips/configs/malta*; do
ARCH=mips make `basename ${cfg}`
ARCH=mips make savedefconfig
mv -v defconfig ${cfg}
done

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6578/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: pata_platform for DB1200
Manuel Lauss [Wed, 26 Mar 2014 14:05:21 +0000 (15:05 +0100)]
MIPS: Alchemy: pata_platform for DB1200

The au1xxx-ide driver isn't any faster than pata_platform since it
spends a lot of time busy waiting for DMA to finish; faster PIO/DMA
modes only work on the db1200 with a certain cpu speed, UDMA is broken,
and finally the old IDE layer is on death row, so time to switch to
the newer ATA layer.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6662/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: fold mach-db1xxx/db1x00 headers into board code
Manuel Lauss [Wed, 26 Mar 2014 09:41:48 +0000 (10:41 +0100)]
MIPS: Alchemy: fold mach-db1xxx/db1x00 headers into board code

Merge the db1200.h and db1300.h headers into their only users.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6660/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: Unify Devboard support.
Manuel Lauss [Thu, 20 Feb 2014 13:59:24 +0000 (14:59 +0100)]
MIPS: Alchemy: Unify Devboard support.

This patch merges support for all DB1xxx and PB1xxx
boards into a single image, along with a new single defconfig
for them.

Run-tested on DB1300 and DB1500.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6577/
Patchwork: https://patchwork.linux-mips.org/patch/6659/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: Determine cohereny at runtime based on cpu type
Manuel Lauss [Thu, 20 Feb 2014 13:59:23 +0000 (14:59 +0100)]
MIPS: Alchemy: Determine cohereny at runtime based on cpu type

All Alchemy chips have coherent DMA, but for example the USB or AC97
peripherals on the Au1000/1500/1100 are not.
This patch uses DMA_MAYBE_COHERENT on Alchemy and sets coherentio based
on CPU type.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6576/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Extend DMA_MAYBE_COHERENT logic to DMA_NONCOHERENT use
Manuel Lauss [Thu, 20 Feb 2014 13:59:22 +0000 (14:59 +0100)]
MIPS: Extend DMA_MAYBE_COHERENT logic to DMA_NONCOHERENT use

Setting DMA_MAYBE_COHERENT gives a platform the opportunity to select
use of cache ops at boot.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6575/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Enable MIPS 3.5 features on Malta
Markos Chandras [Thu, 16 Jan 2014 13:12:36 +0000 (13:12 +0000)]
MIPS: Enable MIPS 3.5 features on Malta

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: Add support for SMP EVA
Markos Chandras [Tue, 21 Jan 2014 09:52:23 +0000 (09:52 +0000)]
MIPS: malta: Add support for SMP EVA

Allow secondary cores to program their segment control registers
during smp bootstrap code. This enables EVA on Malta SMP
configurations

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-init: Fix System Controller memory mapping for EVA
Leonid Yegoshin [Fri, 17 Jan 2014 13:11:29 +0000 (13:11 +0000)]
MIPS: malta: malta-init: Fix System Controller memory mapping for EVA

Shift System Controller memory mapping to 0x80000000

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-memory: Add free_init_pages_eva() callback
Markos Chandras [Wed, 15 Jan 2014 14:07:57 +0000 (14:07 +0000)]
MIPS: malta: malta-memory: Add free_init_pages_eva() callback

Use a Malta specific function to free the init section once the
kernel has booted. When operating in EVA mode, the physical memory
is shifted to 0x80000000. Kernel is loaded into 0x80000000 (virtual)
so the offset between physical and virtual addresses is 0.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-memory: Use the PHYS_OFFSET to build the memory map
Markos Chandras [Wed, 15 Jan 2014 14:13:05 +0000 (14:13 +0000)]
MIPS: malta: malta-memory: Use the PHYS_OFFSET to build the memory map

PHYS_OFFSET is used to denote the physical start address of the
first bank of RAM. When the Malta board is in EVA mode, the physical
start address of RAM is shifted to 0x80000000 so it's necessary to use
this macro in order to make the code EVA agnostic.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-memory: Add support for the 'ememsize' variable
Markos Chandras [Wed, 15 Jan 2014 13:55:07 +0000 (13:55 +0000)]
MIPS: malta: malta-memory: Add support for the 'ememsize' variable

The 'ememsize' variable is used to denote the real RAM which is
present on the Malta board. This is different compared to 'memsize'
which is capped to 256MB. The 'ememsize' is used to get the actual
physical memory when setting up the Malta memory layout. This only
makes sense in case the core operates in the EVA mode, and it's
ignored otherwise.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: spaces.h: Add spaces.h file for Malta (EVA)
Markos Chandras [Wed, 15 Jan 2014 14:11:43 +0000 (14:11 +0000)]
MIPS: malta: spaces.h: Add spaces.h file for Malta (EVA)

Add a spaces.h file for Malta to override certain memory macros
when operating in EVA mode.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: Configure Segment Control registers for EVA boot
Markos Chandras [Wed, 15 Jan 2014 11:18:56 +0000 (11:18 +0000)]
MIPS: malta: Configure Segment Control registers for EVA boot

The Malta board aliases 0x80000000 - 0xffffffff to 0x00000000
- 0x7fffffff ignoring the 256 MB IO hole in 0x10000000.
The physical memory is shifted to 0x80000000 so up to 2GB
can be used. Kuseg is expanded to 3GB (due to board limitations
only 2GB can be accessed) and lowmem (kernel space) is expanded to 2GB.

The Segment Control registers are programmed as follows:

Virtual memory           Physical memory           Mapping
0x00000000 - 0x7fffffff  0x80000000 - 0xfffffffff   MUSUK (kuseg)
0x80000000 - 0x9fffffff  0x00000000 - 0x1ffffffff   MUSUK (kseg0)
0xa0000000 - 0xbf000000  0x00000000 - 0x1ffffffff   MUSUK (kseg1)
0xc0000000 - 0xdfffffff             -                 MK  (kseg2)
0xe0000000 - 0xffffffff             -                 MK  (kseg3)

The location of exception vectors remain the same since 0xbfc00000
(traditional exception base) still maps to 0x1fc00000 physical.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: c-r4k: Flush scache to avoid cache aliases
Leonid Yegoshin [Tue, 21 Jan 2014 09:48:48 +0000 (09:48 +0000)]
MIPS: mm: c-r4k: Flush scache to avoid cache aliases

There is a chance for the secondary cache to have memory
aliases. This can happen if the bootloader is in a non-EVA mode
(or even in EVA mode but with different mapping from the kernel)
and the kernel switching to EVA afterwards. It's best to flush
the icache to avoid having the secondary CPUs fetching stale
data from it.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: c-r4k: Add support for flushing user pages from cache
Markos Chandras [Thu, 16 Jan 2014 13:11:08 +0000 (13:11 +0000)]
MIPS: mm: c-r4k: Add support for flushing user pages from cache

Use the userspace cache flushing functions if the interrupted
process is a userspace one.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: c-r4k: Build EVA {d,i}cache flushing functions
Leonid Yegoshin [Wed, 15 Jan 2014 14:47:28 +0000 (14:47 +0000)]
MIPS: mm: c-r4k: Build EVA {d,i}cache flushing functions

Build EVA specific cache flushing functions (ie cachee).
They will be used by a subsequent patch.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: init: Add free_init_pages() callback for EVA
Markos Chandras [Wed, 15 Jan 2014 14:06:03 +0000 (14:06 +0000)]
MIPS: mm: init: Add free_init_pages() callback for EVA

A core in EVA mode can have any possible segment mapping, so the
default free_initmem_default() function may not always work as expected.
Therefore, add a callback that platforms can use to free up the init section.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: proc: Add EVA to the list of CPU features
Markos Chandras [Mon, 27 Jan 2014 15:10:40 +0000 (15:10 +0000)]
MIPS: kernel: proc: Add EVA to the list of CPU features

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: cpu-probe: Enable EVA option on supported cores
Markos Chandras [Thu, 9 Jan 2014 16:04:51 +0000 (16:04 +0000)]
MIPS: kernel: cpu-probe: Enable EVA option on supported cores

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: cpu: Add cpu flag for Enhanced Virtual Addressing
Markos Chandras [Thu, 9 Jan 2014 16:01:29 +0000 (16:01 +0000)]
MIPS: asm: cpu: Add cpu flag for Enhanced Virtual Addressing

The MIPS *Aptiv family uses bit 28 in Config5 CP0 register to
indicate whether the core supports EVA or not.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: page: Allow __pa_symbol overrides
Leonid Yegoshin [Thu, 9 Jan 2014 13:06:34 +0000 (13:06 +0000)]
MIPS: asm: page: Allow __pa_symbol overrides

This will allow platforms to use an alternative way to get
the physical address of a symbol.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: {ftrace,kgdb}: Set correct address limit for cache flushes
Leonid Yegoshin [Mon, 16 Dec 2013 12:06:55 +0000 (12:06 +0000)]
MIPS: kernel: {ftrace,kgdb}: Set correct address limit for cache flushes

When flushing the icache, make sure the address limit is correct
so the appropriate 'cache' instruction will be used. This has no
impact on cores operating in non-eva mode. However, when EVA is
enabled, we ensure that 'cache' will be used instead of 'cachee'.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: r4kcache: Add EVA cache flushing functions
Leonid Yegoshin [Mon, 16 Dec 2013 11:46:33 +0000 (11:46 +0000)]
MIPS: asm: r4kcache: Add EVA cache flushing functions

Add EVA cache flushing functions similar to non-EVA configurations.
Because the cache may or may not contain user virtual addresses, we
need to use the 'cache' or 'cachee' instruction based on whether we
flush the cache on behalf of kernel or user respectively.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: r4kcache: Add protected cache operation for EVA
Leonid Yegoshin [Mon, 16 Dec 2013 11:38:00 +0000 (11:38 +0000)]
MIPS: asm: r4kcache: Add protected cache operation for EVA

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: r4kcache: Build flushing code for instruction cache
Leonid Yegoshin [Mon, 16 Dec 2013 11:24:13 +0000 (11:24 +0000)]
MIPS: asm: r4kcache: Build flushing code for instruction cache

Build code to invalidate an address range in the  instruction cache
using the Hit Invalidate cache operation.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: signal: Prevent save/restore FPU context in user memory
Leonid Yegoshin [Thu, 12 Dec 2013 16:57:19 +0000 (16:57 +0000)]
MIPS: kernel: signal: Prevent save/restore FPU context in user memory

EVA does not have FPU specific instructions for reading or writing
FPU registers from userspace memory.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: checksum: Add MIPS specific csum_and_copy_from_user function
Leonid Yegoshin [Tue, 17 Dec 2013 09:30:13 +0000 (09:30 +0000)]
MIPS: asm: checksum: Add MIPS specific csum_and_copy_from_user function

A MIPS specific csum_and_copy_from_user function is necessary because
the generic one from include/net/checksum.h will not work for EVA.
This is because the generic one will link to symbols from lib/checksum.c
which are not EVA aware.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: checksum: Split kernel and user copy operations
Leonid Yegoshin [Thu, 19 Dec 2013 17:09:17 +0000 (17:09 +0000)]
MIPS: asm: checksum: Split kernel and user copy operations

In EVA mode, different instructions need to be used to read/write
from kernel and userland. In non-EVA mode, there is no functional
difference. The current address limit is checked to decide the
type of operation that will be performed.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: csum_partial: Add EVA support
Markos Chandras [Fri, 17 Jan 2014 11:36:16 +0000 (11:36 +0000)]
MIPS: lib: csum_partial: Add EVA support

Use EVA specific functions to read and write data to
user address space.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: csum_partial: Add macro to build csum_partial symbols
Markos Chandras [Fri, 17 Jan 2014 10:48:46 +0000 (10:48 +0000)]
MIPS: lib: csum_partial: Add macro to build csum_partial symbols

In preparation for EVA support, we use a macro to build the
__csum_partial_copy_user main code so it can be shared across
multiple implementations. EVA uses the same code but it replaces
the load/store/prefetch instructions with the EVA specific ones
therefore using a macro avoids unnecessary code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: csum_partial: Merge EXC and load/store macros
Markos Chandras [Thu, 16 Jan 2014 17:02:13 +0000 (17:02 +0000)]
MIPS: lib: csum_partial: Merge EXC and load/store macros

Each load/store macro always adds an entry to the __ex_table
using the EXC macro. There are cases where a load instruction may
never fail such as when we are sure the load happens in the kernel
address space. Therefore, we merge these the EXC and LOADX/STOREX
macros into a single one. We also expand the argument list in the EXC
macro to make the macro more flexible. The extra 'type' argument is not
used by this commit, but it will be used when EVA support is added to
memcpy.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: checksum: Split the 'copy_user' symbol
Markos Chandras [Thu, 12 Dec 2013 16:21:00 +0000 (16:21 +0000)]
MIPS: checksum: Split the 'copy_user' symbol

The 'copy_user' symbol can be used to copy from or to
userland so we will use two different symbols for these
operations. This makes no difference in the existing code,
but when the core is operating in EVA mode, different instructions
need to be used to read and write to userland address space.
The old function has also been renamed to 'copy_kernel' to denote
that it is suitable for copy data to and from kernel space.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: unaligned: Handle unaligned accesses for EVA
Leonid Yegoshin [Thu, 12 Dec 2013 16:15:15 +0000 (16:15 +0000)]
MIPS: kernel: unaligned: Handle unaligned accesses for EVA

Handle unaligned accesses when we access userspace memory
EVA mode.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: unaligned: Add EVA instruction wrappers
Markos Chandras [Thu, 19 Dec 2013 16:41:05 +0000 (16:41 +0000)]
MIPS: kernel: unaligned: Add EVA instruction wrappers

Use the load/store instruction wrappers from asm/asm.h to
perform such operations when operating in EVA mode.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Add EVA support for str*_user operations
Markos Chandras [Fri, 3 Jan 2014 14:55:02 +0000 (14:55 +0000)]
MIPS: asm: uaccess: Add EVA support for str*_user operations

The str*_user functions are used to securely access NULL terminated
strings from userland. Therefore, it's necessary to use the appropriate
EVA function. However, if the string is in kernel space, then the normal
instructions are being used to access it. The __str*_kernel_asm and
__str*_user_asm symbols are the same for non-EVA mode so there is no
functional change for the non-EVA kernels.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Add EVA support to copy_{in, to,from}_user
Markos Chandras [Wed, 11 Dec 2013 16:47:10 +0000 (16:47 +0000)]
MIPS: asm: uaccess: Add EVA support to copy_{in, to,from}_user

Use the EVA specific functions from memcpy.S to perform
userspace operations. When get_fs() == get_ds() the usual load/store
instructions are used because the destination address is located in
the kernel address space region. Otherwise, the EVA specifc load/store
instructions are used which will go through th TLB to perform the virtual
to physical translation for the userspace address.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Rename {get,put}_user_asm macros
Markos Chandras [Mon, 6 Jan 2014 12:48:28 +0000 (12:48 +0000)]
MIPS: asm: uaccess: Rename {get,put}_user_asm macros

The {get,put}_user_asm functions can be used to load data from
kernel or the user address space so rename them to avoid
confusion.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Use EVA instructions wrappers
Markos Chandras [Wed, 11 Dec 2013 11:25:33 +0000 (11:25 +0000)]
MIPS: asm: uaccess: Use EVA instructions wrappers

Use the EVA instruction wrappers from asm.h to perform
read/write operations from userland.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Disable unaligned access macros for EVA
Leonid Yegoshin [Tue, 17 Dec 2013 15:20:24 +0000 (15:20 +0000)]
MIPS: asm: uaccess: Disable unaligned access macros for EVA

ulb, ulh, ulw are macros which emulate unaligned access for MIPS.
However, no such macros exist for EVA mode, so the only way to do
EVA unaligned accesses is in the ADE exception handler. As a result
of which, disable these macros for EVA.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Move duplicated code to common function
Markos Chandras [Tue, 17 Dec 2013 14:42:23 +0000 (14:42 +0000)]
MIPS: asm: uaccess: Move duplicated code to common function

Similar to __get_user_* functions, move common code to
__put_user_*_common so it can be shared among similar users.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Add instruction argument to __{put,get}_user_asm
Markos Chandras [Tue, 17 Dec 2013 13:15:40 +0000 (13:15 +0000)]
MIPS: asm: uaccess: Add instruction argument to __{put,get}_user_asm

In preparation for EVA support, an instruction argument is needed
for the __get_user_asm{,_ll32} functions to allow instruction overrides in
EVA mode. Even though EVA only works for MIPS 32-bit, both codepaths are
changed (32-bit and 64-bit) for consistency reasons.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memset: Add EVA support for the __bzero function.
Markos Chandras [Fri, 3 Jan 2014 10:11:45 +0000 (10:11 +0000)]
MIPS: lib: memset: Add EVA support for the __bzero function.

Build the __bzero function using the EVA load/store instructions
when operating in the EVA mode. This function is only used when
accessing user code so there is no need to build two distinct symbols
for user and kernel operations respectively.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memset: Use macro to build the __bzero symbol
Markos Chandras [Fri, 3 Jan 2014 09:23:16 +0000 (09:23 +0000)]
MIPS: lib: memset: Use macro to build the __bzero symbol

Build the __bzero symbol using a macor. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memset: Whitespace fixes
Markos Chandras [Fri, 3 Jan 2014 09:21:20 +0000 (09:21 +0000)]
MIPS: lib: memset: Whitespace fixes

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Add EVA support
Markos Chandras [Tue, 7 Jan 2014 16:20:22 +0000 (16:20 +0000)]
MIPS: lib: memcpy: Add EVA support

Add copy_{to,from,in}_user when the CPU operates in EVA mode.
This is necessary so the EVA specific instructions can be used
to perform the virtual to physical translation for user space
addresses. We will use the non-EVA functions to read from kernel
if needed.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Use macro to build the copy_user code
Markos Chandras [Tue, 7 Jan 2014 14:34:05 +0000 (14:34 +0000)]
MIPS: lib: memcpy: Use macro to build the copy_user code

The code can be shared between EVA and non-EVA configurations,
therefore use a macro to build it to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Split source and destination prefetch macros
Markos Chandras [Tue, 7 Jan 2014 15:59:03 +0000 (15:59 +0000)]
MIPS: lib: memcpy: Split source and destination prefetch macros

In preparation for EVA support, the PREF macro is split into two
separate macros, PREFS and PREFD, for source and destination data
prefetching respectively.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Merge EXC and load/store macros
Markos Chandras [Tue, 7 Jan 2014 12:57:04 +0000 (12:57 +0000)]
MIPS: lib: memcpy: Merge EXC and load/store macros

Each load/store macro always adds an entry to the __ex_table
using the EXC macro. Therefore, these load/store macros are now merged
with the EXC one. The argument list is also expanded in order to make
the macro more flexible. The extra 'type' argument is not used by this
commit, but it will be used when the EVA support is added to the memcpy.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strncpy_user: Add EVA support
Markos Chandras [Thu, 2 Jan 2014 16:40:20 +0000 (16:40 +0000)]
MIPS: lib: strncpy_user: Add EVA support

In non-EVA mode, strncpy_from_user* aliases are used for the
strncpy_from_kernel* symbols since the code is identical. In EVA
mode, new strcpy_from_user* symbols are used which use the EVA
specific instructions to load values from userspace.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strncpy_user: Use macro to build the strncpy_from_user symbol
Markos Chandras [Thu, 2 Jan 2014 16:36:49 +0000 (16:36 +0000)]
MIPS: lib: strncpy_user: Use macro to build the strncpy_from_user symbol

Build the __strncpy_from_user symbol using a macro. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strlen_user: Add EVA support
Markos Chandras [Thu, 2 Jan 2014 16:04:38 +0000 (16:04 +0000)]
MIPS: lib: strlen_user: Add EVA support

In non-EVA mode, strlen_user* aliases are used for the
strlen_kernel* symbols since the code is identical. In EVA
mode, new strlen_user* symbols are used which use the EVA
specific instructions to load values from userspace.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strlen_user: Use macro to build the strlen_user symbol
Markos Chandras [Thu, 2 Jan 2014 15:55:58 +0000 (15:55 +0000)]
MIPS: lib: strlen_user: Use macro to build the strlen_user symbol

Build the __strlen_user symbol using a macro. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strnlen_user: Add EVA support
Markos Chandras [Mon, 9 Dec 2013 15:28:10 +0000 (15:28 +0000)]
MIPS: lib: strnlen_user: Add EVA support

In non-EVA mode, a strlen_user* alias is used for the
strlen_kernel* symbols since the code is identical. In EVA
mode, a new strlen_user* symbol is used which uses the EVA
specific instructions to load values from userspace.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strnlen_user: Use macro to build the strnlen_user symbol
Markos Chandras [Thu, 2 Jan 2014 16:19:49 +0000 (16:19 +0000)]
MIPS: lib: strnlen_user: Use macro to build the strnlen_user symbol

Build the __strnlen_user symbol using a macro. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: traps: Set correct address limit for breakpoints and traps
Leonid Yegoshin [Wed, 4 Dec 2013 16:39:34 +0000 (16:39 +0000)]
MIPS: traps: Set correct address limit for breakpoints and traps

When a breakpoint or trap happens when operating in kernel mode but
on users behalf (eg syscall) it is necessary to change the address
limit to KERNEL_DS so any address checking can be bypassed and print
the correct stack trace.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: traps: Whitespace clean up
Markos Chandras [Wed, 4 Dec 2013 16:20:08 +0000 (16:20 +0000)]
MIPS: kernel: traps: Whitespace clean up

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: scall32-o32: Use EVA wrappers to fetch syscall arguments
Markos Chandras [Wed, 4 Dec 2013 14:35:28 +0000 (14:35 +0000)]
MIPS: kernel: scall32-o32: Use EVA wrappers to fetch syscall arguments

Arguments 4-8 are stored on user's stack, so use the EVA instructions
to fetch them if EVA is enabled.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: uapi: inst: Add instruction format for SPECIAL3 instructions
Leonid Yegoshin [Wed, 4 Dec 2013 11:06:57 +0000 (11:06 +0000)]
MIPS: uapi: inst: Add instruction format for SPECIAL3 instructions

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: uapi: inst: Add new EVA opcodes
Leonid Yegoshin [Wed, 4 Dec 2013 11:00:27 +0000 (11:00 +0000)]
MIPS: uapi: inst: Add new EVA opcodes

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: futex: Add EVA support for futex operations
Markos Chandras [Wed, 4 Dec 2013 09:58:36 +0000 (09:58 +0000)]
MIPS: futex: Add EVA support for futex operations

Use LLE/SCE instructions for performing an address translation for
userspace when EVA is enabled.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: Add wrappers for EVA/non-EVA instructions
Markos Chandras [Wed, 4 Dec 2013 13:56:03 +0000 (13:56 +0000)]
MIPS: asm: Add wrappers for EVA/non-EVA instructions

EVA uses specific instructions for accessing user memory.
Instead of polluting the kernel with numerous #ifdef CONFIG_EVA
we add wrappers for all the instructions that need special
handling when EVA is enabled.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: Add prefetch instruction for EVA
Leonid Yegoshin [Tue, 3 Dec 2013 10:48:15 +0000 (10:48 +0000)]
MIPS: asm: Add prefetch instruction for EVA

EVA can use the PREFE instruction to perform the virtual address
translation using the user mapping of the address rather than the
kernel mapping.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: Kconfig: Add Kconfig symbols for EVA support
Leonid Yegoshin [Tue, 3 Dec 2013 10:22:26 +0000 (10:22 +0000)]
MIPS: Kconfig: Add Kconfig symbols for EVA support

Add basic Kconfig support for EVA. Not selectable by any platform
at this point.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: OProfile: Add CPU_P5600 cases
James Hogan [Wed, 22 Jan 2014 16:19:41 +0000 (16:19 +0000)]
MIPS: OProfile: Add CPU_P5600 cases

Add a CPU_P5600 cpu type case in oprofile_arch_init() to use the MIPS
model, and in mipsxx_init() to set the cpu_type string to "mips/P5600".

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Robert Richter <rric@kernel.org>
Cc: oprofile-list@lists.sf.net
Patchwork: https://patchwork.linux-mips.org/patch/6410/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Allow FTLB to be turned on for CPU_P5600
James Hogan [Wed, 22 Jan 2014 16:19:40 +0000 (16:19 +0000)]
MIPS: Allow FTLB to be turned on for CPU_P5600

Allow FTLB to be turned on or off for CPU_P5600 as well as CPU_PROAPTIV.
The existing if statement is converted into a switch to allow for future
expansion.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6411/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add MIPS P5600 probe support
James Hogan [Wed, 22 Jan 2014 16:19:39 +0000 (16:19 +0000)]
MIPS: Add MIPS P5600 probe support

Add a case in cpu_probe_mips for the MIPS P5600 processor ID, which sets
the CPU type to the new CPU_P5600.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6409/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add cases for CPU_P5600
James Hogan [Wed, 22 Jan 2014 16:19:38 +0000 (16:19 +0000)]
MIPS: Add cases for CPU_P5600

Add a CPU_P5600 case to various switch statements, doing the same thing
as for CPU_PROAPTIV.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6408/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add MIPS P5600 PRid and cputype identifiers
James Hogan [Wed, 22 Jan 2014 16:19:37 +0000 (16:19 +0000)]
MIPS: Add MIPS P5600 PRid and cputype identifiers

Add a Processor ID and CPU type for the MIPS P5600 core.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6407/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Save/restore MSA context around signals
Paul Burton [Thu, 13 Feb 2014 11:27:42 +0000 (11:27 +0000)]
MIPS: Save/restore MSA context around signals

This patch extends sigcontext in order to hold the most significant 64
bits of each vector register in addition to the MSA control & status
register. The least significant 64 bits are already saved as the scalar
FP context. This makes things a little awkward since the least & most
significant 64 bits of each vector register are not contiguous in
memory. Thus the copy_u & insert instructions are used to transfer the
values of the most significant 64 bits via GP registers.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6533/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Warn if vector register partitioning is implemented
Paul Burton [Tue, 28 Jan 2014 14:28:43 +0000 (14:28 +0000)]
MIPS: Warn if vector register partitioning is implemented

No current systems implementing MSA include support for vector register
partitioning which makes it somewhat difficult to implement support for
it in the kernel. Thus for the moment the kernel includes no such
support. However if the kernel were to be run on a system which
implemented register partitioning then it would not function correctly,
mishandling MSA disabled exceptions. Print a warning if run on a system
with vector register partitioning implemented to indicate this problem
should it occur.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6494/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Dumb MSA FP exception handler
Paul Burton [Mon, 27 Jan 2014 15:23:12 +0000 (15:23 +0000)]
MIPS: Dumb MSA FP exception handler

This patch adds a simple handler for MSA FP exceptions which delivers a
SIGFPE to the running task. In the future it should probably be extended
to re-execute the instruction with the MSACSR.NX bit set in order to
generate results for any elements which did not cause an exception
before delivering the SIGFPE signal.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6432/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Basic MSA context switching support
Paul Burton [Mon, 27 Jan 2014 15:23:11 +0000 (15:23 +0000)]
MIPS: Basic MSA context switching support

This patch adds support for context switching the MSA vector registers.
These 128 bit vector registers are aliased with the FP registers - an
FP register accesses the least significant bits of the vector register
with which it is aliased (ie. the register with the same index). Due to
both this & the requirement that the scalar FPU must be 64-bit (FR=1) if
enabled at the same time as MSA the kernel will enable MSA & scalar FP
at the same time for tasks which use MSA. If we restore the MSA vector
context then we might as well enable the scalar FPU since the reason it
was left disabled was to allow for lazy FP context restoring - but we
just restored the FP context as it's a subset of the vector context. If
we restore the FP context and have previously used MSA then we have to
restore the whole vector context anyway (see comment in
enable_restore_fp_context for details) so similarly we might as well
enable MSA.

Thus if a task does not use MSA then it will continue to behave as
without this patch - the scalar FP context will be saved & restored as
usual. But if a task executes an MSA instruction then it will save &
restore the vector context forever more.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6431/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Detect the MSA ASE
Paul Burton [Mon, 27 Jan 2014 15:23:10 +0000 (15:23 +0000)]
MIPS: Detect the MSA ASE

This patch adds support for probing the MSAP bit within the Config3
register in order to detect the presence of the MSA ASE. Presence of the
ASE will be indicated in /proc/cpuinfo. The value of the MSA
implementation register will be displayed at boot to aid debugging and
verification of a correct setup, as is done for the FPU.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6430/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add MSA register definitions & access
Paul Burton [Mon, 27 Jan 2014 15:23:09 +0000 (15:23 +0000)]
MIPS: Add MSA register definitions & access

This patch introduces definitions for the MSA control registers and
functions which allow access to both the control & vector registers. If
the toolchain being used to build the kernel includes support for MSA
then this patch will make use of that support & use MSA instructions
directly. However toolchain support for MSA is very new & far from a
point where it can be reasonably expected that everyone building the
kernel uses a toolchain with support. Thus fallbacks using .word
assembler directives are also provided for now as a temporary measure.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6429/
Patchwork: https://patchwork.linux-mips.org/patch/6607/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Don't assume 64-bit FP registers for context switch
Paul Burton [Mon, 27 Jan 2014 15:23:08 +0000 (15:23 +0000)]
MIPS: Don't assume 64-bit FP registers for context switch

When saving or restoring scalar FP context we want to access the least
significant 64 bits of each FP register. When the FP registers are 64
bits wide that is trivially the start of the registers value in memory.
However when the FP registers are wider this equivalence will no longer
be true for big endian systems. Define a new set of offset macros for
the least significant 64 bits of each saved FP register within thread
context, and make use of them when saving and restoring scalar FP
context.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6428/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Don't assume 64-bit FP registers for FP regset
Paul Burton [Mon, 27 Jan 2014 15:23:07 +0000 (15:23 +0000)]
MIPS: Don't assume 64-bit FP registers for FP regset

When we want to access 64-bit FP register values we can only treat
consecutive registers as being consecutive in memory when the width of
an FP register equals 64 bits. This assumption will not remain true once
MSA support is introduced, so provide a code path which copies each 64
bit FP register value in turn when the width of an FP register differs
from 64 bits.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6427/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Don't assume 64-bit FP registers for dump_{,task_}fpu
Paul Burton [Mon, 27 Jan 2014 15:23:06 +0000 (15:23 +0000)]
MIPS: Don't assume 64-bit FP registers for dump_{,task_}fpu

This code assumed that saved FP registers are 64 bits wide, an
assumption which will no longer be true once MSA is introduced. This
patch modifies the code to copy the lower 64 bits of each register in
turn, which is safe for any FP register width >= 64 bits.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6425/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Clear upper bits of FP registers on emulator writes
Paul Burton [Mon, 27 Jan 2014 17:14:47 +0000 (17:14 +0000)]
MIPS: Clear upper bits of FP registers on emulator writes

The upper bits of an FP register are architecturally defined as
unpredictable following an instructions which only writes the lower
bits. The prior behaviour of the kernel is to leave them unmodified.
This patch modifies that to clear the upper bits to zero. This is what
the MSA architecture reference manual specifies should happen for its
wider registers and is still permissible for scalar FP instructions
given the bits unpredictability there.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: sergei.shtylyov@cogentembedded.com
Patchwork: https://patchwork.linux-mips.org/patch/6435/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Replace hardcoded 32 with NUM_FPU_REGS in ptrace
Paul Burton [Mon, 27 Jan 2014 15:23:04 +0000 (15:23 +0000)]
MIPS: Replace hardcoded 32 with NUM_FPU_REGS in ptrace

NUM_FPU_REGS just makes it clearer what's going on, rather than the
magic hard coded 32.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6424/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Don't require FPU on sigcontext setup/restore
Paul Burton [Mon, 27 Jan 2014 15:23:03 +0000 (15:23 +0000)]
MIPS: Don't require FPU on sigcontext setup/restore

When a task which has used the FPU at some point in its past takes a
signal the kernel would previously always require the task to take
ownership of the FPU whilst setting up or restoring from the sigcontext.
That means that if the task has not used the FPU within this timeslice
then the kernel would enable the FPU, restore the task's FP context into
FPU registers and then save them into the sigcontext. This seems
inefficient, and if the signal handler doesn't use FP then enabling the
FPU & the extra memory accesses are entirely wasted work.

This patch modifies the sigcontext setup & restore code to copy directly
between the tasks saved FP context & the sigcontext for any tasks which
have used FP in the past but are not currently the FPU owner (ie. have
not used FP in this timeslice).

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6423/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Move & rename fpu_emulator_{save,restore}_context
Paul Burton [Mon, 27 Jan 2014 15:23:02 +0000 (15:23 +0000)]
MIPS: Move & rename fpu_emulator_{save,restore}_context

These functions aren't directly related to the FPU emulator at all, they
simply copy between a thread's saved context & a sigcontext. Thus move
them to the appropriate signal files & rename them accordingly. This
makes it clearer that the functions don't require the FPU emulator in
any way.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6422/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Update outdated comment
Paul Burton [Mon, 27 Jan 2014 15:23:01 +0000 (15:23 +0000)]
MIPS: Update outdated comment

The hard-coded offsets mentioned in this comment seem to not exist
anymore, so remove mention of them from the comment.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6421/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Simplify FP context access
Paul Burton [Thu, 13 Feb 2014 11:26:41 +0000 (11:26 +0000)]
MIPS: Simplify FP context access

This patch replaces the fpureg_t typedef with a "union fpureg" enabling
easier access to 32 & 64 bit values. This allows the access macros used
in cp1emu.c to be simplified somewhat. It will also make it easier to
expand the width of the FP registers as will be done in a future
patch in order to support the 128 bit registers introduced with MSA.

No behavioural change is intended by this patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6532/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Select HAVE_ARCH_SECCOMP_FILTER
Markos Chandras [Wed, 22 Jan 2014 14:40:04 +0000 (14:40 +0000)]
MIPS: Select HAVE_ARCH_SECCOMP_FILTER

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6401/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: seccomp: Handle indirect system calls (o32)
Markos Chandras [Wed, 22 Jan 2014 14:40:03 +0000 (14:40 +0000)]
MIPS: seccomp: Handle indirect system calls (o32)

When userland uses syscall() to perform an indirect system call
the actually system call that needs to be checked by the filter
is on the first argument. The kernel code needs to handle this case
by looking at the original syscall number in v0 and if it's
NR_syscall, then it needs to examine the first argument to
identify the real system call that will be executed.
Similarly, we need to 'virtually' shift the syscall() arguments
so the syscall_get_arguments() function can fetch the correct
arguments for the indirect system call.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6404/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: kernel: scalls: Skip the syscall if denied by the seccomp filter
Markos Chandras [Wed, 22 Jan 2014 14:40:02 +0000 (14:40 +0000)]
MIPS: kernel: scalls: Skip the syscall if denied by the seccomp filter

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6399/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: ptrace: Move away from secure_computing_strict
Markos Chandras [Wed, 22 Jan 2014 14:40:01 +0000 (14:40 +0000)]
MIPS: ptrace: Move away from secure_computing_strict

MIPS now has the infrastructure for dynamic seccomp-bpf
filtering

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6400/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: asm: thread_info: Add _TIF_SECCOMP flag
Markos Chandras [Wed, 22 Jan 2014 14:40:00 +0000 (14:40 +0000)]
MIPS: asm: thread_info: Add _TIF_SECCOMP flag

Add _TIF_SECCOMP flag to _TIF_WORK_SYSCALL_ENTRY to indicate
that the system call needs to be checked against a seccomp filter.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6405/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: asm: syscall: Define syscall_get_arch
Markos Chandras [Wed, 22 Jan 2014 14:39:59 +0000 (14:39 +0000)]
MIPS: asm: syscall: Define syscall_get_arch

This effectively renames __syscall_get_arch to syscall_get_arch
and implements a compatible interface for the seccomp API.
The seccomp code (kernel/seccomp.c) expects a syscall_get_arch
function to be defined for every architecture, so we drop
the leading underscores from the existing function.

This also makes use of the 'task' argument to determine the type
the process instead of assuming the process has the same
characteristics as the kernel it's running on.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6398/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: asm: syscall: Add the syscall_rollback function
Markos Chandras [Wed, 22 Jan 2014 14:39:58 +0000 (14:39 +0000)]
MIPS: asm: syscall: Add the syscall_rollback function

The syscall_rollback function is used by seccomp-bpf but it was never
added for MIPS. It doesn't need to do anything as none of the registers
are clobbered if the system call has been denied by the seccomp filter.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6403/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Deprecate CONFIG_MIPS_CMP
Paul Burton [Wed, 15 Jan 2014 10:32:00 +0000 (10:32 +0000)]
MIPS: Deprecate CONFIG_MIPS_CMP

CONFIG_MIPS_CPS is a better option for systems where it is supported,
which as far as I am aware should be all systems where CONFIG_MIPS_CMP
could provide any value (ie. where there are multiple cores for YAMON to
bring up). This option is therefore deprecated, and marked as such. It
is left intact for the time being in order to provide a fallback should
someone find a system where CONFIG_MIPS_CPS will not function (ie. where
the reset vector cannot be moved), and should be removed entirely in the
future assuming that does not happen.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6369/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: MIPS_CMP should depend upon !SMTC, not upon SMVP
Paul Burton [Wed, 15 Jan 2014 10:31:59 +0000 (10:31 +0000)]
MIPS: MIPS_CMP should depend upon !SMTC, not upon SMVP

Commit f55afb0969cc "MIPS: Clean up MIPS MT and CMP configuration
options." introduced a dependency upon MIPS_MT_SMP (ie. SMVP) for the
MIPS_CMP (ie. CMP framework support) Kconfig option. It did not specify
why, and that dependency is bogus. It is perfectly valid to have a
multi-core system with the YAMON bootloader but without MT support -
an example of this would be any multi-core proAptiv bitstream running on
a Malta. Forcing MT support to be enabled in a kernel for such a system
is incorrect. I suspect that the dependency was actually meant to
reflect the fact that YAMON will only bind 1 TC per VPE on an MT system,
and only describe those 1:1 TC:VPE pairs as CPUs through the AMON
interface. Thus an SMTC kernel makes little sense on a system using
MIPS_CMP, and the Kconfig dependencies should reflect that rather than
introducing the bogus SMVP dependency.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6368/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: More helpful CONFIG_MIPS_CMP label, help text
Paul Burton [Wed, 15 Jan 2014 10:31:58 +0000 (10:31 +0000)]
MIPS: More helpful CONFIG_MIPS_CMP label, help text

The prior help text introduced in commit f55afb0969cc "MIPS: Clean up
MIPS MT and CMP configuration options." reads as though this option
enables the kernel to make use of the CM hardware, which is not true.
What it actually does is allow the kernel to interact with the YAMON
bootloader which actually interacts with the CM hardware to bring up
secondary cores. Re-introduce the word "framework" which that commit
removed to avoid misleading people.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6367/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Remove gcmpregs.h
Paul Burton [Wed, 15 Jan 2014 10:31:57 +0000 (10:31 +0000)]
MIPS: Remove gcmpregs.h

This header was used only by Malta but is used no longer. Remove it. It
was also included unnecessarily in irq-gic.c, so that include is also
removed.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6366/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: Allow use of MIPS CPS SMP implementation
Paul Burton [Wed, 15 Jan 2014 10:31:56 +0000 (10:31 +0000)]
MIPS: Malta: Allow use of MIPS CPS SMP implementation

This patch simply attempts to register the MIPS Coherent Processing
System SMP implementation when it is enabled. If registering that fails
for some reason (like the Kconfig option being disabled or a lack of
hardware support) then we fall back to the same SMP implementations as
before.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6365/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: Probe CPC when supported
Paul Burton [Wed, 15 Jan 2014 10:31:55 +0000 (10:31 +0000)]
MIPS: Malta: Probe CPC when supported

When CPC support is compiled into the kernel (ie. CONFIG_MIPS_CPC=y),
probe the CPC on boot for Malta in order to allow any users of the CPC
to detect its presence & function correctly.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6363/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: Make use of generic CM support
Paul Burton [Wed, 15 Jan 2014 10:31:54 +0000 (10:31 +0000)]
MIPS: Malta: Make use of generic CM support

Remove the Malta-specific CM probe code and instead make use of the
newly added generic CM code.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6364/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Coherent Processing System SMP implementation
Paul Burton [Wed, 15 Jan 2014 10:31:53 +0000 (10:31 +0000)]
MIPS: Coherent Processing System SMP implementation

This patch introduces a new SMP implementation for systems implementing
the MIPS Coherent Processing System architecture. The kernel will make
use of the Coherence Manager, Cluster Power Controller & Global
Interrupt Controller in order to detect, bring up & make use of other
cores in the system. SMTC is not supported, so only a single TC per VPE
in the system is used. That is, this option enables an SMVP style setup
but across multiple cores.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6362/
Patchwork: https://patchwork.linux-mips.org/patch/6611/
Patchwork: https://patchwork.linux-mips.org/patch/6651/
Patchwork: https://patchwork.linux-mips.org/patch/6652/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add cpu_vpe_id macro
Paul Burton [Mon, 24 Mar 2014 10:19:24 +0000 (10:19 +0000)]
MIPS: Add cpu_vpe_id macro

The vpe_id field of struct cpuinfo_mips is only present when one of
CONFIG_MIPS_MT_{SMP,SMTC} is enabled. That means that any code accessing
which may compile without MT is currently forced to use an #ifdef.
Instead this patch provides an accessor macro, #ifdef'd appropriately
to prevent further #ifdef's elsewhere.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6646/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>