[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 04/15] xen: xen_machine_fv, initialize xenstore



From: Anthony PERARD <anthony.perard@xxxxxxxxxx>

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 <anthony.perard@xxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 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_ */
-- 
1.7.0.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.