xl vs. xm: floppy support
Hi,
when I want to boot a guest from a floppy then this works with 'xm/xend' but not with 'xl'.
An example guest config line is this:
fda = '/data/images/guests/XPmode64/Win764.flp'
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Quoted 8 lines · Christoph Egger
Hi,
when I want to boot a guest from a floppy then
this works with 'xm/xend' but not with 'xl'.An example guest config line is this:
fda = '/data/images/guests/XPmode64/Win764.flp'
Looks like there is no floppy disk support in libxl at all :-/. I guess noone missed it up until now.
Adding it probably wouldn't be too hard, but it is too late for 4.1.0, we should definitely queue this work up for 4.2 and consider for a 4.1.1 backport.
Ian.
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Christoph Egger
Hi,
when I want to boot a guest from a floppy then
this works with 'xm/xend' but not with 'xl'.
Quoted 6 lines
Quoted 3 lines
An example guest config line is this:
fda = '/data/images/guests/XPmode64/Win764.flp'
Looks like there is no floppy disk support in libxl at all :-/. I guess noone missed it up until now.
I just guessed xen didn't support it at all! Never saw any code for it on my travels.
Wow
Quoted 9 lines · Gianni Tedesco
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Christoph Egger
Hi,
when I want to boot a guest from a floppy then
this works with 'xm/xend' but not with 'xl'.An example guest config line is this:
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
fda = '/data/images/guests/XPmode64/Win764.flp'
Looks like there is no floppy disk support in libxl at all :-/. I guess noone missed it up until now.
I just guessed xen didn't support it at all! Never saw any code for it on my travels.
It's only for HVM guests. I think it's as simple as passing "-fda /path/to/img" to qemu-dm but of course you still need to plumb that through.
Ian.
Quoted 4 lines · Ian Campbell
It's only for HVM guests. I think it's as simple as passing "-fda /path/to/img" to qemu-dm but of course you still need to plumb that through.
xenops support passing arbitrary extra arguments to qemu-dm, so I will suggest someone add the same feature to xl. It's generally useful for passing new flags (or debugging) without having to modify the toolstack.
Signature · 1 line
Vincent
Quoted 7 lines · Vincent Hanquez
Quoted 4 lines · Ian Campbell
It's only for HVM guests. I think it's as simple as passing "-fda /path/to/img" to qemu-dm but of course you still need to plumb that through.
xenops support passing arbitrary extra arguments to qemu-dm, so I will suggest someone add the same feature to xl.
libxl has the support but it's not plumbed through to xl :-(
Quoted 2 lines
It's generally useful for passing new flags (or debugging) without having to modify the toolstack.
Absolutely.
Ian.
Ian Campbell writes ("Re: [Xen-devel] xl vs. xm: floppy support"):
Quoted 5 lines · Vincent Hanquez
Quoted 2 lines
xenops support passing arbitrary extra arguments to qemu-dm, so I will suggest someone add the same feature to xl.
libxl has the support but it's not plumbed through to xl :-(
This ought to be fixed for 4.1 I think. It's quite an important escape hatch.
Ian.
Quoted 10 lines · Ian Jackson
Ian Campbell writes ("Re: [Xen-devel] xl vs. xm: floppy support"):
Quoted 5 lines · Vincent Hanquez
Quoted 2 lines
xenops support passing arbitrary extra arguments to qemu-dm, so I will suggest someone add the same feature to xl.
libxl has the support but it's not plumbed through to xl :-(
This ought to be fixed for 4.1 I think. It's quite an important escape hatch.
I am ok with having this in 4.1.
At this point we could have the two lines fix to support dm_args as well (libxenlight already supports optional device model arguments, we just
need to parse dm_args in xl).
Quoted 8 lines · Stefano Stabellini
Quoted 7 lines · Ian Jackson
Ian Campbell writes ("Re: [Xen-devel] xl vs. xm: floppy support"):
Quoted 5 lines · Vincent Hanquez
Quoted 2 lines
xenops support passing arbitrary extra arguments to qemu-dm, so I will suggest someone add the same feature to xl.
libxl has the support but it's not plumbed through to xl :-(
Quoted 8 lines
Quoted 3 lines
This ought to be fixed for 4.1 I think. It's quite an important escape hatch.
I am ok with having this in 4.1.
At this point we could have the two lines fix to supportdm_argsas well (libxenlight already supports optional device model arguments, we just
need to parsedm_argsin xl).
I think that's the "escape hatch" Ian was referring to.
I'll knock up a patch in the morning.
Ian.
Quoted 2 lines · Ian Campbell
I'll knock up a patch in the morning.
...
8<------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1299058136 0
# Node ID 9d024bdd2d876ad0d42a35dfeff6a6ec7dbcb0e3
# Parent 372852e09e8071e1de82b5f5e2a163b751c3d2cc
xl: add "device_model_args" to pass arbitrary extra arguments to device model
The libxl support was already in place so simply plumb it through. This allows for passing debug options to the device model and provides a method to work around missing toolstack functionality.
e.g. xl does not current support floppy disks but adding:
device_model_args = [ "-fda", "/scratch/fdboot.img" ]
allowed me to boot FreeDOS from a floppy image.
I was unable to find any equivalent functionality in xend so this is a new xl feature.
Moved xmalloc/xrealloc earlier to allow use from parse_config_data.
tools/libxl/xl_cmdimpl.c +34 -20
@@ -242,6 +242,26 @@ release_lock: fd_lock =-1 ;return rc; +} + +static void *xmalloc (size_t sz) { +void *r; + r =malloc (sz); +if (!r) {fprintf (stderr,"xl: Unable to malloc %lu bytes.\n" , + (unsigned long )sz);exit (-ERROR_FAIL ); } +return r; +} + +static void *xrealloc (void *ptr,size_t sz) { +void *r; +if (!sz) {free (ptr);return 0 ; } +/* realloc(non-0, 0) has a useless return value; +* but xrealloc(anything, 0) is like free +*/ + r =realloc (ptr, sz); +if (!r) {fprintf (stderr,"xl: Unable to realloc to %lu bytes.\n" , + (unsigned long )sz);exit (-ERROR_FAIL ); } +return r; } #define LOG(_f, _a...) dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)
@@ -1087,6 +1107,9 @@ skip_vfb: }if (c_info->hvm ==1 ) { +XLU_ConfigList *dmargs; +int nr_dmargs =0 ; +/* init dm from c and b */ libxl_init_dm_info (dm_info, c_info, b_info);
@@ -1119,31 +1142,22 @@ skip_vfb:xlu_cfg_replace_string (config,"soundhw" , &dm_info->soundhw);if (!xlu_cfg_get_long (config,"xen_platform_pci" , &l)) dm_info->xen_platform_pci = l; + +if (!xlu_cfg_get_list (config,"device_model_args" , &dmargs, &nr_dmargs,0 )) + { +int i; + dm_info->extra =xmalloc (sizeof (char *) * (nr_dmargs +1 )); + dm_info->extra[nr_dmargs] =NULL ; +for (i=0 ; i<nr_dmargs; i++) { +const char *a =xlu_cfg_get_listitem (dmargs, i); + dm_info->extra[i] = a ?strdup (a) :NULL ; + } + } } dm_info->type = c_info->hvm ?XENFV :XENPV ;xlu_cfg_destroy (config); -} - -static void *xmalloc (size_t sz) { -void *r; - r =malloc (sz); -if (!r) {fprintf (stderr,"xl: Unable to malloc %lu bytes.\n" , - (unsigned long )sz);exit (-ERROR_FAIL ); } -return r; -} - -static void *xrealloc (void *ptr,size_t sz) { -void *r; -if (!sz) {free (ptr);return 0 ; } -/* realloc(non-0, 0) has a useless return value; -* but xrealloc(anything, 0) is like free -*/ - r =realloc (ptr, sz); -if (!r) {fprintf (stderr,"xl: Unable to realloc to %lu bytes.\n" , - (unsigned long )sz);exit (-ERROR_FAIL ); } -return r; }/* Returns 1 if domain should be restarted, 2 if domain should be renamed then restarted */
Quoted 5 lines · Ian Campbell
Quoted 2 lines · Ian Campbell
I'll knock up a patch in the morning.
...
[...]
Quoted 3 lines
e.g. xl does not current support floppy disks but adding:
device_model_args = [ "-fda", "/scratch/fdboot.img" ]allowed me to boot FreeDOS from a floppy image.
We may as well have a patch for direct support for fdb/fdb too so we can evaluate it on its merits for 4.1. I've no problem with deferring this to 4.2 at this stage in the release but it is a pretty straightforward patch...
This doesn't support stubdoms, not sure how that works in the xend case either, but I'm pretty certain that patch would be too big for this stage in the release.
8<----------------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1299059966 0
# Node ID b91f5ffd1a6a863af6050e65f8d315fdcbceb5d9 # Parent 6c3ee3d7fd98768f17b24fcc96d2fb86914deb7f libxl/xl: support floppy disk images for HVM guests
tools/libxl/libxl.idl +2 -0
@@ -164,6 +164,8 @@ libxl_device_model_info = Struct("device ("vcpu_avail", integer, False, "vcpus actually available"), ("xen_platform_pci", integer, False, "enable/disable the xen platform pci device"), ("extra", libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"), + ("fda", string, False, "floppy disk image, first drive"), + ("fdb", string, False, "floppy disk image, second drive"), ], comment= """Device Model information.
tools/libxl/libxl_dm.c +12 -0
@@ -119,6 +119,12 @@ static char ** libxl_build_device_model_ }if (info->soundhw) {flexarray_vappend (dm_args,"-soundhw" , info->soundhw,NULL ); + } +if (info->fda) { +flexarray_vappend (dm_args,"-fda" , info->fda,NULL ); + } +if (info->fdb) { +flexarray_vappend (dm_args,"-fdb" , info->fdb,NULL ); }if (info->apic) {flexarray_append (dm_args,"-acpi" );
@@ -255,6 +261,12 @@ static char ** libxl_build_device_model_ }if (info->soundhw) {flexarray_vappend (dm_args,"-soundhw" , info->soundhw,NULL ); + } +if (info->fda) { +flexarray_vappend (dm_args,"-fda" , info->fda,NULL ); + } +if (info->fdb) { +flexarray_vappend (dm_args,"-fdb" , info->fdb,NULL ); }if (!info->apic) {flexarray_append (dm_args,"-no-acpi" );
tools/libxl/xl_cmdimpl.c +4 -1
@@ -365,6 +365,8 @@ static void printf_info(int domid,printf ("\t\t\t(usb %d)\n" , dm_info->usb);printf ("\t\t\t(usbdevice %s)\n" , dm_info->usbdevice);printf ("\t\t\t(apic %d)\n" , dm_info->apic); +printf ("\t\t\t(fda %s)\n" , dm_info->fda); +printf ("\t\t\t(fdb %s)\n" , dm_info->fdb);printf ("\t\t)\n" ); }else {printf ("\t\t(linux %d)\n" , b_info->hvm);
@@ -1142,7 +1144,8 @@ skip_vfb:xlu_cfg_replace_string (config,"soundhw" , &dm_info->soundhw);if (!xlu_cfg_get_long (config,"xen_platform_pci" , &l)) dm_info->xen_platform_pci = l; - +xlu_cfg_replace_string (config,"fda" , &dm_info->fda); +xlu_cfg_replace_string (config,"fdb" , &dm_info->fdb);if (!xlu_cfg_get_list (config,"device_model_args" , &dmargs, &nr_dmargs,0 )) {int i;
Quoted 11 lines · Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 2 lines · Ian Campbell
I'll knock up a patch in the morning.
...
[...]
Quoted 3 lines
e.g. xl does not current support floppy disks but adding:
device_model_args = [ "-fda", "/scratch/fdboot.img" ]allowed me to boot FreeDOS from a floppy image.
Quoted 8 lines
We may as well have a patch for direct support for fdb/fdb too so we can evaluate it on its merits for 4.1. I've no problem with deferring this to 4.2 at this stage in the release but it is a pretty straightforward patch...
This doesn't support stubdoms, not sure how that works in the xend case either, but I'm pretty certain that patch would be too big for this stage in the release.
The right way to implement fd* support is probably to create an "fd" disk type, so that we can have frontends and backends for floppies and support stubdoms.
However that would be obviously too much for this stage of the release. This patch would solve the simple case but would introduce two fields in the libxl idl that we know are wrong.
I would rather implement this kind of simple fd support entirely in xl using the extra field in libxl_device_model_info so that we don't "corrupt" the idl.
Stefano Stabellini writes ("Re: [Xen-devel] xl vs. xm: floppy support"):
Quoted 3 lines
The right way to implement fd* support is probably to create an "fd" disk type, so that we can have frontends and backends for floppies and support stubdoms.
Yes.
Quoted 7 lines
However that would be obviously too much for this stage of the release. This patch would solve the simple case but would introduce two fields in the libxl idl that we know are wrong.
I would rather implement this kind of simple fd support entirely in xl using the extra field in
libxl_device_model_infoso that we don't "corrupt" the idl.
I think for 4.1 we will should to tell users who want floppy support to use device_model_args.
Ian.
Quoted 11 lines · Ian Jackson
Stefano Stabellini writes ("Re: [Xen-devel] xl vs. xm: floppy support"):
Quoted 3 lines
The right way to implement fd* support is probably to create an "fd" disk type, so that we can have frontends and backends for floppies and support stubdoms.
Yes.
Quoted 4 lines
However that would be obviously too much for this stage of the release. This patch would solve the simple case but would introduce two fields in the libxl idl that we know are wrong.
Quoted 6 lines
Quoted 3 lines
I would rather implement this kind of simple fd support entirely in xl using the extra field in
libxl_device_model_infoso that we don't "corrupt" the idl.I think for 4.1 we will should to tell users who want floppy support to use
device_model_args.
that would be yet another workaround to document
Ian Campbell writes ("Re: [Xen-devel] xl vs. xm: floppy support"):
Quoted 1 line
xl: add "
device_model_args" to pass arbitrary extra arguments to device model
Thanks, acked and committed.
Ian.