From: "Jan Beulich" Subject: Re: One question about the hypercall to translate gfn to mfn. Date: Wed, 10 Dec 2014 08:39:14 +0000 Message-ID: <548814C2020000780004E6F9@mail.emea.novell.com> References: <5486CAAF.9070807@linux.intel.com> <9AAE0902D5BC7E449B7C8E4E778ABCD02578573A@AMSPEX01CL01.citrite.net> <5486D0DD.1000902@linux.intel.com> <5486E1EA020000780004E108@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Kevin Tian , Zhang Yu Cc: "Tim (Xen.org)" , Paul Durrant , "Keir (Xen.org)" , "Xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 10.12.14 at 02:07, wrote: >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Tuesday, December 09, 2014 6:50 PM >> >> >>> On 09.12.14 at 11:37, wrote: >> > On 12/9/2014 6:19 PM, Paul Durrant wrote: >> >> I think use of an raw mfn value currently works only because dom0 is using >> a >> > 1:1 IOMMU mapping scheme. Is my understanding correct, or do you really >> need >> > raw mfn values? >> > Thanks for your quick response, Paul. >> > Well, not exactly for this case. :) >> > In XenGT, our need to translate gfn to mfn is for GPU's page table, >> > which contains the translation between graphic address and the memory >> > address. This page table is maintained by GPU drivers, and our service >> > domain need to have a method to translate the guest physical addresses >> > written by the vGPU into host physical ones. >> > We do not use IOMMU in XenGT and therefore this translation may not >> > necessarily be a 1:1 mapping. >> >> Hmm, that suggests you indeed need raw MFNs, which in turn seems >> problematic wrt PVH Dom0 (or you'd need a GFN->GMFN translation >> layer). But while you don't use the IOMMU yourself, I suppose the GPU >> accesses still don't bypass the IOMMU? In which case all you'd need >> returned is a frame number that guarantees that after IOMMU >> translation it refers to the correct MFN, i.e. still allowing for your Dom0 >> driver to simply set aside a part of its PFN space, asking Xen to >> (IOMMU-)map the necessary guest frames into there. >> > > No. What we require is the raw MFNs. One IOMMU device entry can't > point to multiple VM's page tables, so that's why XenGT needs to use > software shadow GPU page table to implement the sharing. Note it's > not for dom0 to access the MFN. It's for dom0 to setup the correct > shadow GPU page table, so a VM can access the graphics memory > in a controlled way. So what's the translation flow here: driver -> GPU -> IOMMU -> hardware or driver -> IOMMU -> GPU -> hardware? Or do things get set up for the GPU to bypass the IOMMU altogether? Jan