iommu/vt-d: Really use upper context table when necessary
authorJoerg Roedel <jroedel@suse.de>
Tue, 25 Aug 2015 08:54:28 +0000 (10:54 +0200)
committerJoerg Roedel <jroedel@suse.de>
Tue, 25 Aug 2015 09:39:27 +0000 (11:39 +0200)
There is a bug in iommu_context_addr() which will always use
the lower context table, even when the upper context table
needs to be used. Fix this issue.

Fixes: 03ecc32c5274 ("iommu/vt-d: support extended root and context entries")
Reported-by: Xiao, Nan <nan.xiao@hp.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel-iommu.c

index a85077d4335b5024255139c756460096d6beb229..63daf1ba04b7ed5d491a78344589a6bb45abe0c4 100644 (file)
@@ -803,6 +803,7 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu
        struct context_entry *context;
        u64 *entry;
 
+       entry = &root->lo;
        if (ecs_enabled(iommu)) {
                if (devfn >= 0x80) {
                        devfn -= 0x80;
@@ -810,7 +811,6 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu
                }
                devfn *= 2;
        }
-       entry = &root->lo;
        if (*entry & 1)
                context = phys_to_virt(*entry & VTD_PAGE_MASK);
        else {