WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 4/7] PCI device register/unregister + pci_dev cleanup

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 4/7] PCI device register/unregister + pci_dev cleanups
From: Espen Skoglund <espen.skoglund@xxxxxxxxxxxxx>
Date: Fri, 4 Jul 2008 17:43:24 +0100
Delivery-date: Fri, 04 Jul 2008 09:43:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <18542.20587.995970.962113@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <18542.20587.995970.962113@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Remove PCI device enumaration in VT-d code

Signed-off-by: Espen Skoglund <espen.skoglund@xxxxxxxxxxxxx>


--
 iommu.c |   60 ++++++------------------------------------------------------
 1 file changed, 6 insertions(+), 54 deletions(-)
--
diff -r 82f38dc16ce2 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Thu Jul 03 22:46:26 2008 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c       Fri Jul 04 15:57:53 2008 +0100
@@ -40,9 +40,6 @@
 static spinlock_t domid_bitmap_lock;    /* protect domain id bitmap */
 static int domid_bitmap_size;           /* domain id bitmap size in bits */
 static unsigned long *domid_bitmap;     /* iommu domain id bitmap */
-
-static void setup_dom0_devices(struct domain *d);
-static void setup_dom0_rmrr(struct domain *d);
 
 #define DID_FIELD_WIDTH 16
 #define DID_HIGH_OFFSET 8
@@ -1045,10 +1042,6 @@
 
             iommu_map_page(d, i, i);
         }
-
-        setup_dom0_devices(d);
-        setup_dom0_rmrr(d);
-
         iommu_flush_all();
 
         for_each_drhd_unit ( drhd )
@@ -1333,12 +1326,18 @@
         break;
 
     case DEV_TYPE_PCIe_ENDPOINT:
+        gdprintk(XENLOG_INFO VTDPREFIX, "domain_context_unmap:PCIe: "
+                 "bdf = %x:%x.%x\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = domain_context_unmap_one(drhd->iommu, bus, devfn);
         break;
 
     case DEV_TYPE_PCI:
         if ( find_pcie_endpoint(&bus, &devfn) )
+        {
+            gdprintk(XENLOG_INFO VTDPREFIX, "domain_context_unmap:PCI:  "
+                     "bdf = %x:%x.%x\n", bus, PCI_SLOT(devfn), 
PCI_FUNC(devfn));
             ret = domain_context_unmap_one(drhd->iommu, bus, devfn);
+        }
         break;
 
     default:
@@ -1593,38 +1592,6 @@
     return domain_context_unmap(pdev->bus, pdev->devfn);
 }
 
-static void setup_dom0_devices(struct domain *d)
-{
-    struct hvm_iommu *hd;
-    struct pci_dev *pdev;
-    int bus, dev, func;
-    u32 l;
-
-    hd = domain_hvm_iommu(d);
-
-    write_lock(&pcidevs_lock);
-    for ( bus = 0; bus < 256; bus++ )
-    {
-        for ( dev = 0; dev < 32; dev++ )
-        {
-            for ( func = 0; func < 8; func++ )
-            {
-                l = pci_conf_read32(bus, dev, func, PCI_VENDOR_ID);
-                /* some broken boards return 0 or ~0 if a slot is empty: */
-                if ( (l == 0xffffffff) || (l == 0x00000000) ||
-                     (l == 0x0000ffff) || (l == 0xffff0000) )
-                    continue;
-
-                pdev = alloc_pdev(bus, PCI_DEVFN(dev, func));
-                pdev->domain = d;
-                list_add(&pdev->domain_list, &d->arch.pdev_list);
-                domain_context_mapping(d, pdev->bus, pdev->devfn);
-            }
-        }
-    }
-    write_unlock(&pcidevs_lock);
-}
-
 void clear_fault_bits(struct iommu *iommu)
 {
     u64 val;
@@ -1687,21 +1654,6 @@
     }
 
     return 0;
-}
-
-static void setup_dom0_rmrr(struct domain *d)
-{
-    struct acpi_rmrr_unit *rmrr;
-    u16 bdf;
-    int ret, i;
-
-    for_each_rmrr_device ( rmrr, bdf, i )
-    {
-        ret = iommu_prepare_rmrr_dev(d, rmrr, PCI_BUS(bdf), PCI_DEVFN2(bdf));
-        if ( ret )
-            gdprintk(XENLOG_ERR VTDPREFIX,
-                     "IOMMU: mapping reserved region failed\n");
-    }
 }
 
 int intel_vtd_setup(void)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel