[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH][RFC] libxl: Add AHCI support for upstream qemu
Usage: ahci=0|1 (default=0) If enabled adds ich9 disk controller in ahci mode and uses it with upstream qemu to emulate disks instead of ide. It doesn't support cdroms which still use ide (cdroms will use "-device ide-cd" as new qemu parameters) Ahci requires new qemu parameters but for now other emulated disks cases remains with old ones because automatic bus selection seems bugged in qemu using new parameters on ide controller. NOTES: This patch is a only a fast draft for testing. Tested with ubuntu 15.04 hvm, windows 7 and windows 8 domUs. Doc entry and libxl.h define should be added, I'll do. Other emulated disks cases should be converted to use new qemu parameters but probably a fix in qemu is needed. Any comment is appreciated. Signed-off-by: Fabio Fantoni <fabio.fantoni@xxxxxxx> --- tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_dm.c | 10 +++++++++- tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index f0da7dc..fcfe24a 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -322,6 +322,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, libxl_defbool_setdefault(&b_info->u.hvm.nested_hvm, false); libxl_defbool_setdefault(&b_info->u.hvm.usb, false); libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci, true); + libxl_defbool_setdefault(&b_info->u.hvm.ahci, false); libxl_defbool_setdefault(&b_info->u.hvm.spice.enable, false); if (!libxl_defbool_val(b_info->u.hvm.spice.enable) && diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 0c6408d..1b48cc9 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -804,6 +804,8 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, flexarray_append(dm_args, libxl__sprintf(gc, "%"PRId64, ram_size)); if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) { + if (libxl_defbool_val(b_info->u.hvm.ahci)) + flexarray_append_pair(dm_args, "-device", "ahci"); for (i = 0; i < num_disks; i++) { int disk, part; int dev_number = @@ -858,7 +860,13 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, drive = libxl__sprintf (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback", pdev_path, disk, format); - else if (disk < 4) + else if (disk < 6 && libxl_defbool_val(b_info->u.hvm.ahci)){ + flexarray_vappend(dm_args, "-drive", + GCSPRINTF("file=%s,if=none,id=ahcidisk-%d,format=%s,cache=writeback", + pdev_path, disk, format), "-device", GCSPRINTF("ide-hd,drive=ahcidisk-%d", + disk), NULL); + continue; + }else if (disk < 4) drive = libxl__sprintf (gc, "file=%s,if=ide,index=%d,media=disk,format=%s,cache=writeback", pdev_path, disk, format); diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 023b21e..6326429 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -433,6 +433,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("nested_hvm", libxl_defbool), ("smbios_firmware", string), ("acpi_firmware", string), + ("ahci", libxl_defbool), ("nographic", libxl_defbool), ("vga", libxl_vga_interface_info), ("vnc", libxl_vnc_info), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 526a1f6..9475a16 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -2195,6 +2195,7 @@ skip_vfb: xlu_cfg_replace_string (config, "soundhw", &b_info->u.hvm.soundhw, 0); xlu_cfg_get_defbool(config, "xen_platform_pci", &b_info->u.hvm.xen_platform_pci, 0); + xlu_cfg_get_defbool(config, "ahci", &b_info->u.hvm.ahci, 0); if(b_info->u.hvm.vnc.listen && b_info->u.hvm.vnc.display -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |