1. 01 10月, 2018 5 次提交
    • Z
      iommu/arm-smmu-v3: Add support for non-strict mode · 9662b99a
      Zhen Lei 提交于
      Now that io-pgtable knows how to dodge strict TLB maintenance, all
      that's left to do is bridge the gap between the IOMMU core requesting
      DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE for default domains, and showing the
      appropriate IO_PGTABLE_QUIRK_NON_STRICT flag to alloc_io_pgtable_ops().
      Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
      [rm: convert to domain attribute, tweak commit message]
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      9662b99a
    • Z
      iommu/arm-smmu-v3: Implement flush_iotlb_all hook · 07fdef34
      Zhen Lei 提交于
      .flush_iotlb_all is currently stubbed to arm_smmu_iotlb_sync() since the
      only time it would ever need to actually do anything is for callers
      doing their own explicit batching, e.g.:
      
      	iommu_unmap_fast(domain, ...);
      	iommu_unmap_fast(domain, ...);
      	iommu_iotlb_flush_all(domain, ...);
      
      where since io-pgtable still issues the TLBI commands implicitly in the
      unmap instead of implementing .iotlb_range_add, the "flush" only needs
      to ensure completion of those already-in-flight invalidations.
      
      However, we're about to start using it in anger with flush queues, so
      let's get a proper implementation wired up.
      Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      [rm: document why it wasn't a bug]
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      07fdef34
    • Z
      iommu/arm-smmu-v3: Avoid back-to-back CMD_SYNC operations · 901510ee
      Zhen Lei 提交于
      Putting adjacent CMD_SYNCs into the command queue is nonsensical, but
      can happen when multiple CPUs are inserting commands. Rather than leave
      the poor old hardware to chew through these operations, we can instead
      drop the subsequent SYNCs and poll for completion of the first. This
      has been shown to improve IO performance under pressure, where the
      number of SYNC operations reduces by about a third:
      
      	CMD_SYNCs reduced:	19542181
      	CMD_SYNCs total:	58098548	(include reduced)
      	CMDs total:		116197099	(TLBI:SYNC about 1:1)
      Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      901510ee
    • Z
      iommu/arm-smmu-v3: Fix unexpected CMD_SYNC timeout · 0f02477d
      Zhen Lei 提交于
      The condition break condition of:
      
      	(int)(VAL - sync_idx) >= 0
      
      in the __arm_smmu_sync_poll_msi() polling loop requires that sync_idx
      must be increased monotonically according to the sequence of the CMDs in
      the cmdq.
      
      However, since the msidata is populated using atomic_inc_return_relaxed()
      before taking the command-queue spinlock, then the following scenario
      can occur:
      
      CPU0			CPU1
      msidata=0
      			msidata=1
      			insert cmd1
      insert cmd0
      			smmu execute cmd1
      smmu execute cmd0
      			poll timeout, because msidata=1 is overridden by
      			cmd0, that means VAL=0, sync_idx=1.
      
      This is not a functional problem, since the caller will eventually either
      timeout or exit due to another CMD_SYNC, however it's clearly not what
      the code is supposed to be doing. Fix it, by incrementing the sequence
      count with the command-queue lock held, allowing us to drop the atomic
      operations altogether.
      Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
      [will: dropped the specialised cmd building routine for now]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      0f02477d
    • J
      iommu/arm-smmu-v3: Fix a couple of minor comment typos · 657135f3
      John Garry 提交于
      Fix some comment typos spotted.
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      657135f3
  2. 08 8月, 2018 1 次提交
  3. 27 7月, 2018 2 次提交
  4. 26 7月, 2018 1 次提交
  5. 10 7月, 2018 1 次提交
    • R
      iommu: Remove IOMMU_OF_DECLARE · ac6bbf0c
      Rob Herring 提交于
      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 <robin.murphy@arm.com>
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Frank Rowand <frowand.list@gmail.com>
      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: NWill Deacon <will.deacon@arm.com>
      Acked-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Acked-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac6bbf0c
  6. 27 3月, 2018 8 次提交
  7. 17 1月, 2018 1 次提交
  8. 03 1月, 2018 2 次提交
  9. 20 10月, 2017 10 次提交
    • R
      iommu/arm-smmu-v3: Use burst-polling for sync completion · 8ff0f723
      Robin Murphy 提交于
      While CMD_SYNC is unlikely to complete immediately such that we never go
      round the polling loop, with a lightly-loaded queue it may still do so
      long before the delay period is up. If we have no better completion
      notifier, use similar logic as we have for SMMUv2 to spin a number of
      times before each backoff, so that we have more chance of catching syncs
      which complete relatively quickly and avoid delaying unnecessarily.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      8ff0f723
    • W
      iommu/arm-smmu-v3: Consolidate identical timeouts · a529ea19
      Will Deacon 提交于
      We have separate (identical) timeout values for polling for a queue to
      drain and waiting for an MSI to signal CMD_SYNC completion. In reality,
      we only wait for the command queue to drain if we're waiting on a sync,
      so just merged these two timeouts into a single constant.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      a529ea19
    • W
      iommu/arm-smmu-v3: Split arm_smmu_cmdq_issue_sync in half · 49806599
      Will Deacon 提交于
      arm_smmu_cmdq_issue_sync is a little unwieldy now that it supports both
      MSI and event-based polling, so split it into two functions to make things
      easier to follow.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      49806599
    • R
      iommu/arm-smmu-v3: Use CMD_SYNC completion MSI · 37de98f8
      Robin Murphy 提交于
      As an IRQ, the CMD_SYNC interrupt is not particularly useful, not least
      because we often need to wait for sync completion within someone else's
      IRQ handler anyway. However, when the SMMU is both coherent and supports
      MSIs, we can have a lot more fun by not using it as an interrupt at all.
      Following the example suggested in the architecture and using a write
      targeting normal memory, we can let callers wait on a status variable
      outside the lock instead of having to stall the entire queue or even
      touch MMIO registers. Since multiple sync commands are guaranteed to
      complete in order, a simple incrementing sequence count is all we need
      to unambiguously support any realistic number of overlapping waiters.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      37de98f8
    • R
      iommu/arm-smmu-v3: Forget about cmdq-sync interrupt · dce032a1
      Robin Murphy 提交于
      The cmdq-sync interrupt is never going to be particularly useful, since
      for stage 1 DMA at least we'll often need to wait for sync completion
      within someone else's IRQ handler, thus have to implement polling
      anyway. Beyond that, the overhead of taking an interrupt, then still
      having to grovel around in the queue to figure out *which* sync command
      completed, doesn't seem much more attractive than simple polling either.
      
      Furthermore, if an implementation both has wired interrupts and supports
      MSIs, then we don't want to be taking the IRQ unnecessarily if we're
      using the MSI write to update memory. Let's just make life simpler by
      not even bothering to claim it in the first place.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      dce032a1
    • R
      iommu/arm-smmu-v3: Specialise CMD_SYNC handling · 2f657add
      Robin Murphy 提交于
      CMD_SYNC already has a bit of special treatment here and there, but as
      we're about to extend it with more functionality for completing outside
      the CMDQ lock, things are going to get rather messy if we keep trying to
      cram everything into a single generic command interface. Instead, let's
      break out the issuing of CMD_SYNC into its own specific helper where
      upcoming changes will have room to breathe.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      2f657add
    • R
      iommu/arm-smmu-v3: Correct COHACC override message · 2a22baa2
      Robin Murphy 提交于
      Slightly confusingly, when reporting a mismatch of the ID register
      value, we still refer to the IORT COHACC override flag as the
      "dma-coherent property" if we booted with ACPI. Update the message
      to be firmware-agnostic in line with SMMUv2.
      Acked-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reported-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      2a22baa2
    • Y
      iommu/arm-smmu-v3: Avoid ILLEGAL setting of STE.S1STALLD and CD.S · 9cff86fd
      Yisheng Xie 提交于
      According to Spec, it is ILLEGAL to set STE.S1STALLD if STALL_MODEL
      is not 0b00, which means we should not disable stall mode if stall
      or terminate mode is not configuable.
      
      Meanwhile, it is also ILLEGAL when STALL_MODEL==0b10 && CD.S==0 which
      means if stall mode is force we should always set CD.S.
      
      As Jean-Philippe's suggestion, this patch introduce a feature bit
      ARM_SMMU_FEAT_STALL_FORCE, which means smmu only supports stall force.
      Therefore, we can avoid the ILLEGAL setting of STE.S1STALLD.by checking
      ARM_SMMU_FEAT_STALL_FORCE.
      
      This patch keeps the ARM_SMMU_FEAT_STALLS as the meaning of stall supported
      (force or configuable) to easy to expand the future function, i.e. we can
      only use ARM_SMMU_FEAT_STALLS to check whether we should register fault
      handle or enable master can_stall, etc to supporte platform SVM.
      
      The feature bit, STE.S1STALLD and CD.S setting will be like:
      
      STALL_MODEL  FEATURE                                         S1STALLD CD.S
      0b00         ARM_SMMU_FEAT_STALLS                                 0b1 0b0
      0b01         !ARM_SMMU_FEAT_STALLS && !ARM_SMMU_FEAT_STALL_FORCE  0b0 0b0
      0b10         ARM_SMMU_FEAT_STALLS && ARM_SMMU_FEAT_STALL_FORCE    0b0 0b1
      
      after apply this patch.
      Signed-off-by: NYisheng Xie <xieyisheng1@huawei.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      9cff86fd
    • W
      iommu/arm-smmu-v3: Ensure we sync STE when only changing config field · 704c0382
      Will Deacon 提交于
      The SMMUv3 architecture permits caching of data structures deemed to be
      "reachable" by the SMU, which includes STEs marked as invalid. When
      transitioning an STE to a bypass/fault configuration at init or detach
      time, we mistakenly elide the CMDQ_OP_CFGI_STE operation in some cases,
      therefore potentially leaving the old STE state cached in the SMMU.
      
      This patch fixes the problem by ensuring that we perform the
      CMDQ_OP_CFGI_STE operation irrespective of the validity of the previous
      STE.
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Reported-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      704c0382
    • R
      iommu/arm-smmu: Remove ACPICA workarounds · 6948d4a7
      Robin Murphy 提交于
      Now that the kernel headers have synced with the relevant upstream
      ACPICA updates, it's time to clean up the temporary local definitions.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      6948d4a7
  10. 02 10月, 2017 1 次提交
  11. 17 8月, 2017 1 次提交
  12. 24 6月, 2017 7 次提交