1. 13 5月, 2020 1 次提交
  2. 05 5月, 2020 12 次提交
  3. 01 5月, 2020 1 次提交
  4. 29 4月, 2020 1 次提交
    • K
      iommu: Fix the memory leak in dev_iommu_free() · 5375e874
      Kevin Hao 提交于
      In iommu_probe_device(), we would invoke dev_iommu_free() to free the
      dev->iommu after the ->add_device() returns failure. But after commit
      72acd9df ("iommu: Move iommu_fwspec to struct dev_iommu"), we also
      need to free the iommu_fwspec before the dev->iommu is freed. This fixes
      the following memory leak reported by kmemleak:
        unreferenced object 0xffff000bc836c700 (size 128):
          comm "swapper/0", pid 1, jiffies 4294896304 (age 782.120s)
          hex dump (first 32 bytes):
            00 00 00 00 00 00 00 00 d8 cd 9b ff 0b 00 ff ff  ................
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          backtrace:
            [<00000000df34077b>] kmem_cache_alloc_trace+0x244/0x4b0
            [<000000000e560ac0>] iommu_fwspec_init+0x7c/0xb0
            [<0000000075eda275>] of_iommu_xlate+0x80/0xe8
            [<00000000728d6bf9>] of_pci_iommu_init+0xb0/0xb8
            [<00000000d001fe6f>] pci_for_each_dma_alias+0x48/0x190
            [<000000006db6bbce>] of_iommu_configure+0x1ac/0x1d0
            [<00000000634745f8>] of_dma_configure+0xdc/0x220
            [<000000002cbc8ba0>] pci_dma_configure+0x50/0x78
            [<00000000cdf6e193>] really_probe+0x8c/0x340
            [<00000000fddddc46>] driver_probe_device+0x60/0xf8
            [<0000000061bcdb51>] __device_attach_driver+0x8c/0xd0
            [<000000009b9ff58e>] bus_for_each_drv+0x80/0xd0
            [<000000004b9c8aa3>] __device_attach+0xec/0x148
            [<00000000a5c13bf3>] device_attach+0x1c/0x28
            [<000000005071e151>] pci_bus_add_device+0x58/0xd0
            [<000000002d4f87d1>] pci_bus_add_devices+0x40/0x90
      
      Fixes: 72acd9df ("iommu: Move iommu_fwspec to struct dev_iommu")
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Link: https://lore.kernel.org/r/20200402143749.40500-1-haokexin@gmail.comSigned-off-by: NJoerg Roedel <jroedel@suse.de>
      5375e874
  5. 27 3月, 2020 2 次提交
  6. 28 2月, 2020 1 次提交
    • R
      iommu: Use C99 flexible array in fwspec · 098accf2
      Robin Murphy 提交于
      Although the 1-element array was a typical pre-C99 way to implement
      variable-length structures, and indeed is a fundamental construct in the
      APIs of certain other popular platforms, there's no good reason for it
      here (and in particular the sizeof() trick is far too "clever" for its
      own good). We can just as easily implement iommu_fwspec's preallocation
      behaviour using a standard flexible array member, so let's make it look
      the way most readers would expect.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      098accf2
  7. 08 1月, 2020 1 次提交
  8. 23 12月, 2019 4 次提交
  9. 17 12月, 2019 2 次提交
  10. 15 10月, 2019 3 次提交
  11. 03 9月, 2019 1 次提交
  12. 30 8月, 2019 2 次提交
  13. 23 8月, 2019 6 次提交
  14. 30 7月, 2019 1 次提交
    • W
      iommu: Pass struct iommu_iotlb_gather to ->unmap() and ->iotlb_sync() · 56f8af5e
      Will Deacon 提交于
      To allow IOMMU drivers to batch up TLB flushing operations and postpone
      them until ->iotlb_sync() is called, extend the prototypes for the
      ->unmap() and ->iotlb_sync() IOMMU ops callbacks to take a pointer to
      the current iommu_iotlb_gather structure.
      
      All affected IOMMU drivers are updated, but there should be no
      functional change since the extra parameter is ignored for now.
      Signed-off-by: NWill Deacon <will@kernel.org>
      56f8af5e
  15. 24 7月, 2019 2 次提交
    • W
      iommu: Introduce struct iommu_iotlb_gather for batching TLB flushes · a7d20dc1
      Will Deacon 提交于
      To permit batching of TLB flushes across multiple calls to the IOMMU
      driver's ->unmap() implementation, introduce a new structure for
      tracking the address range to be flushed and the granularity at which
      the flushing is required.
      
      This is hooked into the IOMMU API and its caller are updated to make use
      of the new structure. Subsequent patches will plumb this into the IOMMU
      drivers as well, but for now the gathering information is ignored.
      Signed-off-by: NWill Deacon <will@kernel.org>
      a7d20dc1
    • W
      iommu: Remove empty iommu_tlb_range_add() callback from iommu_ops · 6d1bcb95
      Will Deacon 提交于
      Commit add02cfd ("iommu: Introduce Interface for IOMMU TLB Flushing")
      added three new TLB flushing operations to the IOMMU API so that the
      underlying driver operations can be batched when unmapping large regions
      of IO virtual address space.
      
      However, the ->iotlb_range_add() callback has not been implemented by
      any IOMMU drivers (amd_iommu.c implements it as an empty function, which
      incurs the overhead of an indirect branch). Instead, drivers either flush
      the entire IOTLB in the ->iotlb_sync() callback or perform the necessary
      invalidation during ->unmap().
      
      Attempting to implement ->iotlb_range_add() for arm-smmu-v3.c revealed
      two major issues:
      
        1. The page size used to map the region in the page-table is not known,
           and so it is not generally possible to issue TLB flushes in the most
           efficient manner.
      
        2. The only mutable state passed to the callback is a pointer to the
           iommu_domain, which can be accessed concurrently and therefore
           requires expensive synchronisation to keep track of the outstanding
           flushes.
      
      Remove the callback entirely in preparation for extending ->unmap() and
      ->iotlb_sync() to update a token on the caller's stack.
      Signed-off-by: NWill Deacon <will@kernel.org>
      6d1bcb95