[PATCH] intel-iommu: intel_iommu_domain_alloc should check'dmar_disabled'

From: Bhavesh Davda
Date: Fri Jan 16 2009 - 18:54:26 EST



intel_iommu_domain_alloc() will try and iommu_alloc_domain(iommu),
which calls alloc_domain_mem() to allocate out of 'iommu_domain_cache'.
Unfortunately iommu_domain_cache will not be created if booted with
"intel_iommu=off", i.e. dmar_disabled = 1.

This fixes that.

Signed-off-by: Bhavesh P. Davda <bhavesh@xxxxxxxxxx>
---
drivers/pci/intel-iommu.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 5c8baa4..06237a8 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2356,6 +2356,11 @@ struct dmar_domain *intel_iommu_domain_alloc(struct pci_dev *pdev)
struct dmar_domain *domain;
struct intel_iommu *iommu;

+ if (dmar_disabled) {
+ printk(KERN_ERR "intel_iommu_domain_alloc: Intel-IOMMU disabled\n");
+ return NULL;
+ }
+
drhd = dmar_find_matched_drhd_unit(pdev);
if (!drhd) {
printk(KERN_ERR "intel_iommu_domain_alloc: drhd == NULL\n");
--
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/