From nobody Fri Apr 19 01:43:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 154410364740662.727762606502324; Thu, 6 Dec 2018 05:40:47 -0800 (PST) Received: from localhost ([::1]:41081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUttH-0006kq-NQ for importer@patchew.org; Thu, 06 Dec 2018 08:40:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUtsK-0006O5-Bb for qemu-devel@nongnu.org; Thu, 06 Dec 2018 08:39:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUtsG-0000fi-E1 for qemu-devel@nongnu.org; Thu, 06 Dec 2018 08:39:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:35678 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUtsG-0000eQ-6k for qemu-devel@nongnu.org; Thu, 06 Dec 2018 08:39:28 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 17D70AECE; Thu, 6 Dec 2018 13:39:26 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: qemu-devel@nongnu.org, xen-devel@lists.xenproject.org Date: Thu, 6 Dec 2018 14:39:23 +0100 Message-Id: <20181206133923.30105-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH] pvusb: set max grants only in initialise X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, Juergen Gross , sstabellini@kernel.org, kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Don't call xen_be_set_max_grant_refs() in usbback_alloc(), as the gnttabdev pointer won't be initialised yet. The call can easily be moved to usbback_connect(). Signed-off-by: Juergen Gross --- hw/usb/xen-usb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 5b2e21ed18..f5d5c91094 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -860,10 +860,14 @@ static int usbback_connect(struct XenDevice *xendev) struct usbif_conn_sring *conn_sring; int urb_ring_ref; int conn_ring_ref; - unsigned int i; + unsigned int i, max_grants; =20 TR_BUS(xendev, "start\n"); =20 + /* max_grants: for each request and for the rings (request and connect= ). */ + max_grants =3D USBIF_MAX_SEGMENTS_PER_REQUEST * USB_URB_RING_SIZE + 2; + xen_be_set_max_grant_refs(xendev, max_grants); + usbif =3D container_of(xendev, struct usbback_info, xendev); =20 if (xenstore_read_fe_int(xendev, "urb-ring-ref", &urb_ring_ref)) { @@ -1005,7 +1009,7 @@ static void usbback_alloc(struct XenDevice *xendev) { struct usbback_info *usbif; USBPort *p; - unsigned int i, max_grants; + unsigned int i; =20 usbif =3D container_of(xendev, struct usbback_info, xendev); =20 @@ -1021,10 +1025,6 @@ static void usbback_alloc(struct XenDevice *xendev) QTAILQ_INIT(&usbif->req_free_q); QSIMPLEQ_INIT(&usbif->hotplug_q); usbif->bh =3D qemu_bh_new(usbback_bh, usbif); - - /* max_grants: for each request and for the rings (request and connect= ). */ - max_grants =3D USBIF_MAX_SEGMENTS_PER_REQUEST * USB_URB_RING_SIZE + 2; - xen_be_set_max_grant_refs(xendev, max_grants); } =20 static int usbback_free(struct XenDevice *xendev) --=20 2.16.4