1. 13 10月, 2022 1 次提交
  2. 13 7月, 2022 1 次提交
  3. 08 3月, 2022 1 次提交
  4. 31 12月, 2021 1 次提交
  5. 23 12月, 2021 1 次提交
  6. 02 9月, 2021 1 次提交
  7. 23 7月, 2021 1 次提交
  8. 19 7月, 2021 2 次提交
    • E
      iommu: Introduce bind/unbind_guest_msi · 9db83ab7
      Eric Auger 提交于
      virt inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I401IF
      CVE: NA
      
      ------------------------------
      
      On ARM, MSI are translated by the SMMU. An IOVA is allocated
      for each MSI doorbell. If both the host and the guest are exposed
      with SMMUs, we end up with 2 different IOVAs allocated by each.
      guest allocates an IOVA (gIOVA) to map onto the guest MSI
      doorbell (gDB). The Host allocates another IOVA (hIOVA) to map
      onto the physical doorbell (hDB).
      
      So we end up with 2 untied mappings:
               S1            S2
      gIOVA    ->    gDB
                    hIOVA    ->    hDB
      
      Currently the PCI device is programmed by the host with hIOVA
      as MSI doorbell. So this does not work.
      
      This patch introduces an API to pass gIOVA/gDB to the host so
      that gIOVA can be reused by the host instead of re-allocating
      a new IOVA. So the goal is to create the following nested mapping:
      
               S1            S2
      gIOVA    ->    gDB     ->    hDB
      
      and program the PCI device with gIOVA MSI doorbell.
      
      In case we have several devices attached to this nested domain
      (devices belonging to the same group), they cannot be isolated
      on guest side either. So they should also end up in the same domain
      on guest side. We will enforce that all the devices attached to
      the host iommu domain use the same physical doorbell and similarly
      a single virtual doorbell mapping gets registered (1 single
      virtual doorbell is used on guest as well).
      Signed-off-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: Kunkun Jiang<jiangkunkun@huawei.com>
      Reviewed-by: NKeqian Zhu <zhukeqian1@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      9db83ab7
    • E
      iommu: Introduce attach/detach_pasid_table API · dbb4844d
      Eric Auger 提交于
      virt inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I401IF
      CVE: NA
      
      ------------------------------
      
      In virtualization use case, when a guest is assigned
      a PCI host device, protected by a virtual IOMMU on the guest,
      the physical IOMMU must be programmed to be consistent with
      the guest mappings. If the physical IOMMU supports two
      translation stages it makes sense to program guest mappings
      onto the first stage/level (ARM/Intel terminology) while the host
      owns the stage/level 2.
      
      In that case, it is mandated to trap on guest configuration
      settings and pass those to the physical iommu driver.
      
      This patch adds a new API to the iommu subsystem that allows
      to set/unset the pasid table information.
      
      A generic iommu_pasid_table_config struct is introduced in
      a new iommu.h uapi header. This is going to be used by the VFIO
      user API.
      Signed-off-by: NJean-Philippe Brucker <jean-philippe.brucker@arm.com>
      Signed-off-by: NLiu, Yi L <yi.l.liu@linux.intel.com>
      Signed-off-by: NAshok Raj <ashok.raj@intel.com>
      Signed-off-by: NJacob Pan <jacob.jun.pan@linux.intel.com>
      Signed-off-by: NEric Auger <eric.auger@redhat.com>
      Signed-off-by: Kunkun Jiang<jiangkunkun@huawei.com>
      Reviewed-by: NKeqian Zhu <zhukeqian1@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      dbb4844d
  9. 16 7月, 2021 2 次提交
  10. 03 7月, 2021 1 次提交
  11. 03 6月, 2021 9 次提交
  12. 09 4月, 2021 1 次提交
  13. 09 3月, 2021 1 次提交
  14. 01 10月, 2020 2 次提交
  15. 18 9月, 2020 1 次提交
  16. 04 9月, 2020 1 次提交
  17. 09 7月, 2020 1 次提交
  18. 30 6月, 2020 1 次提交
  19. 29 5月, 2020 1 次提交
    • J
      iommu: Remove iommu_sva_ops::mm_exit() · edcc40d2
      Jean-Philippe Brucker 提交于
      After binding a device to an mm, device drivers currently need to
      register a mm_exit handler. This function is called when the mm exits,
      to gracefully stop DMA targeting the address space and flush page faults
      to the IOMMU.
      
      This is deemed too complex for the MMU release() notifier, which may be
      triggered by any mmput() invocation, from about 120 callsites [1]. The
      upcoming SVA module has an example of such complexity: the I/O Page
      Fault handler would need to call mmput_async() instead of mmput() after
      handling an IOPF, to avoid triggering the release() notifier which would
      in turn drain the IOPF queue and lock up.
      
      Another concern is the DMA stop function taking too long, up to several
      minutes [2]. For some mmput() callers this may disturb other users. For
      example, if the OOM killer picks the mm bound to a device as the victim
      and that mm's memory is locked, if the release() takes too long, it
      might choose additional innocent victims to kill.
      
      To simplify the MMU release notifier, don't forward the notification to
      device drivers. Since they don't stop DMA on mm exit anymore, the PASID
      lifetime is extended:
      
      (1) The device driver calls bind(). A PASID is allocated.
      
        Here any DMA fault is handled by mm, and on error we don't print
        anything to dmesg. Userspace can easily trigger errors by issuing DMA
        on unmapped buffers.
      
      (2) exit_mmap(), for example the process took a SIGKILL. This step
          doesn't happen during normal operations. Remove the pgd from the
          PASID table, since the page tables are about to be freed. Invalidate
          the IOTLBs.
      
        Here the device may still perform DMA on the address space. Incoming
        transactions are aborted but faults aren't printed out. ATS
        Translation Requests return Successful Translation Completions with
        R=W=0. PRI Page Requests return with Invalid Request.
      
      (3) The device driver stops DMA, possibly following release of a fd, and
          calls unbind(). PASID table is cleared, IOTLB invalidated if
          necessary. The page fault queues are drained, and the PASID is
          freed.
      
        If DMA for that PASID is still running here, something went seriously
        wrong and errors should be reported.
      
      For now remove iommu_sva_ops entirely. We might need to re-introduce
      them at some point, for example to notify device drivers of unhandled
      IOPF.
      
      [1] https://lore.kernel.org/linux-iommu/20200306174239.GM31668@ziepe.ca/
      [2] https://lore.kernel.org/linux-iommu/4d68da96-0ad5-b412-5987-2f7a6aa796c3@amd.com/Signed-off-by: NJean-Philippe Brucker <jean-philippe@linaro.org>
      Acked-by: NJacob Pan <jacob.jun.pan@linux.intel.com>
      Acked-by: NLu Baolu <baolu.lu@linux.intel.com>
      Link: https://lore.kernel.org/r/20200423125329.782066-3-jean-philippe@linaro.orgSigned-off-by: NJoerg Roedel <jroedel@suse.de>
      edcc40d2
  20. 15 5月, 2020 1 次提交
  21. 13 5月, 2020 1 次提交
  22. 05 5月, 2020 5 次提交
  23. 27 3月, 2020 3 次提交