Skip to content
Snippets Groups Projects
  1. Sep 09, 2021
  2. Sep 01, 2021
  3. Aug 30, 2021
  4. Aug 09, 2021
  5. Jul 01, 2021
  6. Oct 06, 2020
    • Christoph Hellwig's avatar
      dma-mapping: split <linux/dma-mapping.h> · 0a0f0d8b
      Christoph Hellwig authored
      
      Split out all the bits that are purely for dma_map_ops implementations
      and related code into a new <linux/dma-map-ops.h> header so that they
      don't get pulled into all the drivers.  That also means the architecture
      specific <asm/dma-mapping.h> is not pulled in by <linux/dma-mapping.h>
      any more, which leads to a missing includes that were pulled in by the
      x86 or arm versions in a few not overly portable drivers.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      0a0f0d8b
  7. Sep 25, 2020
    • Christoph Hellwig's avatar
      dma-mapping: add a new dma_alloc_pages API · efa70f2f
      Christoph Hellwig authored
      
      This API is the equivalent of alloc_pages, except that the returned memory
      is guaranteed to be DMA addressable by the passed in device.  The
      implementation will also be used to provide a more sensible replacement
      for DMA_ATTR_NON_CONSISTENT flag.
      
      Additionally dma_alloc_noncoherent is switched over to use dma_alloc_pages
      as its backend.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> (MIPS part)
      efa70f2f
  8. Sep 03, 2020
    • Nicolin Chen's avatar
      dma-mapping: introduce dma_get_seg_boundary_nr_pages() · 1e9d90db
      Nicolin Chen authored
      
      We found that callers of dma_get_seg_boundary mostly do an ALIGN
      with page mask and then do a page shift to get number of pages:
          ALIGN(boundary + 1, 1 << shift) >> shift
      
      However, the boundary might be as large as ULONG_MAX, which means
      that a device has no specific boundary limit. So either "+ 1" or
      passing it to ALIGN() would potentially overflow.
      
      According to kernel defines:
          #define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
          #define ALIGN(x, a)	ALIGN_MASK(x, (typeof(x))(a) - 1)
      
      We can simplify the logic here into a helper function doing:
        ALIGN(boundary + 1, 1 << shift) >> shift
      = ALIGN_MASK(b + 1, (1 << s) - 1) >> s
      = {[b + 1 + (1 << s) - 1] & ~[(1 << s) - 1]} >> s
      = [b + 1 + (1 << s) - 1] >> s
      = [b + (1 << s)] >> s
      = (b >> s) + 1
      
      This patch introduces and applies dma_get_seg_boundary_nr_pages()
      as an overflow-free helper for the dma_get_seg_boundary() callers
      to get numbers of pages. It also takes care of the NULL dev case
      for non-DMA API callers.
      
      Suggested-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
      Acked-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      1e9d90db
  9. Aug 12, 2020
  10. Jun 26, 2020
  11. Apr 05, 2020
  12. Feb 04, 2020
  13. Jan 06, 2020
  14. Oct 14, 2019
  15. Sep 08, 2019
    • Helge Deller's avatar
      parisc: Disable HP HSC-PCI Cards to prevent kernel crash · 5fa16591
      Helge Deller authored
      
      The HP Dino PCI controller chip can be used in two variants: as on-board
      controller (e.g. in B160L), or on an Add-On card ("Card-Mode") to bridge
      PCI components to systems without a PCI bus, e.g. to a HSC/GSC bus.  One
      such Add-On card is the HP HSC-PCI Card which has one or more DEC Tulip
      PCI NIC chips connected to the on-card Dino PCI controller.
      
      Dino in Card-Mode has a big disadvantage: All PCI memory accesses need
      to go through the DINO_MEM_DATA register, so Linux drivers will not be
      able to use the ioremap() function. Without ioremap() many drivers will
      not work, one example is the tulip driver which then simply crashes the
      kernel if it tries to access the ports on the HP HSC card.
      
      This patch disables the HP HSC card if it finds one, and as such
      fixes the kernel crash on a HP D350/2 machine.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Noticed-by: default avatarPhil Scarr <phil.scarr@pm.me>
      Cc: stable@vger.kernel.org
      5fa16591
  16. Sep 05, 2019
  17. Sep 04, 2019
    • Christoph Hellwig's avatar
      parisc: don't set ARCH_NO_COHERENT_DMA_MMAP · 5128da32
      Christoph Hellwig authored
      
      parisc is the only architecture that sets ARCH_NO_COHERENT_DMA_MMAP
      when an MMU is enabled.  AFAIK this is because parisc CPUs use VIVT
      caches, which means exporting normally cachable memory to userspace is
      relatively dangrous due to cache aliasing.
      
      But normally cachable memory is only allocated by dma_alloc_coherent
      on parisc when using the sba_iommu or ccio_iommu drivers, so just
      remove the .mmap implementation for them so that we don't have to set
      ARCH_NO_COHERENT_DMA_MMAP, which I plan to get rid of.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      5128da32
    • Christoph Hellwig's avatar
      dma-mapping: explicitly wire up ->mmap and ->get_sgtable · f9f3232a
      Christoph Hellwig authored
      
      While the default ->mmap and ->get_sgtable implementations work for the
      majority of our dma_map_ops impementations they are inherently safe
      for others that don't use the page allocator or CMA and/or use their
      own way of remapping not covered by the common code.  So remove the
      defaults if these methods are not wired up, but instead wire up the
      default implementations for all safe instances.
      
      Fixes: e1c7e324 ("dma-mapping: always provide the dma_map_ops based implementation")
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      f9f3232a
  18. Jun 06, 2019
    • danglin44's avatar
      parisc: Use lpa instruction to load physical addresses in driver code · 116d7533
      danglin44 authored and Helge Deller's avatar Helge Deller committed
      
      Most I/O in the kernel is done using the kernel offset mapping.
      However, there is one API that uses aliased kernel address ranges:
      
      > The final category of APIs is for I/O to deliberately aliased address
      > ranges inside the kernel.  Such aliases are set up by use of the
      > vmap/vmalloc API.  Since kernel I/O goes via physical pages, the I/O
      > subsystem assumes that the user mapping and kernel offset mapping are
      > the only aliases.  This isn't true for vmap aliases, so anything in
      > the kernel trying to do I/O to vmap areas must manually manage
      > coherency.  It must do this by flushing the vmap range before doing
      > I/O and invalidating it after the I/O returns.
      
      For this reason, we should use the hardware lpa instruction to load the
      physical address of kernel virtual addresses in the driver code.
      
      I believe we only use the vmap/vmalloc API with old PA 1.x processors
      which don't have a sba, so we don't hit this problem.
      
      Tested on c3750, c8000 and rp3440.
      
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      116d7533
    • danglin44's avatar
      parisc: Use implicit space register selection for loading the coherence index of I/O pdirs · 63923d2c
      danglin44 authored and Helge Deller's avatar Helge Deller committed
      
      We only support I/O to kernel space. Using %sr1 to load the coherence
      index may be racy unless interrupts are disabled. This patch changes the
      code used to load the coherence index to use implicit space register
      selection. This saves one instruction and eliminates the race.
      
      Tested on rp3440, c8000 and c3750.
      
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      63923d2c
  19. Jun 05, 2019
  20. May 30, 2019
  21. May 21, 2019
  22. May 03, 2019
  23. Apr 06, 2019
  24. Feb 21, 2019
  25. Feb 20, 2019
  26. Dec 28, 2018
Loading