1. 05 5月, 2020 12 次提交
  2. 27 3月, 2020 2 次提交
  3. 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
  4. 08 1月, 2020 1 次提交
  5. 23 12月, 2019 4 次提交
  6. 17 12月, 2019 2 次提交
  7. 15 10月, 2019 3 次提交
  8. 03 9月, 2019 1 次提交
  9. 30 8月, 2019 2 次提交
  10. 23 8月, 2019 6 次提交
  11. 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
  12. 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
  13. 12 6月, 2019 3 次提交
    • E
      iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions · adfd3738
      Eric Auger 提交于
      Introduce a new type for reserved region. This corresponds
      to directly mapped regions which are known to be relaxable
      in some specific conditions, such as device assignment use
      case. Well known examples are those used by USB controllers
      providing PS/2 keyboard emulation for pre-boot BIOS and
      early BOOT or RMRRs associated to IGD working in legacy mode.
      
      Since commit c875d2c1 ("iommu/vt-d: Exclude devices using RMRRs
      from IOMMU API domains") and commit 18436afd ("iommu/vt-d: Allow
      RMRR on graphics devices too"), those regions are currently
      considered "safe" with respect to device assignment use case
      which requires a non direct mapping at IOMMU physical level
      (RAM GPA -> HPA mapping).
      
      Those RMRRs currently exist and sometimes the device is
      attempting to access it but this has not been considered
      an issue until now.
      
      However at the moment, iommu_get_group_resv_regions() is
      not able to make any difference between directly mapped
      regions: those which must be absolutely enforced and those
      like above ones which are known as relaxable.
      
      This is a blocker for reporting severe conflicts between
      non relaxable RMRRs (like MSI doorbells) and guest GPA space.
      
      With this new reserved region type we will be able to use
      iommu_get_group_resv_regions() to enumerate the IOVA space
      that is usable through the IOMMU API without introducing
      regressions with respect to existing device assignment
      use cases (USB and IGD).
      Signed-off-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      adfd3738
    • E
      iommu: Fix a leak in iommu_insert_resv_region · ad0834de
      Eric Auger 提交于
      In case we expand an existing region, we unlink
      this latter and insert the larger one. In
      that case we should free the original region after
      the insertion. Also we can immediately return.
      
      Fixes: 6c65fb31 ("iommu: iommu_get_group_resv_regions")
      Signed-off-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      ad0834de
    • J
      iommu: Add recoverable fault reporting · bf3255b3
      Jean-Philippe Brucker 提交于
      Some IOMMU hardware features, for example PCI PRI and Arm SMMU Stall,
      enable recoverable I/O page faults. Allow IOMMU drivers to report PRI Page
      Requests and Stall events through the new fault reporting API. The
      consumer of the fault can be either an I/O page fault handler in the host,
      or a guest OS.
      
      Once handled, the fault must be completed by sending a page response back
      to the IOMMU. Add an iommu_page_response() function to complete a page
      fault.
      
      There are two ways to extend the userspace API:
      * Add a field to iommu_page_response and a flag to
        iommu_page_response::flags describing the validity of this field.
      * Introduce a new iommu_page_response_X structure with a different version
        number. The kernel must then support both versions.
      Signed-off-by: NJacob Pan <jacob.jun.pan@linux.intel.com>
      Signed-off-by: NJean-Philippe Brucker <jean-philippe.brucker@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      bf3255b3