From patchwork Tue May 24 13:34:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 97159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9DD80B6F77 for ; Tue, 24 May 2011 23:40:14 +1000 (EST) Received: from localhost ([::1]:60716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOrqE-0005OT-NK for incoming@patchwork.ozlabs.org; Tue, 24 May 2011 09:40:10 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOrq0-0005OL-MI for qemu-devel@nongnu.org; Tue, 24 May 2011 09:39:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOrpz-00083n-ED for qemu-devel@nongnu.org; Tue, 24 May 2011 09:39:56 -0400 Received: from smtp.citrix.com ([66.165.176.89]:9524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOrpz-00083j-9v for qemu-devel@nongnu.org; Tue, 24 May 2011 09:39:55 -0400 X-IronPort-AV: E=Sophos;i="4.65,261,1304308800"; d="scan'208";a="14252373" Received: from ftlpmailmx01.citrite.net ([10.13.107.65]) by FTLPIPO01.CITRIX.COM with ESMTP/TLS/RC4-MD5; 24 May 2011 09:39:54 -0400 Received: from smtp01.ad.xensource.com (10.219.128.104) by smtprelay.citrix.com (10.13.107.65) with Microsoft SMTP Server id 8.3.137.0; Tue, 24 May 2011 09:39:54 -0400 Received: from perard.uk.xensource.com (dhcp-3-28.uk.xensource.com [10.80.3.28] (may be forged)) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id p4ODYlMB021295; Tue, 24 May 2011 06:39:52 -0700 From: To: QEMU-devel , Stefano Stabellini , Alexander Graf Date: Tue, 24 May 2011 14:34:20 +0100 Message-ID: <1306244061-18503-2-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1306244061-18503-1-git-send-email-anthony.perard@citrix.com> References: <1306244061-18503-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Anthony PERARD , Xen Devel Subject: [Qemu-devel] [PATCH V3 1/2] xen: Add xc_domain_add_to_physmap to xen_interface. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony PERARD This function will be used to support sync dirty bitmap. This come with a check against every Xen release, and special implementation for Xen version that doesn't have this specific call. This function will not be usable with Xen 3.3 because the behavior is different. Signed-off-by: Anthony PERARD --- configure | 29 ++++++++++++++++++++++++++++- hw/xen_common.h | 14 ++++++++++++++ 2 files changed, 42 insertions(+), 1 deletions(-) diff --git a/configure b/configure index a318d37..7886d3f 100755 --- a/configure +++ b/configure @@ -1206,6 +1206,7 @@ int main(void) { xc = xc_interface_open(0, 0, 0); xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); xc_gnttab_open(NULL, 0); + xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); return 0; } EOF @@ -1224,10 +1225,14 @@ EOF # error HVM_MAX_VCPUS not defined #endif int main(void) { + struct xen_add_to_physmap xatp = { + .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, + }; xs_daemon_open(); xc_interface_open(); xc_gnttab_open(); xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); + xc_memory_op(0, XENMEM_add_to_physmap, &xatp); return 0; } EOF @@ -1236,7 +1241,29 @@ EOF xen_ctrl_version=400 xen=yes - # Xen 3.3.0, 3.4.0 + # Xen 3.4.0 + elif ( + cat > $TMPC < +#include +int main(void) { + struct xen_add_to_physmap xatp = { + .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, + }; + xs_daemon_open(); + xc_interface_open(); + xc_gnttab_open(); + xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); + xc_memory_op(0, XENMEM_add_to_physmap, &xatp); + return 0; +} +EOF + compile_prog "" "$xen_libs" + ) ; then + xen_ctrl_version=340 + xen=yes + + # Xen 3.3.0 elif ( cat > $TMPC < diff --git a/hw/xen_common.h b/hw/xen_common.h index a1958a0..2c79af6 100644 --- a/hw/xen_common.h +++ b/hw/xen_common.h @@ -71,6 +71,20 @@ static inline int xc_domain_populate_physmap_exact (xc_handle, domid, nr_extents, extent_order, mem_flags, extent_start); } +static inline int xc_domain_add_to_physmap(int xc_handle, uint32_t domid, + unsigned int space, unsigned long idx, + xen_pfn_t gpfn) +{ + struct xen_add_to_physmap xatp = { + .domid = domid, + .space = space, + .idx = idx, + .gpfn = gpfn, + }; + + return xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp); +} + /* Xen 4.1 */ #else