public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@hp.com>
To: dwmw2@infradead.org
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, alex.williamson@hp.com
Subject: [PATCH 3/5] intel-iommu: Use max_pfn to determine whether a device can passthrough
Date: Mon, 26 Oct 2009 17:25:09 -0600	[thread overview]
Message-ID: <20091026232508.9646.19296.stgit@nehalem.aw> (raw)
In-Reply-To: <20091026232401.9646.90540.stgit@nehalem.aw>

A dma_mask that's greater than 32-bit does not imply the device
can DMA anywhere in physical memory.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

 drivers/pci/intel-iommu.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 40be49a..19f10ae 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -39,6 +39,7 @@
 #include <linux/sysdev.h>
 #include <linux/tboot.h>
 #include <linux/dmi.h>
+#include <linux/bootmem.h>
 #include <asm/cacheflush.h>
 #include <asm/iommu.h>
 #include "pci.h"
@@ -2196,7 +2197,8 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
 	 * take them out of the 1:1 domain later.
 	 */
 	if (!startup)
-		return pdev->dma_mask > DMA_BIT_MASK(32);
+		return (pdev->dma_mask & (max_pfn << PAGE_SHIFT)) ==
+						(max_pfn << PAGE_SHIFT);
 
 	return 1;
 }
@@ -2537,11 +2539,12 @@ static int iommu_no_mapping(struct device *dev)
 			return 1;
 		else {
 			/*
-			 * 32 bit DMA is removed from si_domain and fall back
-			 * to non-identity mapping.
+			 * Devices that cannot support identity mapping
+			 * are removed from si_domain and fall back to
+			 * non-identity mapping.
 			 */
 			domain_remove_one_dev_info(si_domain, pdev);
-			printk(KERN_INFO "32bit %s uses non-identity mapping\n",
+			printk(KERN_INFO "%s uses non-identity mapping\n",
 			       pci_name(pdev));
 			return 0;
 		}


  parent reply	other threads:[~2009-10-26 23:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 23:24 [PATCH 0/5] intel-iommu fixes Alex Williamson
2009-10-26 23:24 ` [PATCH 1/5] dma: create dma_generic_alloc/free_coherent() Alex Williamson
2009-10-27  0:57   ` Paul Mundt
2009-10-27  2:26     ` Alex Williamson
2009-10-27  1:47   ` FUJITA Tomonori
2009-10-26 23:25 ` [PATCH 2/5] intel-iommu: Use dma_generic_alloc_coherent() for passthrough mappings Alex Williamson
2009-10-27  3:24   ` [PATCH v2 2/5] intel-iommu: Obey coherent_dma_mask for alloc_coherent on passthrough Alex Williamson
2009-10-26 23:25 ` Alex Williamson [this message]
2009-10-26 23:25 ` [PATCH 4/5] intel-iommu: Reinstate RMRRs if a device is removed from passthrough domain Alex Williamson
2009-10-27  8:15   ` David Woodhouse
2009-10-27 15:50     ` Alex Williamson
2009-10-28 14:36       ` David Woodhouse
2009-10-28 16:06         ` Alex Williamson
2009-10-28 20:35           ` Alex Williamson
2009-10-26 23:25 ` [PATCH 5/5] intel-iommu: Quiet unnecessary output Alex Williamson

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=20091026232508.9646.19296.stgit@nehalem.aw \
    --to=alex.williamson@hp.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@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