From: David Woodhouse Subject: Re: [PATCH v5 6/6] VT-d: support the device IOTLB Date: Sun, 09 Aug 2009 11:28:20 +0100 Message-ID: <1249813700.4919.91.camel@macbook.infradead.org> References: <1242625897-1678-1-git-send-email-yu.zhao@intel.com> <1242625897-1678-7-git-send-email-yu.zhao@intel.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, jbarnes@virtuousgeek.org To: Yu Zhao Return-path: In-Reply-To: <1242625897-1678-7-git-send-email-yu.zhao@intel.com> Sender: linux-pci-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Mon, 2009-05-18 at 13:51 +0800, Yu Zhao wrote: > > +static struct device_domain_info *iommu_support_dev_iotlb( > + struct dmar_domain *domain, int segment, u8 bus, u8 devfn) > +{ > + int found = 0; > + unsigned long flags; > + struct device_domain_info *info; > + struct intel_iommu *iommu = device_to_iommu(segment, bus, > devfn); > + > + if (!ecap_dev_iotlb_support(iommu->ecap)) > + return NULL; > + > + if (!iommu->qi) > + return NULL; > + > + spin_lock_irqsave(&device_domain_lock, flags); > + list_for_each_entry(info, &domain->devices, link) > + if (info->bus == bus && info->devfn == devfn) { > + found = 1; > + break; > + } > + spin_unlock_irqrestore(&device_domain_lock, flags); What if there's more than one device? You only enable ATS for the first device that supports it, and ignore the others? -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation