public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ashok Raj <ashok.raj@intel.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, ak@suse.de, gregkh@suse.de, muli@il.ibm.com,
	asit.k.mallick@intel.com, suresh.b.siddha@intel.com,
	anil.s.keshavamurthy@intel.com, arjan@linux.intel.com,
	ashok.raj@intel.com, shaohua.li@intel.com
Subject: [patch 8/8] [Intel IOMMU] Preserve some Virtual Address when devices cannot address entire range.
Date: Mon, 09 Apr 2007 14:56:00 -0700	[thread overview]
Message-ID: <20070409215724.508109000@intel.com> (raw)
In-Reply-To: 20070409215552.221374000@intel.com

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

Some devices may not support entire 64bit DMA. In a situation where such 
devices are co-located in a shared domain, we need to ensure there is some 
address space reserved for such devices without the low addresses getting
depleted by other devices capable of handling high dma addresses.

Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Index: linux-2.6.21-rc5/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.21-rc5.orig/Documentation/kernel-parameters.txt	2007-04-09 03:05:38.000000000 -0700
+++ linux-2.6.21-rc5/Documentation/kernel-parameters.txt	2007-04-09 03:05:41.000000000 -0700
@@ -735,6 +735,11 @@
 			first 16M. The floppy disk could be modified to use
 			the DMA api's but thats a lot of pain for very small
 			gain. This option is turned on by default.
+		preserve_{1g/2g/4g/512m/256m/16m}
+			If a device is sharing a domain with other devices
+			and the device mask doesnt cover the 64bit range,
+			use this option to let the iommu code preserve some
+			virtual addr for such devices.
 	io7=		[HW] IO7 for Marvel based alpha systems
 			See comment before marvel_specify_io7 in
 			arch/alpha/kernel/core_marvel.c.
Index: linux-2.6.21-rc5/drivers/pci/intel-iommu.c
===================================================================
--- linux-2.6.21-rc5.orig/drivers/pci/intel-iommu.c	2007-04-09 03:05:38.000000000 -0700
+++ linux-2.6.21-rc5/drivers/pci/intel-iommu.c	2007-04-09 03:06:17.000000000 -0700
@@ -90,6 +90,7 @@
 static int dmar_disabled, dmar_force_rw;
 static int dmar_map_gfx = 1, dmar_no_gfx_identity_map = 1;
 static int dmar_fix_isa = 1;
+static u64 dmar_preserve_iova_mask;
 
 static char *get_fault_reason(u8 fault_reason)
 {
@@ -119,6 +120,28 @@
 		} else if (!strncmp(str, "noisamap", 8)) {
 			dmar_fix_isa = 0;
 			printk (KERN_INFO"Intel-IOMMU: Turning off 16M unity map for LPC\n");
+ 		} else if (!strncmp(str, "preserve_", 9)) {
+ 			if (!strncmp(str + 9, "4g", 2) ||
+ 			    !strncmp(str + 9, "4G", 2))
+ 				dmar_preserve_iova_mask = DMA_32BIT_MASK;
+ 			else if (!strncmp(str + 9, "2g", 2) ||
+ 				!strncmp(str + 9, "2G", 2))
+ 				dmar_preserve_iova_mask = DMA_31BIT_MASK;
+ 			else if (!strncmp(str + 9, "1g", 2) ||
+ 			         !strncmp(str + 9, "1G", 2))
+ 				dmar_preserve_iova_mask = DMA_30BIT_MASK;
+ 			else if (!strncmp(str + 9, "512m", 2) ||
+ 			         !strncmp(str + 9, "512M", 2))
+ 				dmar_preserve_iova_mask = DMA_29BIT_MASK;
+ 			else if (!strncmp(str + 9, "256m", 4) ||
+ 			         !strncmp(str + 9, "256M", 4))
+ 				dmar_preserve_iova_mask = DMA_28BIT_MASK;
+ 			else if (!strncmp(str + 9, "16m", 3) ||
+ 			         !strncmp(str + 9, "16M", 3))
+ 				dmar_preserve_iova_mask = DMA_24BIT_MASK;
+			printk(KERN_INFO
+ 			"DMAR: Preserved IOVA mask 0x%Lx for devices "
+ 			"sharing domain\n", dmar_preserve_iova_mask);
 		}
 
 		str += strcspn(str, ",");
@@ -1726,9 +1749,10 @@
 	 * leave rooms for other devices
 	 */
 	if ((domain->flags & DOMAIN_FLAG_MULTIPLE_DEVICES) &&
-			pdev->dma_mask > DMA_32BIT_MASK)
+			dmar_preserve_iova_mask &&
+			pdev->dma_mask > dmar_preserve_iova_mask)
 		iova = alloc_iova(domain, addr, size,
-				DMA_32BIT_MASK + 1, pdev->dma_mask);
+				dmar_preserve_iova_mask + 1, pdev->dma_mask);
 	else
 		iova = alloc_iova(domain, addr, size,
 				IOVA_START_ADDR, pdev->dma_mask);

-- 

  parent reply	other threads:[~2007-04-09 22:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-09 21:55 [patch 0/8] [Intel IOMMU] Support for Intel Virtualization Technology for Directed I/O Ashok Raj
2007-04-09 21:55 ` [patch 1/8] [Intel IOMMU] ACPI support " Ashok Raj
2007-04-10  3:39   ` Len Brown
2007-04-10 16:26     ` Ashok Raj
2007-04-09 21:55 ` [patch 2/8] [Intel IOMMU] Some generic search functions required to lookup device relationships Ashok Raj
2007-04-10  3:46   ` Greg KH
2007-04-10  8:11     ` Shaohua Li
2007-04-10 13:03       ` Greg KH
2007-04-11  1:40         ` Shaohua Li
2007-04-11  4:36           ` Greg KH
2007-04-11  6:10         ` Shaohua Li
2007-04-09 21:55 ` [patch 3/8] [Intel IOMMU] Generic hardware support for Intel IOMMU Ashok Raj
2007-04-09 21:55 ` [patch 4/8] [Intel IOMMU] Supporting Zero Length Reads in " Ashok Raj
2007-04-09 21:55 ` [patch 5/8] [Intel IOMMU] Graphics driver workarounds to provide unity map Ashok Raj
2007-04-10  8:33   ` Christoph Hellwig
2007-04-10  9:07     ` David Miller
2007-04-10  9:12       ` Andi Kleen
2007-04-11  2:40         ` Wang Zhenyu
2007-04-10 16:29       ` Arjan van de Ven
2007-04-09 21:55 ` [patch 6/8] [Intel IOMMU] Doc updates for Intel Virtualization Technology for Directed I/O Ashok Raj
2007-04-09 21:55 ` [patch 7/8] [Intel IOMMU] Support for legacy ISA devices Ashok Raj
2007-04-09 21:56 ` Ashok Raj [this message]
2007-04-10  7:49 ` [patch 0/8] [Intel IOMMU] Support for Intel Virtualization Technology for Directed I/O Andi Kleen
2007-04-10  7:57   ` Shaohua Li
2007-04-10  8:09     ` Muli Ben-Yehuda
2007-04-10  8:20       ` Shaohua Li
2007-04-10 16:31   ` Ashok Raj
2007-04-10  8:21 ` Jeff Garzik
2007-04-10  8:27   ` Shaohua Li
2007-04-10  8:34     ` Jeff Garzik
2007-04-10 16:43       ` Ashok Raj

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=20070409215724.508109000@intel.com \
    --to=ashok.raj@intel.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=arjan@linux.intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muli@il.ibm.com \
    --cc=shaohua.li@intel.com \
    --cc=suresh.b.siddha@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