From: Sheng Yang Date: Sat, 12 Jun 2010 11:21:42 +0000 (+0800) Subject: intel-iommu: Fix reference by physical address in intel_iommu_attach_device() X-Git-Tag: v2.6.35-rc4~64^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25cbff1660d3f4c059a178a1e5b851be6d70c5e8;p=platform%2Fkernel%2Flinux-exynos.git intel-iommu: Fix reference by physical address in intel_iommu_attach_device() Commit a99c47a2 "intel-iommu: errors with smaller iommu widths" replace the dmar_domain->pgd with the first entry of page table when iommu's supported width is smaller than dmar_domain's. But it use physical address directly for new dmar_domain->pgd... This result in KVM oops with VT-d on some machines. Reported-by: Allen Kay Cc: Tom Lyon Signed-off-by: Sheng Yang Signed-off-by: David Woodhouse --- diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 796828f..3bd3055 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c @@ -3603,7 +3603,8 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, pte = dmar_domain->pgd; if (dma_pte_present(pte)) { free_pgtable_page(dmar_domain->pgd); - dmar_domain->pgd = (struct dma_pte *)dma_pte_addr(pte); + dmar_domain->pgd = (struct dma_pte *) + phys_to_virt(dma_pte_addr(pte)); } dmar_domain->agaw--; }