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

Re: [Xen-devel] [PATCH][RFC] libxl: Add AHCI support for upstream qemu

Il 13/05/2015 14:54, Fabio Fantoni ha scritto:
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.

Probably I don't remember good, there is bus selection problem with multiple disks with ahci:
qemu-system-i386: -device ide-hd,drive=ahcidisk-1: Can't create IDE unit 1, bus supports only 1 units qemu-system-i386: -device ide-hd,drive=ahcidisk-1: Device initialization failed. qemu-system-i386: -device ide-hd,drive=ahcidisk-1: Device 'ide-hd' could not be initialized
Force to unit=0 all don't solves the problem:
qemu-system-i386: -device ide-hd,unit=0,drive=ahcidisk-1: IDE unit 0 is in use qemu-system-i386: -device ide-hd,unit=0,drive=ahcidisk-1: Device initialization failed. qemu-system-i386: -device ide-hd,unit=0,drive=ahcidisk-1: Device 'ide-hd' could not be initialized
Bus definition is needed to have it full working (already test, I'll post v2 with it)

Is there any problem in xen with disk bus "not automatic"?

I'll retry also conversion to new qemu parameters for other disk emulation cases and I'll post the patch if will works.

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 
      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
                           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",
+                        pdev_path, disk, format), "-device", 
+                        disk), NULL);
+                    continue;
+                }else if (disk < 4)
                      drive = libxl__sprintf
                           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),
                                         ("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);
             && b_info->u.hvm.vnc.display

Xen-devel mailing list



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