From patchwork Fri Jun 26 07:32: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: 488620 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 69B0314028F for ; Fri, 26 Jun 2015 17:34:02 +1000 (AEST) Received: from localhost ([::1]:58668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8O9A-0005wH-7E for incoming@patchwork.ozlabs.org; Fri, 26 Jun 2015 03:34:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8O7l-0003jJ-0E for qemu-devel@nongnu.org; Fri, 26 Jun 2015 03:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8O7h-0006UO-My for qemu-devel@nongnu.org; Fri, 26 Jun 2015 03:32:32 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:42270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8O7h-0006Ty-FC for qemu-devel@nongnu.org; Fri, 26 Jun 2015 03:32:29 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Jun 2015 08:32:28 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 26 Jun 2015 08:32:25 +0100 X-Helo: d06dlp02.portsmouth.uk.ibm.com X-MailFrom: gkurz@linux.vnet.ibm.com X-RcptTo: qemu-devel@nongnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9265A2190046 for ; Fri, 26 Jun 2015 08:32:02 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t5Q7WOQ536569174 for ; Fri, 26 Jun 2015 07:32:24 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 t5Q7WNH4013644 for ; Fri, 26 Jun 2015 01:32:24 -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 t5Q7WNmu013624; Fri, 26 Jun 2015 01:32:23 -0600 Received: from bahia.huguette.org (sig-9-83-234-144.evts.de.ibm.com [9.83.234.144]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 4F4EA22002A; Fri, 26 Jun 2015 09:32:22 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 26 Jun 2015 09:32:21 +0200 Message-ID: <20150626073221.26832.58745.stgit@bahia.huguette.org> In-Reply-To: <20150626073212.26832.5649.stgit@bahia.huguette.org> References: <20150626073212.26832.5649.stgit@bahia.huguette.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15062607-0025-0000-0000-000005BFC985 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.112 Cc: Cornelia Huck , Stefan Hajnoczi , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc() 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 During early virtio 1.0 devel, there were several proposals about how to deal with the endianness of the vring descriptor fields: - convert the decriptor to host endianness in a single place, and use its fields directly in the code - keep the descriptor untouched and use virtio memory helpers to access its fields with the appropriate endianness It seems like both approaches got merged: commit f5a5628cf0b6 introduces an extra swap that negates the one brought by commit b0e5d90ebc3e. This breaks boot in SLOF (BE client) when host is ppc64le with the following QEMU error: Failed to map descriptor addr 0x18e2517e00000000 len 268435456 A solution could be to revert f5a5628cf0b6, but dropping copy_in_vring_desc() is equivalent and result in a smaller patch. This patch allows SLOF to boot the OS. Signed-off-by: Greg Kurz --- hw/virtio/dataplane/vring.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c index 35891856ee06..3fa421b9d773 100644 --- a/hw/virtio/dataplane/vring.c +++ b/hw/virtio/dataplane/vring.c @@ -207,16 +207,6 @@ static int get_desc(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem, return 0; } -static void copy_in_vring_desc(VirtIODevice *vdev, - const struct vring_desc *guest, - struct vring_desc *host) -{ - host->addr = virtio_ldq_p(vdev, &guest->addr); - host->len = virtio_ldl_p(vdev, &guest->len); - host->flags = virtio_lduw_p(vdev, &guest->flags); - host->next = virtio_lduw_p(vdev, &guest->next); -} - /* This is stolen from linux/drivers/vhost/vhost.c. */ static int get_indirect(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem, struct vring_desc *indirect) @@ -261,7 +251,7 @@ static int get_indirect(VirtIODevice *vdev, Vring *vring, vring->broken = true; return -EFAULT; } - copy_in_vring_desc(vdev, desc_ptr, &desc); + desc = *desc_ptr; memory_region_unref(mr); /* Ensure descriptor has been loaded before accessing fields */ @@ -383,7 +373,7 @@ int vring_pop(VirtIODevice *vdev, Vring *vring, ret = -EFAULT; goto out; } - copy_in_vring_desc(vdev, &vring->vr.desc[i], &desc); + desc = vring->vr.desc[i]; /* Ensure descriptor is loaded before accessing fields */ barrier();