Skip to content

Commit

Permalink
iommu/vt-d: Prepare for killing function irq_remapping_supported()
Browse files Browse the repository at this point in the history
Prepare for killing function irq_remapping_supported() by moving code
from intel_irq_remapping_supported() into intel_prepare_irq_remapping().

Combined with patch from Joerg at https://lkml.org/lkml/2014/12/15/487,
so assume an signed-off from Joerg.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
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-9-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Jiang Liu authored and Thomas Gleixner committed Jan 15, 2015
1 parent ef1b2b8 commit 2966d95
Showing 1 changed file with 25 additions and 33 deletions.
58 changes: 25 additions & 33 deletions drivers/iommu/intel_irq_remapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,30 +568,6 @@ static int __init dmar_x2apic_optout(void)

static int __init intel_irq_remapping_supported(void)
{
struct dmar_drhd_unit *drhd;
struct intel_iommu *iommu;

if (disable_irq_remap)
return 0;
if (irq_remap_broken) {
printk(KERN_WARNING
"This system BIOS has enabled interrupt remapping\n"
"on a chipset that contains an erratum making that\n"
"feature unstable. To maintain system stability\n"
"interrupt remapping is being disabled. Please\n"
"contact your BIOS vendor for an update\n");
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
disable_irq_remap = 1;
return 0;
}

if (!dmar_ir_support())
return 0;

for_each_iommu(iommu, drhd)
if (!ecap_ir_support(iommu->ecap))
return 0;

return 1;
}

Expand All @@ -616,26 +592,42 @@ static int __init intel_prepare_irq_remapping(void)
struct dmar_drhd_unit *drhd;
struct intel_iommu *iommu;

/* First check whether IRQ remapping should be enabled */
if (disable_irq_remap)
return -ENODEV;

if (irq_remap_broken) {
printk(KERN_WARNING
"This system BIOS has enabled interrupt remapping\n"
"on a chipset that contains an erratum making that\n"
"feature unstable. To maintain system stability\n"
"interrupt remapping is being disabled. Please\n"
"contact your BIOS vendor for an update\n");
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
disable_irq_remap = 1;
return -ENODEV;
}

if (dmar_table_init() < 0)
return -1;
return -ENODEV;

if (!dmar_ir_support())
return -ENODEV;

if (parse_ioapics_under_ir() != 1) {
printk(KERN_INFO "Not enabling interrupt remapping\n");
goto error;
}

for_each_iommu(iommu, drhd) {
if (!ecap_ir_support(iommu->ecap))
continue;

/* Do the allocations early */
if (intel_setup_irq_remapping(iommu))
for_each_iommu(iommu, drhd)
if (!ecap_ir_support(iommu->ecap) ||
intel_setup_irq_remapping(iommu))
goto error;
}
return 0;

error:
intel_cleanup_irq_remapping();
return -1;
return -ENODEV;
}

static int __init intel_enable_irq_remapping(void)
Expand Down

0 comments on commit 2966d95

Please sign in to comment.