xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Julien Grall <julien.grall@linaro.org>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@citrix.com,
	ian.campbell@citrix.com, tim@xen.org
Subject: Re: [PATCH v9 2/2] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m
Date: Tue, 27 May 2014 14:51:08 +0100	[thread overview]
Message-ID: <5384B46C0200007800015FDD@mail.emea.novell.com> (raw)
In-Reply-To: <1401189101-13211-3-git-send-email-julien.grall@linaro.org>

>>> On 27.05.14 at 13:11, <julien.grall@linaro.org> wrote:
> Grant mappings can be used for DMA requests. Currently the dev_bus_addr 
> returned
> by the hypercall is the MFN (not the IPA). Guest expects to be able the 
> returned
> address for DMA. When the device is protected by IOMMU the request will 
> fail.
> Therefore, we have to add 1:1 mapping in the domain p2m to allow DMA request
> to work.
> 
> This is valid because DOM0 has its memory mapped 1:1 and therefore we know
> that RAM and devices cannot clash.
> 
> If the guest only owns protected device, the return dev_bus_addr should be 
> an
> IPA. This will allow us to remove safely the 1:1 mapping and make grant 
> mapping
> works correctly in the guest. For now, this is not addressed by this patch.
> 
> The grant mapping code does the reference counting on every MFN and will
> call iommu_{map,unmap}_page when necessary. This was already handle for x86
> PV guests, so we can reuse the same code path for ARM guest.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Jan Beulich <jbeulich@suse.com>
on the common and x86 changes, provided you change ...

> --- a/xen/include/asm-arm/grant_table.h
> +++ b/xen/include/asm-arm/grant_table.h
> @@ -33,6 +33,9 @@ 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) && need_iommu(ld))

... from "ld" to "d" here and ...

> --- a/xen/include/asm-x86/grant_table.h
> +++ b/xen/include/asm-x86/grant_table.h
> @@ -65,6 +65,9 @@ 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) && need_iommu(ld))

... here.

Jan

  reply	other threads:[~2014-05-27 13:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 11:11 [PATCH v9 0/2] xen/arm: Add SMMU drivers Julien Grall
2014-05-27 11:11 ` [PATCH v9 1/2] drivers/passthrough: arm: Add support for " Julien Grall
2014-05-27 11:11 ` [PATCH v9 2/2] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m Julien Grall
2014-05-27 13:51   ` Jan Beulich [this message]
2014-06-02 15:45     ` Ian Campbell
2014-06-02 16:05       ` Ian Campbell
  -- strict thread matches above, loose matches on Subject: below --
2014-05-28 13:31 [PATCH v9 0/2] xen/arm: Add SMMU drivers Julien Grall
2014-05-28 13:31 ` [PATCH v9 2/2] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m Julien Grall

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=5384B46C0200007800015FDD@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --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).