1. 13 8月, 2015 1 次提交
  2. 06 8月, 2015 1 次提交
    • R
      iommu/io-pgtable-arm: Allow appropriate DMA API use · f8d54961
      Robin Murphy 提交于
      Currently, users of the LPAE page table code are (ab)using dma_map_page()
      as a means to flush page table updates for non-coherent IOMMUs. Since
      from the CPU's point of view, creating IOMMU page tables *is* passing
      DMA buffers to a device (the IOMMU's page table walker), there's little
      reason not to use the DMA API correctly.
      
      Allow IOMMU drivers to opt into DMA API operations for page table
      allocation and updates by providing their appropriate device pointer.
      The expectation is that an LPAE IOMMU should have a full view of system
      memory, so use streaming mappings to avoid unnecessary pressure on
      ZONE_DMA, and treat any DMA translation as a warning sign.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      f8d54961
  3. 28 7月, 2015 1 次提交
  4. 02 6月, 2015 1 次提交
    • G
      break kconfig dependency loop · 06b718c0
      Gerd Hoffmann 提交于
      After adding virtio-gpu I get this funky kconfig dependency loop.
      
      scripts/kconfig/conf --oldconfig Kconfig
      drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
      drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
      drivers/gpu/drm/Kconfig:34:     symbol DRM_KMS_FB_HELPER is selected by DRM_VIRTIO_GPU
      drivers/gpu/drm/virtio/Kconfig:1:       symbol DRM_VIRTIO_GPU depends on VIRTIO
      drivers/virtio/Kconfig:1:       symbol VIRTIO is selected by REMOTEPROC
      drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by OMAP_REMOTEPROC
      drivers/remoteproc/Kconfig:12:  symbol OMAP_REMOTEPROC depends on OMAP_IOMMU
      drivers/iommu/Kconfig:141:      symbol OMAP_IOMMU is selected by VIDEO_OMAP3
      drivers/media/platform/Kconfig:96:      symbol VIDEO_OMAP3 depends on VIDEO_V4L2
      drivers/media/v4l2-core/Kconfig:6:      symbol VIDEO_V4L2 depends on I2C
      drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
      drivers/video/fbdev/Kconfig:59: symbol FB_DDC is selected by FB_CYBER2000_DDC
      drivers/video/fbdev/Kconfig:374:        symbol FB_CYBER2000_DDC depends on FB_CYBER2000
      drivers/video/fbdev/Kconfig:362:        symbol FB_CYBER2000 depends on FB
      
      Making VIDEO_OMAP3 depend on OMAP_IOMMU instead of selecting it breaks the
      loop, which looks like the best way to handle it to me.  Updated OMAP_IOMMU
      help text accordingly.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Acked-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      06b718c0
  5. 29 5月, 2015 1 次提交
    • W
      iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices · 48ec83bc
      Will Deacon 提交于
      Version three of the ARM SMMU architecture introduces significant
      changes and improvements over previous versions of the specification,
      necessitating a new driver in the Linux kernel.
      
      The main change to the programming interface is that the majority of the
      configuration data has been moved from MMIO registers to in-memory data
      structures, with communication between the CPU and the SMMU being
      mediated via in-memory circular queues.
      
      This patch adds an initial driver for SMMUv3 to Linux. We currently
      support pinned stage-1 (DMA) and stage-2 (KVM VFIO) mappings using the
      generic IO-pgtable code.
      
      Cc: Robin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      48ec83bc
  6. 04 5月, 2015 1 次提交
  7. 03 3月, 2015 1 次提交
  8. 25 2月, 2015 1 次提交
    • T
      iommu/msm: Mark driver BROKEN · a3f447a4
      Thierry Reding 提交于
      The MSM IOMMU driver unconditionally calls bus_set_iommu(), which is a
      very stupid thing to do on multi-platform kernels. While marking the
      driver BROKEN may seem a little extreme, there is no other way to make
      the driver skip initialization. One of the problems is that it doesn't
      have devicetree binding documentation and the driver doesn't contain a
      struct of_device_id table either, so no way to check that it is indeed
      valid to set up the IOMMU operations for this driver.
      
      This fixes a problem on Tegra20 where the DRM driver will try to use the
      obviously non-existent MSM IOMMU.
      
      Marking the driver BROKEN shouldn't do any harm, since there aren't any
      users currently. There is no struct of_device_id table, so the device
      can't be instantiated from device tree, and I couldn't find any code
      that would instantiate a matching platform_device either, so the driver
      is effectively unused.
      Reported-by: NNicolas Chauvet <kwizart@gmail.com>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Daniel Walker <dwalker@fifo99.com>
      Cc: Bryan Huntsman <bryanh@codeaurora.org>
      Cc: Olav Haugan <ohaugan@codeaurora.org>
      Acked-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      a3f447a4
  9. 30 1月, 2015 2 次提交
    • J
      iommu: Make more drivers depend on COMPILE_TEST · 477ab7a1
      Joerg Roedel 提交于
      For easier compile testing of these iommu drivers.
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      477ab7a1
    • A
      iommu: Disable on !MMU builds · e5144c93
      Arnd Bergmann 提交于
      A lot of the IOMMU support code does not build if the CPU does
      not have an MMU itself, and it's not clear if there is any
      use case for it, so let's just disable it and wait for anybody
      to need it.
      
      This avoids randconfig errors like
      
      ../arch/arm/mm/dma-mapping.c: In function '__iommu_alloc_remap':
      ../arch/arm/mm/dma-mapping.c:1278:34: error: 'VM_ARM_DMA_CONSISTENT' undeclared (first use in this function)
        area = get_vm_area_caller(size, VM_ARM_DMA_CONSISTENT | VM_USERMAP,
                                        ^
      ../arch/arm/mm/dma-mapping.c:1278:34: note: each undeclared identifier is reported only once for each function it appears in
      ../arch/arm/mm/dma-mapping.c: In function '__atomic_get_pages':
      ../arch/arm/mm/dma-mapping.c:1358:27: error: 'atomic_pool' undeclared (first use in this function)
        struct dma_pool *pool = &atomic_pool;
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      e5144c93
  10. 26 1月, 2015 1 次提交
  11. 19 1月, 2015 5 次提交
  12. 17 12月, 2014 1 次提交
    • M
      iommu/exynos: Fix arm64 allmodconfig build · 20911ce6
      Mark Brown 提交于
      The Exynos IOMMU driver uses the ARM specific dmac_flush_range() and
      outer_flush_range() functions. This breaks the build on arm64 allmodconfig
      in -next since support has been merged for some Exynos ARMv8 SoCs. Add a
      dependency on ARM to keep things building until either the driver has the
      ARM dependencies removed or the ARMv8 architecture code implements these
      ARM specific APIs.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      20911ce6
  13. 04 12月, 2014 1 次提交
    • T
      memory: Add NVIDIA Tegra memory controller support · 89184651
      Thierry Reding 提交于
      The memory controller on NVIDIA Tegra exposes various knobs that can be
      used to tune the behaviour of the clients attached to it.
      
      Currently this driver sets up the latency allowance registers to the HW
      defaults. Eventually an API should be exported by this driver (via a
      custom API or a generic subsystem) to allow clients to register latency
      requirements.
      
      This driver also registers an IOMMU (SMMU) that's implemented by the
      memory controller. It is supported on Tegra30, Tegra114 and Tegra124
      currently. Tegra20 has a GART instead.
      
      The Tegra SMMU operates on memory clients and SWGROUPs. A memory client
      is a unidirectional, special-purpose DMA master. A SWGROUP represents a
      set of memory clients that form a logical functional unit corresponding
      to a single device. Typically a device has two clients: one client for
      read transactions and one client for write transactions, but there are
      also devices that have only read clients, but many of them (such as the
      display controllers).
      
      Because there is no 1:1 relationship between memory clients and devices
      the driver keeps a table of memory clients and the SWGROUPs that they
      belong to per SoC. Note that this is an exception and due to the fact
      that the SMMU is tightly integrated with the rest of the Tegra SoC. The
      use of these tables is discouraged in drivers for generic IOMMU devices
      such as the ARM SMMU because the same IOMMU could be used in any number
      of SoCs and keeping such tables for each SoC would not scale.
      Acked-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      89184651
  14. 02 12月, 2014 1 次提交
  15. 05 11月, 2014 1 次提交
  16. 04 11月, 2014 1 次提交
    • D
      iommu/rockchip: rk3288 iommu driver · c68a2921
      Daniel Kurtz 提交于
      The rk3288 has several iommus.  Each iommu belongs to a single master
      device.  There is one device (ISP) that has two slave iommus, but that
      case is not yet supported by this driver.
      
      At subsys init, the iommu driver registers itself as the iommu driver for
      the platform bus.  The master devices find their slave iommus using the
      "iommus" field in their devicetree description.  Since each slave iommu
      belongs to exactly one master, their is no additional data needed at probe
      to associate a slave with its master.
      
      An iommu device's power domain, clock and irq are all shared with its
      master device, and the master device must be careful to attach from the
      iommu only after powering and clocking it (and leave it powered and
      clocked before detaching).  Because their is no guarantee what the status
      of the iommu is at probe, and since the driver does not even know if the
      device is powered, we delay requesting its irq until the master device
      attaches, at which point we have a guarantee that the device is powered
      and clocked and we can reset it and disable its interrupt mask.
      
      An iommu_domain describes a virtual iova address space.  Each iommu_domain
      has a corresponding page table that lists the mappings from iova to
      physical address.
      
      For the rk3288 iommu, the page table has two levels:
       The Level 1 "directory_table" has 1024 4-byte dte entries.
       Each dte points to a level 2 "page_table".
       Each level 2 page_table has 1024 4-byte pte entries.
       Each pte points to a 4 KiB page of memory.
      
      An iommu_domain is created when a dma_iommu_mapping is created via
      arm_iommu_create_mapping.  Master devices can then attach themselves to
      this mapping (or attach the mapping to themselves?) by calling
      arm_iommu_attach_device().  This in turn instructs the iommu driver to
      write the page table's physical address into the slave iommu's "Directory
      Table Entry" (DTE) register.
      
      In fact multiple master devices, each with their own slave iommu device,
      can all attach to the same mapping.  The iommus for these devices will
      share the same iommu_domain and therefore point to the same page table.
      Thus, the iommu domain maintains a list of iommu devices which are
      attached.  This driver relies on the iommu core to ensure that all devices
      have detached before destroying a domain.
      
      v6: - add .add/remove_device() callbacks.
          - parse platform_device device tree nodes for "iommus" property
          - store platform device pointer as group iommudata
          - Check for existence of iommu group instead of relying on a
            dev_get_drvdata() to return NULL for a NULL device.
      
      v7: - fixup some strings.
          - In rk_iommu_disable_paging() # and % were reversed.
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Signed-off-by: NSimon Xue <xxm@rock-chips.com>
      Reviewed-by: NGrant Grundler <grundler@chromium.org>
      Reviewed-by: NStéphane Marchesin <marcheu@chromium.org>
      Tested-by: NHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      c68a2921
  17. 23 10月, 2014 1 次提交
    • S
      iommu/omap: Integrate omap-iommu-debug into omap-iommu · 61c75352
      Suman Anna 提交于
      The debugfs support for OMAP IOMMU is currently implemented
      as a module, warranting certain OMAP-specific IOMMU API to
      be exported. The OMAP IOMMU, when enabled, can only be built-in
      into the kernel, so integrate the OMAP IOMMU debug module
      into the OMAP IOMMU driver. This helps in eliminating the
      need to export most of the current OMAP IOMMU API.
      
      The following are the main changes:
      - The debugfs directory and entry creation logic is reversed,
        the calls are invoked by the OMAP IOMMU driver now.
      - The current iffy circular logic of adding IOMMU archdata
        to the IOMMU devices itself to get a pointer to the omap_iommu
        object in the debugfs support code is replaced by directly
        using the omap_iommu structure while creating the debugfs
        entries.
      - The debugfs root directory is renamed from the generic name
        "iommu" to a specific name "omap_iommu".
      - Unneeded headers have also been cleaned up while at this.
      - There will no longer be a omap-iommu-debug.ko module after
        this patch.
      - The OMAP_IOMMU_DEBUG Kconfig option is converted to boolean
        only, the OMAP IOMMU debugfs support is built alongside the
        OMAP IOMMU driver only when this option is enabled.
      Signed-off-by: NSuman Anna <s-anna@ti.com>
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      61c75352
  18. 29 7月, 2014 2 次提交
  19. 10 7月, 2014 1 次提交
  20. 26 5月, 2014 3 次提交
  21. 04 3月, 2014 1 次提交
  22. 07 1月, 2014 1 次提交
  23. 16 11月, 2013 1 次提交
    • L
      Don't try to compile shmobile-iommu outside of ARM · f63c4824
      Linus Torvalds 提交于
      Commit 7d02c4d6 ("iommu/shmobile: Enable the driver on all ARM
      platforms") completely brokenly enabled the shmobile-iommu driver under
      COMPILE_TEST.
      
      It's bogus, because it won't compile anywhere else than ARM, since it
      tries to include <asm/dma-iommu.h>, which is very much ARM-only.
      
      So remove the bogus COMPILE_TEST dependency, which just causes
      allmodconfig to fail on non-ARM platforms.
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: iommu@lists.linux-foundation.org
      Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Cc: Simon Horman <horms@verge.net.au>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f63c4824
  24. 01 11月, 2013 1 次提交
  25. 05 10月, 2013 1 次提交
    • T
      x86, build, pci: Fix PCI_MSI build on !SMP · 0dbc6078
      Thomas Petazzoni 提交于
      Commit ebd97be6 ('PCI: remove ARCH_SUPPORTS_MSI kconfig option')
      removed the ARCH_SUPPORTS_MSI option which architectures could select
      to indicate that they support MSI. Now, all architectures are supposed
      to build fine when MSI support is enabled: instead of having the
      architecture tell *when* MSI support can be used, it's up to the
      architecture code to ensure that MSI support can be enabled.
      
      On x86, commit ebd97be6 removed the following line:
      
        select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC)
      
      Which meant that MSI support was only available when the local APIC
      and I/O APIC were enabled. While this is always true on SMP or x86-64,
      it is not necessarily the case on i386 !SMP.
      
      The below patch makes sure that the local APIC and I/O APIC support is
      always enabled when MSI support is enabled. To do so, it:
      
       * Ensures the X86_UP_APIC option is not visible when PCI_MSI is
         enabled. This is the option that allows, on UP machines, to enable
         or not the APIC support. It is already not visible on SMP systems,
         or x86-64 systems, for example. We're simply also making it
         invisible on i386 MSI systems.
      
       * Ensures that the X86_LOCAL_APIC and X86_IO_APIC options are 'y'
         when PCI_MSI is enabled.
      
      Notice that this change requires a change in drivers/iommu/Kconfig to
      avoid a recursive Kconfig dependencey. The AMD_IOMMU option selects
      PCI_MSI, but was depending on X86_IO_APIC. This dependency is no
      longer needed: as soon as PCI_MSI is selected, the presence of
      X86_IO_APIC is guaranteed. Moreover, the AMD_IOMMU already depended on
      X86_64, which already guaranteed that X86_IO_APIC was enabled, so this
      dependency was anyway redundant.
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Link: http://lkml.kernel.org/r/1380794354-9079-1-git-send-email-thomas.petazzoni@free-electrons.comReported-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      0dbc6078
  26. 14 8月, 2013 1 次提交
    • V
      iommu/fsl: Freescale PAMU driver and iommu implementation. · 695093e3
      Varun Sethi 提交于
      Following is a brief description of the PAMU hardware:
      PAMU determines what action to take and whether to authorize the action on
      the basis of the memory address, a Logical IO Device Number (LIODN), and
      PAACT table (logically) indexed by LIODN and address. Hardware devices which
      need to access memory must provide an LIODN in addition to the memory address.
      
      Peripheral Access Authorization and Control Tables (PAACTs) are the primary
      data structures used by PAMU. A PAACT is a table of peripheral access
      authorization and control entries (PAACE).Each PAACE defines the range of
      I/O bus address space that is accessible by the LIOD and the associated access
      capabilities.
      
      There are two types of PAACTs: primary PAACT (PPAACT) and secondary PAACT
      (SPAACT).A given physical I/O device may be able to act as one or more
      independent logical I/O devices (LIODs). Each such logical I/O device is
      assigned an identifier called logical I/O device number (LIODN). A LIODN is
      allocated a contiguous portion of the I/O bus address space called the DSA window
      for performing DSA operations. The DSA window may optionally be divided into
      multiple sub-windows, each of which may be used to map to a region in system
      storage space. The first sub-window is referred to as the primary sub-window
      and the remaining are called secondary sub-windows.
      
      This patch provides the PAMU driver (fsl_pamu.c) and the corresponding IOMMU
      API implementation (fsl_pamu_domain.c). The PAMU hardware driver (fsl_pamu.c)
      has been derived from the work done by Ashish Kalra and Timur Tabi.
      
      [For iommu group support]
      Acked-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NTimur Tabi <timur@tabi.org>
      Signed-off-by: NVarun Sethi <Varun.Sethi@freescale.com>
      Signed-off-by: NJoerg Roedel <joro@8bytes.org>
      695093e3
  27. 26 6月, 2013 1 次提交
  28. 20 6月, 2013 2 次提交
  29. 10 3月, 2013 1 次提交
  30. 06 2月, 2013 1 次提交
    • H
      iommu/shmobile: Add iommu driver for Renesas IPMMU modules · c2c460f7
      Hideki EIRAKU 提交于
      This is the Renesas IPMMU driver and IOMMU API implementation.
      
      The IPMMU module supports the MMU function and the PMB function.  The
      MMU function provides address translation by pagetable compatible with
      ARMv6.  The PMB function provides address translation including
      tile-linear translation.  This patch implements the MMU function.
      
      The iommu driver does not register a platform driver directly because:
      - the register space of the MMU function and the PMB function
        have a common register (used for settings flush), so they should ideally
        have a way to appropriately share this register.
      - the MMU function uses the IOMMU API while the PMB function does not.
      - the two functions may be used independently.
      Signed-off-by: NHideki EIRAKU <hdk@igel.co.jp>
      Signed-off-by: NJoerg Roedel <joro@8bytes.org>
      c2c460f7
  31. 05 2月, 2013 1 次提交