From patchwork Fri Feb 6 05:24:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiejun Chen X-Patchwork-Id: 437055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0B1D614027F for ; Fri, 6 Feb 2015 16:28:31 +1100 (AEDT) Received: from localhost ([::1]:46748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJbSv-0005Qm-1b for incoming@patchwork.ozlabs.org; Fri, 06 Feb 2015 00:28:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJbSf-0005AG-RL for qemu-devel@nongnu.org; Fri, 06 Feb 2015 00:28:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJbSc-0008A1-Lj for qemu-devel@nongnu.org; Fri, 06 Feb 2015 00:28:13 -0500 Received: from mga03.intel.com ([134.134.136.65]:11424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJbSc-00089v-Fq for qemu-devel@nongnu.org; Fri, 06 Feb 2015 00:28:10 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 05 Feb 2015 21:23:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="450593587" Received: from tchen0-linux.bj.intel.com ([10.238.154.91]) by FMSMGA003.fm.intel.com with ESMTP; 05 Feb 2015 21:13:49 -0800 From: Tiejun Chen To: aliguori@amazon.com, mst@redhat.com, amit.shah@redhat.com, cornelia.huck@de.ibm.com, borntraeger@de.ibm.com, agraf@suse.de Date: Fri, 6 Feb 2015 13:24:32 +0800 Message-Id: <1423200272-15786-1-git-send-email-tiejun.chen@intel.com> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.65 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [RFC][PATCH] virtio: uniform virtio device IDs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 | 14 ++++++++++++++ pc-bios/s390-ccw/virtio.h | 7 ------- 8 files changed, 14 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..c2d3731 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -23,6 +23,20 @@ #include "hw/virtio/virtio-9p.h" #endif +/* from Linux's linux/virtio_ids.h */ + +#define VIRTIO_ID_RESERVED 0 /* invalid virtio device */ +#define VIRTIO_ID_NET 1 /* virtio net */ +#define VIRTIO_ID_BLOCK 2 /* virtio block */ +#define VIRTIO_ID_CONSOLE 3 /* virtio console */ +#define VIRTIO_ID_RNG 4 /* virtio rng */ +#define VIRTIO_ID_BALLOON 5 /* virtio balloon */ +#define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ +#define VIRTIO_ID_SCSI 8 /* virtio scsi */ +#define VIRTIO_ID_9P 9 /* 9p virtio console */ +#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ +#define 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..6713a45 100644 --- a/pc-bios/s390-ccw/virtio.h +++ b/pc-bios/s390-ccw/virtio.h @@ -23,13 +23,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;