1. 22 Dec, 2018 1 commit
  2. 09 Oct, 2018 1 commit
  3. 08 Oct, 2018 1 commit
    • Stephen Boyd's avatar
      dma-debug: Check for drivers mapping invalid addresses in dma_map_single() · 99c65fa7
      Stephen Boyd authored
      I recently debugged a DMA mapping oops where a driver was trying to map
      a buffer returned from request_firmware() with dma_map_single(). Memory
      returned from request_firmware() is mapped into the vmalloc region and
      this isn't a valid region to map with dma_map_single() per the DMA
      documentation's "What memory is DMA'able?" section.
      Unfortunately, we don't really check that in the DMA debugging code, so
      enabling DMA debugging doesn't help catch this problem. Let's add a new
      DMA debug function to check for a vmalloc address or an invalid virtual
      address and print a warning if this happens. This makes it a little
      easier to debug these sorts of problems, instead of seeing odd behavior
      or crashes when drivers attempt to map the vmalloc space for DMA.
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
  4. 01 Oct, 2018 1 commit
  5. 25 Sep, 2018 1 commit
  6. 20 Sep, 2018 3 commits
    • Christoph Hellwig's avatar
      dma-mapping: support non-coherent devices in dma_common_get_sgtable · 9406a49f
      Christoph Hellwig authored
      We can use the arch_dma_coherent_to_pfn hook to provide a ->get_sgtable
      implementation.  Note that this isn't an endorsement of this interface
      (which is a horrible bad idea), but it is required to move arm64 over
      to the generic code without a loss of functionality.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    • Christoph Hellwig's avatar
      dma-mapping: consolidate the dma mmap implementations · 58b04406
      Christoph Hellwig authored
      The only functional differences (modulo a few missing fixes in the arch
      code) is that architectures without coherent caches need a hook to
      convert a virtual or dma address into a pfn, given that we don't have
      the kernel linear mapping available for the otherwise easy virt_to_page
      call.  As a side effect we can support mmap of the per-device coherent
      area even on architectures not providing the callback, and we make
      previous dangerous default methods dma_common_mmap actually save for
      non-coherent architectures by rejecting it without the right helper.
      In addition to that we need a hook so that some architectures can
      override the protection bits when mmaping a dma coherent allocations.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts
    • Christoph Hellwig's avatar
      dma-mapping: merge direct and noncoherent ops · bc3ec75d
      Christoph Hellwig authored
      All the cache maintainance is already stubbed out when not enabled,
      but merging the two allows us to nicely handle the case where
      cache maintainance is required for some devices, but not others.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts
  7. 08 Sep, 2018 3 commits
  8. 25 Jul, 2018 1 commit
    • Robin Murphy's avatar
      dma-mapping: relax warning for per-device areas · d27fb99f
      Robin Murphy authored
      The reasons why dma_free_attrs() should not be called from IRQ context
      are not necessarily obvious and somewhat buried in the development
      history, so let's start by documenting the warning itself to help anyone
      who does happen to hit it and wonder what the deal is.
      However, this check turns out to be slightly over-restrictive for the
      way that per-device memory has been spliced into the general API, since
      for that case we know that dma_declare_coherent_memory() has created an
      appropriate CPU mapping for the entire area and nothing dynamic should
      be happening. Given that the usage model for per-device memory is often
      more akin to streaming DMA than 'real' coherent DMA (e.g. allocating and
      freeing space to copy short-lived packets in and out), it is also
      somewhat more reasonable for those operations to happen in IRQ handlers
      for such devices.
      Therefore, let's move the irqs_disabled() check down past the per-device
      area hook, so that that gets a chance to resolve the request before we
      reach definite "you're doing it wrong" territory.
      Reported-by: default avatarFredrik Noring <noring@nocrew.org>
      Tested-by: default avatarFredrik Noring <noring@nocrew.org>
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
  9. 28 May, 2018 1 commit
  10. 25 May, 2018 1 commit
  11. 19 May, 2018 1 commit
  12. 09 May, 2018 1 commit
  13. 07 May, 2018 1 commit
    • Christoph Hellwig's avatar
      PCI: remove PCI_DMA_BUS_IS_PHYS · 325ef185
      Christoph Hellwig authored
      This was used by the ide, scsi and networking code in the past to
      determine if they should bounce payloads.  Now that the dma mapping
      always have to support dma to all physical memory (thanks to swiotlb
      for non-iommu systems) there is no need to this crude hack any more.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: Palmer Dabbelt <palmer@sifive.com> (for riscv)
      Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
  14. 28 Mar, 2018 1 commit
  15. 16 Mar, 2018 2 commits
  16. 12 Feb, 2018 1 commit
  17. 15 Jan, 2018 4 commits
  18. 10 Jan, 2018 1 commit
  19. 22 Nov, 2017 1 commit
  20. 16 Nov, 2017 1 commit
  21. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      How this work was done:
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
      All documentation files were explicitly excluded.
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
         For non */uapi/* files that summary was:
         SPDX license identifier                            # files
         GPL-2.0                                              11139
         and resulted in the first patch in this series.
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
         SPDX license identifier                            # files
         GPL-2.0 WITH Linux-syscall-note                        930
         and resulted in the second patch in this series.
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
         SPDX license identifier                            # files
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
         and that resulted in the third patch in this series.
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  22. 19 Oct, 2017 1 commit
  23. 01 Sep, 2017 2 commits
  24. 29 Aug, 2017 1 commit
  25. 25 Aug, 2017 1 commit
  26. 20 Jul, 2017 1 commit
  27. 18 Jul, 2017 1 commit
    • Tom Lendacky's avatar
      swiotlb: Add warnings for use of bounce buffers with SME · 648babb7
      Tom Lendacky authored
      Add warnings to let the user know when bounce buffers are being used for
      DMA when SME is active.  Since the bounce buffers are not in encrypted
      memory, these notifications are to allow the user to determine some
      appropriate action - if necessary.  Actions can range from utilizing an
      IOMMU, replacing the device with another device that can support 64-bit
      DMA, ignoring the message if the device isn't used much, etc.
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brijesh Singh <brijesh.singh@amd.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Larry Woodman <lwoodman@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Toshimitsu Kani <toshi.kani@hpe.com>
      Cc: kasan-dev@googlegroups.com
      Cc: kvm@vger.kernel.org
      Cc: linux-arch@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-efi@vger.kernel.org
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/d112564053c3f2e86ca634a8d4fa4abc0eb53a6a.1500319216.git.thomas.lendacky@amd.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
  28. 28 Jun, 2017 4 commits