qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Fabio Fantoni <fabio.fantoni@m2r.biz>
Cc: xen-devel@lists.xensource.com, wei.liu2@citrix.com,
	Ian.Campbell@citrix.com, Stefano.Stabellini@eu.citrix.com,
	Ian.Jackson@eu.citrix.com, qemu-devel@nongnu.org,
	Paul.Durrant@citrix.com, anthony.perard@citrix.com
Subject: Re: [Qemu-devel] [PATCH][RFC] libxl: use new qemu parameters for emulated qemuu disks
Date: Mon, 18 May 2015 16:43:55 +0100	[thread overview]
Message-ID: <20150518154355.GF9503@zion.uk.xensource.com> (raw)
In-Reply-To: <1431690872-10558-1-git-send-email-fabio.fantoni@m2r.biz>

On Fri, May 15, 2015 at 01:54:32PM +0200, Fabio Fantoni wrote:
> NOTES:
> This patch is a only a fast draft for testing.
> 
> Some tests result:
> At xl create cdrom empty or not  are both working, xl cd-insert is
> working, xl cd-eject seems working but on xl command in linux hvm domU
> return qmp error of "Device 'ide-N' is locked", in windows 7 instead
> don't show the errror.
> xl block-attach seems working correctly and xl block-detach works
> correctly with linux hvm but not with windows 7 (seems block the disk
> remove, I don't know if do the same without this patch)
> Scsi disk case not tested for now.
> 
> Any comment is appreciated.
> 

I presume you're trying to use AHCI?  Do you notice improvement using
AHCI when booting a guest?

> Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
> ---
>  tools/libxl/libxl_dm.c | 35 ++++++++++++++++++-----------------
>  1 file changed, 18 insertions(+), 17 deletions(-)
> 
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 4bec5ba..6d00e38 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -811,7 +811,6 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>              int dev_number =
>                  libxl__device_disk_dev_number(disks[i].vdev, &disk, &part);
>              const char *format = qemu_disk_format_string(disks[i].format);
> -            char *drive;
>              const char *pdev_path;
>  
>              if (dev_number == -1) {
> @@ -822,13 +821,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>  
>              if (disks[i].is_cdrom) {
>                  if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY)
> -                    drive = libxl__sprintf
> -                        (gc, "if=ide,index=%d,media=cdrom,cache=writeback,id=ide-%i",
> -                         disk, dev_number);
> +                    flexarray_vappend(dm_args, "-drive",
> +                        GCSPRINTF("if=none,id=ide-%i,cache=writeback", dev_number), "-device",
> +                        GCSPRINTF("ide-cd,drive=ide-%i", dev_number), NULL);
>                  else
> -                    drive = libxl__sprintf
> -                        (gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s,cache=writeback,id=ide-%i",
> -                         disks[i].pdev_path, disk, format, dev_number);
> +                    flexarray_vappend(dm_args, "-drive",
> +                        GCSPRINTF("file=%s,if=none,id=ide-%i,format=%s,cache=writeback",
> +                        disks[i].pdev_path, dev_number, format), "-device",
> +                        GCSPRINTF("ide-cd,drive=ide-%i", dev_number), NULL);
>              } else {
>                  if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
>                      LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "cannot support"
> @@ -857,25 +857,26 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>                   * hd[a-d] and ignore the rest.
>                   */
>                  if (strncmp(disks[i].vdev, "sd", 2) == 0)
> -                    drive = libxl__sprintf
> -                        (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback",
> -                         pdev_path, disk, format);
> +                    flexarray_vappend(dm_args, "-drive",
> +                        GCSPRINTF("file=%s,if=none,id=scsidisk-%d,format=%s,cache=writeback",
> +                        pdev_path, disk, format), "-device",
> +                        GCSPRINTF("scsi-hd,drive=scsidisk-%d,scsi-id=%d",
> +                        disk, disk), NULL);
>                  else if (disk < 6 && libxl_defbool_val(b_info->u.hvm.ahci)){

I don't see a "ahci" field in libxl idl. Did you forget to commit that
part?

Another question is that do we always want to enable AHCI? Do we want to
make it user tunable? This affects if you actually need a new field in
idl.

Wei.

>                      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,bus=ahci0.%d,unit=0,drive=ahcidisk-%d",
> +                        pdev_path, disk, format), "-device",
> +                        GCSPRINTF("ide-hd,bus=ahci0.%d,unit=0,drive=ahcidisk-%d",
>                          disk, 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);
> +                    flexarray_vappend(dm_args, "-drive",
> +                        GCSPRINTF("file=%s,if=none,id=idedisk-%d,format=%s,cache=writeback",
> +                        pdev_path, disk, format), "-device", GCSPRINTF("ide-hd,drive=idedisk-%d",
> +                        disk), NULL);
>                  else
>                      continue; /* Do not emulate this disk */
>              }
>  
> -            flexarray_append(dm_args, "-drive");
> -            flexarray_append(dm_args, drive);
>          }
>  
>          switch (b_info->u.hvm.vendor_device) {
> -- 
> 1.9.1

  parent reply	other threads:[~2015-05-18 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 11:54 [Qemu-devel] [PATCH][RFC] libxl: use new qemu parameters for emulated qemuu disks Fabio Fantoni
2015-05-18 11:24 ` [Qemu-devel] [Xen-devel] " George Dunlap
2015-05-18 17:02   ` Fabio Fantoni
2015-05-18 15:43 ` Wei Liu [this message]
2015-05-18 17:13   ` [Qemu-devel] " Fabio Fantoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150518154355.GF9503@zion.uk.xensource.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=fabio.fantoni@m2r.biz \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).