From: "Jan Beulich" Subject: Re: One question about the hypercall to translate gfn to mfn. Date: Wed, 10 Dec 2014 10:07:22 +0000 Message-ID: <5488296A020000780004E794@mail.emea.novell.com> References: <5486CAAF.9070807@linux.intel.com> <9AAE0902D5BC7E449B7C8E4E778ABCD02578573A@AMSPEX01CL01.citrite.net> <5486D0DD.1000902@linux.intel.com> <5486E1EA020000780004E108@mail.emea.novell.com> <548814C2020000780004E6F9@mail.emea.novell.com> <54881D8A020000780004E73E@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 10:51, wrote: >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Wednesday, December 10, 2014 5:17 PM >> >> >>> On 10.12.14 at 09:47, wrote: >> > two translation paths in assigned case: >> > >> > 1. [direct CPU access from VM], with partitioned PCI aperture >> > resource, every VM can access a portion of PCI aperture directly. >> > >> > - CPU page table/EPT: CPU virtual address->PCI aperture >> > - PCI aperture - bar base = Graphics Memory Address (GMA) >> > - GPU page table: GMA -> GPA (as programmed by guest) >> > - IOMMU: GPA -> MPA >> > >> > 2. [GPU access through GPU command operands], with GPU scheduling, >> > every VM's command buffer will be fetched by GPU in a time-shared >> > manner. >> > >> > - GPU page table: GMA->GPA >> > - IOMMU: GPA->MPA >> > >> > In our case, IOMMU is setup with 1:1 identity table for dom0. So >> > when GPU may access GPAs from different VMs, we can't count on >> > IOMMU which can only serve one mapping for one device (unless >> > we have SR-IOV). >> > >> > That's why we need shadow GPU page table in dom0, and need a >> > p2m query call to translate from GPA -> MPA: >> > >> > - shadow GPU page table: GMA->MPA >> > - IOMMU: MPA->MPA (for dom0) >> >> I still can't see why the Dom0 translation has to remain 1:1, i.e. >> why Xen couldn't return some "arbitrary" GPA for the query in >> question here, setting up a suitable GPA->MPA translation. (I put >> arbitrary in quotes because this of course must not conflict with >> GPAs already or possibly in use by Dom0.) And I can only stress >> again that you shouldn't leave out PVH (where the IOMMU already >> isn't set up with all 1:1 mappings) from these considerations. >> > > It's interesting that you think IOMMU can be used in such situation. > > what do you mean by "arbitrary" GPA here? and It's not just about > conflicting with Dom0's GPA, it's about confliction in all VM's GPAs > when you hosting them through one IOMMU page table, and there's > no way to prevent this definitely since GPAs are picked by VMs > themselves. As long as for the involved DomU-s the physical address comes in ways similar to PCI device BARs (which they're capable to deal with), that's not a problem imo. For Dom0, just like BARs may get assigned while bringing up PCI devices, a "virtual" BAR could be invented here. > I don't think we can support PVH here if IOMMU is not 1:1 mapping. That would make XenGT quite a bit less useful going forward. But otoh don't you only care about certain MMIO regions to be 1:1 mapped? That's the case for PVH Dom0 too, iirc. Jan