From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752340AbbHGLHz (ORCPT ); Fri, 7 Aug 2015 07:07:55 -0400 Received: from 8bytes.org ([81.169.241.247]:58153 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbbHGLHD (ORCPT ); Fri, 7 Aug 2015 07:07:03 -0400 Date: Fri, 7 Aug 2015 13:07:01 +0200 From: Joerg Roedel To: Alex Williamson Cc: iommu@lists.linux-foundation.org, David Woodhouse , linux-kernel@vger.kernel.org, jroedel@suse.de Subject: Re: [PATCH 01/26] iommu/vt-d: Keep track of per-iommu domain ids Message-ID: <20150807110700.GX14980@8bytes.org> References: <1438787937-7340-1-git-send-email-joro@8bytes.org> <1438787937-7340-2-git-send-email-joro@8bytes.org> <1438888792.4023.118.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438888792.4023.118.camel@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2015 at 01:19:52PM -0600, Alex Williamson wrote: > On Wed, 2015-08-05 at 17:18 +0200, Joerg Roedel wrote: > > From: Joerg Roedel > > > > Instead of searching in the domain array for already > > allocated domain ids, keep track of them explicitly. > > > > Signed-off-by: Joerg Roedel > > --- > > drivers/iommu/intel-iommu.c | 51 +++++++++++++++++++++++---------------------- > > 1 file changed, 26 insertions(+), 25 deletions(-) > > > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > > index 0649b94..c3c5167 100644 > > --- a/drivers/iommu/intel-iommu.c > > +++ b/drivers/iommu/intel-iommu.c > > @@ -378,6 +378,9 @@ struct dmar_domain { > > DECLARE_BITMAP(iommu_bmp, DMAR_UNITS_SUPPORTED); > > /* bitmap of iommus this domain uses*/ > > > > + u16 iommu_did[DMAR_UNITS_SUPPORTED]; > > + /* Domain ids per IOMMU */ > > Maybe a spec reference here to justify u16 that the 2.3 vt-d spec only > supports up to 16bit domain IDs. Makes sense, I added a reference to the VT-d spec, section 9.3. > > + num = domain->iommu_did[iommu->seq_id]; > > + > > + WARN_ON(num == 0); > > Return -ENODEV and let the caller decide if that's an error? Then we > could safely call this over all all iommus. Changed that too, but not -ENODEV but just a plain return. The callers do not care about errors anyway. Joerg