mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luming Yu <luming.yu@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: [RFC patch] Add boot option intel_iommu_drhd_mask
Date: Tue, 11 Aug 2009 10:56:34 +0800	[thread overview]
Message-ID: <3877989d0908101956o303c43c5i5c5f08297afb312@mail.gmail.com> (raw)

Hi there,

As a follow up to my rfc-patch "return early if all dmar HW unit ignored",
The following patch add an option intel_iommu_drhd_mask to be able
to disable Dma-remapping hardware unit individually.

Please review. If make sense, please apply.


**The patch is enclosed in text attachment*
**Using web client to send the patch* *
**below is for review, please apply attached  patch*/

Thanks,
Luming


Signed-off-by: Yu Luming <luming.yu@intel.com>

 Documentation/kernel-parameters.txt |    3 +++
 drivers/pci/dmar.c                  |    7 +++++--
 drivers/pci/intel-iommu.c           |   10 ++++++++++
 include/linux/intel-iommu.h         |    1 +
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Documentation/kernel-parameters.txt
b/Documentation/kernel-parameters.txt
index dd1a6d4..d9eb422 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -981,6 +981,9 @@ and is between 256 and 4096 characters. It is
defined in the file
 			result in a hardware IOTLB flush operation as opposed
 			to batching them for performance.

+	intel_iommu_drhd_mask=0xAAAAAAAA
+			Set a bit mask of DMAR hardware unit to be ignored
+
 	inttest=	[IA64]

 	iomem=		Disable strict checking of access to MMIO memory
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 7b287cb..28f3f6b 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -167,7 +167,7 @@ static int __init dmar_parse_dev_scope(void
*start, void *end, int *cnt,
  * present in the platform
  */
 static int __init
-dmar_parse_one_drhd(struct acpi_dmar_header *header)
+dmar_parse_one_drhd(struct acpi_dmar_header *header, int drhd_count)
 {
 	struct acpi_dmar_hardware_unit *drhd;
 	struct dmar_drhd_unit *dmaru;
@@ -197,6 +197,8 @@ dmar_parse_one_drhd(struct acpi_dmar_header *header)
 		kfree(dmaru);
 		return ret;
 	}
+	if (intel_iommu_drhd_mask & (0x1 << drhd_count))
+		dmaru->ignored = 1;
 	dmar_register_drhd_unit(dmaru);
 	return 0;
 }
@@ -405,6 +407,7 @@ parse_dmar_table(void)
 {
 	struct acpi_table_dmar *dmar;
 	struct acpi_dmar_header *entry_header;
+	int drhd_count = 0;
 	int ret = 0;

 	/*
@@ -440,7 +443,7 @@ parse_dmar_table(void)

 		switch (entry_header->type) {
 		case ACPI_DMAR_TYPE_HARDWARE_UNIT:
-			ret = dmar_parse_one_drhd(entry_header);
+			ret = dmar_parse_one_drhd(entry_header, drhd_count);
 			break;
 		case ACPI_DMAR_TYPE_RESERVED_MEMORY:
 #ifdef CONFIG_DMAR
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 2314ad7..03afd92 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -337,6 +337,7 @@ static DEFINE_SPINLOCK(device_domain_lock);
 static LIST_HEAD(device_domain_list);

 static struct iommu_ops intel_iommu_ops;
+unsigned int intel_iommu_drhd_mask;

 static int __init intel_iommu_setup(char *str)
 {
@@ -371,6 +372,15 @@ static int __init intel_iommu_setup(char *str)
 }
 __setup("intel_iommu=", intel_iommu_setup);

+static int __init intel_iommu_drhd_mask_setup(char *str)
+{
+	if (!str)
+		return -EINVAL;
+	intel_iommu_drhd_mask = simple_strtoul(str, NULL, 0);
+	return 0;
+}
+__setup("intel_iommu_drhd_mask=", intel_iommu_drhd_mask_setup);
+
 static struct kmem_cache *iommu_domain_cache;
 static struct kmem_cache *iommu_devinfo_cache;
 static struct kmem_cache *iommu_iova_cache;
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 482dc91..113c8e9 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -359,5 +359,6 @@ extern void qi_flush_dev_iotlb(struct intel_iommu
*iommu, u16 sid, u16 qdep,
 			       u64 addr, unsigned mask);

 extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
+extern unsigned int intel_iommu_drhd_mask;

 #endif

             reply	other threads:[~2009-08-11 12:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11  2:56 Luming Yu [this message]
2009-08-11  3:02 ` Luming Yu
2009-08-11  5:10   ` Luming Yu
2009-08-11  9:22 ` David Woodhouse
2009-08-11 14:22   ` Luming Yu

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=3877989d0908101956o303c43c5i5c5f08297afb312@mail.gmail.com \
    --to=luming.yu@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®