[7225] xen: blk & nic configuration via cmd line.
Revision: 7225
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7225 Author: aliguori Date: 2009-04-22 15:19:39 +0000 (Wed, 22 Apr 2009)
Log Message:
-----------
xen: blk & nic configuration via cmd line. (Gerd Hoffmann)
This patch makes qemu create backend and frontend device entries in xenstore for devices configured on the command line. It will use qdisk and qnic backend names, so the qemu internal backends will be used.
Disks can be created using -drive if=xen,file=...
Nics can be created using -net nic,macaddr=...
Modified Paths:
--------------
trunk/Makefile.target
trunk/hw/xen_backend.c
trunk/hw/xen_backend.h
trunk/hw/xen_machine_pv.c
Added Paths:
-----------
trunk/hw/xen_devconfig.c
Modified: trunk/Makefile.target
===================================================================
Makefile.target +1 -1
@@ -561,7 +561,7 @@ endif # xen backend driver support -XEN_OBJS := xen_machine_pv.o xen_backend.o +XEN_OBJS := xen_machine_pv.o xen_backend.o xen_devconfig.o XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o ifeq ($(CONFIG_XEN), yes) OBJS += $(XEN_OBJS)
Modified: trunk/hw/xen_backend.c
===================================================================
hw/xen_backend.c +1 -0
@@ -45,6 +45,7 @@/* public */ int xen_xc;struct xs_handle *xenstore =NULL ; +const char *xen_protocol;/* private */ static TAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = TAILQ_HEAD_INITIALIZER(xendevs);
Modified: trunk/hw/xen_backend.h
===================================================================
hw/xen_backend.h +8 -0
@@ -3,6 +3,8 @@#include "xen_common.h" #include "sysemu.h" +#include "net.h" +#include "block_int.h" /* ------------------------------------------------------------- */
@@ -56,6 +58,7 @@/* variables */ extern int xen_xc;extern struct xs_handle *xenstore; +extern const char *xen_protocol;/* xenstore helper functions */ int xenstore_write_str (const char *base,const char *node,const char *val);
@@ -93,4 +96,9 @@void xen_init_display (int domid); +/* configuration (aka xenbus setup) */ +void xen_config_cleanup (void ); +int xen_config_dev_blk (DriveInfo *disk); +int xen_config_dev_nic (NICInfo *nic); +#endif /* QEMU_HW_XEN_BACKEND_H */
Added: trunk/hw/xen_devconfig.c
===================================================================
hw/xen_devconfig.c +142 -0
142 lines not on this page · raw message
Modified: trunk/hw/xen_machine_pv.c
===================================================================
hw/xen_machine_pv.c +19 -0
@@ -39,6 +39,7 @@ const char *cpu_model) {CPUState *env; +int i, index;/* Initialize a dummy CPU */ if (cpu_model ==NULL ) {
@@ -62,6 +63,24 @@xen_be_register ("qdisk" , &xen_blkdev_ops);xen_be_register ("qnic" , &xen_netdev_ops); +/* configure disks */ +for (i =0 ; i <16 ; i++) { + index =drive_get_index (IF_XEN ,0 , i); +if (index ==-1 ) +continue ; +xen_config_dev_blk (drives_table + index); + } + +/* configure nics */ +for (i =0 ; i < nb_nics; i++) { +if (!nd_table[i].model ||0 !=strcmp (nd_table[i].model,"xen" )) +continue ; +xen_config_dev_nic (nd_table + i); + } + +/* config cleanup hook */ +atexit (xen_config_cleanup); +/* setup framebuffer */ xen_init_display (xen_domid); }