From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKiUH-00023h-Gy for qemu-devel@nongnu.org; Mon, 09 Feb 2015 02:10:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKiUC-0005tN-Dk for qemu-devel@nongnu.org; Mon, 09 Feb 2015 02:10:29 -0500 Received: from mga14.intel.com ([192.55.52.115]:22986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKiUC-0005t7-8h for qemu-devel@nongnu.org; Mon, 09 Feb 2015 02:10:24 -0500 Message-ID: <54D85D59.6010209@intel.com> Date: Mon, 09 Feb 2015 15:10:17 +0800 From: "Chen, Tiejun" MIME-Version: 1.0 References: <1423201286-16503-1-git-send-email-tiejun.chen@intel.com> <20150206131446.713805ed.cornelia.huck@de.ibm.com> <20150208104854.GF3185@redhat.com> <54D85B3B.3040306@intel.com> <20150209070249.GA11823@redhat.com> In-Reply-To: <20150209070249.GA11823@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [v2][RFC][PATCH] virtio: uniform virtio device IDs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, agraf@suse.de, amit.shah@redhat.com, aliguori@amazon.com, Cornelia Huck On 2015/2/9 15:02, Michael S. Tsirkin wrote: > On Mon, Feb 09, 2015 at 03:01:15PM +0800, Chen, Tiejun wrote: >> 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? >> >> 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. */ >> >> Thanks >> Tiejun > > This still means each change has to be done in two places. Are you saying another head file, pc-bios/s390-ccw/virtio.h? But seems Cornelia thought in case of s390-ccw, -quote- "Even though this one is incomplete; but we don't need anything but the block id anyway." So I'm not sure we really should do this :) Thanks Tiejun