1. 11 9月, 2015 1 次提交
    • C
      dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent} · 6894258e
      Christoph Hellwig 提交于
      Since 2009 we have a nice asm-generic header implementing lots of DMA API
      functions for architectures using struct dma_map_ops, but unfortunately
      it's still missing a lot of APIs that all architectures still have to
      duplicate.
      
      This series consolidates the remaining functions, although we still need
      arch opt outs for two of them as a few architectures have very
      non-standard implementations.
      
      This patch (of 5):
      
      The coherent DMA allocator works the same over all architectures supporting
      dma_map operations.
      
      This patch consolidates them and converges the minor differences:
      
       - the debug_dma helpers are now called from all architectures, including
         those that were previously missing them
       - dma_alloc_from_coherent and dma_release_from_coherent are now always
         called from the generic alloc/free routines instead of the ops
         dma-mapping-common.h always includes dma-coherent.h to get the defintions
         for them, or the stubs if the architecture doesn't support this feature
       - checks for ->alloc / ->free presence are removed.  There is only one
         magic instead of dma_map_ops without them (mic_dma_ops) and that one
         is x86 only anyway.
      
      Besides that only x86 needs special treatment to replace a default devices
      if none is passed and tweak the gfp_flags.  An optional arch hook is provided
      for that.
      
      [linux@roeck-us.net: fix build]
      [jcmvbkbc@gmail.com: fix xtensa]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6894258e
  2. 03 9月, 2015 4 次提交
  3. 26 8月, 2015 3 次提交
  4. 03 8月, 2015 2 次提交
    • R
      MIPS: Partially disable RIXI support. · 55fdcb2d
      Ralf Baechle 提交于
      Execution of break instruction, trap instructions, emulation of unaligned
      loads or floating point instructions - anything that tries to read the
      instruction's opcode from userspace - needs read access to a page.
      
      RIXI (Read Inhibit / Execute Inhibit) support however allows the creation of
      pags that are executable but not readable.  On such a mapping the attempted
      load of the opcode by the kernel is going to cause an endless loop of
      page faults.
      
      The quick workaround for this is to disable the combinations that the kernel
      currently isn't able to handle which are executable mappings.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      55fdcb2d
    • R
      MIPS: Handle page faults of executable but unreadable pages correctly. · e070dab7
      Ralf Baechle 提交于
      Without this we end taking execeptions in an endless loop hanging the
      thread.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e070dab7
  5. 10 7月, 2015 2 次提交
  6. 25 6月, 2015 1 次提交
    • Z
      mm/hugetlb: reduce arch dependent code about huge_pmd_unshare · e81f2d22
      Zhang Zhen 提交于
      Currently we have many duplicates in definitions of huge_pmd_unshare.  In
      all architectures this function just returns 0 when
      CONFIG_ARCH_WANT_HUGE_PMD_SHARE is N.
      
      This patch puts the default implementation in mm/hugetlb.c and lets these
      architectures use the common code.
      Signed-off-by: NZhang Zhen <zhenzhang.zhang@huawei.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: James Yang <James.Yang@freescale.com>
      Cc: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e81f2d22
  7. 22 6月, 2015 9 次提交
  8. 17 6月, 2015 3 次提交
  9. 06 6月, 2015 1 次提交
  10. 19 5月, 2015 3 次提交
  11. 16 5月, 2015 1 次提交
  12. 15 4月, 2015 2 次提交
    • K
      mm: expose arch_mmap_rnd when available · 2b68f6ca
      Kees Cook 提交于
      When an architecture fully supports randomizing the ELF load location,
      a per-arch mmap_rnd() function is used to find a randomized mmap base.
      In preparation for randomizing the location of ET_DYN binaries
      separately from mmap, this renames and exports these functions as
      arch_mmap_rnd(). Additionally introduces CONFIG_ARCH_HAS_ELF_RANDOMIZE
      for describing this feature on architectures that support it
      (which is a superset of ARCH_BINFMT_ELF_RANDOMIZE_PIE, since s390
      already supports a separated ET_DYN ASLR from mmap ASLR without the
      ARCH_BINFMT_ELF_RANDOMIZE_PIE logic).
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Cc: Hector Marco-Gisbert <hecmargi@upv.es>
      Cc: Russell King <linux@arm.linux.org.uk>
      Reviewed-by: NIngo Molnar <mingo@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Andrey Ryabinin <a.ryabinin@samsung.com>
      Cc: Arun Chandran <achandran@mvista.com>
      Cc: Yann Droneaud <ydroneaud@opteya.com>
      Cc: Min-Hua Chen <orca.chen@gmail.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Vineeth Vijayan <vvijayan@mvista.com>
      Cc: Jeff Bailey <jeffbailey@google.com>
      Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: Behan Webster <behanw@converseincode.com>
      Cc: Ismael Ripoll <iripoll@upv.es>
      Cc: Jan-Simon Mller <dl9pf@gmx.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2b68f6ca
    • K
      mips: extract logic for mmap_rnd() · 1f0569df
      Kees Cook 提交于
      In preparation for splitting out ET_DYN ASLR, extract the mmap ASLR
      selection into a separate function.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NIngo Molnar <mingo@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1f0569df
  13. 10 4月, 2015 1 次提交
  14. 02 4月, 2015 1 次提交
    • M
      MIPS: c-r4k.c: Fix the 74K D-cache alias erratum workaround · e2e7f29a
      Maciej W. Rozycki 提交于
      Fix the 74K D-cache alias erratum workaround so that it actually works.
      Our current code sets MIPS_CACHE_VTAG for the D-cache, but that flag
      only has any effect for the I-cache.  Additionally MIPS_CACHE_PINDEX is
      set for the D-cache if CP0.Config7.AR is also set for an affected
      processor, leading to confusing information in the bootstrap log (the
      flag isn't used beyond that).
      
      So delete the setting of MIPS_CACHE_VTAG and rely on MIPS_CACHE_ALIASES,
      set in a common place, removing I-cache coherency issues seen in GDB
      testing with software breakpoints, gdbserver and ptrace(2), on affected
      systems.
      
      While at it add a little piece of explanation of what CP0.Config6.SYND
      is so that people do not have to chase documentation.
      Signed-off-by: NMaciej W. Rozycki <macro@codesourcery.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/8507/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e2e7f29a
  15. 01 4月, 2015 2 次提交
  16. 25 3月, 2015 2 次提交
    • L
      MIPS: Fix race condition in lazy cache flushing. · 4d46a67a
      Lars Persson 提交于
      The lazy cache flushing implemented in the MIPS kernel suffers from a
      race condition that is exposed by do_set_pte() in mm/memory.c.
      
      A pre-condition is a file-system that writes to the page from the CPU
      in its readpage method and then calls flush_dcache_page(). One example
      is ubifs. Another pre-condition is that the dcache flush is postponed
      in __flush_dcache_page().
      
      Upon a page fault for an executable mapping not existing in the
      page-cache, the following will happen:
      1. Write to the page
      2. flush_dcache_page
      3. flush_icache_page
      4. set_pte_at
      5. update_mmu_cache (commits the flush of a dcache-dirty page)
      
      Between steps 4 and 5 another thread can hit the same page and it will
      encounter a valid pte. Because the data still is in the L1 dcache the CPU
      will fetch stale data from L2 into the icache and execute garbage.
      
      This fix moves the commit of the cache flush to step 3 to close the
      race window. It also reduces the amount of flushes on non-executable
      mappings because we never enter __flush_dcache_page() for non-aliasing
      CPUs.
      
      Regressions can occur in drivers that mistakenly relies on the
      flush_dcache_page() in get_user_pages() for DMA operations.
      
      [ralf@linux-mips.org: Folded in patch 9346 to fix highmem issue.]
      Signed-off-by: NLars Persson <larper@axis.com>
      Cc: linux-mips@linux-mips.org
      Cc: paul.burton@imgtec.com
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/9346/
      Patchwork: https://patchwork.linux-mips.org/patch/9738/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4d46a67a
    • L
      Revert "MIPS: Remove race window in page fault handling" · 5b9593f3
      Lars Persson 提交于
      Revert commit 2a4a8b1e ("MIPS: Remove race window in page fault
      handling") because it increased the number of flushed dcache pages and
      became a performance problem for some workloads.
      Signed-off-by: NLars Persson <larper@axis.com>
      Cc: linux-mips@linux-mips.org
      Cc: paul.burton@imgtec.com
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/9345/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5b9593f3
  17. 20 3月, 2015 1 次提交
  18. 18 3月, 2015 1 次提交
    • S
      MIPS: Rearrange PTE bits into fixed positions. · be0c37c9
      Steven J. Hill 提交于
      This patch rearranges the PTE bits into fixed positions for R2
      and later cores. In the past, the TLB handling code did runtime
      checking of RI/XI and adjusted the shifts and rotates in order
      to fit the largest PFN value into the PTE. The checking now
      occurs when building the TLB handler, thus eliminating those
      checks. These new arrangements also define the largest possible
      PFN value that can fit in the PTE. HUGE page support is only
      available for 64-bit cores. Layouts of the PTE bits are now:
      
         64-bit, R1 or earlier:     CCC D V G [S H] M A W R P
         32-bit, R1 or earler:      CCC D V G M A W R P
         64-bit, R2 or later:       CCC D V G RI/R XI [S H] M A W P
         32-bit, R2 or later:       CCC D V G RI/R XI M A W P
      
      [ralf@linux-mips.org: Fix another build error *rant* *rant*]
      Signed-off-by: NSteven J. Hill <Steven.Hill@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/9353/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      be0c37c9