From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wei Wang2" Subject: Re: [XEN-IOMMU] Proposal of DMA protection/isolation support Date: Wed, 16 Jan 2008 18:15:53 +0100 Message-ID: <1200503754.4026.108.camel@gran.amd.com> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: muli@il.ibm.com, "Dannowski, Uwe" , "Hohmuth, Michael" , "Woller, Thomas" , iommu@lists.linux-foundation.org, xen-devel@lists.xensource.com, elsie.wahlig@amd.com, amit.shah@qumranet.com List-Id: xen-devel@lists.xenproject.org On Wed, 2008-01-16 at 16:45 +0000, Keir Fraser wrote: > On 16/1/08 16:34, "Wei Wang2" wrote: > > > 1) Before submitting io request to generic block layer, block backend > > driver will invoke GNTTABOPs to map granted remote pages . However > > creating iommu mapping only in GNTTABOP not very enough because local > > pages will also be submitted to block layer and they should also be > > translated by iommu. > > Local pages could always be mapped into the iommu, and only remote pages > would need to be temporarily mapped via the gnttab hooks. I remembered that vtd patch used to hook page assignment to for this, but it was soon replaced with statical 1:1 mapping. Could you suggest me how to trace local page changes instead of mapping whole the physical ram? > 2) When dma layer is invoked to prepare a bus address for native block > > device driver. It would be better to have a "hypervisor-aware" dma layer > > which always maps virtual address to bus address via hypercall. > > __gnttab_dma_map_page() might be a good place to trigger this new > > hypercall. Both remote and local pages can be mapped by this way. > > An extra hypercall here will likely hurt performance. I have implemented a prototype for this which removes 1:1 mapping and invoke a hypercall for dma mapping. Since block driver uses dma_map_sg heavily which is easy to batch, I have not seen dramatic performance loss. -Wei > -- Keir > > > > -Wei