mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suresh Siddha <suresh.b.siddha@intel.com>
To: mingo@elte.hu, tglx@linutronix.de, hpa@zytor.com, dwmw2@infradead.org
Cc: yinghai@kernel.org, youquan.song@intel.com, joerg.roedel@amd.com,
	tony.luck@intel.com, linux-kernel@vger.kernel.org,
	andrew.vasquez@qlogic.com,
	Suresh Siddha <suresh.b.siddha@intel.com>
Subject: [patch 2/8] intr_remap: call dmar_dev_scope_init() explicitly
Date: Tue, 23 Aug 2011 17:05:19 -0700	[thread overview]
Message-ID: <20110824001456.229207526@sbsiddha-desk.sc.intel.com> (raw)
In-Reply-To: <20110824000517.710353624@sbsiddha-desk.sc.intel.com>

[-- Attachment #1: init_dev_scope_from_intr_remap.patch --]
[-- Type: text/plain, Size: 3346 bytes --]

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>
---
 drivers/iommu/dmar.c           |   15 ++++++++++++---
 drivers/iommu/intel-iommu.c    |    6 +-----
 drivers/iommu/intr_remapping.c |    9 +++++++++
 3 files changed, 22 insertions(+), 8 deletions(-)

Index: tree/drivers/iommu/dmar.c
===================================================================
--- tree.orig/drivers/iommu/dmar.c
+++ tree/drivers/iommu/dmar.c
@@ -557,13 +557,17 @@ dmar_find_matched_drhd_unit(struct pci_d
 
 int __init dmar_dev_scope_init(void)
 {
+	static int dmar_dev_scope_initialized;
 	struct dmar_drhd_unit *drhd, *drhd_n;
 	int ret = -ENODEV;
 
+	if (dmar_dev_scope_initialized)
+		return dmar_dev_scope_initialized;
+
 	list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) {
 		ret = dmar_parse_dev(drhd);
 		if (ret)
-			return ret;
+			goto fail;
 	}
 
 #ifdef CONFIG_DMAR
@@ -574,17 +578,22 @@ int __init dmar_dev_scope_init(void)
 		list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) {
 			ret = rmrr_parse_dev(rmrr);
 			if (ret)
-				return ret;
+				goto fail;
 		}
 
 		list_for_each_entry_safe(atsr, atsr_n, &dmar_atsr_units, list) {
 			ret = atsr_parse_dev(atsr);
 			if (ret)
-				return ret;
+				goto fail;
 		}
 	}
 #endif
 
+	dmar_dev_scope_initialized = 1;
+	return 0;
+
+fail:
+	dmar_dev_scope_initialized = ret;
 	return ret;
 }
 
Index: tree/drivers/iommu/intr_remapping.c
===================================================================
--- tree.orig/drivers/iommu/intr_remapping.c
+++ tree/drivers/iommu/intr_remapping.c
@@ -773,6 +773,15 @@ int __init parse_ioapics_under_ir(void)
 	return ir_supported;
 }
 
+int ir_dev_scope_init(void)
+{
+	if (!intr_remapping_enabled)
+		return 0;
+
+	return dmar_dev_scope_init();
+}
+rootfs_initcall(ir_dev_scope_init);
+
 void disable_intr_remapping(void)
 {
 	struct dmar_drhd_unit *drhd;
Index: tree/drivers/iommu/intel-iommu.c
===================================================================
--- tree.orig/drivers/iommu/intel-iommu.c
+++ tree/drivers/iommu/intel-iommu.c
@@ -3439,16 +3439,12 @@ int __init intel_iommu_init(void)
 		return 	-ENODEV;
 	}
 
-	if (dmar_dev_scope_init()) {
+	if (dmar_dev_scope_init() < 0) {
 		if (force_on)
 			panic("tboot: Failed to initialize DMAR device scope\n");
 		return 	-ENODEV;
 	}
 
-	/*
-	 * Check the need for DMA-remapping initialization now.
-	 * Above initialization will also be used by Interrupt-remapping.
-	 */
 	if (no_iommu || dmar_disabled)
 		return -ENODEV;
 



  parent reply	other threads:[~2011-08-24  0:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24  0:05 [patch 0/8] intel iommu, irq-remap, x2apic bug fixes and cleanups Suresh Siddha
2011-08-24  0:05 ` [patch 1/8] x86, x2apic: enable the bios request for x2apic optout Suresh Siddha
2011-08-24  0:05 ` Suresh Siddha [this message]
2011-08-24  0:05 ` [patch 3/8] iommu: move IOMMU specific code to intel-iommu.c Suresh Siddha
2011-08-24  9:27   ` Roedel, Joerg
2011-08-24 18:31     ` Suresh Siddha
2011-08-25 17:05       ` Roedel, Joerg
2011-08-24  0:05 ` [patch 4/8] iommu: no need to set dmar_disabled in check_zero_address() Suresh Siddha
2011-08-24  0:05 ` [patch 5/8] iommu: cleanup ifdefs in detect_intel_iommu() Suresh Siddha
2011-08-24  0:05 ` [patch 6/8] x86, msi, intr-remap: use the ioapic set affinity routine Suresh Siddha
2011-08-24  6:57   ` Yinghai Lu
2011-08-24  0:05 ` [patch 7/8] x86, ioapic: define irq_remap_modify_chip_defaults() Suresh Siddha
2011-08-24  0:05 ` [patch 8/8] iommu: rename the DMAR and INTR_REMAP config options Suresh Siddha
2011-08-24  6:47   ` Yinghai Lu
2011-08-24  8:28     ` Roedel, Joerg
2011-08-24 18:25       ` Suresh Siddha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110824001456.229207526@sbsiddha-desk.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=dwmw2@infradead.org \
    --cc=hpa@zytor.com \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=yinghai@kernel.org \
    --cc=youquan.song@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®