From: Tim Deegan Subject: Re: [PATCH v5 4/4] xen: introduce XENMEM_exchange_and_pin and XENMEM_unpin Date: Tue, 10 Sep 2013 19:37:59 +0100 Message-ID: <20130910183759.GE26833@ocelot.phlegethon.org> References: <1378742763-24299-4-git-send-email-stefano.stabellini@eu.citrix.com> <522F298D02000078000F1DE0@nat28.tlf.novell.com> <1378817450.21748.111.camel@kazak.uk.xensource.com> <522F3AB702000078000F1EA0@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VJSpB-0004CA-NI for xen-devel@lists.xenproject.org; Tue, 10 Sep 2013 18:38:05 +0000 Content-Disposition: inline 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: Stefano Stabellini Cc: xen-devel , Ian Campbell , Jan Beulich List-Id: xen-devel@lists.xenproject.org At 19:32 +0100 on 10 Sep (1378841575), Stefano Stabellini wrote: > On Tue, 10 Sep 2013, Jan Beulich wrote: > > >>> On 10.09.13 at 14:50, Ian Campbell wrote: > > > On Tue, 2013-09-10 at 13:15 +0100, Jan Beulich wrote: > > > > > >> > @@ -459,6 +460,52 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_sharing_op_t); > > >> > * The zero value is appropiate. > > >> > */ > > >> > > > >> > +#define XENMEM_exchange_and_pin 26 > > >> > +/* > > >> > + * This hypercall is similar to XENMEM_exchange: it takes the same > > >> > + * struct as an argument and it exchanges the pages passed in with a new > > >> > + * set of pages. The new pages are going to be "pinned": it's guaranteed > > >> > + * that their p2m mapping won't be changed until explicitly "unpinned". > > >> > + * The content of the exchanged pages is lost. > > >> > + * Only normal guest r/w memory can be pinned: no granted pages or > > >> > + * ballooned pages. > > >> > + * If return code is zero then @out.extent_list provides the DMA frame > > >> > + * numbers of the newly-allocated memory. > > >> > > >> "DMA"? I don't think that term is universally true across all possible > > >> architectures (but we're in an architecture independent header > > >> here). "Machine" would probably be better (as it implies CPU > > >> perspective, whereas DMA hints at device perspective). > > > > > > I think DMA here is correct. The purpose of exchange and pin is so that > > > the page can be safely handed to a device for DMA. > > > > > > On an architecture where DMA address != Machine address then this should > > > indeed return the DMA addresses. > > > > One problem is that I think there are architectures where there's no > > single canonical DMA address; such an address may depend on the > > placement of a device in the system's topology. Hence I don't think > > it would even be possible to return "the" DMA address here. It ought > > to be the machine address (CPU view), and the consumer ought to > > know how to translate this to a DMA address for a particular device. > > We could leave it up to each architecture to specify whether the > hypercall returns a DMA address or a Machine address (according to > their definition of DMA address and Machine address). > Even if this is a common header. Is this going to be needed on architectures other than arm? It's not useful for x86, AFAICT. Tim.