From patchwork Thu Jun 25 15:26:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 488483 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 4AB9214012C for ; Fri, 26 Jun 2015 01:26:55 +1000 (AEST) Received: from localhost ([::1]:56215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z893F-0003Rl-7w for incoming@patchwork.ozlabs.org; Thu, 25 Jun 2015 11:26:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z892r-0002t9-Fg for qemu-devel@nongnu.org; Thu, 25 Jun 2015 11:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z892o-0002Bl-7p for qemu-devel@nongnu.org; Thu, 25 Jun 2015 11:26:29 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:33494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z892n-0002BW-UB for qemu-devel@nongnu.org; Thu, 25 Jun 2015 11:26:26 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Jun 2015 16:26:25 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Jun 2015 16:26:23 +0100 X-Helo: d06dlp03.portsmouth.uk.ibm.com X-MailFrom: gkurz@linux.vnet.ibm.com X-RcptTo: qemu-devel@nongnu.org Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 21C0A1B08061 for ; Thu, 25 Jun 2015 16:27:27 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t5PFQMP931981574 for ; Thu, 25 Jun 2015 15:26:22 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t5PFQLJd020308 for ; Thu, 25 Jun 2015 09:26:22 -0600 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t5PFQLLH020297; Thu, 25 Jun 2015 09:26:21 -0600 Received: from bahia.lab.toulouse-stg.fr.ibm.com (bahia.lab.toulouse-stg.fr.ibm.com [9.101.4.41]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 7B85C22002A; Thu, 25 Jun 2015 17:26:21 +0200 (CEST) From: Greg Kurz To: Stefan Hajnoczi Date: Thu, 25 Jun 2015 17:26:21 +0200 Message-ID: <20150625152621.16966.12617.stgit@bahia.lab.toulouse-stg.fr.ibm.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15062515-0009-0000-0000-000004A12503 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.108 Cc: Cornelia Huck , qemu-devel@nongnu.org, "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH] dataplane: endian fix in host notification 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 This field comes either LE with virtio 1.0, either guest endian with legacy. It must only be accessed with an accessor that knows about the appropriate endianness. Signed-off-by: Greg Kurz --- hw/virtio/dataplane/vring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c index 3fa421b9d773..a93ee2d338d7 100644 --- a/hw/virtio/dataplane/vring.c +++ b/hw/virtio/dataplane/vring.c @@ -117,7 +117,7 @@ void vring_disable_notification(VirtIODevice *vdev, Vring *vring) bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) { if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { - vring_avail_event(&vring->vr) = vring->vr.avail->idx; + vring_avail_event(&vring->vr) = vring_get_avail_idx(vdev, vring); } else { vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); }