diff options
author | Jiang Liu <jiang.liu@linux.intel.com> | 2015-01-07 02:31:35 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-15 05:24:23 -0500 |
commit | 2966d9566beb39c53477c96525820b9415de7a7d (patch) | |
tree | 88d5962e944590daa051be62645819ef7dbeea93 /drivers/iommu/intel_irq_remapping.c | |
parent | ef1b2b8ad13858ab2f87c05261b8ce3253f90af9 (diff) |
iommu/vt-d: Prepare for killing function irq_remapping_supported()
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>
Diffstat (limited to 'drivers/iommu/intel_irq_remapping.c')
-rw-r--r-- | drivers/iommu/intel_irq_remapping.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 1e7e09327753..8ccc7aa7e43a 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c | |||
@@ -568,30 +568,6 @@ static int __init dmar_x2apic_optout(void) | |||
568 | 568 | ||
569 | static int __init intel_irq_remapping_supported(void) | 569 | static int __init intel_irq_remapping_supported(void) |
570 | { | 570 | { |
571 | struct dmar_drhd_unit *drhd; | ||
572 | struct intel_iommu *iommu; | ||
573 | |||
574 | if (disable_irq_remap) | ||
575 | return 0; | ||
576 | if (irq_remap_broken) { | ||
577 | printk(KERN_WARNING | ||
578 | "This system BIOS has enabled interrupt remapping\n" | ||
579 | "on a chipset that contains an erratum making that\n" | ||
580 | "feature unstable. To maintain system stability\n" | ||
581 | "interrupt remapping is being disabled. Please\n" | ||
582 | "contact your BIOS vendor for an update\n"); | ||
583 | add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); | ||
584 | disable_irq_remap = 1; | ||
585 | return 0; | ||
586 | } | ||
587 | |||
588 | if (!dmar_ir_support()) | ||
589 | return 0; | ||
590 | |||
591 | for_each_iommu(iommu, drhd) | ||
592 | if (!ecap_ir_support(iommu->ecap)) | ||
593 | return 0; | ||
594 | |||
595 | return 1; | 571 | return 1; |
596 | } | 572 | } |
597 | 573 | ||
@@ -616,26 +592,42 @@ static int __init intel_prepare_irq_remapping(void) | |||
616 | struct dmar_drhd_unit *drhd; | 592 | struct dmar_drhd_unit *drhd; |
617 | struct intel_iommu *iommu; | 593 | struct intel_iommu *iommu; |
618 | 594 | ||
595 | /* First check whether IRQ remapping should be enabled */ | ||
596 | if (disable_irq_remap) | ||
597 | return -ENODEV; | ||
598 | |||
599 | if (irq_remap_broken) { | ||
600 | printk(KERN_WARNING | ||
601 | "This system BIOS has enabled interrupt remapping\n" | ||
602 | "on a chipset that contains an erratum making that\n" | ||
603 | "feature unstable. To maintain system stability\n" | ||
604 | "interrupt remapping is being disabled. Please\n" | ||
605 | "contact your BIOS vendor for an update\n"); | ||
606 | add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); | ||
607 | disable_irq_remap = 1; | ||
608 | return -ENODEV; | ||
609 | } | ||
610 | |||
619 | if (dmar_table_init() < 0) | 611 | if (dmar_table_init() < 0) |
620 | return -1; | 612 | return -ENODEV; |
613 | |||
614 | if (!dmar_ir_support()) | ||
615 | return -ENODEV; | ||
621 | 616 | ||
622 | if (parse_ioapics_under_ir() != 1) { | 617 | if (parse_ioapics_under_ir() != 1) { |
623 | printk(KERN_INFO "Not enabling interrupt remapping\n"); | 618 | printk(KERN_INFO "Not enabling interrupt remapping\n"); |
624 | goto error; | 619 | goto error; |
625 | } | 620 | } |
626 | 621 | ||
627 | for_each_iommu(iommu, drhd) { | 622 | for_each_iommu(iommu, drhd) |
628 | if (!ecap_ir_support(iommu->ecap)) | 623 | if (!ecap_ir_support(iommu->ecap) || |
629 | continue; | 624 | intel_setup_irq_remapping(iommu)) |
630 | |||
631 | /* Do the allocations early */ | ||
632 | if (intel_setup_irq_remapping(iommu)) | ||
633 | goto error; | 625 | goto error; |
634 | } | ||
635 | return 0; | 626 | return 0; |
627 | |||
636 | error: | 628 | error: |
637 | intel_cleanup_irq_remapping(); | 629 | intel_cleanup_irq_remapping(); |
638 | return -1; | 630 | return -ENODEV; |
639 | } | 631 | } |
640 | 632 | ||
641 | static int __init intel_enable_irq_remapping(void) | 633 | static int __init intel_enable_irq_remapping(void) |