From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v5 12/14] xen/arm: p2m: Clean cache PT when the IOMMU doesn't support coherent walk Date: Wed, 14 May 2014 13:45:00 +0100 Message-ID: <5373654C.6010206@linaro.org> References: <1399996230-18201-1-git-send-email-julien.grall@linaro.org> <1399996230-18201-13-git-send-email-julien.grall@linaro.org> <537334D90200007800012009@mail.emea.novell.com> <537332C5.2010302@linaro.org> <5373529002000078000120B9@mail.emea.novell.com> 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 1WkYYU-0001CR-Tr for xen-devel@lists.xenproject.org; Wed, 14 May 2014 12:45:07 +0000 Received: by mail-ee0-f53.google.com with SMTP id c13so1321838eek.26 for ; Wed, 14 May 2014 05:45:04 -0700 (PDT) In-Reply-To: <5373529002000078000120B9@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel@lists.xenproject.org, stefano.stabellini@citrix.com, ian.campbell@citrix.com, Xiantao Zhang , tim@xen.org List-Id: xen-devel@lists.xenproject.org On 05/14/2014 10:25 AM, Jan Beulich wrote: >>>> On 14.05.14 at 11:09, wrote: >>>> @@ -139,6 +147,7 @@ struct iommu_ops { >>>> void (*iotlb_flush)(struct domain *d, unsigned long gfn, unsigned int page_count); >>>> void (*iotlb_flush_all)(struct domain *d); >>>> void (*dump_p2m_table)(struct domain *d); >>>> + uint32_t (*features)(struct domain *d); >>> >>> I think I said this on an earlier round already - for future extensibility >>> this should return "const unsigned long *", and get accessed by the >>> wrapper function using test_bit(). Or even better without an accessor >>> function at all, just directly having a "const unsigned long *" field here. >>> Unless of course the backend implementation - which isn't part of this >>> patch - would have difficulty setting up a suitable bitfield during (early) >>> initialization. >> >> The SMMU drivers handle multiple SMMUs. Each SMMU can have different >> specifications (e.g coherent walk support or not). >> >> As each domain doesn't use all SMMUs, we might be able to avoid flushing >> PT on some of them. That's why I've choose to use a callback with the >> domain in parameter. >> >> I don't like the solution which return "unsigned long *" because we are >> assuming the driver will always a valid pointer (for instance with 2 >> unsigned long), even if he doesn't need it. > > In that case simply make this a bitmap embedded in struct iommu_ops, > which the driver has to populate suitably early. That way the individual > drivers don't need to care about the eventually growing size. That doesn't really help me. Because a same platform can have a mix of SMMU support coherent walk or not. For optimization it would be better to have a per-domain feature. What about creating a callback: iommu_has_feature(struct domain *d, enum iommu_feature) and let the driver handling the feature? Regards, -- Julien Grall