aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/intel_irq_remapping.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/intel_irq_remapping.c')
-rw-r--r--drivers/iommu/intel_irq_remapping.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index fdf57534b76c..f307a3fb93ce 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -520,6 +520,7 @@ static int __init dmar_x2apic_optout(void)
520static int __init intel_irq_remapping_supported(void) 520static int __init intel_irq_remapping_supported(void)
521{ 521{
522 struct dmar_drhd_unit *drhd; 522 struct dmar_drhd_unit *drhd;
523 struct intel_iommu *iommu;
523 524
524 if (disable_irq_remap) 525 if (disable_irq_remap)
525 return 0; 526 return 0;
@@ -538,12 +539,9 @@ static int __init intel_irq_remapping_supported(void)
538 if (!dmar_ir_support()) 539 if (!dmar_ir_support())
539 return 0; 540 return 0;
540 541
541 for_each_drhd_unit(drhd) { 542 for_each_iommu(iommu, drhd)
542 struct intel_iommu *iommu = drhd->iommu;
543
544 if (!ecap_ir_support(iommu->ecap)) 543 if (!ecap_ir_support(iommu->ecap))
545 return 0; 544 return 0;
546 }
547 545
548 return 1; 546 return 1;
549} 547}
@@ -551,6 +549,7 @@ static int __init intel_irq_remapping_supported(void)
551static int __init intel_enable_irq_remapping(void) 549static int __init intel_enable_irq_remapping(void)
552{ 550{
553 struct dmar_drhd_unit *drhd; 551 struct dmar_drhd_unit *drhd;
552 struct intel_iommu *iommu;
554 bool x2apic_present; 553 bool x2apic_present;
555 int setup = 0; 554 int setup = 0;
556 int eim = 0; 555 int eim = 0;
@@ -573,9 +572,7 @@ static int __init intel_enable_irq_remapping(void)
573 "Use 'intremap=no_x2apic_optout' to override BIOS request.\n"); 572 "Use 'intremap=no_x2apic_optout' to override BIOS request.\n");
574 } 573 }
575 574
576 for_each_drhd_unit(drhd) { 575 for_each_iommu(iommu, drhd) {
577 struct intel_iommu *iommu = drhd->iommu;
578
579 /* 576 /*
580 * If the queued invalidation is already initialized, 577 * If the queued invalidation is already initialized,
581 * shouldn't disable it. 578 * shouldn't disable it.
@@ -600,9 +597,7 @@ static int __init intel_enable_irq_remapping(void)
600 /* 597 /*
601 * check for the Interrupt-remapping support 598 * check for the Interrupt-remapping support
602 */ 599 */
603 for_each_drhd_unit(drhd) { 600 for_each_iommu(iommu, drhd) {
604 struct intel_iommu *iommu = drhd->iommu;
605
606 if (!ecap_ir_support(iommu->ecap)) 601 if (!ecap_ir_support(iommu->ecap))
607 continue; 602 continue;
608 603
@@ -616,10 +611,8 @@ static int __init intel_enable_irq_remapping(void)
616 /* 611 /*
617 * Enable queued invalidation for all the DRHD's. 612 * Enable queued invalidation for all the DRHD's.
618 */ 613 */
619 for_each_drhd_unit(drhd) { 614 for_each_iommu(iommu, drhd) {
620 int ret; 615 int ret = dmar_enable_qi(iommu);
621 struct intel_iommu *iommu = drhd->iommu;
622 ret = dmar_enable_qi(iommu);
623 616
624 if (ret) { 617 if (ret) {
625 printk(KERN_ERR "DRHD %Lx: failed to enable queued, " 618 printk(KERN_ERR "DRHD %Lx: failed to enable queued, "
@@ -632,9 +625,7 @@ static int __init intel_enable_irq_remapping(void)
632 /* 625 /*
633 * Setup Interrupt-remapping for all the DRHD's now. 626 * Setup Interrupt-remapping for all the DRHD's now.
634 */ 627 */
635 for_each_drhd_unit(drhd) { 628 for_each_iommu(iommu, drhd) {
636 struct intel_iommu *iommu = drhd->iommu;
637
638 if (!ecap_ir_support(iommu->ecap)) 629 if (!ecap_ir_support(iommu->ecap))
639 continue; 630 continue;
640 631
@@ -778,19 +769,17 @@ static int ir_parse_ioapic_hpet_scope(struct acpi_dmar_header *header,
778static int __init parse_ioapics_under_ir(void) 769static int __init parse_ioapics_under_ir(void)
779{ 770{
780 struct dmar_drhd_unit *drhd; 771 struct dmar_drhd_unit *drhd;
772 struct intel_iommu *iommu;
781 int ir_supported = 0; 773 int ir_supported = 0;
782 int ioapic_idx; 774 int ioapic_idx;
783 775
784 for_each_drhd_unit(drhd) { 776 for_each_iommu(iommu, drhd)
785 struct intel_iommu *iommu = drhd->iommu;
786
787 if (ecap_ir_support(iommu->ecap)) { 777 if (ecap_ir_support(iommu->ecap)) {
788 if (ir_parse_ioapic_hpet_scope(drhd->hdr, iommu)) 778 if (ir_parse_ioapic_hpet_scope(drhd->hdr, iommu))
789 return -1; 779 return -1;
790 780
791 ir_supported = 1; 781 ir_supported = 1;
792 } 782 }
793 }
794 783
795 if (!ir_supported) 784 if (!ir_supported)
796 return 0; 785 return 0;