From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v4 7/8] xen/iommu: smmu: Advertise when the SMMU support coherent table walk Date: Mon, 2 Mar 2015 16:24:07 +0000 Message-ID: <1425313447.24959.1.camel@citrix.com> References: <1424890381-4225-1-git-send-email-julien.grall@linaro.org> <1424890381-4225-8-git-send-email-julien.grall@linaro.org> <1425301809.21151.9.camel@citrix.com> <54F48059.6000604@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YST8k-0003Wu-DH for xen-devel@lists.xenproject.org; Mon, 02 Mar 2015 16:24:18 +0000 In-Reply-To: <54F48059.6000604@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: xen-devel@lists.xenproject.org, manish.jaggi@caviumnetworks.com, stefano.stabellini@citrix.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2015-03-02 at 15:23 +0000, Julien Grall wrote: > >> + /* Find the last SMMU added and retrieve its features. */ > > > > This comment no longer applies, I think? > > I think it's useful to have a comment explaining why we are retrieving > the SMMU. Sorry, I initially misread things and thought this was processing all smmus. > > >> + spin_lock(&arm_smmu_devices_lock); > >> + list_for_each_entry(smmu, &arm_smmu_devices, list) { > >> + if (smmu->dev == &dev->dev) > >> + goto found; > > > > Please try and avoid goto. In this case I think > > { > > platform_features &= smmu->features; > > break; > > } > > I though about this solution but it doesn't say if for some reason we > miss to find the SMMU. I think that's fine in this context. If it isn't on the list at this point it might as well not exist and/or there would have been an error somewhere else already. > > > > within the if would be fine, combined with dropping the following BUG(). > > > > Alternatively you might prefer to provide a helper function to lookup an > > smmu by &dev->dev. > > I would like to keep the BUG(). Because this would be a mistake to not > find the last SMMU added. Sounds more like an ASSERT to me. > I will move to an helper function. Sure.