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

Re: [Xen-devel] [PATCH v02 1/7] arm: introduce remoteprocessor iommu module



Hi

On Thu, Jul 31, 2014 at 3:11 PM, Julien Grall <julien.grall@xxxxxxxxxx> wrote:
> On 07/31/2014 12:59 PM, Andrii Tseglytskyi wrote:
>> Hi Julien,
>
> Hi Andrii,
>
>
>> Could you please clarify:
>>
>>>
>>>>> +    /* pagetable size can be more than one page */
>>>>> +    for ( i = 0; i < MMU_PGD_TABLE_SIZE(mmu) / PAGE_SIZE; i++ )
>>>>> +    {
>>>>> +        /* lookup address where remoteproc pagetable is stored by kernel
>>>>> */
>>>>> +        maddr = p2m_lookup(current->domain, pgt->paddr + i * PAGE_SIZE,
>>>>> NULL);
>>>>> +        if ( !maddr )
>>>>> +        {
>>>>> +            pr_mmu("failed to translate 0x%08lx to maddr", pgt->paddr + i
>>>>> * PAGE_SIZE);
>>>>> +            return -EINVAL;
>>>>> +        }
>>>>> +
>>>>> +        pagetable = ioremap_nocache(maddr, MMU_PGD_TABLE_SIZE(mmu));
>>>>
>>>>
>>>> ioremap_* should only be used to map device memory. For the guest memory 
>>>> you
>>>> have to use copy_from_guest helper.
>>>>
>>>
>>> OK. Just a small question - if I use copy_from_guest(), can I copy
>>> from physical pointer ?  Here I have an address, which points to exact
>>> physical memory.
>>>
>>
>> I'm not sure that this works in my case. I see that copy_from_user /
>> copy_to_user deals with  domain virtual addresses and it is widely
>> used in hypercalls. Here I need to copy from a pointer to physical
>> memory - iow from intermediate physical address. Can I use this macro
>> in this case? Maybe copy_from_user / copy_to_user can be slightly
>> modified to work with IPAs ?
>
> Right, copy_*_guest helpers are only able to cope with guest virtual
> address.
>
> The behavior of those function can't be modified because they are used
> in common code.
>
> You will have to introduce new helpers based on p2m_lookup and
> map_domain_page.

map_domain_page works fine for me, thank you for detailed explanation.

Regards,
Andrii

>
> There is an ongoing discussion about it here:
>
> http://lists.xen.org/archives/html/xen-devel/2014-07/msg02096.html
>
> Regards,
>
> --
> Julien Grall



-- 

Andrii Tseglytskyi | Embedded Dev
GlobalLogic
www.globallogic.com

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