ia64/xen-unstable

changeset 17978:a3e4840b1584

Remove PCI device enumaration in VT-d code

Signed-off-by: Espen Skoglund <espen.skoglund@netronome.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jul 04 17:55:33 2008 +0100 (2008-07-04)
parents 183ca809e1d7
children 10d5ec48f84c
files xen/drivers/passthrough/vtd/iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Fri Jul 04 17:52:50 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Fri Jul 04 17:55:33 2008 +0100
     1.3 @@ -41,9 +41,6 @@ static spinlock_t domid_bitmap_lock;    
     1.4  static int domid_bitmap_size;           /* domain id bitmap size in bits */
     1.5  static unsigned long *domid_bitmap;     /* iommu domain id bitmap */
     1.6  
     1.7 -static void setup_dom0_devices(struct domain *d);
     1.8 -static void setup_dom0_rmrr(struct domain *d);
     1.9 -
    1.10  #define DID_FIELD_WIDTH 16
    1.11  #define DID_HIGH_OFFSET 8
    1.12  static void context_set_domain_id(struct context_entry *context,
    1.13 @@ -1045,10 +1042,6 @@ static int intel_iommu_domain_init(struc
    1.14  
    1.15              iommu_map_page(d, i, i);
    1.16          }
    1.17 -
    1.18 -        setup_dom0_devices(d);
    1.19 -        setup_dom0_rmrr(d);
    1.20 -
    1.21          iommu_flush_all();
    1.22  
    1.23          for_each_drhd_unit ( drhd )
    1.24 @@ -1333,12 +1326,18 @@ static int domain_context_unmap(u8 bus, 
    1.25          break;
    1.26  
    1.27      case DEV_TYPE_PCIe_ENDPOINT:
    1.28 +        gdprintk(XENLOG_INFO VTDPREFIX, "domain_context_unmap:PCIe: "
    1.29 +                 "bdf = %x:%x.%x\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    1.30          ret = domain_context_unmap_one(drhd->iommu, bus, devfn);
    1.31          break;
    1.32  
    1.33      case DEV_TYPE_PCI:
    1.34          if ( find_pcie_endpoint(&bus, &devfn) )
    1.35 +        {
    1.36 +            gdprintk(XENLOG_INFO VTDPREFIX, "domain_context_unmap:PCI:  "
    1.37 +                     "bdf = %x:%x.%x\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
    1.38              ret = domain_context_unmap_one(drhd->iommu, bus, devfn);
    1.39 +        }
    1.40          break;
    1.41  
    1.42      default:
    1.43 @@ -1593,38 +1592,6 @@ static int intel_iommu_remove_device(str
    1.44      return domain_context_unmap(pdev->bus, pdev->devfn);
    1.45  }
    1.46  
    1.47 -static void setup_dom0_devices(struct domain *d)
    1.48 -{
    1.49 -    struct hvm_iommu *hd;
    1.50 -    struct pci_dev *pdev;
    1.51 -    int bus, dev, func;
    1.52 -    u32 l;
    1.53 -
    1.54 -    hd = domain_hvm_iommu(d);
    1.55 -
    1.56 -    write_lock(&pcidevs_lock);
    1.57 -    for ( bus = 0; bus < 256; bus++ )
    1.58 -    {
    1.59 -        for ( dev = 0; dev < 32; dev++ )
    1.60 -        {
    1.61 -            for ( func = 0; func < 8; func++ )
    1.62 -            {
    1.63 -                l = pci_conf_read32(bus, dev, func, PCI_VENDOR_ID);
    1.64 -                /* some broken boards return 0 or ~0 if a slot is empty: */
    1.65 -                if ( (l == 0xffffffff) || (l == 0x00000000) ||
    1.66 -                     (l == 0x0000ffff) || (l == 0xffff0000) )
    1.67 -                    continue;
    1.68 -
    1.69 -                pdev = alloc_pdev(bus, PCI_DEVFN(dev, func));
    1.70 -                pdev->domain = d;
    1.71 -                list_add(&pdev->domain_list, &d->arch.pdev_list);
    1.72 -                domain_context_mapping(d, pdev->bus, pdev->devfn);
    1.73 -            }
    1.74 -        }
    1.75 -    }
    1.76 -    write_unlock(&pcidevs_lock);
    1.77 -}
    1.78 -
    1.79  void clear_fault_bits(struct iommu *iommu)
    1.80  {
    1.81      u64 val;
    1.82 @@ -1689,21 +1656,6 @@ static int init_vtd_hw(void)
    1.83      return 0;
    1.84  }
    1.85  
    1.86 -static void setup_dom0_rmrr(struct domain *d)
    1.87 -{
    1.88 -    struct acpi_rmrr_unit *rmrr;
    1.89 -    u16 bdf;
    1.90 -    int ret, i;
    1.91 -
    1.92 -    for_each_rmrr_device ( rmrr, bdf, i )
    1.93 -    {
    1.94 -        ret = iommu_prepare_rmrr_dev(d, rmrr, PCI_BUS(bdf), PCI_DEVFN2(bdf));
    1.95 -        if ( ret )
    1.96 -            gdprintk(XENLOG_ERR VTDPREFIX,
    1.97 -                     "IOMMU: mapping reserved region failed\n");
    1.98 -    }
    1.99 -}
   1.100 -
   1.101  int intel_vtd_setup(void)
   1.102  {
   1.103      struct acpi_drhd_unit *drhd;