From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH v02 1/7] arm: introduce remoteprocessor iommu module Date: Tue, 22 Jul 2014 13:42:53 +0100 Message-ID: References: <1403780826-22123-1-git-send-email-andrii.tseglytskyi@globallogic.com> <1403780826-22123-2-git-send-email-andrii.tseglytskyi@globallogic.com> <1405523940.1087.19.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1405523940.1087.19.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Julien Grall , Andrii Tseglytskyi , xen-devel@lists.xen.org, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 16 Jul 2014, Ian Campbell wrote: > On Fri, 2014-07-04 at 14:59 +0100, Stefano Stabellini wrote: > > On Thu, 26 Jun 2014, Andrii Tseglytskyi wrote: > > > This is a fisrst patch from patch series which was > > > developed to handle remote (external) processors > > > memory management units. Remote processors are > > > typically used for graphic rendering (GPUs) and > > > high quality video decoding (IPUs). They are typically > > > installed on such multimedia SoCs as OMAP4 / OMAP5. > > > > > > As soon as remoteprocessor MMU typically works with > > > pagetables filled by physical addresses, which are > > > allocated by domU kernel, it is almost impossible to > > > use them under Xen, intermediate physical addresses > > > allocated by kernel, need to be translated to machine > > > addresses. > > > > > > This patch introduces a simple framework to perform > > > pfn -> mfn translation for external MMUs. > > > It introduces basic data structures and algorithms > > > needed for translation. > > > > > > Typically, when MMU is configured, some it registers > > > are updated by new values. Introduced frameworks > > > uses traps as starting point of remoteproc MMUs > > > pagetables translation. > > > > > > Change-Id: Ia4d311a40289df46a003f5ae8706c150bee1885d > > > Signed-off-by: Andrii Tseglytskyi > > > > There is one problem with this patch: you need to find a way to "pin" > > the p2m entries for the pfns and mfns found in the pagetables translated > > by remoteproc_iommu.c. Otherwise Xen might decide to change the pfn to > > mfn mappings for the domain, breaking the pagetables already translated > > by remoteproc_iommu.c. pfn to mfn mappings are not guaranteed to be > > stable. At the moment Xen on ARM wouldn't change pfn to mfn mappings > > under the guest feet, but features like memory sharing or swapping, > > supported on x86, could cause it to happen. > > I've not fully grokked this patch but wouldn't it be easier and better > to have a hook to cause the remoteproc to throw away and rebuild its > mappings when this happens? It could be called from e.g. the TLB flush > associated with the p2m changing, I think. I guess it depends on how often Xen or the Xen tools are going to change the p2m for a running domain. For example changing one page mapping a couple of times a second would be very expensive if we have to rebuild the remoteproc pagetables every time.