aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLu Baolu <baolu.lu@linux.intel.com>2018-12-09 20:58:59 -0500
committerJoerg Roedel <jroedel@suse.de>2018-12-11 04:45:58 -0500
commit3b33d4ab3217337f648f7ff3e57e755e6444c748 (patch)
treed3d57942c0777b924091d9ef3884251d8a6dc861
parent5d308fc1ecf5351418a4f003ccb74dc91b424bd1 (diff)
iommu/vt-d: Reserve a domain id for FL and PT modes
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>
-rw-r--r--drivers/iommu/intel-iommu.c10
-rw-r--r--drivers/iommu/intel-pasid.h6
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index d55254abd5ff..9818aaf2d0f7 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1621,6 +1621,16 @@ static int iommu_init_domains(struct intel_iommu *iommu)
1621 */ 1621 */
1622 set_bit(0, iommu->domain_ids); 1622 set_bit(0, iommu->domain_ids);
1623 1623
1624 /*
1625 * Vt-d spec rev3.0 (section 6.2.3.1) requires that each pasid
1626 * entry for first-level or pass-through translation modes should
1627 * be programmed with a domain id different from those used for
1628 * second-level or nested translation. We reserve a domain id for
1629 * this purpose.
1630 */
1631 if (sm_supported(iommu))
1632 set_bit(FLPT_DEFAULT_DID, iommu->domain_ids);
1633
1624 return 0; 1634 return 0;
1625} 1635}
1626 1636
diff --git a/drivers/iommu/intel-pasid.h b/drivers/iommu/intel-pasid.h
index 12f480c2bb8b..03c1612d173c 100644
--- a/drivers/iommu/intel-pasid.h
+++ b/drivers/iommu/intel-pasid.h
@@ -17,6 +17,12 @@
17#define PDE_PFN_MASK PAGE_MASK 17#define PDE_PFN_MASK PAGE_MASK
18#define PASID_PDE_SHIFT 6 18#define PASID_PDE_SHIFT 6
19 19
20/*
21 * Domain ID reserved for pasid entries programmed for first-level
22 * only and pass-through transfer modes.
23 */
24#define FLPT_DEFAULT_DID 1
25
20struct pasid_dir_entry { 26struct pasid_dir_entry {
21 u64 val; 27 u64 val;
22}; 28};