[xen-unstable] vtd: Remove dead code.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen-unstable] vtd: Remove dead code.

Xen patchbot-unstable
# HG changeset patch
# User Keir Fraser <[hidden email]>
# Date 1212067848 -3600
# Node ID 121d196b4cc85222dccbd947b372a8c2d218035c
# Parent  6f48c4ee8ae231715a302af7cc98fd902adeb92c
vtd: Remove dead code.
Signed-off-by: Keir Fraser <[hidden email]>
---
 xen/drivers/passthrough/vtd/dmar.c    |   33 ------
 xen/drivers/passthrough/vtd/dmar.h    |    1
 xen/drivers/passthrough/vtd/x86/vtd.c |  178 ----------------------------------
 xen/include/xen/iommu.h               |    2
 4 files changed, 214 deletions(-)

diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c Thu May 29 13:38:31 2008 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c Thu May 29 14:30:48 2008 +0100
@@ -147,39 +147,6 @@ struct acpi_drhd_unit * acpi_find_matche
     return NULL;
 }
 
-struct acpi_rmrr_unit * acpi_find_matched_rmrr_unit(struct pci_dev *dev)
-{
-    struct acpi_rmrr_unit *rmrr;
-
-    list_for_each_entry ( rmrr, &acpi_rmrr_units, list )
-        if ( acpi_pci_device_match(rmrr->devices,
-                                   rmrr->devices_cnt, dev) )
-            return rmrr;
-
-    return NULL;
-}
-
-struct acpi_atsr_unit * acpi_find_matched_atsr_unit(struct pci_dev *dev)
-{
-    struct acpi_atsr_unit *atsru;
-    struct acpi_atsr_unit *all_ports_atsru;
-
-    all_ports_atsru = NULL;
-    list_for_each_entry ( atsru, &acpi_atsr_units, list )
-    {
-        if ( atsru->all_ports )
-            all_ports_atsru = atsru;
-        if ( acpi_pci_device_match(atsru->devices,
-                                   atsru->devices_cnt, dev) )
-            return atsru;
-    }
-
-    if ( all_ports_atsru )
-        return all_ports_atsru;;
-
-    return NULL;
-}
-
 static int scope_device_count(void *start, void *end)
 {
     struct acpi_dev_scope *scope;
diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/drivers/passthrough/vtd/dmar.h
--- a/xen/drivers/passthrough/vtd/dmar.h Thu May 29 13:38:31 2008 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.h Thu May 29 14:30:48 2008 +0100
@@ -86,7 +86,6 @@ struct acpi_atsr_unit {
     }
 
 struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *dev);
-struct acpi_rmrr_unit * acpi_find_matched_rmrr_unit(struct pci_dev *dev);
 
 #define DMAR_TYPE 1
 #define RMRR_TYPE 2
diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/drivers/passthrough/vtd/x86/vtd.c
--- a/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 29 13:38:31 2008 +0100
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 29 14:30:48 2008 +0100
@@ -123,181 +123,3 @@ void hvm_dpci_isairq_eoi(struct domain *
         }
     }
 }
