08 Aug, 2018

1 commit

  • All iommu drivers use the default_iommu_map_sg implementation, and there
    is no good reason to ever override it. Just expose it as iommu_map_sg
    directly and remove the indirection, specially in our post-spectre world
    where indirect calls are horribly expensive.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Joerg Roedel

    Christoph Hellwig
     

12 Apr, 2018

1 commit

  • Pull IOMMU updates from Joerg Roedel:

    - OF_IOMMU support for the Rockchip iommu driver so that it can use
    generic DT bindings

    - rework of locking in the AMD IOMMU interrupt remapping code to make
    it work better in RT kernels

    - support for improved iotlb flushing in the AMD IOMMU driver

    - support for 52-bit physical and virtual addressing in the ARM-SMMU

    - various other small fixes and cleanups

    * tag 'iommu-updates-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (53 commits)
    iommu/io-pgtable-arm: Avoid warning with 32-bit phys_addr_t
    iommu/rockchip: Support sharing IOMMU between masters
    iommu/rockchip: Add runtime PM support
    iommu/rockchip: Fix error handling in init
    iommu/rockchip: Use OF_IOMMU to attach devices automatically
    iommu/rockchip: Use IOMMU device for dma mapping operations
    dt-bindings: iommu/rockchip: Add clock property
    iommu/rockchip: Control clocks needed to access the IOMMU
    iommu/rockchip: Fix TLB flush of secondary IOMMUs
    iommu/rockchip: Use iopoll helpers to wait for hardware
    iommu/rockchip: Fix error handling in attach
    iommu/rockchip: Request irqs in rk_iommu_probe()
    iommu/rockchip: Fix error handling in probe
    iommu/rockchip: Prohibit unbind and remove
    iommu/amd: Return proper error code in irq_remapping_alloc()
    iommu/amd: Make amd_iommu_devtable_lock a spin_lock
    iommu/amd: Drop the lock while allocating new irq remap table
    iommu/amd: Factor out setting the remap table for a devid
    iommu/amd: Use `table' instead `irt' as variable name in amd_iommu_update_ga()
    iommu/amd: Remove the special case from alloc_irq_table()
    ...

    Linus Torvalds
     

06 Apr, 2018

1 commit

  • Currently #includes for no obvious
    reason. It looks like it's only a convenience, so remove kmemleak.h
    from slab.h and add to any users of kmemleak_* that
    don't already #include it. Also remove from source
    files that do not use it.

    This is tested on i386 allmodconfig and x86_64 allmodconfig. It would
    be good to run it through the 0day bot for other $ARCHes. I have
    neither the horsepower nor the storage space for the other $ARCHes.

    Update: This patch has been extensively build-tested by both the 0day
    bot & kisskb/ozlabs build farms. Both of them reported 2 build failures
    for which patches are included here (in v2).

    [ slab.h is the second most used header file after module.h; kernel.h is
    right there with slab.h. There could be some minor error in the
    counting due to some #includes having comments after them and I didn't
    combine all of those. ]

    [akpm@linux-foundation.org: security/keys/big_key.c needs vmalloc.h, per sfr]
    Link: http://lkml.kernel.org/r/e4309f98-3749-93e1-4bb7-d9501a39d015@infradead.org
    Link: http://kisskb.ellerman.id.au/kisskb/head/13396/
    Signed-off-by: Randy Dunlap
    Reviewed-by: Ingo Molnar
    Reported-by: Michael Ellerman [2 build failures]
    Reported-by: Fengguang Wu [2 build failures]
    Reviewed-by: Andrew Morton
    Cc: Wei Yongjun
    Cc: Luis R. Rodriguez
    Cc: Greg Kroah-Hartman
    Cc: Mimi Zohar
    Cc: John Johansen
    Cc: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

13 Feb, 2018

