This whole thing seems very messy. I see a couple of problems:
1) There are if(CONFIG_EVA) ... else ... endif all over the place. It
is very ugly.
2) You cannot have a signel kernel with both EVA and non-EVA support.
Have you considered just tagging all the instructions that touch the
user address space, and patching them at system boot with their EVA
equivalents if EVA support is desired?
You might even be able to use the existing exception tables and not have
to add a special table for EVA. The instructions that can trap are
exactly those where the EVA version should be used.
David Daney
On 01/27/2014 12:18 PM, Markos Chandras wrote:
Hi,
This patchset adds support for the Enhanced Virtual Addressing feature
of the MIPS 3.5 ISA currently present in the *Aptiv processors.
In Release 3, the memory architecture defines the partitioning of memory
space into fixed‐size segments, whose access properties and cacheability
attributes are programmable. The "mapped" and "unmapped" segment‐access
properties can now be modified so as to extend system memory space
(kseg0/kseg1) to include unmapped access to user space (xkseg), a
feature called Enhanced Virtual Addressing (EVA). Instructions that
facilitate system read/write access to xkseg have also been added to the
R3 ISA (lwe, swe, lbue, etc).
This patchset also adds EVA support for the Malta board. The unmapped
address space (kseg0/kseg1) has been extended to 2GB.
If you want to try it, you can use the 'eva-next' branch on
the following git repository
https://github.com/hwoarang/linux.git eva-next
The patchset applies on top of the upstream-sfr/mips-for-linux-next tree.
Leonid Yegoshin (18):
MIPS: Kconfig: Add Kconfig symbols for EVA support
MIPS: asm: Add prefetch instruction for EVA
MIPS: uapi: inst: Add new EVA opcodes
MIPS: uapi: inst: Add instruction format for SPECIAL3 instructions
MIPS: traps: Set correct address limit for breakpoints and traps
MIPS: asm: uaccess: Disable unaligned access macros for EVA
MIPS: kernel: unaligned: Handle unaligned accesses for EVA
MIPS: asm: checksum: Split kernel and user copy operations
MIPS: asm: checksum: Add MIPS specific csum_and_copy_from_user
function
MIPS: kernel: signal: Prevent save/restore FPU context in user memory
MIPS: asm: r4kcache: Build flushing code for instruction cache
MIPS: asm: r4kcache: Add protected cache operation for EVA
MIPS: asm: r4kcache: Add EVA cache flushing functions
MIPS: kernel: {ftrace,kgdb}: Set correct address limit for cache
flushes
MIPS: asm: page: Allow __pa_symbol overrides
MIPS: mm: c-r4k: Build EVA {d,i}cache flushing functions
MIPS: mm: c-r4k: Flush scache to avoid cache aliases
MIPS: malta: malta-init: Fix System Controller memory mapping for EVA
Markos Chandras (40):
MIPS: asm: Add wrappers for EVA/non-EVA instructions
MIPS: futex: Add EVA support for futex operations
MIPS: kernel: scall32-o32: Use EVA wrappers to fetch syscall arguments
MIPS: kernel: traps: Whitespace clean up
MIPS: lib: strnlen_user: Use macro to build the strnlen_user symbol
MIPS: lib: strnlen_user: Add EVA support
MIPS: lib: strlen_user: Use macro to build the strlen_user symbol
MIPS: lib: strlen_user: Add EVA support
MIPS: lib: strncpy_user: Use macro to build the strncpy_from_user
symbol
MIPS: lib: strncpy_user: Add EVA support
MIPS: lib: memcpy: Merge EXC and load/store macros
MIPS: lib: memcpy: Split source and destination prefetch macros
MIPS: lib: memcpy: Use macro to build the copy_user code
MIPS: lib: memcpy: Add EVA support
MIPS: lib: memset: Whitespace fixes
MIPS: lib: memset: Use macro to build the __bzero symbol
MIPS: lib: memset: Add EVA support for the __bzero function.
MIPS: asm: uaccess: Add instruction argument to __{put,get}_user_asm
MIPS: asm: uaccess: Move duplicated code to common function
MIPS: asm: uaccess: Use EVA instructions wrappers
MIPS: asm: uaccess: Rename {get,put}_user_asm macros
MIPS: asm: uaccess: Add EVA support to copy_{in, to,from}_user
MIPS: asm: uaccess: Add EVA support for str*_user operations
MIPS: kernel: unaligned: Add EVA instruction wrappers
MIPS: checksum: Split the 'copy_user' symbol
MIPS: lib: csum_partial: Merge EXC and load/store macros
MIPS: lib: csum_partial: Add macro to build csum_partial symbols
MIPS: lib: csum_partial: Add EVA support
MIPS: asm: cpu: Add cpu flag for Enhanced Virtual Addressing
MIPS: kernel: cpu-probe: Enable EVA option on supported cores
MIPS: kernel: proc: Add EVA to the list of CPU features
MIPS: mm: init: Add free_init_pages() callback for EVA
MIPS: mm: c-r4k: Add support for flushing user pages from cache
MIPS: malta: Configure Segment Control registers for EVA boot
MIPS: malta: spaces.h: Add spaces.h file for Malta (EVA)
MIPS: malta: malta-memory: Add support for the 'ememsize' variable
MIPS: malta: malta-memory: Use the PHYS_OFFSET to build the memory map
MIPS: malta: malta-memory: Add free_init_pages_eva() callback
MIPS: malta: Add support for SMP EVA
MIPS: Enable MIPS 3.5 features on Malta
arch/mips/Kconfig | 29 +-
arch/mips/include/asm/asm.h | 130 +++++
arch/mips/include/asm/bootinfo.h | 2 +
arch/mips/include/asm/checksum.h | 44 +-
arch/mips/include/asm/cpu-features.h | 4 +-
arch/mips/include/asm/cpu.h | 1 +
arch/mips/include/asm/futex.h | 9 +-
arch/mips/include/asm/fw/fw.h | 2 +-
.../include/asm/mach-malta/kernel-entry-init.h | 115 ++++-
arch/mips/include/asm/mach-malta/spaces.h | 46 ++
arch/mips/include/asm/page.h | 2 +
arch/mips/include/asm/r4kcache.h | 173 ++++++-
arch/mips/include/asm/uaccess.h | 559 ++++++++++++++++-----
arch/mips/include/uapi/asm/inst.h | 25 +-
arch/mips/kernel/cpu-probe.c | 3 +
arch/mips/kernel/ftrace.c | 4 +
arch/mips/kernel/head.S | 2 +-
arch/mips/kernel/kgdb.c | 17 +-
arch/mips/kernel/mips_ksyms.c | 24 +-
arch/mips/kernel/proc.c | 1 +
arch/mips/kernel/scall32-o32.S | 9 +-
arch/mips/kernel/signal.c | 26 +
arch/mips/kernel/traps.c | 29 +-
arch/mips/kernel/unaligned.c | 135 ++++-
arch/mips/lib/csum_partial.S | 282 +++++++----
arch/mips/lib/memcpy.S | 416 ++++++++++-----
arch/mips/lib/memset.S | 146 ++++--
arch/mips/lib/strlen_user.S | 36 +-
arch/mips/lib/strncpy_user.S | 40 +-
arch/mips/lib/strnlen_user.S | 36 +-
arch/mips/mm/c-r4k.c | 64 ++-
arch/mips/mm/init.c | 12 +-
arch/mips/mti-malta/malta-init.c | 13 +
arch/mips/mti-malta/malta-memory.c | 58 ++-
arch/mips/mti-malta/malta-setup.c | 4 +
35 files changed, 1974 insertions(+), 524 deletions(-)
create mode 100644 arch/mips/include/asm/mach-malta/spaces.h