1. 15 1月, 2018 3 次提交
  2. 10 1月, 2018 1 次提交
    • C
      dma-mapping: move swiotlb arch helpers to a new header · ea8c64ac
      Christoph Hellwig 提交于
      phys_to_dma, dma_to_phys and dma_capable are helpers published by
      architecture code for use of swiotlb and xen-swiotlb only.  Drivers are
      not supposed to use these directly, but use the DMA API instead.
      
      Move these to a new asm/dma-direct.h helper, included by a
      linux/dma-direct.h wrapper that provides the default linear mapping
      unless the architecture wants to override it.
      
      In the MIPS case the existing dma-coherent.h is reused for now as
      untangling it will take a bit of work.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: NRobin Murphy <robin.murphy@arm.com>
      ea8c64ac
  3. 04 10月, 2017 1 次提交
  4. 02 10月, 2017 1 次提交
  5. 21 8月, 2017 2 次提交
  6. 20 7月, 2017 1 次提交
  7. 20 6月, 2017 1 次提交
  8. 15 6月, 2017 1 次提交
  9. 05 5月, 2017 1 次提交
  10. 02 5月, 2017 1 次提交
    • S
      xen/arm,arm64: fix xen_dma_ops after 815dd187 "Consolidate get_dma_ops..." · e0586326
      Stefano Stabellini 提交于
      The following commit:
      
        commit 815dd187
        Author: Bart Van Assche <bart.vanassche@sandisk.com>
        Date:   Fri Jan 20 13:04:04 2017 -0800
      
            treewide: Consolidate get_dma_ops() implementations
      
      rearranges get_dma_ops in a way that xen_dma_ops are not returned when
      running on Xen anymore, dev->dma_ops is returned instead (see
      arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
      include/linux/dma-mapping.h:get_dma_ops).
      
      Fix the problem by storing dev->dma_ops in dev_archdata, and setting
      dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
      by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
      dev_archdata when needed. It also allows us to remove __generic_dma_ops
      from common headers.
      Signed-off-by: NStefano Stabellini <sstabellini@kernel.org>
      Tested-by: NJulien Grall <julien.grall@arm.com>
      Suggested-by: NCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Cc: <stable@vger.kernel.org>        [4.11+]
      CC: linux@armlinux.org.uk
      CC: catalin.marinas@arm.com
      CC: will.deacon@arm.com
      CC: boris.ostrovsky@oracle.com
      CC: jgross@suse.com
      CC: Julien Grall <julien.grall@arm.com>
      e0586326
  11. 29 4月, 2017 1 次提交
  12. 20 4月, 2017 1 次提交
  13. 23 3月, 2017 1 次提交
  14. 25 2月, 2017 1 次提交
  15. 06 2月, 2017 1 次提交
    • R
      iommu/dma: Remove bogus dma_supported() implementation · a1831bb9
      Robin Murphy 提交于
      Back when this was first written, dma_supported() was somewhat of a
      murky mess, with subtly different interpretations being relied upon in
      various places. The "does device X support DMA to address range Y?"
      uses assuming Y to be physical addresses, which motivated the current
      iommu_dma_supported() implementation and are alluded to in the comment
      therein, have since been cleaned up, leaving only the far less ambiguous
      "can device X drive address bits Y" usage internal to DMA API mask
      setting. As such, there is no reason to keep a slightly misleading
      callback which does nothing but duplicate the current default behaviour;
      we already constrain IOVA allocations to the iommu_domain aperture where
      necessary, so let's leave DMA mask business to architecture-specific
      code where it belongs.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      a1831bb9
  16. 26 1月, 2017 1 次提交
  17. 25 1月, 2017 2 次提交
    • B
      treewide: Move dma_ops from struct dev_archdata into struct device · 5657933d
      Bart Van Assche 提交于
      Some but not all architectures provide set_dma_ops(). Move dma_ops
      from struct dev_archdata into struct device such that it becomes
      possible on all architectures to configure dma_ops per device.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: x86@kernel.org
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      5657933d
    • B
      treewide: Constify most dma_map_ops structures · 5299709d
      Bart Van Assche 提交于
      Most dma_map_ops structures are never modified. Constify these
      structures such that these can be write-protected. This patch
      has been generated as follows:
      
      git grep -l 'struct dma_map_ops' |
        xargs -d\\n sed -i \
          -e 's/struct dma_map_ops/const struct dma_map_ops/g' \
          -e 's/const struct dma_map_ops {/struct dma_map_ops {/g' \
          -e 's/^const struct dma_map_ops;$/struct dma_map_ops;/' \
          -e 's/const const struct dma_map_ops /const struct dma_map_ops /g';
      sed -i -e 's/const \(struct dma_map_ops intel_dma_ops\)/\1/' \
        $(git grep -l 'struct dma_map_ops intel_dma_ops');
      sed -i -e 's/const \(struct dma_map_ops dma_iommu_ops\)/\1/' \
        $(git grep -l 'struct dma_map_ops' | grep ^arch/powerpc);
      sed -i -e '/^struct vmd_dev {$/,/^};$/ s/const \(struct dma_map_ops[[:blank:]]dma_ops;\)/\1/' \
             -e '/^static void vmd_setup_dma_ops/,/^}$/ s/const \(struct dma_map_ops \*dest\)/\1/' \
             -e 's/const \(struct dma_map_ops \*dest = \&vmd->dma_ops\)/\1/' \
          drivers/pci/host/*.c
      sed -i -e '/^void __init pci_iommu_alloc(void)$/,/^}$/ s/dma_ops->/intel_dma_ops./' arch/ia64/kernel/pci-dma.c
      sed -i -e 's/static const struct dma_map_ops sn_dma_ops/static struct dma_map_ops sn_dma_ops/' arch/ia64/sn/pci/pci_dma.c
      sed -i -e 's/(const struct dma_map_ops \*)//' drivers/misc/mic/bus/vop_bus.c
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: x86@kernel.org
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      5299709d
  18. 23 1月, 2017 1 次提交
  19. 19 1月, 2017 1 次提交
  20. 12 1月, 2017 1 次提交
  21. 19 12月, 2016 1 次提交
  22. 14 11月, 2016 1 次提交
  23. 08 11月, 2016 1 次提交
  24. 16 9月, 2016 1 次提交
  25. 22 8月, 2016 2 次提交
    • J
      arm64: apply __ro_after_init to some objects · 5a9e3e15
      Jisheng Zhang 提交于
      These objects are set during initialization, thereafter are read only.
      
      Previously I only want to mark vdso_pages, vdso_spec, vectors_page and
      cpu_ops as __read_mostly from performance point of view. Then inspired
      by Kees's patch[1] to apply more __ro_after_init for arm, I think it's
      better to mark them as __ro_after_init. What's more, I find some more
      objects are also read only after init. So apply __ro_after_init to all
      of them.
      
      This patch also removes global vdso_pagelist and tries to clean up
      vdso_spec[] assignment code.
      
      [1] http://www.spinics.net/lists/arm-kernel/msg523188.htmlAcked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NJisheng Zhang <jszhang@marvell.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      5a9e3e15
    • K
      arm64: mm: convert __dma_* routines to use start, size · d34fdb70
      Kwangwoo Lee 提交于
      __dma_* routines have been converted to use start and size instread of
      start and end addresses. The patch was origianlly for adding
      __clean_dcache_area_poc() which will be used in pmem driver to clean
      dcache to the PoC(Point of Coherency) in arch_wb_cache_pmem().
      
      The functionality of __clean_dcache_area_poc()  was equivalent to
      __dma_clean_range(). The difference was __dma_clean_range() uses the end
      address, but __clean_dcache_area_poc() uses the size to clean.
      
      Thus, __clean_dcache_area_poc() has been revised with a fallthrough
      function of __dma_clean_range() after the change that __dma_* routines
      use start and size instead of using start and end.
      
      As a consequence of using start and size, the name of __dma_* routines
      has also been altered following the terminology below:
          area: takes a start and size
          range: takes a start and end
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NKwangwoo Lee <kwangwoo.lee@sk.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      d34fdb70
  26. 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
  27. 09 7月, 2016 1 次提交
    • L
      arm64: mm: change IOMMU notifier action to attach DMA ops · 16c11325
      Lorenzo Pieralisi 提交于
      Current bus notifier in ARM64 (__iommu_attach_notifier)
      attempts to attach dma_ops to a device on BUS_NOTIFY_ADD_DEVICE
      action notification.
      
      This will cause issues on ACPI based systems, where PCI devices
      can be added before the IOMMUs the devices are attached to
      had a chance to be probed, causing failures on attempts to
      attach dma_ops in that the domain for the respective IOMMU
      may not be set-up yet by the time the bus notifier is run.
      
      Devices dma_ops do not require to be set-up till the matching
      device drivers are probed. This means that instead of running
      the notifier attaching dma_ops to devices (__iommu_attach_notifier)
      on BUS_NOTIFY_ADD_DEVICE action, it can be run just before the
      device driver is bound to the device in question (on action
      BUS_NOTIFY_BIND_DRIVER) so that it is certain that its IOMMU
      group and domain are set-up accordingly at the time the
      notifier is triggered.
      
      This patch changes the notifier action upon which dma_ops
      are attached to devices and defer it to driver binding time,
      so that IOMMU devices have a chance to be probed and to register
      their bus notifiers before the dma_ops attach sequence for a
      device is actually carried out.
      
      As a result we also no longer need worry about racing with
      iommu_bus_notifier(), or about retrying the queue in case devices
      were added too early on DT-based systems, so clean up the notifier
      itself plus the additional workaround from 722ec35f ("arm64:
      dma-mapping: fix handling of devices registered before arch_initcall")
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      [rm: get rid of other now-redundant bits]
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      16c11325
  28. 21 6月, 2016 1 次提交
  29. 09 5月, 2016 2 次提交
  30. 22 4月, 2016 2 次提交
  31. 17 2月, 2016 1 次提交
  32. 02 12月, 2015 1 次提交
  33. 17 11月, 2015 1 次提交
    • A
      arm64: simplify dma_get_ops · 1dccb598
      Arnd Bergmann 提交于
      Including linux/acpi.h from asm/dma-mapping.h causes tons of compile-time
      warnings, e.g.
      
       drivers/isdn/mISDN/dsp_ecdis.h:43:0: warning: "FALSE" redefined
       drivers/isdn/mISDN/dsp_ecdis.h:44:0: warning: "TRUE" redefined
       drivers/net/fddi/skfp/h/targetos.h:62:0: warning: "TRUE" redefined
       drivers/net/fddi/skfp/h/targetos.h:63:0: warning: "FALSE" redefined
      
      However, it looks like the dependency should not even there as
      I do not see why __generic_dma_ops() cares about whether we have
      an ACPI based system or not.
      
      The current behavior is to fall back to the global dma_ops when
      a device has not set its own dma_ops, but only for DT based systems.
      This seems dangerous, as a random device might have different
      requirements regarding IOMMU or coherency, so we should really
      never have that fallback and just forbid DMA when we have not
      initialized DMA for a device.
      
      This removes the global dma_ops variable and the special-casing
      for ACPI, and just returns the dma ops that got set for the
      device, or the dummy_dma_ops if none were present.
      
      The original code has apparently been copied from arm32 where we
      rely on it for ISA devices things like the floppy controller, but
      we should have no such devices on ARM64.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      [catalin.marinas@arm.com: removed acpi_disabled check in arch_setup_dma_ops()]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      1dccb598