diff --git a/vtd-check-secbus-devfn.patch b/vtd-check-secbus-devfn.patch new file mode 100644 index 0000000..7fc6d10 --- /dev/null +++ b/vtd-check-secbus-devfn.patch @@ -0,0 +1,43 @@ +If the device at :00.0 is the device the mapping operation was +initiated for, trying to map it a second time will fail, and hence +this second mapping attempt must be prevented (as was done prior to +said c/s). + +Once at it, simplify the code a little, too. + +Signed-off-by: Jan Beulich + +--- a/xen/drivers/passthrough/vtd/iommu.c ++++ b/xen/drivers/passthrough/vtd/iommu.c +@@ -1371,23 +1371,16 @@ static int domain_context_mapping(struct + if ( find_upstream_bridge(&bus, &devfn, &secbus) < 1 ) + break; + +- /* PCIe to PCI/PCIx bridge */ +- if ( pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE ) +- { +- ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn); +- if ( ret ) +- return ret; ++ ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn); + +- /* +- * Devices behind PCIe-to-PCI/PCIx bridge may generate +- * different requester-id. It may originate from devfn=0 +- * on the secondary bus behind the bridge. Map that id +- * as well. +- */ ++ /* ++ * Devices behind PCIe-to-PCI/PCIx bridge may generate different ++ * requester-id. It may originate from devfn=0 on the secondary bus ++ * behind the bridge. Map that id as well if we didn't already. ++ */ ++ if ( !ret && pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE && ++ (secbus != pdev->bus || pdev->devfn != 0) ) + ret = domain_context_mapping_one(domain, drhd->iommu, secbus, 0); +- } +- else /* Legacy PCI bridge */ +- ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn); + + break; + diff --git a/xen.spec b/xen.spec index c7cabb9..8fce34d 100644 --- a/xen.spec +++ b/xen.spec @@ -275,6 +275,9 @@ Patch10021: xenpaging.mem_event_check_ring-free_requests.patch Patch10022: xenpaging.blacklist.patch Patch10023: xenpaging.autostart_delay.patch Patch10040: xenpaging.doc.patch + +# Other patches +Patch11001: vtd-check-secbus-devfn.patch Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/ BuildRoot: %{_tmppath}/%{name}-%{version}-build #%define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()") @@ -770,6 +773,7 @@ Authors: %patch10022 -p1 %patch10023 -p1 %patch10040 -p1 +%patch11001 -p1 %build XEN_EXTRAVERSION=%version-%release