[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091026232508.9646.19296.stgit@nehalem.aw>
Date: Mon, 26 Oct 2009 17:25:09 -0600
From: Alex Williamson <alex.williamson@...com>
To: dwmw2@...radead.org
Cc: iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, alex.williamson@...com
Subject: [PATCH 3/5] intel-iommu: Use max_pfn to determine whether a device
can passthrough
A dma_mask that's greater than 32-bit does not imply the device
can DMA anywhere in physical memory.
Signed-off-by: Alex Williamson <alex.williamson@...com>
---
drivers/pci/intel-iommu.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 40be49a..19f10ae 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -39,6 +39,7 @@
#include <linux/sysdev.h>
#include <linux/tboot.h>
#include <linux/dmi.h>
+#include <linux/bootmem.h>
#include <asm/cacheflush.h>
#include <asm/iommu.h>
#include "pci.h"
@@ -2196,7 +2197,8 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
* take them out of the 1:1 domain later.
*/
if (!startup)
- return pdev->dma_mask > DMA_BIT_MASK(32);
+ return (pdev->dma_mask & (max_pfn << PAGE_SHIFT)) ==
+ (max_pfn << PAGE_SHIFT);
return 1;
}
@@ -2537,11 +2539,12 @@ static int iommu_no_mapping(struct device *dev)
return 1;
else {
/*
- * 32 bit DMA is removed from si_domain and fall back
- * to non-identity mapping.
+ * Devices that cannot support identity mapping
+ * are removed from si_domain and fall back to
+ * non-identity mapping.
*/
domain_remove_one_dev_info(si_domain, pdev);
- printk(KERN_INFO "32bit %s uses non-identity mapping\n",
+ printk(KERN_INFO "%s uses non-identity mapping\n",
pci_name(pdev));
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists