1. 11 8月, 2017 1 次提交
  2. 20 7月, 2017 2 次提交
    • V
      iommu/arm-smmu: Fix the error path in arm_smmu_add_device · c54451a5
      Vivek Gautam 提交于
      fwspec->iommu_priv is available only after arm_smmu_master_cfg
      instance has been allocated. We shouldn't free it before that.
      Also it's logical to free the master cfg itself without
      checking for fwspec.
      Signed-off-by: NVivek Gautam <vivek.gautam@codeaurora.org>
      [will: remove redundant assignment to fwspec]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      c54451a5
    • W
      iommu/arm-smmu: Reintroduce locking around TLB sync operations · 8e517e76
      Will Deacon 提交于
      Commit 523d7423 ("iommu/arm-smmu: Remove io-pgtable spinlock")
      removed the locking used to serialise map/unmap calls into the io-pgtable
      code from the ARM SMMU driver. This is good for performance, but opens
      us up to a nasty race with TLB syncs because the TLB sync register is
      shared within a context bank (or even globally for stage-2 on SMMUv1).
      
      There are two cases to consider:
      
        1. A CPU can be spinning on the completion of a TLB sync, take an
           interrupt which issues a subsequent TLB sync, and then report a
           timeout on return from the interrupt.
      
        2. A CPU can be spinning on the completion of a TLB sync, but other
           CPUs can continuously issue additional TLB syncs in such a way that
           the backoff logic reports a timeout.
      
      Rather than fix this by spinning for completion of prior TLB syncs before
      issuing a new one (which may suffer from fairness issues on large systems),
      instead reintroduce locking around TLB sync operations in the ARM SMMU
      driver.
      
      Fixes: 523d7423 ("iommu/arm-smmu: Remove io-pgtable spinlock")
      Cc: Robin Murphy <robin.murphy@arm.com>
      Reported-by: NRay Jui <ray.jui@broadcom.com>
      Tested-by: NRay Jui <ray.jui@broadcom.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      8e517e76
  3. 24 6月, 2017 3 次提交
    • R
      iommu/arm-smmu: Remove io-pgtable spinlock · 523d7423
      Robin Murphy 提交于
      With the io-pgtable code now robust against (valid) races, we no longer
      need to serialise all operations with a lock. This might make broken
      callers who issue concurrent operations on overlapping addresses go even
      more wrong than before, but hey, they already had little hope of useful
      or deterministic results.
      
      We do however still have to keep a lock around to serialise the ATS1*
      translation ops, as parallel iova_to_phys() calls could lead to
      unpredictable hardware behaviour otherwise.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      523d7423
    • R
      iommu/io-pgtable: Introduce explicit coherency · 81b3c252
      Robin Murphy 提交于
      Once we remove the serialising spinlock, a potential race opens up for
      non-coherent IOMMUs whereby a caller of .map() can be sure that cache
      maintenance has been performed on their new PTE, but will have no
      guarantee that such maintenance for table entries above it has actually
      completed (e.g. if another CPU took an interrupt immediately after
      writing the table entry, but before initiating the DMA sync).
      
      Handling this race safely will add some potentially non-trivial overhead
      to installing a table entry, which we would much rather avoid on
      coherent systems where it will be unnecessary, and where we are stirivng
      to minimise latency by removing the locking in the first place.
      
      To that end, let's introduce an explicit notion of cache-coherency to
      io-pgtable, such that we will be able to avoid penalising IOMMUs which
      know enough to know when they are coherent.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      81b3c252
    • R
      iommu/arm-smmu: Plumb in new ACPI identifiers · 84c24379
      Robin Murphy 提交于
      Revision C of IORT now allows us to identify ARM MMU-401 and the Cavium
      ThunderX implementation. Wire them up so that we can probe these models
      once firmware starts using the new codes in place of generic ones, and
      so that the appropriate features and quirks get enabled when we do.
      
      For the sake of backports and mitigating sychronisation problems with
      the ACPICA headers, we'll carry a backup copy of the new definitions
      locally for the short term to make life simpler.
      
      CC: stable@vger.kernel.org # 4.10
      Acked-by: NRobert Richter <rrichter@cavium.com>
      Tested-by: NRobert Richter <rrichter@cavium.com>
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      84c24379
  4. 26 4月, 2017 1 次提交
  5. 25 4月, 2017 1 次提交
  6. 20 4月, 2017 1 次提交
  7. 06 4月, 2017 9 次提交
  8. 22 3月, 2017 2 次提交
    • R
      iommu/dma: Make PCI window reservation generic · 273df963
      Robin Murphy 提交于
      Now that we're applying the IOMMU API reserved regions to our IOVA
      domains, we shouldn't need to privately special-case PCI windows, or
      indeed anything else which isn't specific to our iommu-dma layer.
      However, since those aren't IOMMU-specific either, rather than start
      duplicating code into IOMMU drivers let's transform the existing
      function into an iommu_get_resv_regions() helper that they can share.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      273df963
    • R
      iommu: Disambiguate MSI region types · 9d3a4de4
      Robin Murphy 提交于
      The introduction of reserved regions has left a couple of rough edges
      which we could do with sorting out sooner rather than later. Since we
      are not yet addressing the potential dynamic aspect of software-managed
      reservations and presenting them at arbitrary fixed addresses, it is
      incongruous that we end up displaying hardware vs. software-managed MSI
      regions to userspace differently, especially since ARM-based systems may
      actually require one or the other, or even potentially both at once,
      (which iommu-dma currently has no hope of dealing with at all). Let's
      resolve the former user-visible inconsistency ASAP before the ABI has
      been baked into a kernel release, in a way that also lays the groundwork
      for the latter shortcoming to be addressed by follow-up patches.
      
      For clarity, rename the software-managed type to IOMMU_RESV_SW_MSI, use
      IOMMU_RESV_MSI to describe the hardware type, and document everything a
      little bit. Since the x86 MSI remapping hardware falls squarely under
      this meaning of IOMMU_RESV_MSI, apply that type to their regions as well,
      so that we tell the same story to userspace across all platforms.
      
      Secondly, as the various region types require quite different handling,
      and it really makes little sense to ever try combining them, convert the
      bitfield-esque #defines to a plain enum in the process before anyone
      gets the wrong impression.
      
      Fixes: d30ddcaa ("iommu: Add a new type field in iommu_resv_region")
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      CC: Alex Williamson <alex.williamson@redhat.com>
      CC: David Woodhouse <dwmw2@infradead.org>
      CC: kvm@vger.kernel.org
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      9d3a4de4
  9. 10 2月, 2017 2 次提交
  10. 27 1月, 2017 2 次提交
    • T
      iommu/arm-smmu: Fix for ThunderX erratum #27704 · 3677a649
      Tomasz Nowicki 提交于
      The goal of erratum #27704 workaround was to make sure that ASIDs and VMIDs
      are unique across all SMMU instances on affected Cavium systems.
      
      Currently, the workaround code partitions ASIDs and VMIDs by increasing
      global cavium_smmu_context_count which in turn becomes the base ASID and VMID
      value for the given SMMU instance upon the context bank initialization.
      
      For systems with multiple SMMU instances this approach implies the risk
      of crossing 8-bit ASID, like for 1-socket CN88xx capable of 4 SMMUv2,
      128 context banks each:
      SMMU_0 (0-127 ASID RANGE)
      SMMU_1 (127-255 ASID RANGE)
      SMMU_2 (256-383 ASID RANGE) <--- crossing 8-bit ASID
      SMMU_3 (384-511 ASID RANGE) <--- crossing 8-bit ASID
      
      Since now we use 8-bit ASID (SMMU_CBn_TCR2.AS = 0) we effectively misconfigure
      ASID[15:8] bits of SMMU_CBn_TTBRm register for SMMU_2/3. Moreover, we still
      assume non-zero ASID[15:8] bits upon context invalidation. In the end,
      except SMMU_0/1 devices all other devices under other SMMUs will fail on guest
      power off/on. Since we try to invalidate TLB with 16-bit ASID but we actually
      have 8-bit zero padded 16-bit entry.
      
      This patch adds 16-bit ASID support for stage-1 AArch64 contexts so that
      we use ASIDs consistently for all SMMU instances.
      Signed-off-by: NTomasz Nowicki <tn@semihalf.com>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Reviewed-by: NTirumalesh Chalamarla  <Tirumalesh.Chalamarla@cavium.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      3677a649
    • A
      iommu/arm-smmu: Support for Extended Stream ID (16 bit) · dc0eaa4e
      Aleksey Makarov 提交于
      It is the time we have the real 16-bit Stream ID user, which is the
      ThunderX. Its IO topology uses 1:1 map for Requester ID to Stream ID
      translation for each root complex which allows to get full 16-bit
      Stream ID.  Firmware assigns bus IDs that are greater than 128 (0x80)
      to some buses under PEM (external PCIe interface).  Eventually SMMU
      drops devices on that buses because their Stream ID is out of range:
      
        pci 0006:90:00.0: stream ID 0x9000 out of range for SMMU (0x7fff)
      
      To fix above issue enable the Extended Stream ID optional feature
      when available.
      Reviewed-by: NTomasz Nowicki <tomasz.nowicki@caviumnetworks.com>
      Signed-off-by: NAleksey Makarov <aleksey.makarov@linaro.org>
      Tested-by: NTomasz Nowicki <tomasz.nowicki@caviumnetworks.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      dc0eaa4e
  11. 23 1月, 2017 2 次提交
  12. 19 1月, 2017 1 次提交
  13. 29 11月, 2016 5 次提交
  14. 15 11月, 2016 1 次提交
  15. 08 11月, 2016 3 次提交
  16. 16 9月, 2016 4 次提交