From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLWFB-0001GD-JO for qemu-devel@nongnu.org; Tue, 19 Jan 2016 08:22:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLWF6-0000wd-LS for qemu-devel@nongnu.org; Tue, 19 Jan 2016 08:22:45 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLWF6-0000wT-FD for qemu-devel@nongnu.org; Tue, 19 Jan 2016 08:22:40 -0500 Received: by mail-wm0-x242.google.com with SMTP id u188so23216438wmu.0 for ; Tue, 19 Jan 2016 05:22:40 -0800 (PST) Sender: Paolo Bonzini References: <1452861718-25806-1-git-send-email-pbonzini@redhat.com> <1452861718-25806-2-git-send-email-pbonzini@redhat.com> <20160119130957.77634a1d.cornelia.huck@de.ibm.com> From: Paolo Bonzini Message-ID: <569E389D.7050604@redhat.com> Date: Tue, 19 Jan 2016 14:22:37 +0100 MIME-Version: 1.0 In-Reply-To: <20160119130957.77634a1d.cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 01/10] virtio: move VirtQueueElement at the beginning of the structs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: qemu-devel@nongnu.org, mst@redhat.com On 19/01/2016 13:09, Cornelia Huck wrote: >> > The next patch will make virtqueue_pop/vring_pop allocate memory for a > s/will make/will make it possible for/ > > ? This patch will actually do that. This patch makes it possible. > I had to spend some time grepping through the code to find that blk and > scsi (and gpu, which already had elem at the beginning of its > structure) are the only ones that work like this and that other devices > do not need any change. > >> > "subclass" of VirtQueueElement. For this to work, VirtQueueElement >> > must be the first field in the containing struct. So... The next patch will make virtqueue_pop/vring_pop allocate memory for the VirtQueueElement. In some cases (blk, scsi, gpu) the device wants to extend VirtQueueElement with device-specific fields and, until now, the place of the VirtQueueElement within the containing struct didn't matter. When allocating the entire block in virtqueue_pop/vring_pop, however, the containing struct must basically be a "subclass" of VirtQueueElement, with the VirtQueueElement as the first field. Make that the case for blk and scsi; gpu is already doing it. Paolo >> > Signed-off-by: Paolo Bonzini >> > --- >> > hw/scsi/virtio-scsi.c | 3 +-- >> > include/hw/virtio/virtio-blk.h | 2 +- >> > include/hw/virtio/virtio-scsi.h | 13 ++++++------- >> > 3 files changed, 8 insertions(+), 10 deletions(-) > Otherwise, > > Reviewed-by: Cornelia Huck > > >