1. 24 1月, 2019 1 次提交
  2. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      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
         lines).
      
      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: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  3. 02 5月, 2017 2 次提交
  4. 03 12月, 2016 1 次提交
  5. 04 8月, 2016 1 次提交
    • K
      dma-mapping: use unsigned long for dma_attrs · 00085f1e
      Krzysztof Kozlowski 提交于
      The dma-mapping core and the implementations do not change the DMA
      attributes passed by pointer.  Thus the pointer can point to const data.
      However the attributes do not have to be a bitfield.  Instead unsigned
      long will do fine:
      
      1. This is just simpler.  Both in terms of reading the code and setting
         attributes.  Instead of initializing local attributes on the stack
         and passing pointer to it to dma_set_attr(), just set the bits.
      
      2. It brings safeness and checking for const correctness because the
         attributes are passed by value.
      
      Semantic patches for this change (at least most of them):
      
          virtual patch
          virtual context
      
          @r@
          identifier f, attrs;
      
          @@
          f(...,
          - struct dma_attrs *attrs
          + unsigned long attrs
          , ...)
          {
          ...
          }
      
          @@
          identifier r.f;
          @@
          f(...,
          - NULL
          + 0
           )
      
      and
      
          // Options: --all-includes
          virtual patch
          virtual context
      
          @r@
          identifier f, attrs;
          type t;
      
          @@
          t f(..., struct dma_attrs *attrs);
      
          @@
          identifier r.f;
          @@
          f(...,
          - NULL
          + 0
           )
      
      Link: http://lkml.kernel.org/r/1468399300-5399-2-git-send-email-k.kozlowski@samsung.comSigned-off-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Acked-by: NVineet Gupta <vgupta@synopsys.com>
      Acked-by: NRobin Murphy <robin.murphy@arm.com>
      Acked-by: NHans-Christian Noren Egtvedt <egtvedt@samfundet.no>
      Acked-by: Mark Salter <msalter@redhat.com> [c6x]
      Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> [cris]
      Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> [drm]
      Reviewed-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Acked-by: Joerg Roedel <jroedel@suse.de> [iommu]
      Acked-by: Fabien Dessenne <fabien.dessenne@st.com> [bdisp]
      Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> [vb2-core]
      Acked-by: David Vrabel <david.vrabel@citrix.com> [xen]
      Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> [xen swiotlb]
      Acked-by: Joerg Roedel <jroedel@suse.de> [iommu]
      Acked-by: Richard Kuo <rkuo@codeaurora.org> [hexagon]
      Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k]
      Acked-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> [s390]
      Acked-by: NBjorn Andersson <bjorn.andersson@linaro.org>
      Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> [avr32]
      Acked-by: Vineet Gupta <vgupta@synopsys.com> [arc]
      Acked-by: Robin Murphy <robin.murphy@arm.com> [arm64 and dma-iommu]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      00085f1e
  6. 09 2月, 2016 1 次提交
    • I
      xen/arm: correctly handle DMA mapping of compound pages · 52ba0746
      Ian Campbell 提交于
      Currently xen_dma_map_page concludes that DMA to anything other than
      the head page of a compound page must be foreign, since the PFN of the
      page is that of the head.
      
      Fix the check to instead consider the whole of a compound page to be
      local if the PFN of the head passes the 1:1 check.
      
      We can never see a compound page which is a mixture of foreign and
      local sub-pages.
      
      The comment already correctly described the intention, but fixup the
      spelling and some grammar.
      
      This fixes the various SSH protocol errors which we have been seeing
      on the cubietrucks in our automated test infrastructure.
      
      This has been broken since commit 3567258d ("xen/arm: use
      hypercall to flush caches in map_page"), which was in v3.19-rc1.
      
      NB arch/arm64/.../xen/page-coherent.h also includes this file.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Reviewed-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Cc: xen-devel@lists.xenproject.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: stable@vger.kernel.org # v3.19+
      52ba0746
  7. 23 10月, 2015 1 次提交
    • J
      xen/swiotlb: Add support for 64KB page granularity · 9435cce8
      Julien Grall 提交于
      Swiotlb is used on ARM64 to support DMA on platform where devices are
      not protected by an SMMU. Furthermore it's only enabled for DOM0.
      
      While Xen is always using 4KB page granularity in the stage-2 page table,
      Linux ARM64 may either use 4KB or 64KB. This means that a Linux page
      can be spanned accross multiple Xen page.
      
      The Swiotlb code has to validate that the buffer used for DMA is
      physically contiguous in the memory. As a Linux page can't be shared
      between local memory and foreign page by design (the balloon code always
      removing entirely a Linux page), the changes in the code are very
      minimal because we only need to check the first Xen PFN.
      
      Note that it may be possible to optimize the function
      check_page_physically_contiguous to avoid looping over every Xen PFN
      for local memory. Although I will let this optimization for a follow-up.
      Signed-off-by: NJulien Grall <julien.grall@citrix.com>
      Reviewed-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      9435cce8
  8. 04 12月, 2014 3 次提交
  9. 12 9月, 2014 1 次提交
    • S
      xen/arm: reimplement xen_dma_unmap_page & friends · 340720be
      Stefano Stabellini 提交于
      xen_dma_unmap_page, xen_dma_sync_single_for_cpu and
      xen_dma_sync_single_for_device are currently implemented by calling into
      the corresponding generic ARM implementation of these functions. In
      order to do this, firstly the dma_addr_t handle, that on Xen is a
      machine address, needs to be translated into a physical address.  The
      operation is expensive and inaccurate, given that a single machine
      address can correspond to multiple physical addresses in one domain,
      because the same page can be granted multiple times by the frontend.
      
      To avoid this problem, we introduce a Xen specific implementation of
      xen_dma_unmap_page, xen_dma_sync_single_for_cpu and
      xen_dma_sync_single_for_device, that can operate on machine addresses
      directly.
      
      The new implementation relies on the fact that the hypervisor creates a
      second p2m mapping of any grant pages at physical address == machine
      address of the page for dom0. Therefore we can access memory at physical
      address == dma_addr_r handle and perform the cache flushing there. Some
      cache maintenance operations require a virtual address. Instead of using
      ioremap_cache, that is not safe in interrupt context, we allocate a
      per-cpu PAGE_KERNEL scratch page and we manually update the pte for it.
      
      arm64 doesn't need cache maintenance operations on unmap for now.
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Tested-by: NDenis Schneider <v1ne2go@gmail.com>
      340720be
  10. 25 10月, 2013 1 次提交
  11. 10 10月, 2013 1 次提交
    • S
      xen: introduce xen_alloc/free_coherent_pages · d6fe76c5
      Stefano Stabellini 提交于
      xen_swiotlb_alloc_coherent needs to allocate a coherent buffer for cpu
      and devices. On native x86 is sufficient to call __get_free_pages in
      order to get a coherent buffer, while on ARM (and potentially ARM64) we
      need to call the native dma_ops->alloc implementation.
      
      Introduce xen_alloc_coherent_pages to abstract the arch specific buffer
      allocation.
      
      Similarly introduce xen_free_coherent_pages to free a coherent buffer:
      on x86 is simply a call to free_pages while on ARM and ARM64 is
      arm_dma_ops.free.
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      
      
      Changes in v7:
      - rename __get_dma_ops to __generic_dma_ops;
      - call __generic_dma_ops(hwdev)->alloc/free on arm64 too.
      
      Changes in v6:
      - call __get_dma_ops to get the native dma_ops pointer on arm.
      d6fe76c5