From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH v4 18/21] xen/arm: p2m: Clean cache PT when the IOMMU doesn't support coherent walk Date: Tue, 29 Apr 2014 08:40:44 +0100 Message-ID: <535F739C020000780000D318@nat28.tlf.novell.com> References: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> <1398172475-27873-19-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wf2en-0001Mx-Lz for xen-devel@lists.xenproject.org; Tue, 29 Apr 2014 07:40:49 +0000 In-Reply-To: <1398172475-27873-19-git-send-email-julien.grall@linaro.org> Content-Disposition: inline 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, stefano.stabellini@citrix.com, ian.campbell@citrix.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org >>> On 22.04.14 at 15:14, wrote: > +bool_t iommu_has_feature(struct domain *d, uint32_t feature) > +{ > + const struct iommu_ops *ops = domain_hvm_iommu(d)->platform_ops; > + uint32_t features = 0; > + > + if ( iommu_enabled && ops && ops->features ) > + features = ops->features(d); > + > + return !!(features & feature); > +} That's slightly strange a feature check: Passing in a bit mask allows the caller to set more than one bit, with obvious ambiguity in what this would mean. I'd suggest making this a bit position (with individual bits defined via enumeration), at once hiding from the generic caller whether eventually there might be more than 32 features defined. Jan