aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-01-07 02:31:36 -0500
committerThomas Gleixner <tglx@linutronix.de>2015-01-15 05:24:23 -0500
commit69cf1d8a1286a7bfbeec497b69c43cc7ebb2a787 (patch)
tree8d8062607fc72a455e7e789c5ec3e41ae80cf7ff /drivers/iommu
parent2966d9566beb39c53477c96525820b9415de7a7d (diff)
iommu/vt-d: Allocate IRQ remapping data structures only for all IOMMUs
IRQ remapping is only supported when all IOMMUs in the system support it. So check if all IOMMUs in the system support IRQ remapping before doing the allocations. [Jiang] 1) Rebased to v3.19. 2) Remove redundant check of ecap_ir_support(iommu->ecap) in function intel_enable_irq_remapping(). Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Tested-by: Joerg Roedel <joro@8bytes.org> Cc: Tony Luck <tony.luck@intel.com> Cc: iommu@lists.linux-foundation.org Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Link: http://lkml.kernel.org/r/1420615903-28253-10-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel_irq_remapping.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 8ccc7aa7e43a..137663bd5da2 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -619,10 +619,16 @@ static int __init intel_prepare_irq_remapping(void)
619 goto error; 619 goto error;
620 } 620 }
621 621
622 /* First make sure all IOMMUs support IRQ remapping */
622 for_each_iommu(iommu, drhd) 623 for_each_iommu(iommu, drhd)
623 if (!ecap_ir_support(iommu->ecap) || 624 if (!ecap_ir_support(iommu->ecap))
624 intel_setup_irq_remapping(iommu)) 625 goto error;
626
627 /* Do the allocations early */
628 for_each_iommu(iommu, drhd)
629 if (intel_setup_irq_remapping(iommu))
625 goto error; 630 goto error;
631
626 return 0; 632 return 0;
627 633
628error: 634error:
@@ -673,16 +679,12 @@ static int __init intel_enable_irq_remapping(void)
673 /* 679 /*
674 * check for the Interrupt-remapping support 680 * check for the Interrupt-remapping support
675 */ 681 */
676 for_each_iommu(iommu, drhd) { 682 for_each_iommu(iommu, drhd)
677 if (!ecap_ir_support(iommu->ecap))
678 continue;
679
680 if (eim && !ecap_eim_support(iommu->ecap)) { 683 if (eim && !ecap_eim_support(iommu->ecap)) {
681 printk(KERN_INFO "DRHD %Lx: EIM not supported by DRHD, " 684 printk(KERN_INFO "DRHD %Lx: EIM not supported by DRHD, "
682 " ecap %Lx\n", drhd->reg_base_addr, iommu->ecap); 685 " ecap %Lx\n", drhd->reg_base_addr, iommu->ecap);
683 goto error; 686 goto error;
684 } 687 }
685 }
686 688
687 /* 689 /*
688 * Enable queued invalidation for all the DRHD's. 690 * Enable queued invalidation for all the DRHD's.
@@ -702,9 +704,6 @@ static int __init intel_enable_irq_remapping(void)
702 * Setup Interrupt-remapping for all the DRHD's now. 704 * Setup Interrupt-remapping for all the DRHD's now.
703 */ 705 */
704 for_each_iommu(iommu, drhd) { 706 for_each_iommu(iommu, drhd) {
705 if (!ecap_ir_support(iommu->ecap))
706 continue;
707
708 iommu_set_irq_remapping(iommu, eim); 707 iommu_set_irq_remapping(iommu, eim);
709 setup = 1; 708 setup = 1;
710 } 709 }