04 Aug, 2016

1 commit

  • 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.com
    Signed-off-by: Krzysztof Kozlowski
    Acked-by: Vineet Gupta
    Acked-by: Robin Murphy
    Acked-by: Hans-Christian Noren Egtvedt
    Acked-by: Mark Salter [c6x]
    Acked-by: Jesper Nilsson [cris]
    Acked-by: Daniel Vetter [drm]
    Reviewed-by: Bart Van Assche
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Fabien Dessenne [bdisp]
    Reviewed-by: Marek Szyprowski [vb2-core]
    Acked-by: David Vrabel [xen]
    Acked-by: Konrad Rzeszutek Wilk [xen swiotlb]
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Richard Kuo [hexagon]
    Acked-by: Geert Uytterhoeven [m68k]
    Acked-by: Gerald Schaefer [s390]
    Acked-by: Bjorn Andersson
    Acked-by: Hans-Christian Noren Egtvedt [avr32]
    Acked-by: Vineet Gupta [arc]
    Acked-by: Robin Murphy [arm64 and dma-iommu]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Krzysztof Kozlowski
     

01 Aug, 2016

1 commit

  • Pull IOMMU updates from Joerg Roedel:

    - big-endian support and preparation for defered probing for the Exynos
    IOMMU driver

    - simplifications in iommu-group id handling

    - support for Mediatek generation one IOMMU hardware

    - conversion of the AMD IOMMU driver to use the generic IOVA allocator.
    This driver now also benefits from the recent scalability
    improvements in the IOVA code.

    - preparations to use generic DMA mapping code in the Rockchip IOMMU
    driver

    - device tree adaption and conversion to use generic page-table code
    for the MSM IOMMU driver

    - an iova_to_phys optimization in the ARM-SMMU driver to greatly
    improve page-table teardown performance with VFIO

    - various other small fixes and conversions

    * tag 'iommu-updates-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (59 commits)
    iommu/amd: Initialize dma-ops domains with 3-level page-table
    iommu/amd: Update Alias-DTE in update_device_table()
    iommu/vt-d: Return error code in domain_context_mapping_one()
    iommu/amd: Use container_of to get dma_ops_domain
    iommu/amd: Flush iova queue before releasing dma_ops_domain
    iommu/amd: Handle IOMMU_DOMAIN_DMA in ops->domain_free call-back
    iommu/amd: Use dev_data->domain in get_domain()
    iommu/amd: Optimize map_sg and unmap_sg
    iommu/amd: Introduce dir2prot() helper
    iommu/amd: Implement timeout to flush unmap queues
    iommu/amd: Implement flush queue
    iommu/amd: Allow NULL pointer parameter for domain_flush_complete()
    iommu/amd: Set up data structures for flush queue
    iommu/amd: Remove align-parameter from __map_single()
    iommu/amd: Remove other remains of old address allocator
    iommu/amd: Make use of the generic IOVA allocator
    iommu/amd: Remove special mapping code for dma_ops path
    iommu/amd: Pass gfp-flags to iommu_map_page()
    iommu/amd: Implement apply_dm_region call-back
    iommu/amd: Create a list of reserved iova addresses
    ...

    Linus Torvalds
     

31 Jul, 2016

1 commit

  • Pull DeviceTree updates from Rob Herring:

    - remove most of_platform_populate() calls in arch code. Now the DT
    core code calls it in the default case and platforms only need to
    call it if they have special needs

    - use pr_fmt on all the DT core print statements

    - CoreSight binding doc improvements to block name descriptions

    - add dt_to_config script which can parse dts files and list
    corresponding kernel config options

    - fix memory leak hit with a PowerMac DT

    - correct a bunch of STMicro compatible strings to use the correct
    vendor prefix

    - fix DA9052 PMIC binding doc to match what is actually used in dts
    files

    * tag 'devicetree-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (35 commits)
    documentation: da9052: Update regulator bindings names to match DA9052/53 DTS expectations
    xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table"
    xtensa: Fix build error due to missing include file
    MIPS: ath79: Add missing include file
    Fix spelling errors in Documentation/devicetree
    ARM: dts: fix STMicroelectronics compatible strings
    powerpc/dts: fix STMicroelectronics compatible strings
    Documentation: dt: i2c: use correct STMicroelectronics vendor prefix
    scripts/dtc: dt_to_config - kernel config options for a devicetree
    of: fdt: mark unflattened tree as detached
    of: overlay: add resolver error prints
    coresight: document binding acronyms
    Documentation/devicetree: document cavium-pip rx-delay/tx-delay properties
    of: use pr_fmt prefix for all console printing
    of/irq: Mark initialised interrupt controllers as populated
    of: fix memory leak related to safe_name()
    Revert "of/platform: export of_default_bus_match_table"
    of: unittest: use of_platform_default_populate() to populate default bus
    memory: omap-gpmc: use of_platform_default_populate() to populate default bus
    bus: uniphier-system-bus: use of_platform_default_populate() to populate default bus
    ...

    Linus Torvalds
     

