rpms/kernel/F-11 kernel.spec, 1.1603, 1.1604 linux-2.6-iommu-fixes.patch, 1.3, 1.4

Kyle McMartin kyle at fedoraproject.org
Wed May 13 02:23:25 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23458

Modified Files:
	kernel.spec linux-2.6-iommu-fixes.patch 
Log Message:
* Tue May 12 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.3-142
- linux-2.6-iommu-fixes.patch: intel-iommu: fix PCI device detach
    from virtual machine
  3199aa6bc8766e17b8f60820c4f78d59c25fce0e upstream.



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1603
retrieving revision 1.1604
diff -u -p -r1.1603 -r1.1604
--- kernel.spec	12 May 2009 17:43:27 -0000	1.1603
+++ kernel.spec	13 May 2009 02:22:55 -0000	1.1604
@@ -1970,6 +1970,11 @@ fi
 # and build.
 
 %changelog
+* Tue May 12 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.3-142
+- linux-2.6-iommu-fixes.patch: intel-iommu: fix PCI device detach
+    from virtual machine
+  3199aa6bc8766e17b8f60820c4f78d59c25fce0e upstream.
+
 * Tue May 12 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.3-141
 - linux-2.6-iommu-fixes.patch: intel-iommu: PAE memory corruption fix
   fd18de50b9e7965f93d231e7390436fb8900c0e6 upstream. Also, re-cherry-pick

linux-2.6-iommu-fixes.patch:

Index: linux-2.6-iommu-fixes.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/linux-2.6-iommu-fixes.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- linux-2.6-iommu-fixes.patch	12 May 2009 17:43:27 -0000	1.3
+++ linux-2.6-iommu-fixes.patch	13 May 2009 02:22:55 -0000	1.4
@@ -1,3 +1,23 @@
+commit 0717e50c97ae74bc9fda0f07ce4cc6934d69c8e4
+Author: Han, Weidong <weidong.han at intel.com>
+Date:   Thu Feb 26 17:31:12 2009 +0800
+
+    intel-iommu: fix PCI device detach from virtual machine
+    
+    When assign a device behind conventional PCI bridge or PCIe to
+    PCI/PCI-x bridge to a domain, it must assign its bridge and may
+    also need to assign secondary interface to the same domain.
+    
+    Dependent assignment is already there, but dependent
+    deassignment is missed when detach device from virtual machine.
+    This results in conventional PCI device assignment failure after
+    it has been assigned once. This patch addes dependent
+    deassignment, and fixes the issue.
+    
+    Signed-off-by: Weidong Han <weidong.han at intel.com>
+    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
+    (cherry picked from commit 3199aa6bc8766e17b8f60820c4f78d59c25fce0e)
+
 commit bbad20263a1aa62f406847a98706f4509d66062e
 Author: David Woodhouse <dwmw2 at infradead.org>
 Date:   Sun May 10 23:57:41 2009 +0100
@@ -173,13 +193,13 @@ Date:   Mon Mar 16 17:04:54 2009 -0700
     Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
     (cherry picked from commit 0ac2491f57af5644f88383d28809760902d6f4d7)
 
- drivers/pci/dmar.c           |  311 ++++++++++++++++++++++++++++++++++-
- drivers/pci/intel-iommu.c    |  376 +++++++++++++++++++++----------------------
- drivers/pci/intr_remapping.c |   44 +++++
+ drivers/pci/dmar.c           |  311 +++++++++++++++++++++++++++++++--
+ drivers/pci/intel-iommu.c    |  405 ++++++++++++++++++++++---------------------
+ drivers/pci/intr_remapping.c |   44 ++++
  include/linux/compiler.h     |    4 
  include/linux/dmar.h         |   10 +
  include/linux/intel-iommu.h  |   12 +
- 6 files changed, 552 insertions(+), 205 deletions(-)
+ 6 files changed, 581 insertions(+), 205 deletions(-)
 
 diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
 index 8a01120..8734b14 100644
