01 Jun, 2016

2 commits


30 May, 2016

2 commits

  • We must handle data access exception as well as memory address unaligned
    exceptions from return from trap window fill faults, not just normal
    TLB misses.

    Otherwise we can get an OOPS that looks like this:

    ld-linux.so.2(36808): Kernel bad sw trap 5 [#1]
    CPU: 1 PID: 36808 Comm: ld-linux.so.2 Not tainted 4.6.0 #34
    task: fff8000303be5c60 ti: fff8000301344000 task.ti: fff8000301344000
    TSTATE: 0000004410001601 TPC: 0000000000a1a784 TNPC: 0000000000a1a788 Y: 00000002 Not tainted
    TPC:
    g0: fff8000024fc8248 g1: 0000000000db04dc g2: 0000000000000000 g3: 0000000000000001
    g4: fff8000303be5c60 g5: fff800030e672000 g6: fff8000301344000 g7: 0000000000000001
    o0: 0000000000b95ee8 o1: 000000000000012b o2: 0000000000000000 o3: 0000000200b9b358
    o4: 0000000000000000 o5: fff8000301344040 sp: fff80003013475c1 ret_pc: 0000000000a1a77c
    RPC:
    l0: 00000000000007ff l1: 0000000000000000 l2: 000000000000005f l3: 0000000000000000
    l4: fff8000301347e98 l5: fff8000024ff3060 l6: 0000000000000000 l7: 0000000000000000
    i0: fff8000301347f60 i1: 0000000000102400 i2: 0000000000000000 i3: 0000000000000000
    i4: 0000000000000000 i5: 0000000000000000 i6: fff80003013476a1 i7: 0000000000404d4c
    I7:
    Call Trace:
    [0000000000404d4c] user_rtt_fill_fixup+0x6c/0x7c

    The window trap handlers are slightly clever, the trap table entries for them are
    composed of two pieces of code. First comes the code that actually performs
    the window fill or spill trap handling, and then there are three instructions at
    the end which are for exception processing.

    The userland register window fill handler is:

    add %sp, STACK_BIAS + 0x00, %g1; \
    ldxa [%g1 + %g0] ASI, %l0; \
    mov 0x08, %g2; \
    mov 0x10, %g3; \
    ldxa [%g1 + %g2] ASI, %l1; \
    mov 0x18, %g5; \
    ldxa [%g1 + %g3] ASI, %l2; \
    ldxa [%g1 + %g5] ASI, %l3; \
    add %g1, 0x20, %g1; \
    ldxa [%g1 + %g0] ASI, %l4; \
    ldxa [%g1 + %g2] ASI, %l5; \
    ldxa [%g1 + %g3] ASI, %l6; \
    ldxa [%g1 + %g5] ASI, %l7; \
    add %g1, 0x20, %g1; \
    ldxa [%g1 + %g0] ASI, %i0; \
    ldxa [%g1 + %g2] ASI, %i1; \
    ldxa [%g1 + %g3] ASI, %i2; \
    ldxa [%g1 + %g5] ASI, %i3; \
    add %g1, 0x20, %g1; \
    ldxa [%g1 + %g0] ASI, %i4; \
    ldxa [%g1 + %g2] ASI, %i5; \
    ldxa [%g1 + %g3] ASI, %i6; \
    ldxa [%g1 + %g5] ASI, %i7; \
    restored; \
    retry; nop; nop; nop; nop; \
    b,a,pt %xcc, fill_fixup_dax; \
    b,a,pt %xcc, fill_fixup_mna; \
    b,a,pt %xcc, fill_fixup;

    And the way this works is that if any of those memory accesses
    generate an exception, the exception handler can revector to one of
    those final three branch instructions depending upon which kind of
    exception the memory access took. In this way, the fault handler
    doesn't have to know if it was a spill or a fill that it's handling
    the fault for. It just always branches to the last instruction in
    the parent trap's handler.

    For example, for a regular fault, the code goes:

    winfix_trampoline:
    rdpr %tpc, %g3
    or %g3, 0x7c, %g3
    wrpr %g3, %tnpc
    done

    All window trap handlers are 0x80 aligned, so if we "or" 0x7c into the
    trap time program counter, we'll get that final instruction in the
    trap handler.

    On return from trap, we have to pull the register window in but we do
    this by hand instead of just executing a "restore" instruction for
    several reasons. The largest being that from Niagara and onward we
    simply don't have enough levels in the trap stack to fully resolve all
    possible exception cases of a window fault when we are already at
    trap level 1 (which we enter to get ready to return from the original
    trap).

    This is executed inline via the FILL_*_RTRAP handlers. rtrap_64.S's
    code branches directly to these to do the window fill by hand if
    necessary. Now if you look at them, we'll see at the end:

    ba,a,pt %xcc, user_rtt_fill_fixup;
    ba,a,pt %xcc, user_rtt_fill_fixup;
    ba,a,pt %xcc, user_rtt_fill_fixup;

    And oops, all three cases are handled like a fault.

    This doesn't work because each of these trap types (data access
    exception, memory address unaligned, and faults) store their auxiliary
    info in different registers to pass on to the C handler which does the
    real work.

    So in the case where the stack was unaligned, the unaligned trap
    handler sets up the arg registers one way, and then we branched to
    the fault handler which expects them setup another way.

    So the FAULT_TYPE_* value ends up basically being garbage, and
    randomly would generate the backtrace seen above.

    Reported-by: Nick Alcock
    Signed-off-by: David S. Miller

    David S. Miller
     
  • All signal frames must be at least 16-byte aligned, because that is
    the alignment we explicitly create when we build signal return stack
    frames.

    All stack pointers must be at least 8-byte aligned.

    Signed-off-by: David S. Miller

    David S. Miller
     

