qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paul Durrant <paul.durrant@citrix.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 14/18] xen: add implementations of xen-qdisk connect and disconnect functions...
Date: Wed, 28 Nov 2018 17:34:47 +0100	[thread overview]
Message-ID: <20181128163447.GF4222@dhcp-200-186.str.redhat.com> (raw)
In-Reply-To: <20181121151211.15997-15-paul.durrant@citrix.com>

Am 21.11.2018 um 16:12 hat Paul Durrant geschrieben:
> ...and wire in the dataplane.
> 
> This patch adds the remaining code to make the xen-qdisk XenDevice
> functional. The parameters that a block frontend expects to find are
> populated in the backend xenstore area, and the 'ring-ref' and
> 'event-channel' values specified in the frontend xenstore area are
> mapped/bound and used to set up the dataplane.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Max Reitz <mreitz@redhat.com>
> ---
>  hw/block/xen-qdisk.c       | 140 +++++++++++++++++++++++++++++++++++++++++++++
>  hw/xen/xen-bus.c           |  12 ++--
>  include/hw/xen/xen-bus.h   |   8 +++
>  include/hw/xen/xen-qdisk.h |  12 ++++
>  4 files changed, 166 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/block/xen-qdisk.c b/hw/block/xen-qdisk.c
> index 35f7b70480..8c88393832 100644
> --- a/hw/block/xen-qdisk.c
> +++ b/hw/block/xen-qdisk.c
> @@ -9,6 +9,10 @@
>  #include "qapi/visitor.h"
>  #include "hw/hw.h"
>  #include "hw/xen/xen-qdisk.h"
> +#include "sysemu/blockdev.h"
> +#include "sysemu/block-backend.h"
> +#include "sysemu/iothread.h"
> +#include "dataplane/xen-qdisk.h"
>  #include "trace.h"
>  
>  static char *xen_qdisk_get_name(XenDevice *xendev, Error **errp)
> @@ -23,6 +27,11 @@ static void xen_qdisk_realize(XenDevice *xendev, Error **errp)
>  {
>      XenQdiskDevice *qdiskdev = XEN_QDISK_DEVICE(xendev);
>      XenQdiskVdev *vdev = &qdiskdev->vdev;
> +    BlockConf *conf = &qdiskdev->conf;
> +    DriveInfo *dinfo;
> +    bool is_cdrom;
> +    unsigned int info;
> +    int64_t size;
>  
>      if (!vdev->valid) {
>          error_setg(errp, "vdev property not set");
> @@ -30,13 +39,134 @@ static void xen_qdisk_realize(XenDevice *xendev, Error **errp)
>      }
>  
>      trace_xen_qdisk_realize(vdev->disk, vdev->partition);
> +
> +    if (!conf->blk) {
> +        error_setg(errp, "drive property not set");
> +        return;
> +    }
> +
> +    if (!blk_is_inserted(conf->blk)) {
> +        error_setg(errp, "device needs media, but drive is empty");
> +        return;
> +    }

Hm, the code below suggests that you support CD-ROMs. Don't you want to
support media change as well then? Which would mean that you need to
support empty drives.

> +    if (!blkconf_apply_backend_options(conf, blk_is_read_only(conf->blk),
> +                                       false, errp)) {
> +        return;
> +    }
> +
> +    if (!blkconf_geometry(conf, NULL, 65535, 255, 255, errp)) {
> +        return;
> +    }
> +
> +    dinfo = blk_legacy_dinfo(conf->blk);
> +    is_cdrom = (dinfo && dinfo->media_cd);

It's called legacy for a reason. Don't use this in new devices.

The proper way is to have two different devices for hard disks and CDs
(like scsi-hd and scsi-cd).

Kevin

  reply	other threads:[~2018-11-28 16:42 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 15:11 [Qemu-devel] [PATCH 00/18] Xen PV backend 'qdevification' Paul Durrant
2018-11-21 15:11 ` [Qemu-devel] [PATCH 01/18] xen: re-name XenDevice to XenLegacyDevice Paul Durrant
2018-11-28 16:06   ` Anthony PERARD
2018-11-21 15:11 ` [Qemu-devel] [PATCH 02/18] xen: introduce new 'XenBus' and 'XenDevice' object hierarchy Paul Durrant
2018-11-28 16:19   ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2018-11-28 16:26     ` Paul Durrant
2018-11-28 16:28       ` Paul Durrant
2018-11-28 16:28       ` Stefano Stabellini
2018-11-28 16:29         ` Paul Durrant
2018-11-28 16:39           ` Kevin Wolf
2018-11-28 16:45             ` Paul Durrant
2018-11-28 16:46               ` Paul Durrant
2018-11-29  9:04                 ` Kevin Wolf
2018-11-28 17:01       ` Eric Blake
2018-11-28 17:04         ` Paul Durrant
2018-11-28 17:10   ` [Qemu-devel] " Anthony PERARD
2018-11-28 17:17     ` Paul Durrant
2018-11-28 17:32       ` Anthony PERARD
2018-11-21 15:11 ` [Qemu-devel] [PATCH 03/18] xen: introduce 'xen-qdisk' Paul Durrant
2018-11-29 16:05   ` Anthony PERARD
2018-12-04 15:20     ` Paul Durrant
2018-12-04 15:49       ` Anthony PERARD
2018-12-04 15:50         ` Paul Durrant
2018-12-04 17:14       ` Paul Durrant
2018-11-21 15:11 ` [Qemu-devel] [PATCH 04/18] xen: create xenstore areas for XenDevice-s Paul Durrant
2018-11-29 18:48   ` Anthony PERARD
2018-12-05 12:05     ` Paul Durrant
2018-12-05 12:43       ` Paul Durrant
2018-12-05 13:58         ` Anthony PERARD
2018-12-05 14:24           ` Paul Durrant
2018-12-05 16:28       ` Anthony PERARD
2018-11-21 15:11 ` [Qemu-devel] [PATCH 05/18] xen: add xenstore watcher infratructure Paul Durrant
2018-12-03 14:42   ` Anthony PERARD
2018-12-05 15:24     ` Paul Durrant
2018-11-21 15:11 ` [Qemu-devel] [PATCH 06/18] xen: add grant table interface for XenDevice-s Paul Durrant
2018-12-03 15:45   ` Anthony PERARD
2018-12-05 16:12     ` Paul Durrant
2018-11-21 15:12 ` [Qemu-devel] [PATCH 07/18] xen: add event channel " Paul Durrant
2018-12-03 16:24   ` Anthony PERARD
2018-12-04 14:24     ` Anthony PERARD
2018-12-05 16:16       ` Paul Durrant
2018-11-21 15:12 ` [Qemu-devel] [PATCH 08/18] xen: duplicate xen_disk.c as basis of dataplane/xen-qdisk.c Paul Durrant
2018-12-03 16:35   ` Anthony PERARD
2018-12-03 16:42     ` Anthony PERARD
2018-11-21 15:12 ` [Qemu-devel] [PATCH 09/18] xen: remove unnecessary code from dataplane/xen-qdisk.c Paul Durrant
2018-12-03 16:58   ` Anthony PERARD
2018-11-21 15:12 ` [Qemu-devel] [PATCH 10/18] xen: add header and build dataplane/xen-qdisk.c Paul Durrant
2018-12-03 18:09   ` Anthony PERARD
2018-12-05 17:31     ` Paul Durrant
2018-11-21 15:12 ` [Qemu-devel] [PATCH 11/18] xen: remove 'XenBlkDev' and 'blkdev' names from dataplane/xen-qdisk Paul Durrant
2018-12-04 11:05   ` Anthony PERARD
2018-11-21 15:12 ` [Qemu-devel] [PATCH 12/18] xen: remove 'ioreq' struct/varable/field names from dataplane/xen-qdisk.c Paul Durrant
2018-12-04 11:34   ` Anthony PERARD
2018-11-21 15:12 ` [Qemu-devel] [PATCH 13/18] xen: purge 'blk' and 'ioreq' from function names in dataplane/xen-qdisk.c Paul Durrant
2018-12-04 12:10   ` Anthony PERARD
2018-12-05 17:28     ` Paul Durrant
2018-11-21 15:12 ` [Qemu-devel] [PATCH 14/18] xen: add implementations of xen-qdisk connect and disconnect functions Paul Durrant
2018-11-28 16:34   ` Kevin Wolf [this message]
2018-11-28 16:40     ` Paul Durrant
2018-11-29  9:00       ` Kevin Wolf
2018-11-29  9:33         ` Paul Durrant
2018-11-29 10:46           ` Kevin Wolf
2018-11-29 10:47             ` Paul Durrant
2018-12-04 12:33   ` Anthony PERARD
2018-12-06 12:27     ` Paul Durrant
2018-11-21 15:12 ` [Qemu-devel] [PATCH 15/18] xen: add a mechanism to automatically create XenDevice-s Paul Durrant
2018-12-04 15:35   ` Anthony PERARD
2018-12-06 12:36     ` Paul Durrant
2018-12-06 15:24       ` Anthony PERARD
2018-12-06 15:36         ` Paul Durrant
2018-11-21 15:12 ` [Qemu-devel] [PATCH 16/18] xen: automatically create XenQdiskDevice-s Paul Durrant
2018-12-04 16:40   ` Anthony PERARD
2018-12-06 13:06     ` Paul Durrant
2018-11-21 15:12 ` [Qemu-devel] [PATCH 17/18] MAINTAINERS: add myself as a Xen maintainer Paul Durrant
2018-11-27 19:05   ` Stefano Stabellini
2018-11-29 14:00   ` Philippe Mathieu-Daudé
2018-11-29 14:01     ` Paul Durrant
2018-12-04 16:42   ` Anthony PERARD
2018-11-21 15:12 ` [Qemu-devel] [PATCH 18/18] xen: remove the legacy 'xen_disk' backend Paul Durrant

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=20181128163447.GF4222@dhcp-200-186.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=mreitz@redhat.com \
    --cc=paul.durrant@citrix.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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).