struct device_domain_info {
struct list_head link; /* link to domain siblings */
struct list_head global; /* link to global list */
- int segment; /* PCI domain */
u8 bus; /* PCI bus number */
u8 devfn; /* PCI devfn number */
struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
struct device_domain_info *info;
list_for_each_entry(info, &device_domain_list, global)
- if (info->segment == segment && info->bus == bus &&
+ if (info->iommu->segment == segment && info->bus == bus &&
info->devfn == devfn)
return info;
}
static struct dmar_domain *dmar_insert_dev_info(struct intel_iommu *iommu,
- int segment, int bus, int devfn,
+ int bus, int devfn,
struct device *dev,
struct dmar_domain *domain)
{
if (!info)
return NULL;
- info->segment = segment;
info->bus = bus;
info->devfn = devfn;
info->dev = dev;
found = find_domain(dev);
else {
struct device_domain_info *info2;
- info2 = dmar_search_domain_by_dev_info(segment, bus, devfn);
+ info2 = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
if (info2)
found = info2->domain;
}
/* register pcie-to-pci device */
if (dev_tmp) {
- domain = dmar_insert_dev_info(iommu, segment, bus, devfn, NULL,
+ domain = dmar_insert_dev_info(iommu, bus, devfn, NULL,
domain);
if (!domain)
goto error;
}
found_domain:
- domain = dmar_insert_dev_info(iommu, segment, pdev->bus->number,
+ domain = dmar_insert_dev_info(iommu, pdev->bus->number,
pdev->devfn, &pdev->dev, domain);
error:
if (free != domain)
if (!iommu)
return -ENODEV;
- ndomain = dmar_insert_dev_info(iommu, pci_domain_nr(pdev->bus),
- pdev->bus->number, pdev->devfn,
+ ndomain = dmar_insert_dev_info(iommu, pdev->bus->number, pdev->devfn,
&pdev->dev, domain);
if (ndomain != domain)
return -EBUSY;
spin_lock_irqsave(&device_domain_lock, flags);
list_for_each_entry_safe(info, tmp, &domain->devices, link) {
- if (info->segment == pci_domain_nr(pdev->bus) &&
+ if (info->iommu->segment == pci_domain_nr(pdev->bus) &&
info->bus == pdev->bus->number &&
info->devfn == pdev->devfn) {
unlink_domain_info(info);