From nobody Wed May 8 14:33:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571121988; cv=none; d=zoho.com; s=zohoarc; b=cCmi4kfapcJX3URqmkhcNuHC9szbZMDXZuVCGVsM3R5LIOrpuQhYDoNqtSiwoK34N8ya6XEmCGnSAwOiq6WYxljmkZ2UpYuTVHZfWQkKNXoMCygVCLGEyc20o1MpcLjk+xtcAx1yZ+fE4qBbyeM2t31sjkjiY518JFv/+z1FDUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571121988; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=4gEFJeglMgoAQNt38Vo71zID71bF1y8rYGT9VkDrSxg=; b=RTVvPETEAIRmEv/1L3GK5EQq/ouWd2Jyzb++MEi+LcbYg0pu2DDuPTBxXrAO1/H6ASZGAB9rJwf3F0IcMgMk6IpO9mMqysJ4EtYiS82qtTEWnBUmJvXhkHSttEWkHieLXCNVJy2OythcaLcanzPGbT8oMopjT76EDCwikeNSpOo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157112198830216.983876215915643; Mon, 14 Oct 2019 23:46:28 -0700 (PDT) Received: from localhost ([::1]:35208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKGbC-0001MB-86 for importer@patchew.org; Tue, 15 Oct 2019 02:46:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43506) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKGZR-0000Uo-Na for qemu-devel@nongnu.org; Tue, 15 Oct 2019 02:44:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKGZO-0001Y1-UG for qemu-devel@nongnu.org; Tue, 15 Oct 2019 02:44:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48748) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iKGZO-0001Pm-Ou for qemu-devel@nongnu.org; Tue, 15 Oct 2019 02:44:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3FADBC0A1978 for ; Tue, 15 Oct 2019 06:44:32 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-43.ams2.redhat.com [10.36.116.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4EF45D6B0; Tue, 15 Oct 2019 06:44:27 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9007C11AAA; Tue, 15 Oct 2019 08:44:26 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH] usb-host: add option to allow all resets. Date: Tue, 15 Oct 2019 08:44:26 +0200 Message-Id: <20191015064426.19454-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 15 Oct 2019 06:44:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann 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" Commit 65f14ab98da1 ("usb-host: skip reset for untouched devices") filters out multiple usb device resets in a row. While this improves the situation for usb some devices it doesn't work for others :-( So go add a config option to make the behavior configurable. Buglink: https://bugs.launchpad.net/bugs/1846451 Signed-off-by: Gerd Hoffmann --- hw/usb/host-libusb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 472cc26fc403..fcf48c019333 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -86,7 +86,9 @@ struct USBHostDevice { uint32_t options; uint32_t loglevel; bool needs_autoscan; - bool allow_guest_reset; + bool allow_one_guest_reset; + bool allow_all_guest_resets; + /* state */ QTAILQ_ENTRY(USBHostDevice) next; int seen, errcount; @@ -1462,10 +1464,10 @@ static void usb_host_handle_reset(USBDevice *udev) USBHostDevice *s =3D USB_HOST_DEVICE(udev); int rc; =20 - if (!s->allow_guest_reset) { + if (!s->allow_one_guest_reset && !s->allow_all_guest_resets) { return; } - if (udev->addr =3D=3D 0) { + if (!s->allow_all_guest_resets && udev->addr =3D=3D 0) { return; } =20 @@ -1586,7 +1588,10 @@ static Property usb_host_dev_properties[] =3D { DEFINE_PROP_UINT32("productid", USBHostDevice, match.product_id, 0), DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4), DEFINE_PROP_UINT32("isobsize", USBHostDevice, iso_urb_frames, 32), - DEFINE_PROP_BOOL("guest-reset", USBHostDevice, allow_guest_reset, true= ), + DEFINE_PROP_BOOL("guest-reset", USBHostDevice, + allow_one_guest_reset, true), + DEFINE_PROP_BOOL("guest-resets-all", USBHostDevice, + allow_all_guest_resets, false), DEFINE_PROP_UINT32("loglevel", USBHostDevice, loglevel, LIBUSB_LOG_LEVEL_WARNING), DEFINE_PROP_BIT("pipeline", USBHostDevice, options, --=20 2.18.1