1 commit

  • In the commit 05f80300dc8b ("iommu: Finish making iommu_group support
    mandatory"), the iommu framework has supposed all the iommu drivers have
    their owner iommu-group, it get rid of the FIXME workarounds while the
    group is NULL. But the flow of Mediatek M4U gen1 looks a bit trick that
    it will hang at this case:

    ==========================================
    Unable to handle kernel NULL pointer dereference at virtual address 00000030
    pgd = c0004000
    [00000030] *pgd=00000000
    PC is at mutex_lock+0x28/0x54
    LR is at iommu_attach_device+0xa4/0xd4
    pc : [] lr : [] psr: 60000013
    sp : df0edbb8 ip : df0edbc8 fp : df0edbc4
    r10: c114da14 r9 : df2a3e40 r8 : 00000003
    r7 : df27a210 r6 : df2a90c4 r5 : 00000030 r4 : 00000000
    r3 : df0f8000 r2 : fffff000 r1 : df29c610 r0 : 00000030
    Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
    xxx
    (mutex_lock) from [] (iommu_attach_device+0xa4/0xd4)
    (iommu_attach_device) from [] (__arm_iommu_attach_device+0x28/0x90)
    (__arm_iommu_attach_device) from [] (arm_iommu_attach_device+0x1c/0x30)
    (arm_iommu_attach_device) from [] (mtk_iommu_add_device+0xfc/0x214)
    (mtk_iommu_add_device) from [] (add_iommu_group+0x3c/0x68)
    (add_iommu_group) from [] (bus_for_each_dev+0x78/0xac)
    (bus_for_each_dev) from [] (bus_set_iommu+0xb0/0xec)
    (bus_set_iommu) from [] (mtk_iommu_probe+0x328/0x368)
    (mtk_iommu_probe) from [] (platform_drv_probe+0x5c/0xc0)
    (platform_drv_probe) from [] (driver_probe_device+0x2f4/0x4d8)
    (driver_probe_device) from [] (__driver_attach+0x10c/0x128)
    (__driver_attach) from [] (bus_for_each_dev+0x78/0xac)
    (bus_for_each_dev) from [] (driver_attach+0x2c/0x30)
    (driver_attach) from [] (bus_add_driver+0x1e0/0x278)
    (bus_add_driver) from [] (driver_register+0x88/0x108)
    (driver_register) from [] (__platform_driver_register+0x50/0x58)
    (__platform_driver_register) from [] (m4u_init+0x24/0x28)
    (m4u_init) from [] (do_one_initcall+0xf0/0x17c)
    =========================

    The root cause is that the device's iommu-group is NULL while
    arm_iommu_attach_device is called. This patch prepare a new iommu-group
    for the iommu consumer devices to fix this issue.

    CC: Robin Murphy
    CC: Honghui Zhang
    Fixes: 05f80300dc8b ("iommu: Finish making iommu_group support mandatory")
    Reported-by: Ryder Lee
    Signed-off-by: Yong Wu
    Signed-off-by: Joerg Roedel

    Yong Wu
     

07 Nov, 2017

1 commit

  • There exist two Mediatek iommu drivers for the two different
    generations of the device. But both drivers have the same name
    "mtk-iommu". This breaks the registration of the second driver:

    Error: Driver 'mtk-iommu' is already registered, aborting...

    Fix this by changing the name for first generation to
    "mtk-iommu-v1".

    Fixes: b17336c55d89 ("iommu/mediatek: add support for mtk iommu generation one HW")
    Signed-off-by: Matthias Brugger
    Signed-off-by: Alex Williamson

    Matthias Brugger
     

17 May, 2017

1 commit

  • The mediatek iommu driver relied on an implicit include of dma-mapping.h,
    but for some reason that is no longer there in 4.12-rc1:

    drivers/iommu/mtk_iommu_v1.c: In function 'mtk_iommu_domain_finalise':
    drivers/iommu/mtk_iommu_v1.c:233:16: error: implicit declaration of function 'dma_zalloc_coherent'; did you mean 'debug_dma_alloc_coherent'? [-Werror=implicit-function-declaration]
    drivers/iommu/mtk_iommu_v1.c: In function 'mtk_iommu_domain_free':
    drivers/iommu/mtk_iommu_v1.c:265:2: error: implicit declaration of function 'dma_free_coherent'; did you mean 'debug_dma_free_coherent'? [-Werror=implicit-function-declaration]

    This adds an explicit #include to make it build again.

    Signed-off-by: Arnd Bergmann
    Fixes: 208480bb27 ('iommu: Remove trace-events include from iommu.h')
    Signed-off-by: Joerg Roedel

    Arnd Bergmann
     

03 Apr, 2017

1 commit


07 Dec, 2016

1 commit


15 Nov, 2016

1 commit

  • For each subsequent device assigned to the m4u_group after its initial
    allocation, we need to take an additional reference. Otherwise, the
    caller of iommu_group_get_for_dev() will inadvertently remove the
    reference taken by iommu_group_add_device(), and the group will be
    freed prematurely if any device is removed.

    Signed-off-by: Robin Murphy
    Signed-off-by: Joerg Roedel

    Robin Murphy
     

10 Nov, 2016

2 commits


21 Jun, 2016

2 commits

  • The symbol exists elsewhere already, so that is fails to
    link if the symbol is non-static.

    Signed-off-by: Joerg Roedel

    Joerg Roedel
     
  • Mediatek SoC's M4U has two generations of HW architcture. Generation one
    uses flat, one layer pagetable, and was shipped with ARM architecture, it
    only supports 4K size page mapping. MT2701 SoC uses this generation one
    m4u HW. Generation two uses the ARM short-descriptor translation table
    format for address translation, and was shipped with ARM64 architecture,
    MT8173 uses this generation two m4u HW. All the two generation iommu HW
    only have one iommu domain, and all its iommu clients share the same
    iova address.

    These two generation m4u HW have slit different register groups and
    register offset, but most register names are the same. This patch add iommu
    support for mediatek SoC mt2701.

    Signed-off-by: Honghui Zhang
    Signed-off-by: Joerg Roedel

    Honghui Zhang