iommu/vt-d: Set context field after value initialized
authorLu Baolu <[email protected]>
Fri, 1 Mar 2019 03:23:11 +0000 (11:23 +0800)
committerJoerg Roedel <[email protected]>
Fri, 1 Mar 2019 09:23:35 +0000 (10:23 +0100)
Otherwise, the translation type field of a context entry for
a PCI device will always be 0. All translated DMA requests
will be blocked by IOMMU. As the result, the PCI devices with
PCI ATS (device IOTBL) support won't work as expected.

Cc: Ashok Raj <[email protected]>
Cc: Jacob Pan <[email protected]>
Suggested-by: Kevin Tian <[email protected]>
Fixes: 7373a8cc38197 ("iommu/vt-d: Setup context and enable RID2PASID support")
Signed-off-by: Lu Baolu <[email protected]>
Signed-off-by: Joerg Roedel <[email protected]>
drivers/iommu/intel-iommu.c

index 64ce780336a895aec9c222501ebc8965af708f2d..d7f10fd4ac2dd0ae505cdf0b61142a9483672795 100644 (file)
@@ -2056,7 +2056,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
                int agaw;
 
                context_set_domain_id(context, did);
-               context_set_translation_type(context, translation);
 
                if (translation != CONTEXT_TT_PASS_THROUGH) {
                        /*
@@ -2086,6 +2085,8 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
                         */
                        context_set_address_width(context, iommu->msagaw);
                }
+
+               context_set_translation_type(context, translation);
        }
 
        context_set_fault_enable(context);