From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Kevin Wolf' <kwolf@redhat.com>
Cc: "qemu-block@nongnu.org" <qemu-block@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"xen-devel@lists.xenproject.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: Thu, 29 Nov 2018 09:33:06 +0000 [thread overview]
Message-ID: <bdee6326dd3041f58202220a50abf9c8@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <20181129090046.GA4797@linux.fritz.box>
> -----Original Message-----
> From: Kevin Wolf [mailto:kwolf@redhat.com]
> Sent: 29 November 2018 09:01
> 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: [PATCH 14/18] xen: add implementations of xen-qdisk connect
> and disconnect functions...
>
> Am 28.11.2018 um 17:40 hat Paul Durrant geschrieben:
> > > -----Original Message-----
> > > From: Kevin Wolf [mailto:kwolf@redhat.com]
> > > Sent: 28 November 2018 16:35
> > > 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: [PATCH 14/18] xen: add implementations of xen-qdisk
> connect
> > > and disconnect functions...
> > >
> > > 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.
> >
> > Yes, that's a good point. I should get rid of that check.
>
> Or rather apply it only to hard disks. And for empty CDs, you'll
> probably need to create an empty BlockBackend (the !conf->blk case).
> Just check the IDE and/or SCSI code for comparison.
>
> > >
> > > > + 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).
> >
> > ...or presumably I could have a property? The legacy init code could
> > then set it based on the drive info.
>
> Technically yes, but why would that be a good way to model things? I
> mean, it's true that xen-qdisk is not real hardware, but I've never seen
> any hardware that has a switch to decide whether it should behave as a
> CD drive or a hard disk.
>
> Both have very different characteristics (read-only with removable
> media, or a single read-write disk), and the existing implementations
> use two separate devices. So even if you're not convinced that users
> will consider them different concepts (I am; and if they weren't
> different concepts, you wouldn't need an is_cdrom variable), consistency
> is still a good thing.
Ok. I'll split the device as you suggest... it may mean duplicated code, but the datapath can still be common.
Paul
>
> Kevin
next prev parent reply other threads:[~2018-11-29 9:33 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
2018-11-28 16:40 ` Paul Durrant
2018-11-29 9:00 ` Kevin Wolf
2018-11-29 9:33 ` Paul Durrant [this message]
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=bdee6326dd3041f58202220a50abf9c8@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.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).