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, tim@xen.org
Subject: Re: [PATCH v8 4/4] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m
Date: Tue, 20 May 2014 11:48:51 +0100 [thread overview]
Message-ID: <537B3313.2080604@linaro.org> (raw)
In-Reply-To: <537B24690200007800013EF0@mail.emea.novell.com>
On 05/20/2014 08:46 AM, Jan Beulich wrote:
>> --- a/xen/common/grant_table.c
>> +++ b/xen/common/grant_table.c
>> @@ -727,7 +727,7 @@ __gnttab_map_grant_ref(
>>
>> double_gt_lock(lgt, rgt);
>>
>> - if ( !paging_mode_translate(ld) && need_iommu(ld) )
>> + if ( gnttab_need_iommu_mapping(ld) && need_iommu(ld) )
>
> I suppose that you want to keep the common bits of this condition
> common, but the two "need_iommu" in here look sort of redundant:
> With the name chosen, I think it would make more sense for the
> second condition to be moved into gnttab_need_iommu_mapping().
Ok. I will move these bits in the macro.
>> --- a/xen/include/asm-arm/grant_table.h
>> +++ b/xen/include/asm-arm/grant_table.h
>> @@ -33,6 +33,8 @@ static inline int replace_grant_supported(void)
>> ( ((i >= nr_grant_frames(d->grant_table)) && \
>> (i < max_nr_grant_frames)) ? 0 : (d->arch.grant_table_gpfn[i]))
>>
>> +#define gnttab_need_iommu_mapping(d) is_domain_direct_mapped(d)
>
> While this one indeed doesn't need extra parentheses, ...
>
>> --- a/xen/include/asm-x86/grant_table.h
>> +++ b/xen/include/asm-x86/grant_table.h
>> @@ -65,6 +65,8 @@ static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
>> /* Done implicitly when page tables are destroyed. */
>> #define gnttab_release_host_mappings(domain) ( paging_mode_external(domain) )
>>
>> +#define gnttab_need_iommu_mapping(d) !paging_mode_translate(d)
>
> ... this one does.
Oh right, I will fix it in the next version.
> Also, with all of this I don't see how other than Dom0 is being (or
> going to be) handled in this regard.
Only DOM0 uses direct mapping (i.e 1:1 mapping). The other guests will
use their own mapping. As the P2M is shared, we can't insert this 1:1 entry.
Only protected devices (i.e the IOMMU has been programmed by Xen) will
be passtrough to the guest. So we will be able to modify dev_bus_addr to
return an IPA (guest address) rather than an MFN.
For now, passthrough is not supported, therefore guest doesn't have
DMA-capable device. I will take care of this solution with my non-PCI
passthrough patch series.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-05-20 10:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 16:23 [PATCH v8 0/4] IOMMU support for ARM Julien Grall
2014-05-19 16:23 ` [PATCH v8 1/4] xen/arm: p2m: Clean cache PT when the IOMMU doesn't support coherent walk Julien Grall
2014-05-19 16:23 ` [PATCH v8 2/4] xen: iommu: Define PAGE_{SHIFT, SIZE, ALIGN, MASK)_64K Julien Grall
2014-05-19 16:23 ` [PATCH v8 3/4] drivers/passthrough: arm: Add support for SMMU drivers Julien Grall
2014-05-19 16:24 ` [PATCH v8 4/4] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m Julien Grall
2014-05-20 7:46 ` Jan Beulich
2014-05-20 9:21 ` Ian Campbell
2014-05-20 10:48 ` Julien Grall [this message]
2014-05-21 13:27 ` Ian Campbell
2014-05-21 13:42 ` Julien Grall
2014-05-21 13:50 ` Ian Campbell
2014-05-21 14:01 ` Julien Grall
2014-05-21 14:40 ` Ian Campbell
2014-05-21 13:51 ` Ian Campbell
2014-05-21 13:54 ` Julien Grall
2014-05-21 14:04 ` Ian Campbell
2014-05-21 13:27 ` [PATCH v8 0/4] IOMMU support for ARM Ian Campbell
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=537B3313.2080604@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 \
/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).