1. 12 8月, 2015 17 次提交
  2. 03 8月, 2015 2 次提交
  3. 23 7月, 2015 1 次提交
    • A
      iommu/vt-d: Fix VM domain ID leak · 46ebb7af
      Alex Williamson 提交于
      This continues the attempt to fix commit fb170fb4 ("iommu/vt-d:
      Introduce helper functions to make code symmetric for readability").
      The previous attempt in commit 71684406 ("iommu/vt-d: Detach
      domain *only* from attached iommus") overlooked the fact that
      dmar_domain.iommu_bmp gets cleared for VM domains when devices are
      detached:
      
      intel_iommu_detach_device
        domain_remove_one_dev_info
          domain_detach_iommu
      
      The domain is detached from the iommu, but the iommu is still attached
      to the domain, for whatever reason.  Thus when we get to domain_exit(),
      we can't rely on iommu_bmp for VM domains to find the active iommus,
      we must check them all.  Without that, the corresponding bit in
      intel_iommu.domain_ids doesn't get cleared and repeated VM domain
      creation and destruction will run out of domain IDs.  Meanwhile we
      still can't call iommu_detach_domain() on arbitrary non-VM domains or
      we risk clearing in-use domain IDs, as 71684406 attempted to
      address.
      
      It's tempting to modify iommu_detach_domain() to test the domain
      iommu_bmp, but the call ordering from domain_remove_one_dev_info()
      prevents it being able to work as fb170fb4 seems to have intended.
      Caching of unused VM domains on the iommu object seems to be the root
      of the problem, but this code is far too fragile for that kind of
      rework to be proposed for stable, so we simply revert this chunk to
      its state prior to fb170fb4.
      
      Fixes: fb170fb4 ("iommu/vt-d: Introduce helper functions to make
                            code symmetric for readability")
      Fixes: 71684406 ("iommu/vt-d: Detach domain *only* from attached
                            iommus")
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: stable@vger.kernel.org # v3.17+
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      46ebb7af
  4. 16 6月, 2015 12 次提交
  5. 12 6月, 2015 1 次提交
    • D
      iommu/vt-d: Only enable extended context tables if PASID is supported · c83b2f20
      David Woodhouse 提交于
      Although the extended tables are theoretically a completely orthogonal
      feature to PASID and anything else that *uses* the newly-available bits,
      some of the early hardware has problems even when all we do is enable
      them and use only the same bits that were in the old context tables.
      
      For now, there's no motivation to support extended tables unless we're
      going to use PASID support to do SVM. So just don't use them unless
      PASID support is advertised too. Also add a command-line bailout just in
      case later chips also have issues.
      
      The equivalent problem for PASID support has already been fixed with the
      upcoming VT-d spec update and commit bd00c606 ("iommu/vt-d: Change
      PASID support to bit 40 of Extended Capability Register"), because the
      problematic platforms use the old definition of the PASID-capable bit,
      which is now marked as reserved and meaningless.
      
      So with this change, we'll magically start using ECS again only when we
      see the new hardware advertising "hey, we have PASID support and we
      actually tested it this time" on bit 40.
      
      The VT-d hardware architect has promised that we are not going to have
      any reason to support ECS *without* PASID any time soon, and he'll make
      sure he checks with us before changing that.
      
      In the future, if hypothetical new features also use new bits in the
      context tables and can be seen on implementations *without* PASID support,
      we might need to add their feature bits to the ecs_enabled() macro.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      c83b2f20
  6. 11 5月, 2015 1 次提交
    • D
      iommu/vt-d: Fix passthrough mode with translation-disabled devices · 4ed6a540
      David Woodhouse 提交于
      When we use 'intel_iommu=igfx_off' to disable translation for the
      graphics, and when we discover that the BIOS has misconfigured the DMAR
      setup for I/OAT, we use a special DUMMY_DEVICE_DOMAIN_INFO value in
      dev->archdata.iommu to indicate that translation is disabled.
      
      With passthrough mode, we were attempting to dereference that as a
      normal pointer to a struct device_domain_info when setting up an
      identity mapping for the affected device.
      
      This fixes the problem by making device_to_iommu() explicitly check for
      the special value and indicate that no IOMMU was found to handle the
      devices in question.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Cc: stable@vger.kernel.org (which means you can pick up 18436afd now too)
      4ed6a540
  7. 31 3月, 2015 1 次提交
  8. 25 3月, 2015 2 次提交
    • D
      iommu/vt-d: support extended root and context entries · 03ecc32c
      David Woodhouse 提交于
      Add a new function iommu_context_addr() which takes care of the
      differences and returns a pointer to a context entry which may be
      in either format. The formats are binary compatible for all the old
      fields anyway; the new one is just larger and some of the reserved
      bits in the original 128 are now meaningful.
      
      So far, nothing actually uses the new fields in the extended context
      entry. Modulo hardware bugs with interpreting the new-style tables,
      this should basically be a no-op.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      03ecc32c
    • D
      iommu/vt-d: Allow RMRR on graphics devices too · 18436afd
      David Woodhouse 提交于
      Commit c875d2c1 ("iommu/vt-d: Exclude devices using RMRRs from IOMMU API
      domains") prevents certain options for devices with RMRRs. This even
      prevents those devices from getting a 1:1 mapping with 'iommu=pt',
      because we don't have the code to handle *preserving* the RMRR regions
      when moving the device between domains.
      
      There's already an exclusion for USB devices, because we know the only
      reason for RMRRs there is a misguided desire to keep legacy
      keyboard/mouse emulation running in some theoretical OS which doesn't
      have support for USB in its own right... but which *does* enable the
      IOMMU.
      
      Add an exclusion for graphics devices too, so that 'iommu=pt' works
      there. We should be able to successfully assign graphics devices to
      guests too, as long as the initial handling of stolen memory is
      reconfigured appropriately. This has certainly worked in the past.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Cc: stable@vger.kernel.org
      18436afd
  9. 24 3月, 2015 1 次提交
  10. 23 3月, 2015 1 次提交
    • A
      iommu/vt-d: Detach domain *only* from attached iommus · 71684406
      Alex Williamson 提交于
      Device domains never span IOMMU hardware units, which allows the
      domain ID space for each IOMMU to be an independent address space.
      Therefore we can have multiple, independent domains, each with the
      same domain->id, but attached to different hardware units.  This is
      also why we need to do a heavy-weight search for VM domains since
      they can span multiple IOMMUs hardware units and we don't require a
      single global ID to use for all hardware units.
      
      Therefore, if we call iommu_detach_domain() across all active IOMMU
      hardware units for a non-VM domain, the result is that we clear domain
      IDs that are not associated with our domain, allowing them to be
      re-allocated and causing apparent coherency issues when the device
      cannot access IOVAs for the intended domain.
      
      This bug was introduced in commit fb170fb4 ("iommu/vt-d: Introduce
      helper functions to make code symmetric for readability"), but is
      significantly exacerbated by the more recent commit 62c22167
      ("iommu/vt-d: Fix dmar_domain leak in iommu_attach_device") which calls
      domain_exit() more frequently to resolve a domain leak.
      
      Fixes: fb170fb4 ("iommu/vt-d: Introduce helper functions to make code symmetric for readability")
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: stable@vger.kernel.org # v3.17+
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      71684406
  11. 17 3月, 2015 1 次提交
    • R
      ACPI: Introduce has_acpi_companion() · ca5b74d2
      Rafael J. Wysocki 提交于
      Now that the ACPI companions of devices are represented by pointers
      to struct fwnode_handle, it is not quite efficient to check whether
      or not an ACPI companion of a device is present by evaluating the
      ACPI_COMPANION() macro.
      
      For this reason, introduce a special static inline routine for that,
      has_acpi_companion(), and update the code to use it where applicable.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ca5b74d2