From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v02 1/7] arm: introduce remoteprocessor iommu module Date: Thu, 31 Jul 2014 13:11:11 +0100 Message-ID: <53DA325F.6040603@linaro.org> References: <1403780826-22123-1-git-send-email-andrii.tseglytskyi@globallogic.com> <1403780826-22123-2-git-send-email-andrii.tseglytskyi@globallogic.com> <53B05448.8050908@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrii Tseglytskyi Cc: Stefano Stabellini , Tim Deegan , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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. There is an ongoing discussion about it here: http://lists.xen.org/archives/html/xen-devel/2014-07/msg02096.html Regards, -- Julien Grall