From: Julien Grall <julien.grall@linaro.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@citrix.com,
ian.campbell@citrix.com, Xiantao Zhang <xiantao.zhang@intel.com>,
tim@xen.org
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 10:09:25 +0100 [thread overview]
Message-ID: <537332C5.2010302@linaro.org> (raw)
In-Reply-To: <537334D90200007800012009@mail.emea.novell.com>
Hi Ian,
On 14/05/14 08:18, Jan Beulich wrote:
>> --- a/xen/drivers/passthrough/iommu.c
>> +++ b/xen/drivers/passthrough/iommu.c
>> @@ -344,6 +344,17 @@ void iommu_crash_shutdown(void)
>> iommu_enabled = iommu_intremap = 0;
>> }
>>
>> +bool_t iommu_has_feature(struct domain *d, enum iommu_feature feature)
>> +{
>> + const struct iommu_ops *ops = domain_hvm_iommu(d)->platform_ops;
>> + uint32_t features = 0;
>
> Please here and further down - don't use fixed width type unless
> you really need to.
>
>> --- a/xen/include/xen/iommu.h
>> +++ b/xen/include/xen/iommu.h
>> @@ -67,6 +67,14 @@ int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn,
>> unsigned int flags);
>> int iommu_unmap_page(struct domain *d, unsigned long gfn);
>>
>> +enum iommu_feature
>> +{
>> + IOMMU_FEAT_COHERENT_WALK = 1,
>
> Why 1? Enumerations are defined to start at zero, and starting at
> zero is what you really want here. Don't specify a value at all.
It's a mistake when I create the enum. I will drop the 1.
>> @@ -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.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-05-14 9:09 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 15:50 [PATCH v5 00/14] IOMMU support for ARM Julien Grall
2014-05-13 15:50 ` [PATCH v5 01/14] xen/arm: Introduce flush_tlb_domain Julien Grall
2014-05-14 13:28 ` Ian Campbell
2014-05-14 13:29 ` Julien Grall
2014-05-13 15:50 ` [PATCH v5 02/14] xen/passthrough: amd: Remove domain_id from hvm_iommu Julien Grall
2014-05-13 15:50 ` [PATCH v5 03/14] xen/passthrough: amd: rename iommu_has_feature into amd_iommu_has_feature Julien Grall
2014-05-13 15:50 ` [PATCH v5 04/14] xen/passthrough: vtd: iommu_set_hwdom_mapping is VTD specific Julien Grall
2014-05-13 15:50 ` [PATCH v5 05/14] xen/passthrough: rework hwdom_pvh_reqs to use it also on ARM Julien Grall
2014-05-13 15:50 ` [PATCH v5 06/14] xen/passthrough: iommu: Split generic IOMMU code Julien Grall
2014-05-13 15:50 ` [PATCH v5 07/14] xen/passthrough: iommu: Introduce arch specific code Julien Grall
2014-05-13 15:50 ` [PATCH v5 08/14] xen/passthrough: iommu: Basic support of device tree assignment Julien Grall
2014-05-13 15:50 ` [PATCH v5 09/14] xen/passthrough: Introduce IOMMU ARM architecture Julien Grall
2014-05-13 15:50 ` [PATCH v5 10/14] MAINTAINERS: Add drivers/passthrough/arm Julien Grall
2014-05-13 15:50 ` [PATCH v5 11/14] xen/arm: Don't give IOMMU devices to dom0 when iommu is disabled Julien Grall
2014-05-13 15:50 ` [PATCH v5 12/14] xen/arm: p2m: Clean cache PT when the IOMMU doesn't support coherent walk Julien Grall
2014-05-14 7:18 ` Jan Beulich
2014-05-14 9:09 ` Julien Grall [this message]
2014-05-14 9:25 ` Jan Beulich
2014-05-14 12:45 ` Julien Grall
2014-05-14 13:08 ` Jan Beulich
2014-05-14 13:11 ` Julien Grall
2014-05-14 13:15 ` Jan Beulich
2014-05-14 13:56 ` Julien Grall
2014-05-13 15:50 ` [PATCH v5 13/14] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m Julien Grall
2014-05-13 15:50 ` [PATCH v5 14/14] drivers/passthrough: arm: Add support for SMMU drivers Julien Grall
2014-05-14 7:29 ` Jan Beulich
2014-05-14 12:47 ` Julien Grall
2014-05-14 14:05 ` [PATCH v5 00/14] IOMMU support for ARM Ian Campbell
2014-05-14 14:13 ` Julien Grall
2014-05-14 14:35 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=537332C5.2010302@linaro.org \
--to=julien.grall@linaro.org \
--cc=JBeulich@suse.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xiantao.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).