28 Jul, 2016

1 commit

  • Some of our "for_each_xyz()" macro constructs make gcc unhappy about
    lack of braces around if-statements inside or outside the loop, because
    the loop construct itself has a "if-then-else" statement inside of it.

    The resulting warnings look something like this:

    drivers/gpu/drm/i915/i915_debugfs.c: In function ‘i915_dump_lrc’:
    drivers/gpu/drm/i915/i915_debugfs.c:2103:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
    if (ctx != dev_priv->kernel_context)
    ^

    even if the code itself is fine.

    Since the warning is fairly easy to avoid by adding a braces around the
    if-statement near the for_each_xyz() construct, do so, rather than
    disabling the otherwise potentially useful warning.

    (The if-then-else statements used in the "for_each_xyz()" constructs are
    designed to be inherently safe even with no braces, but in this case
    it's quite understandable that gcc isn't really able to tell that).

    This finally leaves the standard "allmodconfig" build with just a
    handful of remaining warnings, so new and valid warnings hopefully will
    stand out.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

27 Jul, 2016

1 commit


26 Jul, 2016

3 commits


14 Jul, 2016

6 commits


13 Jul, 2016

19 commits


12 Jul, 2016

1 commit


07 Jul, 2016

2 commits

  • Use devm_request_irq to simplify error handling path,
    when probe smmu device.

    Also devm_{request|free}_irq when init or destroy domain context.

    Signed-off-by: Peng Fan
    Cc: Will Deacon
    Cc: Robin Murphy
    Signed-off-by: Will Deacon

    Peng Fan
     
  • There is a race condition in the AMD IOMMU init code that
    causes requested unity mappings to be blocked by the IOMMU
    for a short period of time. This results on boot failures
    and IO_PAGE_FAULTs on some machines.

    Fix this by making sure the unity mappings are installed
    before all other DMA is blocked.

    Fixes: aafd8ba0ca74 ('iommu/amd: Implement add_device and remove_device')
    Cc: stable@vger.kernel.org # v4.2+
    Signed-off-by: Joerg Roedel

    Joerg Roedel
     

04 Jul, 2016

1 commit

  • Per VT-d spec Section 10.4.2 ("Capability Register"), the maximum
    number of possible domains is 64K; indeed this is the maximum value
    that the cap_ndoms() macro will expand to. Since the value 65536
    will not fix in a u16, the 'did' variable must be promoted to an
    int, otherwise the test for < 65536 will always be true and the
    loop will never end.

    The symptom, in my case, was a hung machine during suspend.

    Fixes: 3bd4f9112f87 ("iommu/vt-d: Fix overflow of iommu->domains array")
    Signed-off-by: Aaron Campbell
    Signed-off-by: Joerg Roedel

    Aaron Campbell
     

01 Jul, 2016

2 commits

  • The implementation of iova_to_phys for the long-descriptor ARM
    io-pgtable code always masks with the granule size when inserting the
    low virtual address bits into the physical address determined from the
    page tables. In cases where the leaf entry is found before the final
    level of table (i.e. due to a block mapping), this results in rounding
    down to the bottom page of the block mapping. Consequently, the physical
    address range batching in the vfio_unmap_unpin is defeated and we end
    up taking the long way home.

    This patch fixes the problem by masking the virtual address with the
    appropriate mask for the level at which the leaf descriptor is located.
    The short-descriptor code already gets this right, so no change is
    needed there.

    Cc:
    Reported-by: Robin Murphy
    Tested-by: Robin Murphy
    Signed-off-by: Will Deacon

    Will Deacon
     
  • The PCIe ACS capability will affect the layout of iommu groups.
    Generally speaking, if the path from root port to the PCIe device
    is ACS enabled, the iommu will create a single iommu group for this
    PCIe device. If all PCIe devices on the path are ACS enabled then
    Linux can determine this path is ACS enabled.

    Linux use two PCIe configuration registers to determine the ACS
    status of PCIe devices:
    ACS Capability Register and ACS Control Register.

    The first register is used to check the implementation of ACS function
    of a PCIe device, the second register is used to check the enable status
    of ACS function. If one PCIe device has implemented and enabled the ACS
    function then Linux will determine this PCIe device enabled ACS.

    From the Chapter:6.12 of PCI Express Base Specification Revision 3.1a,
    we can find that when a PCIe device implements ACS function, the enable
    status is set to disabled by default and can be enabled by ACS-aware
    software.

    ACS will affect the iommu groups topology, so, the iommu driver is
    ACS-aware software. This patch adds a call to pci_request_acs() to the
    arm-smmu driver to enable the ACS function in PCIe devices that support
    it, when they get probed.

    Reviewed-by: Robin Murphy
    Reviewed-by: Eric Auger
    Signed-off-by: Wei Chen
    Signed-off-by: Will Deacon

    Wei Chen
     

27 Jun, 2016

1 commit