[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v9 2/2] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m



>>> On 27.05.14 at 13:11, <julien.grall@xxxxxxxxxx> 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@xxxxxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.