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

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



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

_______________________________________________
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®.