]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86, dmar: use atomic allocations for QI and Intr-remapping init
authorSuresh Siddha <suresh.b.siddha@intel.com>
Tue, 17 Mar 2009 00:05:05 +0000 (17:05 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Tue, 17 Mar 2009 23:49:30 +0000 (16:49 -0700)
Impact: invalid use of GFP_KERNEL in interrupt context

Queued invalidation and interrupt-remapping will get initialized with
interrupts disabled (while enabling interrupt-remapping). So use
GFP_ATOMIC instead of GFP_KERNEL for memory alloacations.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
drivers/pci/dmar.c
drivers/pci/intr_remapping.c

index f1805002e436bf9c73423215d9afd68849cf2429..d313039e2fdf8179dbc3324e7778b7e2e6bed964 100644 (file)
@@ -809,20 +809,20 @@ int dmar_enable_qi(struct intel_iommu *iommu)
        if (iommu->qi)
                return 0;
 
-       iommu->qi = kmalloc(sizeof(*qi), GFP_KERNEL);
+       iommu->qi = kmalloc(sizeof(*qi), GFP_ATOMIC);
        if (!iommu->qi)
                return -ENOMEM;
 
        qi = iommu->qi;
 
-       qi->desc = (void *)(get_zeroed_page(GFP_KERNEL));
+       qi->desc = (void *)(get_zeroed_page(GFP_ATOMIC));
        if (!qi->desc) {
                kfree(qi);
                iommu->qi = 0;
                return -ENOMEM;
        }
 
-       qi->desc_status = kmalloc(QI_LENGTH * sizeof(int), GFP_KERNEL);
+       qi->desc_status = kmalloc(QI_LENGTH * sizeof(int), GFP_ATOMIC);
        if (!qi->desc_status) {
                free_page((unsigned long) qi->desc);
                kfree(qi);
index f7ecd85e2104366c94e1accbb0bbc9185f1fa013..bc5b6976f9184e05708a5ff5fc95fc0f36e6d0c8 100644 (file)
@@ -447,12 +447,12 @@ static int setup_intr_remapping(struct intel_iommu *iommu, int mode)
        struct page *pages;
 
        ir_table = iommu->ir_table = kzalloc(sizeof(struct ir_table),
-                                            GFP_KERNEL);
+                                            GFP_ATOMIC);
 
        if (!iommu->ir_table)
                return -ENOMEM;
 
-       pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, INTR_REMAP_PAGE_ORDER);
+       pages = alloc_pages(GFP_ATOMIC | __GFP_ZERO, INTR_REMAP_PAGE_ORDER);
 
        if (!pages) {
                printk(KERN_ERR "failed to allocate pages of order %d\n",