mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [Intel IOMMU PATCH] Re-evaluate RMRR info for devices removed from si domain
@ 2012-02-28 17:58 Mingarelli, Thomas
  2012-02-28 22:15 ` Chris Wright
  0 siblings, 1 reply; 2+ messages in thread
From: Mingarelli, Thomas @ 2012-02-28 17:58 UTC (permalink / raw)
  To: dwmw2; +Cc: linux-kernel, ddutile, Alex Williamson

This patch is being submitted to handle the case where a pci device is
placed into the si domain, when booting in iommu passthrough mode, then
removed. The RMRR information for such devices need to be re-processed
to avoid DMA Read errors due to the Present Bit being cleared in the
device's context entry.
Signed-off-by: Thomas Mingarelli <thomas.mingarelli@hp.com>

diff -up linux-3.2.4/drivers/iommu/intel-iommu.c.ORIG linux-3.2.4/drivers/iommu/intel-iommu.c
--- linux-3.2.4/drivers/iommu/intel-iommu.c.ORIG	2012-02-22 16:10:07.105254130 -0600
+++ linux-3.2.4/drivers/iommu/intel-iommu.c	2012-02-28 12:49:38.537694065 -0600
@@ -2676,7 +2676,8 @@ static int iommu_dummy(struct pci_dev *p
 static int iommu_no_mapping(struct device *dev)
 {
 	struct pci_dev *pdev;
-	int found;
+	struct dmar_rmrr_unit *rmrr;
+	int i, ret, found;
 
 	if (unlikely(dev->bus != &pci_bus_type))
 		return 1;
@@ -2699,7 +2700,24 @@ static int iommu_no_mapping(struct devic
 			 */
 			domain_remove_one_dev_info(si_domain, pdev);
 			printk(KERN_INFO "32bit %s uses non-identity mapping\n",
-			       pci_name(pdev));
+				pci_name(pdev));
+			printk(KERN_INFO "IOMMU: Re-processing RMRR information for device %s:\n",
+				pci_name(pdev));
+			for_each_rmrr_units(rmrr) {
+				for (i = 0; i < rmrr->devices_cnt; i++) {
+					/*
+					 * Here we are just concerned with finding the
+					 * one device that was removed from the
+					 * si_domain and re-evaluating its RMRR info.
+					 */
+					if (rmrr->devices[i] != pdev)
+						continue;
+					ret = iommu_prepare_rmrr_dev(rmrr, pdev);
+					if (ret)
+						printk(KERN_ERR
+							"IOMMU: mapping reserved region failed for device.\n");
+				}
+			}
 			return 0;
 		}
 	} else {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Intel IOMMU PATCH] Re-evaluate RMRR info for devices removed from si domain
  2012-02-28 17:58 [Intel IOMMU PATCH] Re-evaluate RMRR info for devices removed from si domain Mingarelli, Thomas
@ 2012-02-28 22:15 ` Chris Wright
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wright @ 2012-02-28 22:15 UTC (permalink / raw)
  To: Mingarelli, Thomas; +Cc: dwmw2, linux-kernel, ddutile, Alex Williamson

* Mingarelli, Thomas (Thomas.Mingarelli@hp.com) wrote:
> This patch is being submitted to handle the case where a pci device is
> placed into the si domain, when booting in iommu passthrough mode, then
> removed. The RMRR information for such devices need to be re-processed
> to avoid DMA Read errors due to the Present Bit being cleared in the
> device's context entry.

What happens if that device is attached to a VM, then detached and
rebound to a host driver?  I suspect the reserved memory range won't get
mapped properly for that device in that case.

thanks,
-chris

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-28 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-28 17:58 [Intel IOMMU PATCH] Re-evaluate RMRR info for devices removed from si domain Mingarelli, Thomas
2012-02-28 22:15 ` Chris Wright

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®