[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 7/8] xen/iommu: smmu: Advertise when the SMMU support coherent table walk



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.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.