-
-void iommu_set_pgd(struct domain *d)
-{
-    struct hvm_iommu *hd  = domain_hvm_iommu(d);
-    unsigned long p2m_table;
-
-    p2m_table = mfn_x(pagetable_get_mfn(d->arch.phys_table));
-
-    if ( paging_mode_hap(d) )
-    {
-        int level = agaw_to_level(hd->agaw);
-        struct dma_pte *dpte = NULL;
-        mfn_t pgd_mfn;
-
-        switch ( level )
-        {
-        case VTD_PAGE_TABLE_LEVEL_3:
-            dpte = map_domain_page(p2m_table);
-            if ( !dma_pte_present(*dpte) )
-            {
-                gdprintk(XENLOG_ERR VTDPREFIX,
-                         "iommu_set_pgd: second level wasn't there\n");
-                unmap_domain_page(dpte);
-                return;
-            }
-            pgd_mfn = _mfn(dma_pte_addr(*dpte) >> PAGE_SHIFT_4K);
-            hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K;
-            unmap_domain_page(dpte);
-            break;
-        case VTD_PAGE_TABLE_LEVEL_4:
-            pgd_mfn = _mfn(p2m_table);
-            hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K;
-            break;
-        default:
-            gdprintk(XENLOG_ERR VTDPREFIX,
-                     "iommu_set_pgd:Unsupported p2m table sharing level!\n");
-            break;
-        }
-    }
-    else
-    {
-#if CONFIG_PAGING_LEVELS == 3
-        struct dma_pte *pte = NULL, *pgd_vaddr = NULL, *pmd_vaddr = NULL;
-        int i;
-        u64 pmd_maddr;
-        unsigned long flags;
-        l3_pgentry_t *l3e;
-        int level = agaw_to_level(hd->agaw);
-
-        spin_lock_irqsave(&hd->mapping_lock, flags);
-        hd->pgd_maddr = alloc_pgtable_maddr();
-        if ( hd->pgd_maddr == 0 )
-        {
-            spin_unlock_irqrestore(&hd->mapping_lock, flags);
-            gdprintk(XENLOG_ERR VTDPREFIX,
-                     "Allocate pgd memory failed!\n");
-            return;
-        }
-
-        pgd_vaddr = map_vtd_domain_page(hd->pgd_maddr);
-        l3e = map_domain_page(p2m_table);
-        switch ( level )
-        {
-        case VTD_PAGE_TABLE_LEVEL_3:        /* Weybridge */
-            /* We only support 8 entries for the PAE L3 p2m table */
-            for ( i = 0; i < 8 ; i++ )
-            {
-                /* Don't create new L2 entry, use ones from p2m table */
-                pgd_vaddr[i].val = l3e[i].l3 | _PAGE_PRESENT | _PAGE_RW;
-            }
-            break;
-
-        case VTD_PAGE_TABLE_LEVEL_4:        /* Stoakley */
-            /* We allocate one more page for the top vtd page table. */
-            pmd_maddr = alloc_pgtable_maddr();
-            if ( pmd_maddr == 0 )
-            {
-                unmap_vtd_domain_page(pgd_vaddr);
-                unmap_domain_page(l3e);
-                spin_unlock_irqrestore(&hd->mapping_lock, flags);
-                gdprintk(XENLOG_ERR VTDPREFIX,
-                         "Allocate pmd memory failed!\n");
-                return;
-            }
-
-            pte = &pgd_vaddr[0];
-            dma_set_pte_addr(*pte, pmd_maddr);
-            dma_set_pte_readable(*pte);
-            dma_set_pte_writable(*pte);
-
-            pmd_vaddr = map_vtd_domain_page(pmd_maddr);
-            for ( i = 0; i < 8; i++ )
-            {
-                /* Don't create new L2 entry, use ones from p2m table */
-                pmd_vaddr[i].val = l3e[i].l3 | _PAGE_PRESENT | _PAGE_RW;
-            }
-
-            unmap_vtd_domain_page(pmd_vaddr);
-            break;
-        default:
-            gdprintk(XENLOG_ERR VTDPREFIX,
-                     "iommu_set_pgd:Unsupported p2m table sharing level!\n");
-            break;
-        }
-
-        unmap_vtd_domain_page(pgd_vaddr);
-        unmap_domain_page(l3e);
-        spin_unlock_irqrestore(&hd->mapping_lock, flags);
-
-#elif CONFIG_PAGING_LEVELS == 4
-        mfn_t pgd_mfn;
-        l3_pgentry_t *l3e;
-        int level = agaw_to_level(hd->agaw);
-
-        switch ( level )
-        {
-        case VTD_PAGE_TABLE_LEVEL_3:
-            l3e = map_domain_page(p2m_table);
-            if ( (l3e_get_flags(*l3e) & _PAGE_PRESENT) == 0 )
-            {
-                gdprintk(XENLOG_ERR VTDPREFIX,
-                         "iommu_set_pgd: second level wasn't there\n");
-                unmap_domain_page(l3e);
-                return;
-            }
-
-            pgd_mfn = _mfn(l3e_get_pfn(*l3e));
-            hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K;
-            unmap_domain_page(l3e);
-            break;
-        case VTD_PAGE_TABLE_LEVEL_4:
-            pgd_mfn = _mfn(p2m_table);
-            hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K;
-            break;
-        default:
-            gdprintk(XENLOG_ERR VTDPREFIX,
-                     "iommu_set_pgd:Unsupported p2m table sharing level!\n");
-            break;
-        }
-#endif
-    }
-}
-
-void iommu_free_pgd(struct domain *d)
-{
-#if CONFIG_PAGING_LEVELS == 3
-    struct hvm_iommu *hd  = domain_hvm_iommu(d);
-    int level = agaw_to_level(hd->agaw);
-    struct dma_pte *pgd_vaddr = NULL;
-
-    switch ( level )
-    {
-    case VTD_PAGE_TABLE_LEVEL_3:
-        if ( hd->pgd_maddr != 0 )
-        {
-            free_pgtable_maddr(hd->pgd_maddr);
-            hd->pgd_maddr = 0;
-        }
-        break;
-    case VTD_PAGE_TABLE_LEVEL_4:
-        if ( hd->pgd_maddr != 0 )
-        {
-            pgd_vaddr = (struct dma_pte*)map_vtd_domain_page(hd->pgd_maddr);
-            if ( pgd_vaddr[0].val != 0 )
-                free_pgtable_maddr(pgd_vaddr[0].val);
-            unmap_vtd_domain_page(pgd_vaddr);
-            free_pgtable_maddr(hd->pgd_maddr);
-            hd->pgd_maddr = 0;
-        }
-        break;
-    default:
-        gdprintk(XENLOG_ERR VTDPREFIX,
-                 "Unsupported p2m table sharing level!\n");
-        break;
-    }
-#endif
-}
-
diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h Thu May 29 13:38:31 2008 +0100
+++ b/xen/include/xen/iommu.h Thu May 29 14:30:48 2008 +0100
@@ -68,8 +68,6 @@ void reassign_device_ownership(struct do
                                u8 bus, u8 devfn);
 int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn);
 int iommu_unmap_page(struct domain *d, unsigned long gfn);
-void iommu_set_pgd(struct domain *d);
-void iommu_free_pgd(struct domain *d);
 void iommu_domain_teardown(struct domain *d);
 int hvm_do_IRQ_dpci(struct domain *d, unsigned int irq);
 int dpci_ioport_intercept(ioreq_t *p);

_______________________________________________
Xen-changelog mailing list
[hidden email]
http://lists.xensource.com/xen-changelog