@@ -527,7 +547,7 @@ index 8a01120..8734b14 100644
  	return 0;
  }
 diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
-index 7e4f9e6..5b681b7 100644
+index 7e4f9e6..52af2a3 100644
 --- a/drivers/pci/intel-iommu.c
 +++ b/drivers/pci/intel-iommu.c
 @@ -36,6 +36,7 @@
@@ -760,11 +780,11 @@ index 7e4f9e6..5b681b7 100644
 +	/*
 +	 * Start from the sane iommu hardware state.
 +	 */
-+	for_each_drhd_unit(drhd) {
-+		if (drhd->ignored)
-+			continue;
-+
-+		iommu = drhd->iommu;
+ 	for_each_drhd_unit(drhd) {
+ 		if (drhd->ignored)
+ 			continue;
+ 
+ 		iommu = drhd->iommu;
 +
 +		/*
 +		 * If the queued invalidation is already initialized by us
@@ -785,11 +805,11 @@ index 7e4f9e6..5b681b7 100644
 +		dmar_disable_qi(iommu);
 +	}
 +
- 	for_each_drhd_unit(drhd) {
- 		if (drhd->ignored)
- 			continue;
- 
- 		iommu = drhd->iommu;
++	for_each_drhd_unit(drhd) {
++		if (drhd->ignored)
++			continue;
++
++		iommu = drhd->iommu;
 +
  		if (dmar_enable_qi(iommu)) {
  			/*
@@ -974,6 +994,56 @@ index 7e4f9e6..5b681b7 100644
  
  	register_iommu(&intel_iommu_ops);
  
+@@ -2778,6 +2770,33 @@ static int vm_domain_add_dev_info(struct dmar_domain *domain,
+ 	return 0;
+ }
+ 
++static void iommu_detach_dependent_devices(struct intel_iommu *iommu,
++					   struct pci_dev *pdev)
++{
++	struct pci_dev *tmp, *parent;
++
++	if (!iommu || !pdev)
++		return;
++
++	/* dependent device detach */
++	tmp = pci_find_upstream_pcie_bridge(pdev);
++	/* Secondary interface's bus number and devfn 0 */
++	if (tmp) {
++		parent = pdev->bus->self;
++		while (parent != tmp) {
++			iommu_detach_dev(iommu, parent->bus->number,
++				parent->devfn);
++			parent = parent->bus->self;
++		}
++		if (tmp->is_pcie) /* this is a PCIE-to-PCI bridge */
++			iommu_detach_dev(iommu,
++				tmp->subordinate->number, 0);
++		else /* this is a legacy PCI bridge */
++			iommu_detach_dev(iommu,
++				tmp->bus->number, tmp->devfn);
++	}
++}
++
+ static void vm_domain_remove_one_dev_info(struct dmar_domain *domain,
+ 					  struct pci_dev *pdev)
+ {
+@@ -2803,6 +2822,7 @@ static void vm_domain_remove_one_dev_info(struct dmar_domain *domain,
+ 			spin_unlock_irqrestore(&device_domain_lock, flags);
+ 
+ 			iommu_detach_dev(iommu, info->bus, info->devfn);
++			iommu_detach_dependent_devices(iommu, pdev);
+ 			free_devinfo_mem(info);
+ 
+ 			spin_lock_irqsave(&device_domain_lock, flags);
+@@ -2852,6 +2872,7 @@ static void vm_domain_remove_all_dev_info(struct dmar_domain *domain)
+ 
+ 		iommu = device_to_iommu(info->bus, info->devfn);
+ 		iommu_detach_dev(iommu, info->bus, info->devfn);
++		iommu_detach_dependent_devices(iommu, info->dev);
+ 
+ 		/* clear this iommu in iommu_bmp, update iommu count
+ 		 * and coherency
 diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
 index 45effc5..0a490fe 100644
 --- a/drivers/pci/intr_remapping.c




More information about the scm-commits mailing list