1. 21 8月, 2018 1 次提交
  2. 18 8月, 2018 1 次提交
    • S
      x86/speculation/l1tf: Exempt zeroed PTEs from inversion · f19f5c49
      Sean Christopherson 提交于
      It turns out that we should *not* invert all not-present mappings,
      because the all zeroes case is obviously special.
      
      clear_page() does not undergo the XOR logic to invert the address bits,
      i.e. PTE, PMD and PUD entries that have not been individually written
      will have val=0 and so will trigger __pte_needs_invert(). As a result,
      {pte,pmd,pud}_pfn() will return the wrong PFN value, i.e. all ones
      (adjusted by the max PFN mask) instead of zero. A zeroed entry is ok
      because the page at physical address 0 is reserved early in boot
      specifically to mitigate L1TF, so explicitly exempt them from the
      inversion when reading the PFN.
      
      Manifested as an unexpected mprotect(..., PROT_NONE) failure when called
      on a VMA that has VM_PFNMAP and was mmap'd to as something other than
      PROT_NONE but never used. mprotect() sends the PROT_NONE request down
      prot_none_walk(), which walks the PTEs to check the PFNs.
      prot_none_pte_entry() gets the bogus PFN from pte_pfn() and returns
      -EACCES because it thinks mprotect() is trying to adjust a high MMIO
      address.
      
      [ This is a very modified version of Sean's original patch, but all
        credit goes to Sean for doing this and also pointing out that
        sometimes the __pte_needs_invert() function only gets the protection
        bits, not the full eventual pte.  But zero remains special even in
        just protection bits, so that's ok.   - Linus ]
      
      Fixes: f22cc87f ("x86/speculation/l1tf: Invert all not present mappings")
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f19f5c49
  3. 17 8月, 2018 1 次提交
  4. 16 8月, 2018 2 次提交
  5. 15 8月, 2018 2 次提交
  6. 13 8月, 2018 9 次提交
  7. 11 8月, 2018 2 次提交
    • A
      lib/ubsan: remove null-pointer checks · 3ca17b1f
      Andrey Ryabinin 提交于
      With gcc-8 fsanitize=null become very noisy.  GCC started to complain
      about things like &a->b, where 'a' is NULL pointer.  There is no NULL
      dereference, we just calculate address to struct member.  It's
      technically undefined behavior so UBSAN is correct to report it.  But as
      long as there is no real NULL-dereference, I think, we should be fine.
      
      -fno-delete-null-pointer-checks compiler flag should protect us from any
      consequences.  So let's just no use -fsanitize=null as it's not useful
      for us.  If there is a real NULL-deref we will see crash.  Even if
      userspace mapped something at NULL (root can do this), with things like
      SMAP should catch the issue.
      
      Link: http://lkml.kernel.org/r/20180802153209.813-1-aryabinin@virtuozzo.comSigned-off-by: NAndrey Ryabinin <aryabinin@virtuozzo.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3ca17b1f
    • J
      x86/mm/pti: Move user W+X check into pti_finalize() · d878efce
      Joerg Roedel 提交于
      The user page-table gets the updated kernel mappings in pti_finalize(),
      which runs after the RO+X permissions got applied to the kernel page-table
      in mark_readonly().
      
      But with CONFIG_DEBUG_WX enabled, the user page-table is already checked in
      mark_readonly() for insecure mappings.  This causes false-positive
      warnings, because the user page-table did not get the updated mappings yet.
      
      Move the W+X check for the user page-table into pti_finalize() after it
      updated all required mappings.
      
      [ tglx: Folded !NX supported fix ]
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: linux-mm@kvack.org
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: David Laight <David.Laight@aculab.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Eduardo Valentin <eduval@amazon.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: aliguori@amazon.com
      Cc: daniel.gruss@iaik.tugraz.at
      Cc: hughd@google.com
      Cc: keescook@google.com
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Waiman Long <llong@redhat.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "David H . Gutteridge" <dhgutteridge@sympatico.ca>
      Cc: joro@8bytes.org
      Link: https://lkml.kernel.org/r/1533727000-9172-1-git-send-email-joro@8bytes.org
      d878efce
  8. 10 8月, 2018 3 次提交
  9. 09 8月, 2018 8 次提交
  10. 08 8月, 2018 11 次提交
    • G
      arm64: alternative: Use true and false for boolean values · 3c4d9137
      Gustavo A. R. Silva 提交于
      Return statements in functions returning bool should use true or false
      instead of an integer value. This code was detected with the help of
      Coccinelle.
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      3c4d9137
    • A
      x86/mm/pat: Make set_memory_np() L1TF safe · 958f79b9
      Andi Kleen 提交于
      set_memory_np() is used to mark kernel mappings not present, but it has
      it's own open coded mechanism which does not have the L1TF protection of
      inverting the address bits.
      
      Replace the open coded PTE manipulation with the L1TF protecting low level
      PTE routines.
      
      Passes the CPA self test.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      958f79b9
    • A
      x86/speculation/l1tf: Make pmd/pud_mknotpresent() invert · 0768f915
      Andi Kleen 提交于
      Some cases in THP like:
        - MADV_FREE
        - mprotect
        - split
      
      mark the PMD non present for temporarily to prevent races. The window for
      an L1TF attack in these contexts is very small, but it wants to be fixed
      for correctness sake.
      
      Use the proper low level functions for pmd/pud_mknotpresent() to address
      this.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      0768f915
    • A
      x86/speculation/l1tf: Invert all not present mappings · f22cc87f
      Andi Kleen 提交于
      For kernel mappings PAGE_PROTNONE is not necessarily set for a non present
      mapping, but the inversion logic explicitely checks for !PRESENT and
      PROT_NONE.
      
      Remove the PROT_NONE check and make the inversion unconditional for all not
      present mappings.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      f22cc87f
    • P
      MIPS: VDSO: Force link endianness · 2f002567
      Paul Burton 提交于
      When building the VDSO with clang it appears to invoke ld without
      specifying endianness, even though clang itself was provided with a -EB
      or -EL flag. This results in the build failing due to a mismatch between
      the objects that are the input to ld, and the output it is attempting to
      create:
      
        VDSO    arch/mips/vdso/vdso.so.dbg.raw
        mips-linux-ld: arch/mips/vdso/elf.o: compiled for a big endian system
          and target is little endian
        mips-linux-ld: arch/mips/vdso/elf.o: endianness incompatible with that
          of the selected emulation
        mips-linux-ld: failed to merge target specific data of file
          arch/mips/vdso/elf.o
        ...
      
      Work around this problem by explicitly specifying the link endianness
      using -Wl,-EB or -Wl,-EL when -EB or -EL are part of KBUILD_CFLAGS. This
      resolves the build failure when using clang, and doesn't have any
      negative effect on gcc.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      2f002567
    • P
      MIPS: Always specify -EB or -EL when using clang · c6d6f4c5
      Paul Burton 提交于
      When building using clang, always specify -EB or -EL in order to ensure
      we target the desired endianness.
      
      Since clang cross compiles using a single compiler build with multiple
      targets, our -dumpmachine tests which don't specify clang's --target
      argument check output based upon the build machine rather than the
      machine our build will target. This means our detection of whether to
      specify -EB fails miserably & we never do. Providing the endianness flag
      unconditionally for clang resolves this issue & simplifies the clang
      path somewhat.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      c6d6f4c5
    • J
      x86/mm/pti: Clone kernel-image on PTE level for 32 bit · 16a3fe63
      Joerg Roedel 提交于
      On 32 bit the kernel sections are not huge-page aligned.  When we clone
      them on PMD-level we unevitably map some areas that are normal kernel
      memory and may contain secrets to user-space. To prevent that we need to
      clone the kernel-image on PTE-level for 32 bit.
      
      Also make the page-table cloning code more general so that it can handle
      PMD and PTE level cloning. This can be generalized further in the future to
      also handle clones on the P4D-level.
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: linux-mm@kvack.org
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: David Laight <David.Laight@aculab.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Eduardo Valentin <eduval@amazon.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: aliguori@amazon.com
      Cc: daniel.gruss@iaik.tugraz.at
      Cc: hughd@google.com
      Cc: keescook@google.com
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Waiman Long <llong@redhat.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "David H . Gutteridge" <dhgutteridge@sympatico.ca>
      Cc: joro@8bytes.org
      Link: https://lkml.kernel.org/r/1533637471-30953-4-git-send-email-joro@8bytes.org
      16a3fe63
    • J
      x86/mm/pti: Don't clear permissions in pti_clone_pmd() · 30514eff
      Joerg Roedel 提交于
      The function sets the global-bit on cloned PMD entries, which only makes
      sense when the permissions are identical between the user and the kernel
      page-table. Further, only write-permissions are cleared for entry-text and
      kernel-text sections, which are not writeable at the end of the boot
      process.
      
      The reason why this RW clearing exists is that in the early PTI
      implementations the cloned kernel areas were set up during early boot
      before the kernel text is set to read only and not touched afterwards.
      
      This is not longer true. The cloned areas are still set up early to get the
      entry code working for interrupts and other things, but after the kernel
      text has been set RO the clone is repeated which copies the RO PMD/PTEs
      over to the user visible clone. That means the initial clearing of the
      writable bit can be avoided.
      
      [ tglx: Amended changelog ]
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NDave Hansen <dave.hansen@intel.com>
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: linux-mm@kvack.org
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: David Laight <David.Laight@aculab.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Eduardo Valentin <eduval@amazon.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: aliguori@amazon.com
      Cc: daniel.gruss@iaik.tugraz.at
      Cc: hughd@google.com
      Cc: keescook@google.com
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Waiman Long <llong@redhat.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "David H . Gutteridge" <dhgutteridge@sympatico.ca>
      Cc: joro@8bytes.org
      Link: https://lkml.kernel.org/r/1533637471-30953-3-git-send-email-joro@8bytes.org
      30514eff
    • P
      x86/paravirt: Fix spectre-v2 mitigations for paravirt guests · 5800dc5c
      Peter Zijlstra 提交于
      Nadav reported that on guests we're failing to rewrite the indirect
      calls to CALLEE_SAVE paravirt functions. In particular the
      pv_queued_spin_unlock() call is left unpatched and that is all over the
      place. This obviously wrecks Spectre-v2 mitigation (for paravirt
      guests) which relies on not actually having indirect calls around.
      
      The reason is an incorrect clobber test in paravirt_patch_call(); this
      function rewrites an indirect call with a direct call to the _SAME_
      function, there is no possible way the clobbers can be different
      because of this.
      
      Therefore remove this clobber check. Also put WARNs on the other patch
      failure case (not enough room for the instruction) which I've not seen
      trigger in my (limited) testing.
      
      Three live kernel image disassemblies for lock_sock_nested (as a small
      function that illustrates the problem nicely). PRE is the current
      situation for guests, POST is with this patch applied and NATIVE is with
      or without the patch for !guests.
      
      PRE:
      
      (gdb) disassemble lock_sock_nested
      Dump of assembler code for function lock_sock_nested:
         0xffffffff817be970 <+0>:     push   %rbp
         0xffffffff817be971 <+1>:     mov    %rdi,%rbp
         0xffffffff817be974 <+4>:     push   %rbx
         0xffffffff817be975 <+5>:     lea    0x88(%rbp),%rbx
         0xffffffff817be97c <+12>:    callq  0xffffffff819f7160 <_cond_resched>
         0xffffffff817be981 <+17>:    mov    %rbx,%rdi
         0xffffffff817be984 <+20>:    callq  0xffffffff819fbb00 <_raw_spin_lock_bh>
         0xffffffff817be989 <+25>:    mov    0x8c(%rbp),%eax
         0xffffffff817be98f <+31>:    test   %eax,%eax
         0xffffffff817be991 <+33>:    jne    0xffffffff817be9ba <lock_sock_nested+74>
         0xffffffff817be993 <+35>:    movl   $0x1,0x8c(%rbp)
         0xffffffff817be99d <+45>:    mov    %rbx,%rdi
         0xffffffff817be9a0 <+48>:    callq  *0xffffffff822299e8
         0xffffffff817be9a7 <+55>:    pop    %rbx
         0xffffffff817be9a8 <+56>:    pop    %rbp
         0xffffffff817be9a9 <+57>:    mov    $0x200,%esi
         0xffffffff817be9ae <+62>:    mov    $0xffffffff817be993,%rdi
         0xffffffff817be9b5 <+69>:    jmpq   0xffffffff81063ae0 <__local_bh_enable_ip>
         0xffffffff817be9ba <+74>:    mov    %rbp,%rdi
         0xffffffff817be9bd <+77>:    callq  0xffffffff817be8c0 <__lock_sock>
         0xffffffff817be9c2 <+82>:    jmp    0xffffffff817be993 <lock_sock_nested+35>
      End of assembler dump.
      
      POST:
      
      (gdb) disassemble lock_sock_nested
      Dump of assembler code for function lock_sock_nested:
         0xffffffff817be970 <+0>:     push   %rbp
         0xffffffff817be971 <+1>:     mov    %rdi,%rbp
         0xffffffff817be974 <+4>:     push   %rbx
         0xffffffff817be975 <+5>:     lea    0x88(%rbp),%rbx
         0xffffffff817be97c <+12>:    callq  0xffffffff819f7160 <_cond_resched>
         0xffffffff817be981 <+17>:    mov    %rbx,%rdi
         0xffffffff817be984 <+20>:    callq  0xffffffff819fbb00 <_raw_spin_lock_bh>
         0xffffffff817be989 <+25>:    mov    0x8c(%rbp),%eax
         0xffffffff817be98f <+31>:    test   %eax,%eax
         0xffffffff817be991 <+33>:    jne    0xffffffff817be9ba <lock_sock_nested+74>
         0xffffffff817be993 <+35>:    movl   $0x1,0x8c(%rbp)
         0xffffffff817be99d <+45>:    mov    %rbx,%rdi
         0xffffffff817be9a0 <+48>:    callq  0xffffffff810a0c20 <__raw_callee_save___pv_queued_spin_unlock>
         0xffffffff817be9a5 <+53>:    xchg   %ax,%ax
         0xffffffff817be9a7 <+55>:    pop    %rbx
         0xffffffff817be9a8 <+56>:    pop    %rbp
         0xffffffff817be9a9 <+57>:    mov    $0x200,%esi
         0xffffffff817be9ae <+62>:    mov    $0xffffffff817be993,%rdi
         0xffffffff817be9b5 <+69>:    jmpq   0xffffffff81063aa0 <__local_bh_enable_ip>
         0xffffffff817be9ba <+74>:    mov    %rbp,%rdi
         0xffffffff817be9bd <+77>:    callq  0xffffffff817be8c0 <__lock_sock>
         0xffffffff817be9c2 <+82>:    jmp    0xffffffff817be993 <lock_sock_nested+35>
      End of assembler dump.
      
      NATIVE:
      
      (gdb) disassemble lock_sock_nested
      Dump of assembler code for function lock_sock_nested:
         0xffffffff817be970 <+0>:     push   %rbp
         0xffffffff817be971 <+1>:     mov    %rdi,%rbp
         0xffffffff817be974 <+4>:     push   %rbx
         0xffffffff817be975 <+5>:     lea    0x88(%rbp),%rbx
         0xffffffff817be97c <+12>:    callq  0xffffffff819f7160 <_cond_resched>
         0xffffffff817be981 <+17>:    mov    %rbx,%rdi
         0xffffffff817be984 <+20>:    callq  0xffffffff819fbb00 <_raw_spin_lock_bh>
         0xffffffff817be989 <+25>:    mov    0x8c(%rbp),%eax
         0xffffffff817be98f <+31>:    test   %eax,%eax
         0xffffffff817be991 <+33>:    jne    0xffffffff817be9ba <lock_sock_nested+74>
         0xffffffff817be993 <+35>:    movl   $0x1,0x8c(%rbp)
         0xffffffff817be99d <+45>:    mov    %rbx,%rdi
         0xffffffff817be9a0 <+48>:    movb   $0x0,(%rdi)
         0xffffffff817be9a3 <+51>:    nopl   0x0(%rax)
         0xffffffff817be9a7 <+55>:    pop    %rbx
         0xffffffff817be9a8 <+56>:    pop    %rbp
         0xffffffff817be9a9 <+57>:    mov    $0x200,%esi
         0xffffffff817be9ae <+62>:    mov    $0xffffffff817be993,%rdi
         0xffffffff817be9b5 <+69>:    jmpq   0xffffffff81063ae0 <__local_bh_enable_ip>
         0xffffffff817be9ba <+74>:    mov    %rbp,%rdi
         0xffffffff817be9bd <+77>:    callq  0xffffffff817be8c0 <__lock_sock>
         0xffffffff817be9c2 <+82>:    jmp    0xffffffff817be993 <lock_sock_nested+35>
      End of assembler dump.
      
      
      Fixes: 63f70270 ("[PATCH] i386: PARAVIRT: add common patching machinery")
      Fixes: 3010a066 ("x86/paravirt, objtool: Annotate indirect calls")
      Reported-by: NNadav Amit <namit@vmware.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: stable@vger.kernel.org
      5800dc5c
    • P
      MIPS: Use dins to simplify __write_64bit_c0_split() · 36dc5b20
      Paul Burton 提交于
      The code in __write_64bit_c0_split() is used by MIPS32 kernels running
      on MIPS64 CPUs to write a 64-bit value to a 64-bit coprocessor 0
      register using a single 64-bit dmtc0 instruction. It does this by
      combining the 2x 32-bit registers used to hold the 64-bit value into a
      single register, which in the existing code involves three steps:
      
        1) Zero extend register A which holds bits 31:0 of our data, since it
           may have previously held a sign-extended value.
      
        2) Shift register B which holds bits 63:32 of our data in bits 31:0
           left by 32 bits, such that the bits forming our data are in the
           position they'll be in the final 64-bit value & bits 31:0 of the
           register are zero.
      
        3) Or the two registers together to form the 64-bit value in one
           64-bit register.
      
      From MIPS r2 onwards we have a dins instruction which can effectively
      perform all 3 of those steps using a single instruction.
      
      Add a path for MIPS r2 & beyond which uses dins to take bits 31:0 from
      register B & insert them into bits 63:32 of register A, giving us our
      full 64-bit value in register A with one instruction.
      
      Since we know that MIPS r2 & above support the sel field for the dmtc0
      instruction, we don't bother special casing sel==0. Omiting the sel
      field would assemble to exactly the same instruction as when we
      explicitly specify that it equals zero.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      36dc5b20
    • P
      MIPS: Use read-write output operand in __write_64bit_c0_split() · 08eeb44b
      Paul Burton 提交于
      Commit c22c8043 ("MIPS: Fix input modify in
      __write_64bit_c0_split()") modified __write_64bit_c0_split() constraints
      such that we have both an input & an output which we hope to assign to
      the same registers, and modify the output rather than incorrectly
      clobbering an input.
      
      The way in which we use both an output & an input parameter with the
      input constrained to share the output registers is a little convoluted &
      also problematic for clang, which complains if the input & output values
      have different widths. For example:
      
        In file included from kernel/fork.c:98:
        ./arch/mips/include/asm/mmu_context.h:149:19: error: unsupported
          inline asm: input with type 'unsigned long' matching output with
          type 'unsigned long long'
                write_c0_entryhi(cpu_asid(cpu, next));
                ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
        ./arch/mips/include/asm/mmu_context.h:93:2: note: expanded from macro
          'cpu_asid'
                (cpu_context((cpu), (mm)) & cpu_asid_mask(&cpu_data[cpu]))
                ^
        ./arch/mips/include/asm/mipsregs.h:1617:65: note: expanded from macro
          'write_c0_entryhi'
        #define write_c0_entryhi(val)   __write_ulong_c0_register($10, 0, val)
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
        ./arch/mips/include/asm/mipsregs.h:1430:39: note: expanded from macro
          '__write_ulong_c0_register'
                        __write_64bit_c0_register(reg, sel, val);               \
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
        ./arch/mips/include/asm/mipsregs.h:1400:41: note: expanded from macro
          '__write_64bit_c0_register'
                        __write_64bit_c0_split(register, sel, value);           \
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
        ./arch/mips/include/asm/mipsregs.h:1498:13: note: expanded from macro
          '__write_64bit_c0_split'
                                : "r,0" (val));                                 \
                                         ^~~
      
      We can both fix this build failure & simplify the code somewhat by
      assigning the __tmp variable with the input value in C prior to our
      inline assembly, and then using a single read-write output operand (ie.
      a constraint beginning with +) to provide this value to our assembly.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      08eeb44b