diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-08-23 20:05:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-09-21 04:21:52 -0400 |
commit | c2c7286ac6d996a8ffc8d391d782ba35570b1236 (patch) | |
tree | beb95a2a13b212bbb35d8c591e4fd83cb6182019 | |
parent | 41750d31fc9599fd81763e685a6b7b42d298c4f8 (diff) |
intr_remap: Call dmar_dev_scope_init() explicitly
Both DMA-remapping aswell as Interrupt-remapping depend on the
dmar dev scope to be initialized. When both DMA and
IRQ-remapping are enabled, we depend on DMA-remapping init code
to call dmar_dev_scope_init(). This resulted in not doing this
init when DMA-remapping was turned off but interrupt-remapping
turned on in the kernel config.
This caused interrupt routing to break with CONFIG_INTR_REMAP=y
and CONFIG_DMAR=n.
This issue was introduced by this commit:
| commit 9d5ce73a64be2be8112147a3e0b551ad9cd1247b
| Author: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
| Date: Tue Nov 10 19:46:16 2009 +0900
|
| x86: intel-iommu: Convert detect_intel_iommu to use iommu_init hook
Fix this by calling dmar_dev_scope_init() explicitly from the
interrupt remapping code too.
Reported-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: yinghai@kernel.org
Cc: youquan.song@intel.com
Cc: joerg.roedel@amd.com
Cc: tony.luck@intel.com
Cc: dwmw2@infradead.org
Link: http://lkml.kernel.org/r/20110824001456.229207526@sbsiddha-desk.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | drivers/iommu/dmar.c | 15 | ||||
-rw-r--r-- | drivers/iommu/intel-iommu.c | 6 | ||||
-rw-r--r-- | drivers/iommu/intr_remapping.c | 9 |
3 files changed, 22 insertions, 8 deletions
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index c4a0235a4fdb..17adf1ebcb13 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -557,13 +557,17 @@ dmar_find_matched_drhd_unit(struct pci_dev *dev) | |||
557 | 557 | ||
558 | int __init dmar_dev_scope_init(void) | 558 | int __init dmar_dev_scope_init(void) |
559 | { | 559 | { |
560 | static int dmar_dev_scope_initialized; | ||
560 | struct dmar_drhd_unit *drhd, *drhd_n; | 561 | struct dmar_drhd_unit *drhd, *drhd_n; |
561 | int ret = -ENODEV; | 562 | int ret = -ENODEV; |
562 | 563 | ||
564 | if (dmar_dev_scope_initialized) | ||
565 | return dmar_dev_scope_initialized; | ||
566 | |||
563 | list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) { | 567 | list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) { |
564 | ret = dmar_parse_dev(drhd); | 568 | ret = dmar_parse_dev(drhd); |
565 | if (ret) | 569 | if (ret) |
566 | return ret; | 570 | goto fail; |
567 | } | 571 | } |
568 | 572 | ||
569 | #ifdef CONFIG_DMAR | 573 | #ifdef CONFIG_DMAR |
@@ -574,17 +578,22 @@ int __init dmar_dev_scope_init(void) | |||
574 | list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) { | 578 | list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) { |
575 | ret = rmrr_parse_dev(rmrr); | 579 | ret = rmrr_parse_dev(rmrr); |
576 | if (ret) | 580 | if (ret) |
577 | return ret; | 581 | goto fail; |
578 | } | 582 | } |
579 | 583 | ||
580 | list_for_each_entry_safe(atsr, atsr_n, &dmar_atsr_units, list) { | 584 | list_for_each_entry_safe(atsr, atsr_n, &dmar_atsr_units, list) { |
581 | ret = atsr_parse_dev(atsr); | 585 | ret = atsr_parse_dev(atsr); |
582 | if (ret) | 586 | if (ret) |
583 | return ret; | 587 | goto fail; |
584 | } | 588 | } |
585 | } | 589 | } |
586 | #endif | 590 | #endif |
587 | 591 | ||
592 | dmar_dev_scope_initialized = 1; | ||
593 | return 0; | ||
594 | |||
595 | fail: | ||
596 | dmar_dev_scope_initialized = ret; | ||
588 | return ret; | 597 | return ret; |
589 | } | 598 | } |
590 | 599 | ||
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c621c98c99da..df69618177c5 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -3439,16 +3439,12 @@ int __init intel_iommu_init(void) | |||
3439 | return -ENODEV; | 3439 | return -ENODEV; |
3440 | } | 3440 | } |
3441 | 3441 | ||
3442 | if (dmar_dev_scope_init()) { | 3442 | if (dmar_dev_scope_init() < 0) { |
3443 | if (force_on) | 3443 | if (force_on) |
3444 | panic("tboot: Failed to initialize DMAR device scope\n"); | 3444 | panic("tboot: Failed to initialize DMAR device scope\n"); |
3445 | return -ENODEV; | 3445 | return -ENODEV; |
3446 | } | 3446 | } |
3447 | 3447 | ||
3448 | /* | ||
3449 | * Check the need for DMA-remapping initialization now. | ||
3450 | * Above initialization will also be used by Interrupt-remapping. | ||
3451 | */ | ||
3452 | if (no_iommu || dmar_disabled) | 3448 | if (no_iommu || dmar_disabled) |
3453 | return -ENODEV; | 3449 | return -ENODEV; |
3454 | 3450 | ||
diff --git a/drivers/iommu/intr_remapping.c b/drivers/iommu/intr_remapping.c index 51a2ce9b8789..cfb0dd4bf0b6 100644 --- a/drivers/iommu/intr_remapping.c +++ b/drivers/iommu/intr_remapping.c | |||
@@ -773,6 +773,15 @@ int __init parse_ioapics_under_ir(void) | |||
773 | return ir_supported; | 773 | return ir_supported; |
774 | } | 774 | } |
775 | 775 | ||
776 | int ir_dev_scope_init(void) | ||
777 | { | ||
778 | if (!intr_remapping_enabled) | ||
779 | return 0; | ||
780 | |||
781 | return dmar_dev_scope_init(); | ||
782 | } | ||
783 | rootfs_initcall(ir_dev_scope_init); | ||
784 | |||
776 | void disable_intr_remapping(void) | 785 | void disable_intr_remapping(void) |
777 | { | 786 | { |
778 | struct dmar_drhd_unit *drhd; | 787 | struct dmar_drhd_unit *drhd; |