Skip to content

Commit

Permalink
iommu/vt-d: Remove segment from struct device_domain_info()
Browse files Browse the repository at this point in the history
It's accessible via info->iommu->segment so this is redundant.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Mar 24, 2014
1 parent 67ccac4 commit 41e80dc
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ struct dmar_domain {
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 */
Expand Down Expand Up @@ -2136,15 +2135,15 @@ dmar_search_domain_by_dev_info(int segment, int bus, int devfn)
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;

return NULL;
}

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)
{
Expand All @@ -2156,7 +2155,6 @@ static struct dmar_domain *dmar_insert_dev_info(struct intel_iommu *iommu,
if (!info)
return NULL;

info->segment = segment;
info->bus = bus;
info->devfn = devfn;
info->dev = dev;
Expand All @@ -2170,7 +2168,7 @@ static struct dmar_domain *dmar_insert_dev_info(struct intel_iommu *iommu,
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;
}
Expand Down Expand Up @@ -2250,14 +2248,14 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)

/* 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)
Expand Down Expand Up @@ -2468,8 +2466,7 @@ static int domain_add_dev_info(struct dmar_domain *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;
Expand Down Expand Up @@ -4031,7 +4028,7 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,

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);
Expand Down

0 comments on commit 41e80dc

Please sign in to comment.