1. 01 3月, 2016 1 次提交
  2. 25 2月, 2016 2 次提交
    • J
      iommu/amd: Apply workaround for ATS write permission check · 358875fd
      Jay Cornwall 提交于
      The AMD Family 15h Models 30h-3Fh (Kaveri) BIOS and Kernel Developer's
      Guide omitted part of the BIOS IOMMU L2 register setup specification.
      Without this setup the IOMMU L2 does not fully respect write permissions
      when handling an ATS translation request.
      
      The IOMMU L2 will set PTE dirty bit when handling an ATS translation with
      write permission request, even when PTE RW bit is clear. This may occur by
      direct translation (which would cause a PPR) or by prefetch request from
      the ATC.
      
      This is observed in practice when the IOMMU L2 modifies a PTE which maps a
      pagecache page. The ext4 filesystem driver BUGs when asked to writeback
      these (non-modified) pages.
      
      Enable ATS write permission check in the Kaveri IOMMU L2 if BIOS has not.
      Signed-off-by: NJay Cornwall <jay@jcornwall.me>
      Cc: <stable@vger.kernel.org> # v3.19+
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      358875fd
    • S
      iommu/amd: Fix boot warning when device 00:00.0 is not iommu covered · 38e45d02
      Suravee Suthikulpanit 提交于
      The setup code for the performance counters in the AMD IOMMU driver
      tests whether the counters can be written. It tests to setup a counter
      for device 00:00.0, which fails on systems where this particular device
      is not covered by the IOMMU.
      
      Fix this by not relying on device 00:00.0 but only on the IOMMU being
      present.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      38e45d02
  3. 15 2月, 2016 1 次提交
  4. 29 1月, 2016 3 次提交
  5. 14 1月, 2016 2 次提交
    • C
      iommu/vt-d: Fix 64-bit accesses to 32-bit DMAR_GSTS_REG · fda3bec1
      CQ Tang 提交于
      This is a 32-bit register. Apparently harmless on real hardware, but
      causing justified warnings in simulation.
      Signed-off-by: NCQ Tang <cq.tang@intel.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Cc: stable@vger.kernel.org
      fda3bec1
    • D
      iommu/vt-d: Fix mm refcounting to hold mm_count not mm_users · e57e58bd
      David Woodhouse 提交于
      Holding mm_users works OK for graphics, which was the first user of SVM
      with VT-d. However, it works less well for other devices, where we actually
      do a mmap() from the file descriptor to which the SVM PASID state is tied.
      
      In this case on process exit we end up with a recursive reference count:
       - The MM remains alive until the file is closed and the driver's release()
         call ends up unbinding the PASID.
       - The VMA corresponding to the mmap() remains intact until the MM is
         destroyed.
       - Thus the file isn't closed, even when exit_files() runs, because the
         VMA is still holding a reference to it. And the MM remains alive…
      
      To address this issue, we *stop* holding mm_users while the PASID is bound.
      We already hold mm_count by virtue of the MMU notifier, and that can be
      made to be sufficient.
      
      It means that for a period during process exit, the fun part of mmput()
      has happened and exit_mmap() has been called so the MM is basically
      defunct. But the PGD still exists and the PASID is still bound to it.
      
      During this period, we have to be very careful — exit_mmap() doesn't use
      mm->mmap_sem because it doesn't expect anyone else to be touching the MM
      (quite reasonably, since mm_users is zero). So we also need to fix the
      fault handler to just report failure if mm_users is already zero, and to
      temporarily bump mm_users while handling any faults.
      
      Additionally, exit_mmap() calls mmu_notifier_release() *before* it tears
      down the page tables, which is too early for us to flush the IOTLB for
      this PASID. And __mmu_notifier_release() removes every notifier from the
      list, so when exit_mmap() finally *does* tear down the mappings and
      clear the page tables, we don't get notified. So we work around this by
      clearing the PASID table entry in our MMU notifier release() callback.
      That way, the hardware *can't* get any pages back from the page tables
      before they get cleared.
      
      Hardware designers have confirmed that the resulting 'PASID not present'
      faults should be handled just as gracefully as 'page not present' faults,
      the important criterion being that they don't perturb the operation for
      any *other* PASID in the system.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Cc: stable@vger.kernel.org
      e57e58bd
  6. 07 1月, 2016 4 次提交
  7. 29 12月, 2015 26 次提交
  8. 19 12月, 2015 1 次提交