From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753135AbbHEPVo (ORCPT ); Wed, 5 Aug 2015 11:21:44 -0400 Received: from 8bytes.org ([81.169.241.247]:43130 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397AbbHEPTZ (ORCPT ); Wed, 5 Aug 2015 11:19:25 -0400 From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: David Woodhouse , Alex Williamson , linux-kernel@vger.kernel.org, Joerg Roedel , jroedel@suse.de Subject: [PATCH 25/26] iommu/vt-d: Only insert alias dev_info if there is an alias Date: Wed, 5 Aug 2015 17:18:56 +0200 Message-Id: <1438787937-7340-26-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438787937-7340-1-git-send-email-joro@8bytes.org> References: <1438787937-7340-1-git-send-email-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel For devices without an PCI alias there will be two device_domain_info structures added. Prevent that by checking if the alias is different from the device. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 31efb9c..3882072 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -2318,8 +2318,8 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) struct device_domain_info *info = NULL; struct dmar_domain *domain, *tmp; struct intel_iommu *iommu; + u16 req_id, dma_alias; unsigned long flags; - u16 dma_alias; u8 bus, devfn; domain = find_domain(dev); @@ -2330,6 +2330,8 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) if (!iommu) return NULL; + req_id = ((u16)bus << 8) | devfn; + if (dev_is_pci(dev)) { struct pci_dev *pdev = to_pci_dev(dev); @@ -2360,7 +2362,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) } /* register PCI DMA alias device */ - if (dev_is_pci(dev)) { + if (req_id != dma_alias && dev_is_pci(dev)) { tmp = dmar_insert_one_dev_info(iommu, PCI_BUS_NUM(dma_alias), dma_alias & 0xff, NULL, domain); -- 1.9.1