From: "Michael S. Tsirkin" <mst@redhat.com>
To: Tiejun Chen <tiejun.chen@intel.com>
Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, agraf@suse.de,
cornelia.huck@de.ibm.com, aliguori@amazon.com,
amit.shah@redhat.com
Subject: Re: [Qemu-devel] [v2][RFC][PATCH] virtio: uniform virtio device IDs
Date: Mon, 9 Feb 2015 20:57:42 +0100 [thread overview]
Message-ID: <20150209195742.GA29255@redhat.com> (raw)
In-Reply-To: <1423201286-16503-1-git-send-email-tiejun.chen@intel.com>
On Fri, Feb 06, 2015 at 01:41:26PM +0800, Tiejun Chen wrote:
> Actually we define these device IDs in virtio standard, so
> we'd better put them into one common place to manage conveniently.
> Here I also add VIRTIO_ID_RESERVE according to virtio spec.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
So I just posted a script that pulls in headers from
a linux tree, doing minor changes required to
make the headers portable, such as
linux/types.h -> inttypes.h
I think it's a better idea, a virtio 1.0
work will benefit from this too.
> ---
> hw/9pfs/virtio-9p.h | 2 --
> include/hw/virtio/virtio-balloon.h | 3 ---
> include/hw/virtio/virtio-blk.h | 3 ---
> include/hw/virtio/virtio-rng.h | 3 ---
> include/hw/virtio/virtio-scsi.h | 3 ---
> include/hw/virtio/virtio-serial.h | 3 ---
> include/hw/virtio/virtio.h | 16 ++++++++++++++++
> pc-bios/s390-ccw/virtio.h | 8 +-------
> 8 files changed, 17 insertions(+), 24 deletions(-)
>
> diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
> index 2c3603a..228e05d 100644
> --- a/hw/9pfs/virtio-9p.h
> +++ b/hw/9pfs/virtio-9p.h
> @@ -146,8 +146,6 @@ struct V9fsPDU
>
> /* from Linux's linux/virtio_9p.h */
>
> -/* The ID for virtio console */
> -#define VIRTIO_ID_9P 9
> #define MAX_REQ 128
> #define MAX_TAG_LEN 32
>
> diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-balloon.h
> index f863bfe..6e0a775 100644
> --- a/include/hw/virtio/virtio-balloon.h
> +++ b/include/hw/virtio/virtio-balloon.h
> @@ -24,9 +24,6 @@
>
> /* from Linux's linux/virtio_balloon.h */
>
> -/* The ID for virtio_balloon */
> -#define VIRTIO_ID_BALLOON 5
> -
> /* The feature bitmap for virtio balloon */
> #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
> #define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory stats virtqueue */
> diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
> index 4652b70..6ee3e8f 100644
> --- a/include/hw/virtio/virtio-blk.h
> +++ b/include/hw/virtio/virtio-blk.h
> @@ -25,9 +25,6 @@
>
> /* from Linux's linux/virtio_blk.h */
>
> -/* The ID for virtio_block */
> -#define VIRTIO_ID_BLOCK 2
> -
> /* Feature bits */
> #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
> #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
> diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h
> index 14e85a5..e2bb6ce 100644
> --- a/include/hw/virtio/virtio-rng.h
> +++ b/include/hw/virtio/virtio-rng.h
> @@ -21,9 +21,6 @@
> #define VIRTIO_RNG_GET_PARENT_CLASS(obj) \
> OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_RNG)
>
> -/* The Virtio ID for the virtio rng device */
> -#define VIRTIO_ID_RNG 4
> -
> struct VirtIORNGConf {
> RngBackend *rng;
> uint64_t max_bytes;
> diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
> index bf17cc9..9606f43 100644
> --- a/include/hw/virtio/virtio-scsi.h
> +++ b/include/hw/virtio/virtio-scsi.h
> @@ -29,9 +29,6 @@
> OBJECT_CHECK(VirtIOSCSI, (obj), TYPE_VIRTIO_SCSI)
>
>
> -/* The ID for virtio_scsi */
> -#define VIRTIO_ID_SCSI 8
> -
> /* Feature Bits */
> #define VIRTIO_SCSI_F_INOUT 0
> #define VIRTIO_SCSI_F_HOTPLUG 1
> diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h
> index 11af978..1dcced6 100644
> --- a/include/hw/virtio/virtio-serial.h
> +++ b/include/hw/virtio/virtio-serial.h
> @@ -20,9 +20,6 @@
>
> /* == Interface shared between the guest kernel and qemu == */
>
> -/* The Virtio ID for virtio console / serial ports */
> -#define VIRTIO_ID_CONSOLE 3
> -
> /* Features supported */
> #define VIRTIO_CONSOLE_F_MULTIPORT 1
>
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index f24997d..9ad6bb2 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -23,6 +23,22 @@
> #include "hw/virtio/virtio-9p.h"
> #endif
>
> +/* Refer to Linux's linux/virtio_ids.h */
> +
> +enum virtio_dev_type {
> + VIRTIO_ID_RESERVED = 0, /* invalid virtio device */
> + VIRTIO_ID_NET = 1, /* virtio net */
> + VIRTIO_ID_BLOCK = 2, /* virtio block */
> + VIRTIO_ID_CONSOLE = 3, /* virtio console */
> + VIRTIO_ID_RNG = 4, /* virtio rng */
> + VIRTIO_ID_BALLOON = 5, /* virtio balloon */
> + VIRTIO_ID_RPMSG = 7, /* virtio remote processor messaging */
> + VIRTIO_ID_SCSI = 8, /* virtio scsi */
> + VIRTIO_ID_9P = 9, /* 9p virtio console */
> + VIRTIO_ID_RPROC_SERIAL = 11, /* virtio remoteproc serial link */
> + VIRTIO_ID_CAIF = 12, /* Virtio caif */
> +};
> +
> /* from Linux's linux/virtio_config.h */
>
> /* Status byte for guest to report progress, and synchronize features. */
> diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
> index c23466b..2eabcb4 100644
> --- a/pc-bios/s390-ccw/virtio.h
> +++ b/pc-bios/s390-ccw/virtio.h
> @@ -11,6 +11,7 @@
> #ifndef VIRTIO_H
> #define VIRTIO_H
>
> +#include "hw/virtio/virtio.h"
> #include "s390-ccw.h"
>
> /* Status byte for guest to report progress, and synchronize features. */
> @@ -23,13 +24,6 @@
> /* We've given up on this device. */
> #define VIRTIO_CONFIG_S_FAILED 0x80
>
> -enum virtio_dev_type {
> - VIRTIO_ID_NET = 1,
> - VIRTIO_ID_BLOCK = 2,
> - VIRTIO_ID_CONSOLE = 3,
> - VIRTIO_ID_BALLOON = 5,
> -};
> -
> struct virtio_dev_header {
> enum virtio_dev_type type : 8;
> u8 num_vq;
> --
> 1.9.1
next prev parent reply other threads:[~2015-02-09 19:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 5:41 [Qemu-devel] [v2][RFC][PATCH] virtio: uniform virtio device IDs Tiejun Chen
2015-02-06 12:14 ` Cornelia Huck
2015-02-08 10:48 ` Michael S. Tsirkin
2015-02-09 7:01 ` Chen, Tiejun
2015-02-09 7:02 ` Michael S. Tsirkin
2015-02-09 7:10 ` Chen, Tiejun
2015-02-09 8:47 ` Cornelia Huck
2015-02-11 12:41 ` Michael S. Tsirkin
2015-02-11 18:10 ` Cornelia Huck
2015-02-11 19:53 ` Michael S. Tsirkin
2015-02-09 6:56 ` Chen, Tiejun
2015-02-06 16:28 ` Stefan Hajnoczi
2015-02-09 6:58 ` Chen, Tiejun
2015-02-09 19:57 ` Michael S. Tsirkin [this message]
2015-02-11 11:55 ` Amit Shah
2015-02-11 12:37 ` Michael S. Tsirkin
2015-02-11 11:18 ` Amit Shah
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=20150209195742.GA29255@redhat.com \
--to=mst@redhat.com \
--cc=agraf@suse.de \
--cc=aliguori@amazon.com \
--cc=amit.shah@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=tiejun.chen@intel.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).