Commit 69cf1d8a authored by Joerg Roedel's avatar Joerg Roedel Committed by Thomas Gleixner

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: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Tested-by: default avatarJoerg 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.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 2966d956
...@@ -619,10 +619,16 @@ static int __init intel_prepare_irq_remapping(void) ...@@ -619,10 +619,16 @@ static int __init intel_prepare_irq_remapping(void)
goto error; goto error;
} }
/* First make sure all IOMMUs support IRQ remapping */
for_each_iommu(iommu, drhd) for_each_iommu(iommu, drhd)
if (!ecap_ir_support(iommu->ecap) || if (!ecap_ir_support(iommu->ecap))
intel_setup_irq_remapping(iommu)) goto error;
/* Do the allocations early */
for_each_iommu(iommu, drhd)
if (intel_setup_irq_remapping(iommu))
goto error; goto error;
return 0; return 0;
error: error:
...@@ -673,16 +679,12 @@ static int __init intel_enable_irq_remapping(void) ...@@ -673,16 +679,12 @@ static int __init intel_enable_irq_remapping(void)
/* /*
* check for the Interrupt-remapping support * check for the Interrupt-remapping support
*/ */
for_each_iommu(iommu, drhd) { for_each_iommu(iommu, drhd)
if (!ecap_ir_support(iommu->ecap))
continue;
if (eim && !ecap_eim_support(iommu->ecap)) { if (eim && !ecap_eim_support(iommu->ecap)) {
printk(KERN_INFO "DRHD %Lx: EIM not supported by DRHD, " printk(KERN_INFO "DRHD %Lx: EIM not supported by DRHD, "
" ecap %Lx\n", drhd->reg_base_addr, iommu->ecap); " ecap %Lx\n", drhd->reg_base_addr, iommu->ecap);
goto error; goto error;
} }
}
/* /*
* Enable queued invalidation for all the DRHD's. * Enable queued invalidation for all the DRHD's.
...@@ -702,9 +704,6 @@ static int __init intel_enable_irq_remapping(void) ...@@ -702,9 +704,6 @@ static int __init intel_enable_irq_remapping(void)
* Setup Interrupt-remapping for all the DRHD's now. * Setup Interrupt-remapping for all the DRHD's now.
*/ */
for_each_iommu(iommu, drhd) { for_each_iommu(iommu, drhd) {
if (!ecap_ir_support(iommu->ecap))
continue;
iommu_set_irq_remapping(iommu, eim); iommu_set_irq_remapping(iommu, eim);
setup = 1; setup = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment