All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [VTD] Remove PCI device enumeration for dom0 in Xen
@ 2008-10-22  8:59 Han, Weidong
  2008-10-22  9:29 ` Zhao, Yu
  2008-10-22 10:42 ` Keir Fraser
  0 siblings, 2 replies; 10+ messages in thread
From: Han, Weidong @ 2008-10-22  8:59 UTC (permalink / raw)
  To: Keir Fraser, xen-devel; +Cc: Kay, Allen M, Zhao, Yu, espen.skoglund

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

There are already PCI probe and remove callbacks in dom0 (c/s 593 in
linux-2.6.18-xen.hg). So it is not necessary to enumerate devices for
dom0 in Xen.

Espen had a patch (c/s 17975) to do the same thing, but his patch was
reverted in order to allow old dom0 kernels to work with iommu-capable
platforms. Xen 3.3 has been released for a few months, I think it's time
to clean up it. The rebased patch is attached.

Keir, what's your opinion?

Signed-off-by: Espen Skoglund <espen.skoglund@netronome.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>



[-- Attachment #2: remove-dom0-setup.patch --]
[-- Type: application/octet-stream, Size: 2579 bytes --]

diff -r d2f7243fc571 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Oct 21 18:00:21 2008 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Oct 22 16:19:53 2008 +0800
@@ -40,9 +40,6 @@ static spinlock_t domid_bitmap_lock;    
 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
@@ -1038,9 +1035,6 @@ static int intel_iommu_domain_init(struc
                 iommu_map_page(d, (i*tmp+j), (i*tmp+j));
         }
 
-        setup_dom0_devices(d);
-        setup_dom0_rmrr(d);
-
         iommu_flush_all();
 
         for_each_drhd_unit ( drhd )
@@ -1584,38 +1578,6 @@ static int intel_iommu_remove_device(str
     return domain_context_unmap(pdev->domain, 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;
@@ -1680,20 +1642,6 @@ static int init_vtd_hw(void)
     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)
 {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

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

end of thread, other threads:[~2008-10-22 15:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22  8:59 [PATCH] [VTD] Remove PCI device enumeration for dom0 in Xen Han, Weidong
2008-10-22  9:29 ` Zhao, Yu
2008-10-22 10:42 ` Keir Fraser
2008-10-22 12:38   ` Espen Skoglund
2008-10-22 12:43     ` Keir Fraser
2008-10-22 12:57       ` Espen Skoglund
2008-10-22 15:39         ` Yu Zhao
2008-10-22 13:15       ` Han, Weidong
2008-10-22 13:19         ` Espen Skoglund
2008-10-22 13:26           ` Han, Weidong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.