20 Aug, 2019

1 commit


09 Aug, 2019

1 commit

  • We don't need dev_err() messages when platform_get_irq() fails now that
    platform_get_irq() prints an error message itself when something goes
    wrong. Let's remove these prints with a simple semantic patch.

    //
    @@
    expression ret;
    struct platform_device *E;
    @@

    ret =
    (
    platform_get_irq(E, ...)
    |
    platform_get_irq_byname(E, ...)
    );

    if ( \( ret < 0 \| ret

    While we're here, remove braces on if statements that only have one
    statement (manually).

    Cc: Joerg Roedel
    Cc: iommu@lists.linux-foundation.org
    Cc: Greg Kroah-Hartman
    Signed-off-by: Stephen Boyd
    Signed-off-by: Joerg Roedel

    Stephen Boyd
     

30 Jul, 2019

6 commits


24 Jul, 2019

1 commit

  • In preparation for TLB flush gathering in the IOMMU API, rename the
    iommu_gather_ops structure in io-pgtable to iommu_flush_ops, which
    better describes its purpose and avoids the potential for confusion
    between different levels of the API.

    $ find linux/ -type f -name '*.[ch]' | xargs sed -i 's/gather_ops/flush_ops/g'

    Signed-off-by: Will Deacon

    Will Deacon
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 and
    only version 2 as published by the free software foundation this
    program is distributed in the hope that it will be useful but
    without any warranty without even the implied warranty of
    merchantability or fitness for a particular purpose see the gnu
    general public license for more details you should have received a
    copy of the gnu general public license along with this program if
    not write to the free software foundation inc 51 franklin street
    fifth floor boston ma 02110 1301 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 94 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141334.043630402@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

15 May, 2019

1 commit


01 Mar, 2019

1 commit


11 Feb, 2019

1 commit

  • Move io-pgtable.h to include/linux/ and export alloc_io_pgtable_ops
    and free_io_pgtable_ops. This enables drivers outside drivers/iommu/ to
    use the page table library. Specifically, some ARM Mali GPUs use the
    ARM page table formats.

    Cc: Will Deacon
    Cc: Robin Murphy
    Cc: Joerg Roedel
    Cc: Matthias Brugger
    Cc: Rob Clark
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-arm-msm@vger.kernel.org
    Signed-off-by: Rob Herring
    Signed-off-by: Joerg Roedel

    Rob Herring
     

11 Jan, 2019

1 commit

  • Delete tab aligning a statement with the right hand side of a
    preceding assignment rather than the left hand side.

    Found with the help of Coccinelle.

    Signed-off-by: Julia Lawall
    Signed-off-by: Joerg Roedel

    Julia Lawall
     

03 Dec, 2018

1 commit

  • The Kconfig currently controlling compilation of this code is:

    drivers/iommu/Kconfig:config MSM_IOMMU
    drivers/iommu/Kconfig: bool "MSM IOMMU Support"

    ...meaning that it currently is not being built as a module by anyone.

    Lets remove the modular code that is essentially orphaned, so that
    when reading the driver there is no doubt it is builtin-only.

    Since module_init was not even used by this driver, the init ordering
    remains unchanged with this commit.

    We also delete the MODULE_LICENSE tag etc. since all that information
    was (or is now) contained at the top of the file in the comments.

    Cc: Joerg Roedel
    Cc: Stepan Moskovchenko
    Cc: iommu@lists.linux-foundation.org
    Signed-off-by: Paul Gortmaker
    Signed-off-by: Joerg Roedel

    Paul Gortmaker
     

25 Aug, 2018

1 commit

  • Pull IOMMU updates from Joerg Roedel:

    - PASID table handling updates for the Intel VT-d driver. It implements
    a global PASID space now so that applications usings multiple devices
    will just have one PASID.

    - A new config option to make iommu passthroug mode the default.

    - New sysfs attribute for iommu groups to export the type of the
    default domain.

    - A debugfs interface (for debug only) usable by IOMMU drivers to
    export internals to user-space.

    - R-Car Gen3 SoCs support for the ipmmu-vmsa driver

    - The ARM-SMMU now aborts transactions from unknown devices and devices
    not attached to any domain.

    - Various cleanups and smaller fixes all over the place.

    * tag 'iommu-updates-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (42 commits)
    iommu/omap: Fix cache flushes on L2 table entries
    iommu: Remove the ->map_sg indirection
    iommu/arm-smmu-v3: Abort all transactions if SMMU is enabled in kdump kernel
    iommu/arm-smmu-v3: Prevent any devices access to memory without registration
    iommu/ipmmu-vmsa: Don't register as BUS IOMMU if machine doesn't have IPMMU-VMSA
    iommu/ipmmu-vmsa: Clarify supported platforms
    iommu/ipmmu-vmsa: Fix allocation in atomic context
    iommu: Add config option to set passthrough as default
    iommu: Add sysfs attribyte for domain type
    iommu/arm-smmu-v3: sync the OVACKFLG to PRIQ consumer register
    iommu/arm-smmu: Error out only if not enough context interrupts
    iommu/io-pgtable-arm-v7s: Abort allocation when table address overflows the PTE
    iommu/io-pgtable-arm: Fix pgtable allocation in selftest
    iommu/vt-d: Remove the obsolete per iommu pasid tables
    iommu/vt-d: Apply per pci device pasid table in SVA
    iommu/vt-d: Allocate and free pasid table
    iommu/vt-d: Per PCI device pasid table interfaces
    iommu/vt-d: Add for_each_device_domain() helper
    iommu/vt-d: Move device_domain_info to header
    iommu/vt-d: Apply global PASID in SVA
    ...

    Linus Torvalds
     

08 Aug, 2018

2 commits


10 Jul, 2018

1 commit

  • Now that we use the driver core to stop deferred probe for missing
    drivers, IOMMU_OF_DECLARE can be removed.

    This is slightly less optimal than having a list of built-in drivers in
    that we'll now defer probe twice before giving up. This shouldn't have a
    significant impact on boot times as past discussions about deferred
    probe have given no evidence of deferred probe having a substantial
    impact.

    Cc: Robin Murphy
    Cc: Kukjin Kim
    Cc: Krzysztof Kozlowski
    Cc: Rob Clark
    Cc: Heiko Stuebner
    Cc: Frank Rowand
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-samsung-soc@vger.kernel.org
    Cc: linux-arm-msm@vger.kernel.org
    Cc: linux-rockchip@lists.infradead.org
    Cc: devicetree@vger.kernel.org
    Acked-by: Will Deacon
    Acked-by: Marek Szyprowski
    Acked-by: Joerg Roedel
    Signed-off-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Rob Herring
     

06 Jul, 2018

1 commit

  • Fixes the following splat during boot:

    BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747
    in_atomic(): 1, irqs_disabled(): 128, pid: 77, name: kworker/2:1
    4 locks held by kworker/2:1/77:
    #0: (ptrval) ((wq_completion)"events"){+.+.}, at: process_one_work+0x1fc/0x8fc
    #1: (ptrval) (deferred_probe_work){+.+.}, at: process_one_work+0x1fc/0x8fc
    #2: (ptrval) (&dev->mutex){....}, at: __device_attach+0x40/0x178
    #3: (ptrval) (msm_iommu_lock){....}, at: msm_iommu_add_device+0x28/0xcc
    irq event stamp: 348
    hardirqs last enabled at (347): [] kfree+0xe0/0x3c0
    hardirqs last disabled at (348): [] _raw_spin_lock_irqsave+0x2c/0x68
    softirqs last enabled at (0): [] copy_process.part.5+0x280/0x1a68
    softirqs last disabled at (0): [] (null)
    Preemption disabled at:
    [] (null)
    CPU: 2 PID: 77 Comm: kworker/2:1 Not tainted 4.17.0-rc5-wt-ath-01075-gaca0516bb4cf #239
    Hardware name: Generic DT based system
    Workqueue: events deferred_probe_work_func
    [] (unwind_backtrace) from [] (show_stack+0x20/0x24)
    [] (show_stack) from [] (dump_stack+0xa0/0xcc)
    [] (dump_stack) from [] (___might_sleep+0x1f8/0x2d4)
    ath10k_sdio mmc2:0001:1: Direct firmware load for ath10k/QCA9377/hw1.0/board-2.bin failed with error -2
    [] (___might_sleep) from [] (__might_sleep+0x70/0xa8)
    [] (__might_sleep) from [] (__mutex_lock+0x50/0xb28)
    [] (__mutex_lock) from [] (mutex_lock_nested+0x2c/0x34)
    ath10k_sdio mmc2:0001:1: board_file api 1 bmi_id N/A crc32 544289f7
    [] (mutex_lock_nested) from [] (kernfs_find_and_get_ns+0x30/0x5c)
    [] (kernfs_find_and_get_ns) from [] (sysfs_add_link_to_group+0x28/0x58)
    [] (sysfs_add_link_to_group) from [] (iommu_device_link+0x50/0xb4)
    [] (iommu_device_link) from [] (msm_iommu_add_device+0xa0/0xcc)
    [] (msm_iommu_add_device) from [] (add_iommu_group+0x3c/0x64)
    [] (add_iommu_group) from [] (bus_for_each_dev+0x84/0xc4)
    [] (bus_for_each_dev) from [] (bus_set_iommu+0xd0/0x10c)
    [] (bus_set_iommu) from [] (msm_iommu_probe+0x5b8/0x66c)
    [] (msm_iommu_probe) from [] (platform_drv_probe+0x60/0xbc)
    [] (platform_drv_probe) from [] (driver_probe_device+0x30c/0x4cc)
    [] (driver_probe_device) from [] (__device_attach_driver+0xac/0x14c)
    [] (__device_attach_driver) from [] (bus_for_each_drv+0x68/0xc8)
    [] (bus_for_each_drv) from [] (__device_attach+0xe4/0x178)
    [] (__device_attach) from [] (device_initial_probe+0x1c/0x20)
    [] (device_initial_probe) from [] (bus_probe_device+0x98/0xa0)
    [] (bus_probe_device) from [] (deferred_probe_work_func+0x74/0x198)
    [] (deferred_probe_work_func) from [] (process_one_work+0x2c4/0x8fc)
    [] (process_one_work) from [] (worker_thread+0x2c4/0x5cc)
    [] (worker_thread) from [] (kthread+0x180/0x188)
    [] (kthread) from [] (ret_from_fork+0x14/0x20)

    Fixes: 42df43b36163 ("iommu/msm: Make use of iommu_device_register interface")
    Signed-off-by: Niklas Cassel
    Reviewed-by: Vivek Gautam
    Signed-off-by: Joerg Roedel

    Niklas Cassel
     

17 Jan, 2018

2 commits

  • Now that no more drivers rely on arbitrary early initialisation via an
    of_iommu_init_fn hook, let's clean up the redundant remnants. The
    IOMMU_OF_DECLARE() macro needs to remain for now, as the probe-deferral
    mechanism has no other nice way to detect built-in drivers before they
    have registered themselves, such that it can make the right decision.

    Reviewed-by: Sricharan R
    Signed-off-by: Robin Murphy
    Signed-off-by: Joerg Roedel

    Robin Murphy
     
  • Since the MSM IOMMU driver now probes via DT exclusively rather than
    platform data, dependent masters should be deferred until the IOMMU
    itself is ready. Thus we can do away with the early initialisation
    hook to unconditionally claim the bus ops, and instead do that only
    once an IOMMU is actually probed. Furthermore, this should also make
    the driver safe for multiplatform kernels on non-MSM SoCs.

    Reviewed-by: Sricharan R
    Signed-off-by: Robin Murphy
    Signed-off-by: Joerg Roedel

    Robin Murphy
     

10 Aug, 2017

1 commit

  • As the last step to making groups mandatory, clean up the remaining
    drivers by adding basic support. Whilst it may not perfectly reflect the
    isolation capabilities of the hardware, using generic_device_group()
    should at least maintain existing behaviour with respect to the API.

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

    Robin Murphy
     

10 Feb, 2017

2 commits


21 Jun, 2016

4 commits

  • This iommu uses the armv7 short descriptor format. So use the
    generic ARMV7S pagetable ops instead of rewriting the same stuff
    in the driver.

    Signed-off-by: Sricharan R
    Tested-by: Archit Taneja
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Joerg Roedel

    Sricharan R
     
  • This adds the xlate callback which gets invoked during
    device registration from DT. The master devices gets added
    through this.

    Signed-off-by: Sricharan R
    Tested-by: Archit Taneja
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Joerg Roedel

    Sricharan R
     
  • There are only two functions left in msm_iommu_dev.c. Move it to
    msm_iommu.c and delete the file.

    Signed-off-by: Sricharan R
    Tested-by: Archit Taneja
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Joerg Roedel

    Sricharan R
     
  • The driver currently works based on platform data. Remove this
    and add support for DT. A single master can have multiple ports
    connected to more than one iommu.

    master
    |
    |
    |
    ------------------------
    | |
    IOMMU0 IOMMU1
    | |
    ctx0 ctx1 ctx0 ctx1

    This association of master and iommus/contexts were previously
    represented by platform data parent/child device details. The client
    drivers were responsible for programming all of the iommus/contexts
    for the device. Now while adapting to generic DT bindings we maintain the
    list of iommus, contexts that each master domain is connected to and
    program all of them on attach/detach.

    Signed-off-by: Sricharan R
    Tested-by: Archit Taneja
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Joerg Roedel

    Sricharan R
     

14 Aug, 2015

1 commit


31 Mar, 2015

1 commit


02 Dec, 2014

1 commit


04 Nov, 2014

1 commit

  • Mapping and unmapping are more often than not in the critical path.
    map_sg allows IOMMU driver implementations to optimize the process
    of mapping buffers into the IOMMU page tables.

    Instead of mapping a buffer one page at a time and requiring potentially
    expensive TLB operations for each page, this function allows the driver
    to map all pages in one go and defer TLB maintenance until after all
    pages have been mapped.

    Additionally, the mapping operation would be faster in general since
    clients does not have to keep calling map API over and over again for
    each physically contiguous chunk of memory that needs to be mapped to a
    virtually contiguous region.

    Signed-off-by: Olav Haugan
    Signed-off-by: Joerg Roedel

    Olav Haugan
     

23 Oct, 2014

1 commit

  • A semantic patch approach was proposed with the subject
    "[PATCH with Coccinelle?] Deletion of unnecessary checks
    before specific function calls" on 2014-03-05.
    https://lkml.org/lkml/2014/3/5/344
    http://article.gmane.org/gmane.comp.version-control.coccinelle/3513/

    This patch pattern application was repeated with the help of
    the software "Coccinelle 1.0.0-rc22" on the source files for
    Linux 3.17.1. An extract of the automatically generated
    update suggestions is shown here.

    It was determined that the affected source code places call
    functions which perform input parameter validation already.
    It is therefore not needed that a similar safety check is
    repeated at the call site.

    Signed-off-by: Markus Elfring
    Signed-off-by: Joerg Roedel

    SF Markus Elfring
     

25 Sep, 2014

1 commit


07 Jul, 2014

1 commit


07 Aug, 2013

1 commit

  • Two header files exist in mach-msm's include/mach directory that
    are only used by the MSM iommu driver. Move these files to the
    iommu driver directory and prefix them with "msm_". This allows
    us to compile the MSM iommu driver on multi-platform kernels.

    Acked-by: Joerg Roedel
    Cc: Stepan Moskovchenko
    Signed-off-by: Stephen Boyd
    Signed-off-by: David Brown

    Stephen Boyd
     

03 Apr, 2013

1 commit


11 Jul, 2012

1 commit


30 Jan, 2012

1 commit

  • Error handling in msm_iommu_unmap() is broken. On some error
    conditions retval is set to a non-zero value which causes
    the function to return 'len' at the end. This hides the
    error from the user. Zero should be returned in those error
    cases.

    Cc: David Brown
    Cc: Stepan Moskovchenko
    Cc: stable@vger.kernel.org # >= 3.1
    Signed-off-by: Joerg Roedel
    Acked-by: David Brown

    Joerg Roedel