From patchwork Mon Feb 9 07:01:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiejun Chen X-Patchwork-Id: 437792 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 91C2B1400B6 for ; Mon, 9 Feb 2015 18:01:44 +1100 (AEDT) Received: from localhost ([::1]:59206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKiLm-0006uQ-Lq for incoming@patchwork.ozlabs.org; Mon, 09 Feb 2015 02:01:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKiLW-0006dy-Vp for qemu-devel@nongnu.org; Mon, 09 Feb 2015 02:01:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKiLR-0003D9-Oo for qemu-devel@nongnu.org; Mon, 09 Feb 2015 02:01:26 -0500 Received: from mga03.intel.com ([134.134.136.65]:3389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKiLR-0003CW-KA for qemu-devel@nongnu.org; Mon, 09 Feb 2015 02:01:21 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 08 Feb 2015 22:56:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,542,1418112000"; d="scan'208";a="674961823" Received: from tiejunch-mobl.ccr.corp.intel.com (HELO [10.238.130.53]) ([10.238.130.53]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2015 23:01:16 -0800 Message-ID: <54D85B3B.3040306@intel.com> Date: Mon, 09 Feb 2015 15:01:15 +0800 From: "Chen, Tiejun" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: "Michael S. Tsirkin" , Cornelia Huck References: <1423201286-16503-1-git-send-email-tiejun.chen@intel.com> <20150206131446.713805ed.cornelia.huck@de.ibm.com> <20150208104854.GF3185@redhat.com> In-Reply-To: <20150208104854.GF3185@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.65 Cc: amit.shah@redhat.com, borntraeger@de.ibm.com, agraf@suse.de, aliguori@amazon.com, qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [v2][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 On 2015/2/8 18:48, Michael S. Tsirkin wrote: > On Fri, Feb 06, 2015 at 01:14:46PM +0100, Cornelia Huck wrote: >> On Fri, 6 Feb 2015 13:41:26 +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 > > We really should just write a script to import the headers > from the linux kernel. > They will need some tweaks to avoid dependencies on > linux/types, but this seems easy to do - better than > trying to keep things in sync manually. I prefer Cornelia's comment since actually we're trying to define a little bit according to a spec, so the following may be enough? Thanks Tiejun diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index f24997d..4afb0b7 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 VirtIO Spec 1.0. */ + +#define VIRTIO_ID_RESERVED 0 /* reserved (invalid)*/ +#define VIRTIO_ID_NET 1 /* network card */ +#define VIRTIO_ID_BLOCK 2 /* block device */ +#define VIRTIO_ID_CONSOLE 3 /* console */ +#define VIRTIO_ID_RNG 4 /* entropy source */ +#define VIRTIO_ID_BALLOON 5 /* memory ballooning */ +#define VIRTIO_ID_IOMEMORY 6 /* ioMemory */ +#define VIRTIO_ID_RPMSG 7 /* rpmsg */ +#define VIRTIO_ID_SCSI 8 /* SCSI host */ +#define VIRTIO_ID_9P 9 /* 9P transport */ +#define VIRTIO_ID_MAC80211_WALN 10 /* mac80211 wlan */ +#define VIRTIO_ID_RPROC_SERIAL 11 /* rproc seria */ +#define VIRTIO_ID_CAIF 12 /* virtio CAIF */ + /* from Linux's linux/virtio_config.h */ /* Status byte for guest to report progress, and synchronize features. */