]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iommu/vt-d: Reserve a domain id for FL and PT modes
authorLu Baolu <baolu.lu@linux.intel.com>
Mon, 10 Dec 2018 01:58:59 +0000 (09:58 +0800)
committerJoerg Roedel <jroedel@suse.de>
Tue, 11 Dec 2018 09:45:58 +0000 (10:45 +0100)
Vt-d spec rev3.0 (section 6.2.3.1) requires that each pasid
entry for first-level or pass-through translation should be
programmed with a domain id different from those used for
second-level or nested translation. It is recommended that
software could use a same domain id for all first-only and
pass-through translations.

This reserves a domain id for first-level and pass-through
translations.

Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Liu Yi L <yi.l.liu@intel.com>
Cc: Sanjay Kumar <sanjay.k.kumar@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel-iommu.c
drivers/iommu/intel-pasid.h

index d55254abd5ff4b88bb2275cfd29e8e85741218c3..9818aaf2d0f73a830f34d6cc170986ee22259bae 100644 (file)
@@ -1621,6 +1621,16 @@ static int iommu_init_domains(struct intel_iommu *iommu)
         */
        set_bit(0, iommu->domain_ids);
 
+       /*
+        * Vt-d spec rev3.0 (section 6.2.3.1) requires that each pasid
+        * entry for first-level or pass-through translation modes should
+        * be programmed with a domain id different from those used for
+        * second-level or nested translation. We reserve a domain id for
+        * this purpose.
+        */
+       if (sm_supported(iommu))
+               set_bit(FLPT_DEFAULT_DID, iommu->domain_ids);
+
        return 0;
 }
 
index 12f480c2bb8baf200ae8901e14e6c8665c513d1b..03c1612d173cb30897f0211bb843adb8cd41fa51 100644 (file)
 #define PDE_PFN_MASK                   PAGE_MASK
 #define PASID_PDE_SHIFT                        6
 
+/*
+ * Domain ID reserved for pasid entries programmed for first-level
+ * only and pass-through transfer modes.
+ */
+#define FLPT_DEFAULT_DID               1
+
 struct pasid_dir_entry {
        u64 val;
 };