From patchwork Thu Aug 12 14:09:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 61600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B896AB70A8 for ; Fri, 13 Aug 2010 00:12:43 +1000 (EST) Received: from localhost ([127.0.0.1]:44304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjYVY-0003bX-Px for incoming@patchwork.ozlabs.org; Thu, 12 Aug 2010 10:11:48 -0400 Received: from [140.186.70.92] (port=59909 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjYU5-0002cp-4x for qemu-devel@nongnu.org; Thu, 12 Aug 2010 10:10:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OjYTx-0000x0-Vh for qemu-devel@nongnu.org; Thu, 12 Aug 2010 10:10:11 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:51011) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjYTx-0000vb-Se for qemu-devel@nongnu.org; Thu, 12 Aug 2010 10:10:09 -0400 X-IronPort-AV: E=Sophos;i="4.55,358,1278302400"; d="scan'208";a="109436820" Received: from ftlpexchmx01.citrite.net ([10.9.154.126]) by FTLPIPO02.CITRIX.COM with ESMTP; 12 Aug 2010 10:10:09 -0400 Received: from smtp01.ad.xensource.com ([10.219.128.104]) by FTLPEXCHMX01.citrite.net with Microsoft SMTPSVC(6.0.3790.4675); Thu, 12 Aug 2010 10:10:09 -0400 Received: from localhost.localdomain (kaball.uk.xensource.com [10.80.2.59]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id o7CEA010020767; Thu, 12 Aug 2010 07:10:07 -0700 From: stefano.stabellini@eu.citrix.com To: qemu-devel@nongnu.org Date: Thu, 12 Aug 2010 15:09:51 +0100 Message-Id: <1281622202-3453-4-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: X-OriginalArrivalTime: 12 Aug 2010 14:10:09.0989 (UTC) FILETIME=[12DEDF50:01CB3A28] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Anthony.Perard@citrix.com, Anthony PERARD , xen-devel@lists.xensource.com, Stefano Stabellini Subject: [Qemu-devel] [PATCH 04/15] xen: xen_machine_fv, initialize xenstore X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony PERARD Introduce a xen_dm_init function that opens a new xenstore connection and the xenctrl interface; call xen_dm_init from xen_machine_fv. Signed-off-by: Anthony PERARD Signed-off-by: Stefano Stabellini --- Makefile.target | 1 + hw/xen_machine_fv.c | 8 ++++++++ target-xen/xenstore.c | 24 ++++++++++++++++++++++++ target-xen/xenstore.h | 6 ++++++ 4 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 target-xen/xenstore.c create mode 100644 target-xen/xenstore.h diff --git a/Makefile.target b/Makefile.target index 359a984..63dc7d1 100644 --- a/Makefile.target +++ b/Makefile.target @@ -323,6 +323,7 @@ obj-xen-y += i8259.o obj-xen-y += pc.o obj-xen-y += piix_pci.o obj-xen-y += mc146818rtc.o +obj-xen-y += xenstore.o obj-xen-y += xen_mapcache.o obj-xen-y += stub-functions.o diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c index 8114460..5fef7de 100644 --- a/hw/xen_machine_fv.c +++ b/hw/xen_machine_fv.c @@ -32,6 +32,8 @@ #include "ide.h" #include "sysemu.h" +#include "xen_backend.h" +#include "xenstore.h" #include "xen/hvm/hvm_info_table.h" #define MAX_IDE_BUS 2 @@ -61,6 +63,12 @@ static void xen_init_fv(ram_addr_t ram_size, CPUState *env; + /* Initialize backend core & drivers */ + if (xen_dm_init() != 0) { + fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__); + exit(1); + } + /* Initialize a dummy CPU */ if (cpu_model == NULL) { #ifdef TARGET_X86_64 diff --git a/target-xen/xenstore.c b/target-xen/xenstore.c new file mode 100644 index 0000000..c202f66 --- /dev/null +++ b/target-xen/xenstore.c @@ -0,0 +1,24 @@ +#include "hw/xen_backend.h" +#include "xenstore.h" + +int xen_dm_init(void) +{ + xenstore = xs_daemon_open(); + if (!xenstore) { + xen_be_printf(NULL, 0, "can't connect to xenstored\n"); + return -1; + } + + xen_xc = xc_interface_open(NULL, NULL, 0); + if (xen_xc == NULL) { + xen_be_printf(NULL, 0, "can't open xen interface\n"); + goto err; + } + return 0; + +err: + xs_daemon_close(xenstore); + xenstore = NULL; + + return -1; +} diff --git a/target-xen/xenstore.h b/target-xen/xenstore.h new file mode 100644 index 0000000..90baf79 --- /dev/null +++ b/target-xen/xenstore.h @@ -0,0 +1,6 @@ +#ifndef XENSTORE_H_ +#define XENSTORE_H_ + +int xen_dm_init(void); + +#endif /* !XENSTORE_H_ */