29 May, 2016

6 commits

  • Pull more MIPS updates from Ralf Baechle:
    "This is the secondnd batch of MIPS patches for 4.7. Summary:

    CPS:
    - Copy EVA configuration when starting secondary VPs.

    EIC:
    - Clear Status IPL.

    Lasat:
    - Fix a few off by one bugs.

    lib:
    - Mark intrinsics notrace. Not only are the intrinsics
    uninteresting, it would cause infinite recursion.

    MAINTAINERS:
    - Add file patterns for MIPS BRCM device tree bindings.
    - Add file patterns for mips device tree bindings.

    MT7628:
    - Fix MT7628 pinmux typos.
    - wled_an pinmux gpio.
    - EPHY LEDs pinmux support.

    Pistachio:
    - Enable KASLR

    VDSO:
    - Build microMIPS VDSO for microMIPS kernels.
    - Fix aliasing warning by building with `-fno-strict-aliasing' for
    debugging but also tracing them might result in recursion.

    Misc:
    - Add missing FROZEN hotplug notifier transitions.
    - Fix clk binding example for varioius PIC32 devices.
    - Fix cpu interrupt controller node-names in the DT files.
    - Fix XPA CPU feature separation.
    - Fix write_gc0_* macros when writing zero.
    - Add inline asm encoding helpers.
    - Add missing VZ accessor microMIPS encodings.
    - Fix little endian microMIPS MSA encodings.
    - Add 64-bit HTW fields and fix its configuration.
    - Fix sigreturn via VDSO on microMIPS kernel.
    - Lots of typo fixes.
    - Add definitions of SegCtl registers and use them"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (49 commits)
    MIPS: Add missing FROZEN hotplug notifier transitions
    MIPS: Build microMIPS VDSO for microMIPS kernels
    MIPS: Fix sigreturn via VDSO on microMIPS kernel
    MIPS: devicetree: fix cpu interrupt controller node-names
    MIPS: VDSO: Build with `-fno-strict-aliasing'
    MIPS: Pistachio: Enable KASLR
    MIPS: lib: Mark intrinsics notrace
    MIPS: Fix 64-bit HTW configuration
    MIPS: Add 64-bit HTW fields
    MAINTAINERS: Add file patterns for mips device tree bindings
    MAINTAINERS: Add file patterns for mips brcm device tree bindings
    MIPS: Simplify DSP instruction encoding macros
    MIPS: Add missing tlbinvf/XPA microMIPS encodings
    MIPS: Fix little endian microMIPS MSA encodings
    MIPS: Add missing VZ accessor microMIPS encodings
    MIPS: Add inline asm encoding helpers
    MIPS: Spelling fix lets -> let's
    MIPS: VR41xx: Fix typo
    MIPS: oprofile: Fix typo
    MIPS: math-emu: Fix typo
    ...

    Linus Torvalds
     
  • Pull string hash improvements from George Spelvin:
    "This series does several related things:

    - Makes the dcache hash (fs/namei.c) useful for general kernel use.

    (Thanks to Bruce for noticing the zero-length corner case)

    - Converts the string hashes in to use the
    above.

    - Avoids 64-bit multiplies in hash_64() on 32-bit platforms. Two
    32-bit multiplies will do well enough.

    - Rids the world of the bad hash multipliers in hash_32.

    This finishes the job started in commit 689de1d6ca95 ("Minimal
    fix-up of bad hashing behavior of hash_64()")

    The vast majority of Linux architectures have hardware support for
    32x32-bit multiply and so derive no benefit from "simplified"
    multipliers.

    The few processors that do not (68000, h8/300 and some models of
    Microblaze) have arch-specific implementations added. Those
    patches are last in the series.

    - Overhauls the dcache hash mixing.

    The patch in commit 0fed3ac866ea ("namei: Improve hash mixing if
    CONFIG_DCACHE_WORD_ACCESS") was an off-the-cuff suggestion.
    Replaced with a much more careful design that's simultaneously
    faster and better. (My own invention, as there was noting suitable
    in the literature I could find. Comments welcome!)

    - Modify the hash_name() loop to skip the initial HASH_MIX(). This
    would let us salt the hash if we ever wanted to.

    - Sort out partial_name_hash().

    The hash function is declared as using a long state, even though
    it's truncated to 32 bits at the end and the extra internal state
    contributes nothing to the result. And some callers do odd things:

    - fs/hfs/string.c only allocates 32 bits of state
    - fs/hfsplus/unicode.c uses it to hash 16-bit unicode symbols not bytes

    - Modify bytemask_from_count to handle inputs of 1..sizeof(long)
    rather than 0..sizeof(long)-1. This would simplify users other
    than full_name_hash"

    Special thanks to Bruce Fields for testing and finding bugs in v1. (I
    learned some humbling lessons about "obviously correct" code.)

    On the arch-specific front, the m68k assembly has been tested in a
    standalone test harness, I've been in contact with the Microblaze
    maintainers who mostly don't care, as the hardware multiplier is never
    omitted in real-world applications, and I haven't heard anything from
    the H8/300 world"

    * 'hash' of git://ftp.sciencehorizons.net/linux:
    h8300: Add
    microblaze: Add
    m68k: Add
    : Add support for architecture-specific functions
    fs/namei.c: Improve dcache hash function
    Eliminate bad hash multipliers from hash_32() and hash_64()
    Change hash_64() return value to 32 bits
    : Define hash_str() in terms of hashlen_string()
    fs/namei.c: Add hashlen_string() function
    Pull out string hash to

    Linus Torvalds
     
  • This will improve the performance of hash_32() and hash_64(), but due
    to complete lack of multi-bit shift instructions on H8, performance will
    still be bad in surrounding code.

    Designing H8-specific hash algorithms to work around that is a separate
    project. (But if the maintainers would like to get in touch...)

    Signed-off-by: George Spelvin
    Cc: Yoshinori Sato
    Cc: uclinux-h8-devel@lists.sourceforge.jp

    George Spelvin
     
  • Microblaze is an FPGA soft core that can be configured various ways.

    If it is configured without a multiplier, the standard __hash_32()
    will require a call to __mulsi3, which is a slow software loop.

    Instead, use a shift-and-add sequence for the constant multiply.
    GCC knows how to do this, but it's not as clever as some.

    Signed-off-by: George Spelvin
    Cc: Alistair Francis
    Cc: Michal Simek

    George Spelvin
     
  • This provides a multiply by constant GOLDEN_RATIO_32 = 0x61C88647
    for the original mc68000, which lacks a 32x32-bit multiply instruction.

    Yes, the amount of optimization effort put in is excessive. :-)

    Shift-add chain found by Yevgen Voronenko's Hcub algorithm at
    http://spiral.ece.cmu.edu/mcm/gen.html

    Signed-off-by: George Spelvin
    Cc: Geert Uytterhoeven
    Cc: Greg Ungerer
    Cc: Andreas Schwab
    Cc: Philippe De Muyter
    Cc: linux-m68k@lists.linux-m68k.org

    George Spelvin
     
  • This is just the infrastructure; there are no users yet.

    This is modelled on CONFIG_ARCH_RANDOM; a CONFIG_ symbol declares
    the existence of .

    That file may define its own versions of various functions, and define
    HAVE_* symbols (no CONFIG_ prefix!) to suppress the generic ones.

    Included is a self-test (in lib/test_hash.c) that verifies the basics.
    It is NOT in general required that the arch-specific functions compute
    the same thing as the generic, but if a HAVE_* symbol is defined with
    the value 1, then equality is tested.

    Signed-off-by: George Spelvin
    Cc: Geert Uytterhoeven
    Cc: Greg Ungerer
    Cc: Andreas Schwab
    Cc: Philippe De Muyter
    Cc: linux-m68k@lists.linux-m68k.org
    Cc: Alistair Francis
    Cc: Michal Simek
    Cc: Yoshinori Sato
    Cc: uclinux-h8-devel@lists.sourceforge.jp

    George Spelvin
     

28 May, 2016

30 commits

  • The corresponding FROZEN hotplug notifier transitions used on
    suspend/resume are ignored. Therefore the switch case action argument
    is masked with the frozen hotplug notifier transition mask.

    Signed-off-by: Anna-Maria Gleixner
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Cc: rt@linutronix.de
    Patchwork: https://patchwork.linux-mips.org/patch/13351/
    Signed-off-by: Ralf Baechle

    Anna-Maria Gleixner
     
  • MicroMIPS kernels may be expected to run on microMIPS only cores which
    don't support the normal MIPS instruction set, so be sure to pass the
    -mmicromips flag through to the VDSO cflags.

    Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
    Signed-off-by: James Hogan
    Cc: Paul Burton
    Cc: linux-mips@linux-mips.org
    Cc: # 4.4.x-
    Patchwork: https://patchwork.linux-mips.org/patch/13349/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • In microMIPS kernels, handle_signal() sets the isa16 mode bit in the
    vdso address so that the sigreturn trampolines (which are offset from
    the VDSO) get executed as microMIPS.

    However commit ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
    changed the offsets to come from the VDSO image, which already have the
    isa16 mode bit set correctly since they're extracted from the VDSO
    shared library symbol table.

    Drop the isa16 mode bit handling from handle_signal() to fix sigreturn
    for cores which support both microMIPS and normal MIPS. This doesn't fix
    microMIPS only cores, since the VDSO is still built for normal MIPS, but
    thats a separate problem.

    Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
    Signed-off-by: James Hogan
    Cc: Paul Burton
    Cc: linux-mips@linux-mips.org
    Cc: # 4.4.x-
    Patchwork: https://patchwork.linux-mips.org/patch/13348/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • Here is the quote from [1]:

    The unit-address must match the first address specified
    in the reg property of the node. If the node has no reg property,
    the @ and unit-address must be omitted and the node-name alone
    differentiates the node from other nodes at the same level

    This patch adjusts MIPS dts-files and devicetree binding
    documentation in accordance with [1].

    [1] Power.org(tm) Standard for Embedded Power Architecture(tm)
    Platform Requirements (ePAPR). Version 1.1 – 08 April 2011.
    Chapter 2.2.1.1 Node Name Requirements

    Signed-off-by: Antony Pavlov
    Cc: Paul Burton
    Cc: Zubair Lutfullah Kakakhel
    Cc: Rob Herring
    Cc: Pawel Moll
    Cc: Mark Rutland
    Cc: Ian Campbell
    Cc: Kumar Gala
    Cc: linux-mips@linux-mips.org
    Cc: devicetree@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13345/
    Acked-by: Rob Herring
    Signed-off-by: Ralf Baechle

    Antony Pavlov
     
  • Avoid an aliasing issue causing a build error in VDSO:

    In file included from include/linux/srcu.h:34:0,
    from include/linux/notifier.h:15,
    from ./arch/mips/include/asm/uprobes.h:9,
    from include/linux/uprobes.h:61,
    from include/linux/mm_types.h:13,
    from ./arch/mips/include/asm/vdso.h:14,
    from arch/mips/vdso/vdso.h:27,
    from arch/mips/vdso/gettimeofday.c:11:
    include/linux/workqueue.h: In function 'work_static':
    include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
    return *work_data_bits(work) & WORK_STRUCT_STATIC;
    ^
    cc1: all warnings being treated as errors
    make[2]: *** [arch/mips/vdso/gettimeofday.o] Error 1

    with a CONFIG_DEBUG_OBJECTS_WORK configuration and GCC 5.2.0. Include
    `-fno-strict-aliasing' along with compiler options used, as required for
    kernel code, fixing a problem present since the introduction of VDSO
    with commit ebb5e78cc634 ("MIPS: Initial implementation of a VDSO").

    Thanks to Tejun for diagnosing this properly!

    Signed-off-by: Maciej W. Rozycki
    Reviewed-by: James Hogan
    Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
    Cc: Tejun Heo
    Cc: linux-mips@linux-mips.org
    Cc: stable@vger.kernel.org # v4.3+
    Patchwork: https://patchwork.linux-mips.org/patch/13357/
    Signed-off-by: Ralf Baechle

    Maciej W. Rozycki
     
  • Allow KASLR to be selected on Pistachio based systems. Tested on a
    Creator Ci40.

    Signed-off-by: Matt Redfearn
    Reviewed-by: James Hogan
    Cc: Andrew Bresticker
    Cc: Jonas Gorski
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13356/
    Signed-off-by: Ralf Baechle

    Matt Redfearn
     
  • On certain MIPS32 devices, the ftrace tracer "function_graph" uses
    __lshrdi3() during the capturing of trace data. ftrace then attempts to
    trace __lshrdi3() which leads to infinite recursion and a stack overflow.
    Fix this by marking __lshrdi3() as notrace. Mark the other compiler
    intrinsics as notrace in case the compiler decides to use them in the
    ftrace path.

    Signed-off-by: Harvey Hunt
    Cc:
    Cc:
    Cc: # 4.2.x-
    Patchwork: https://patchwork.linux-mips.org/patch/13354/
    Signed-off-by: Ralf Baechle

    Harvey Hunt
     
  • The Hardware page Table Walker (HTW) is being misconfigured on 64-bit
    kernels. The PWSize.PS (pointer size) bit determines whether pointers
    within directories are loaded as 32-bit or 64-bit addresses, but was
    never being set to 1 for 64-bit kernels where the unsigned long in pgd_t
    is 64-bits wide.

    This actually reduces rather than improves performance when the HTW is
    enabled on P6600 since the HTW is initiated lots, but walks are all
    aborted due I think to bad intermediate pointers.

    Since we were already taking the width of the PTEs into account by
    setting PWSize.PTEW, which is the left shift applied to the page table
    index *in addition to* the native pointer size, we also need to reduce
    PTEW by 1 when PS=1. This is done by calculating PTEW based on the
    relative size of pte_t compared to pgd_t.

    Finally in order for the HTW to be used when PS=1, the appropriate
    XK/XS/XU bits corresponding to the different 64-bit segments need to be
    set in PWCtl. We enable only XU for now to enable walking for XUSeg.

    Supporting walking for XKSeg would be a bit more involved so is left for
    a future patch. It would either require the use of a per-CPU top level
    base directory if supported by the HTW (a bit like pgd_current but with
    a second entry pointing at swapper_pg_dir), or the HTW would prepend bit
    63 of the address to the global directory index which doesn't really
    match how we split user and kernel page directories.

    Fixes: cab25bc7537b ("MIPS: Extend hardware table walking support to MIPS64")
    Signed-off-by: James Hogan
    Cc: Paul Burton
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13364/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • Add field definitions for some of the 64-bit specific Hardware page
    Table Walker (HTW) register fields in PWSize and PWCtl, in preparation
    for fixing the 64-bit HTW configuration.

    Also print these fields out along with the others in print_htw_config().

    Signed-off-by: James Hogan
    Cc: Paul Burton
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13363/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • Simplify the DSP instruction wrapper macros which use explicit encodings
    for microMIPS and normal MIPS by using the new encoding macros and
    removing duplication.

    To me this makes it easier to read since it is much shorter, but it also
    ensures .insn is used, preventing objdump disassembling the microMIPS
    code as normal MIPS.

    Signed-off-by: James Hogan
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13314/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • Hardcoded MIPS instruction encodings are provided for tlbinvf, mfhc0 &
    mthc0 instructions, but microMIPS encodings are missing. I doubt any
    microMIPS cores exist at present which support these instructions, but
    the microMIPS encodings exist, and microMIPS cores may support them in
    the future. Add the missing microMIPS encodings using the new macros.

    Signed-off-by: James Hogan
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13313/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • When the toolchain doesn't support MSA we encode MSA instructions
    explicitly in assembly. Unfortunately we use .word for both MIPS and
    microMIPS encodings which is wrong, since 32-bit microMIPS instructions
    are made up from a pair of halfwords.

    - The most significant halfword always comes first, so for little endian
    builds the halves will be emitted in the wrong order.

    - 32-bit alignment isn't guaranteed, so the assembler may insert a
    16-bit nop instruction to pad the instruction stream to a 32-bit
    boundary.

    Use the new instruction encoding macros to encode microMIPS MSA
    instructions correctly.

    Fixes: d96cc3d1ec5d ("MIPS: Add microMIPS MSA support.")
    Signed-off-by: James Hogan
    Cc: Paul Burton
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13312/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • Toolchains may be used which support microMIPS but not VZ instructions
    (i.e. binutis 2.22 & 2.23), so extend the explicitly encoded versions of
    the guest COP0 register & guest TLB access macros to support microMIPS
    encodings too, using the new macros.

    This prevents non-microMIPS instructions being executed in microMIPS
    mode during CPU probe on cores supporting VZ (e.g. M5150), which cause
    reserved instruction exceptions early during boot.

    Fixes: bad50d79255a ("MIPS: Fix VZ probe gas errors with binutils
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13311/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • To allow simplification of macros which use inline assembly to
    explicitly encode instructions, add a few simple abstractions to
    mipsregs.h which expand to specific microMIPS or normal MIPS encodings
    depending on what type of kernel is being built:

    _ASM_INSN_IF_MIPS(_enc) : Emit a 32bit MIPS instruction if microMIPS is
    not enabled.
    _ASM_INSN32_IF_MM(_enc) : Emit a 32bit microMIPS instruction if enabled.
    _ASM_INSN16_IF_MM(_enc) : Emit a 16bit microMIPS instruction if enabled.

    The macros can be used one after another since the MIPS / microMIPS
    macros are mutually exclusive, for example:

    __asm__ __volatile__(
    ".set push\n\t"
    ".set noat\n\t"
    "# mfgc0 $1, $%1, %2\n\t"
    _ASM_INSN_IF_MIPS(0x40610000 | %1 << 11 | %2)
    _ASM_INSN32_IF_MM(0x002004fc | %1 << 16 | %2 << 11)
    "move %0, $1\n\t"
    ".set pop"
    : "=r" (__res)
    : "i" (source), "i" (sel));

    Signed-off-by: James Hogan
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13310/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • As noticed by Sergei in the discussion of Andrea Gelmini's patch series.

    Signed-off-by: Ralf Baechle
    Reported-by: Sergei Shtylyov

    Ralf Baechle
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13338/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: rric@kernel.org
    Cc: linux-mips@linux-mips.org
    Cc: trivial@kernel.org
    Cc: oprofile-list@lists.sf.net
    Patchwork: https://patchwork.linux-mips.org/patch/13334/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: macro@imgtec.com
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13333/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13331/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: paul.burton@imgtec.com
    Cc: macro@imgtec.com
    Cc: james.hogan@imgtec.com
    Cc: jslaby@suse.cz
    Cc: adam.buchbinder@gmail.com
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13330/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: macro@imgtec.com
    Cc: paul.burton@imgtec.com
    Cc: Leonid.Yegoshin@imgtec.com
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13329/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: adam.buchbinder@gmail.com
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13328/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: david.daney@cavium.com
    Cc: janne.huttunen@nokia.com
    Cc: aaro.koskinen@nokia.com
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13324/
    Patchwork: https://patchwork.linux-mips.org/patch/13325/
    Patchwork: https://patchwork.linux-mips.org/patch/13326/
    Patchwork: https://patchwork.linux-mips.org/patch/13327/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: linux-mips@linux-mips.org
    Cc: trivial@kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13323/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: chenhc@lemote.com
    Cc: viresh.kumar@linaro.org
    Cc: linux-mips@linux-mips.org
    Cc: trivial@kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13322/
    Patchwork: https://patchwork.linux-mips.org/patch/13332/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13321/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13320/
    Patchwork: https://patchwork.linux-mips.org/patch/13335/
    Patchwork: https://patchwork.linux-mips.org/patch/13336/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13319/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: trivial@kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13318/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini
     
  • Signed-off-by: Andrea Gelmini
    Cc: chenhc@lemote.com
    Cc: james.hogan@imgtec.com
    Cc: linux-mips@linux-mips.org
    Cc: trivial@kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13317/
    Signed-off-by: Ralf Baechle

    Andrea Gelmini