From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean Guyader Subject: [PATCH 4/6] mm: New XENMEM, XENMEM_add_to_physmap_gmfn_range Date: Mon, 7 Nov 2011 15:16:37 +0000 Message-ID: <1320678999-24995-5-git-send-email-jean.guyader@eu.citrix.com> References: <1320678999-24995-1-git-send-email-jean.guyader@eu.citrix.com> <1320678999-24995-2-git-send-email-jean.guyader@eu.citrix.com> <1320678999-24995-3-git-send-email-jean.guyader@eu.citrix.com> <1320678999-24995-4-git-send-email-jean.guyader@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------true" Return-path: In-Reply-To: <1320678999-24995-4-git-send-email-jean.guyader@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: tim@xen.org, allen.m.kay@intel.com, Jean Guyader List-Id: xen-devel@lists.xenproject.org --------------true Content-Type: text/plain; charset="UTF-8"; format=fixed Content-Transfer-Encoding: 8bit XENMEM_add_to_physmap_gmfn_range is like XENMEM_add_to_physmap on the gmfn space but the number of pages on which xen will iterate. Use the 16 bits padding between .domid and .space in struct xen_add_to_physmap to keep compatibility with older versions. Signed-off-by: Jean Guyader --- xen/arch/x86/mm.c | 22 +++++++++++++++++++++- xen/include/public/memory.h | 5 ++++- 2 files changed, 25 insertions(+), 2 deletions(-) --------------true Content-Type: text/x-patch; name="0004-mm-New-XENMEM-XENMEM_add_to_physmap_gmfn_range.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0004-mm-New-XENMEM-XENMEM_add_to_physmap_gmfn_range.patch" diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index f75011e..cca64b8 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4714,9 +4714,29 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg) return -EPERM; } - xenmem_add_to_physmap(d, xatp); + if ( xatp.space != XENMAPSPACE_gmfn_range ) + xatp.size = 1; + + for ( ; xatp.size > 0; xatp.size-- ) + { + if ( hypercall_preempt_check() ) + { + rc = -EAGAIN; + break; + } + xenmem_add_to_physmap(d, xatp); + xatp.idx++; + xatp.gpfn++; + } rcu_unlock_domain(d); + if ( rc == -EAGAIN ) + { + if ( copy_to_guest(arg, &xatp, 1) ) + return -EFAULT; + rc = hypercall_create_continuation( + __HYPERVISOR_memory_op, "ih", op, arg); + } return rc; } diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h index 08355e3..886d4c3 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h @@ -208,10 +208,14 @@ struct xen_add_to_physmap { /* Which domain to change the mapping for. */ domid_t domid; + /* Number of pages to go through for gmfn_range */ + uint16_t size; + /* Source mapping space. */ #define XENMAPSPACE_shared_info 0 /* shared info page */ #define XENMAPSPACE_grant_table 1 /* grant table page */ #define XENMAPSPACE_gmfn 2 /* GMFN */ +#define XENMAPSPACE_gmfn_range 3 /* GMFN_range */ unsigned int space; #define XENMAPIDX_grant_table_status 0x80000000 @@ -290,7 +294,6 @@ typedef struct xen_pod_target xen_pod_target_t; * The call never fails. */ #define XENMEM_get_sharing_freed_pages 18 - #endif /* __XEN_PUBLIC_MEMORY_H__ */ /* --------------true Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------true--