From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063757085581.5308107353881; Mon, 29 May 2017 06:15:57 -0700 (PDT) Received: from localhost ([::1]:48736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKWY-00041P-Nw for importer@patchew.org; Mon, 29 May 2017 09:15:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKQy-0007tn-GM for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQu-0002BE-HO for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQu-0002B8-B7 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:04 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2935B83F40 for ; Mon, 29 May 2017 13:10:03 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 437E45C466; Mon, 29 May 2017 13:10:00 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 9B3BB80C5F; Mon, 29 May 2017 15:09:58 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2935B83F40 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2935B83F40 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:48 +0200 Message-Id: <20170529130956.20297-2-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 29 May 2017 13:10:03 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/9] ehci: fix overflow in frame timer code 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In case the frame timer doesn't run for a while due to the host being busy skipped_uframes can become big enough that UFRAME_TIMER_NS * skipped_uframes overflows. Which in turn throws off all subsequent ehci frame timer calculations. Reported-by: =E6=9D=8E=E6=9E=97 <8610_28@163.com> Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20170515104543.32044-1-kraxel@redhat.com --- hw/usb/hcd-ehci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 50ef817f93..d7361e570f 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2238,7 +2238,7 @@ static void ehci_frame_timer(void *opaque) int need_timer =3D 0; int64_t expire_time, t_now; uint64_t ns_elapsed; - int uframes, skipped_uframes; + uint64_t uframes, skipped_uframes; int i; =20 t_now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063524897551.4104687081168; Mon, 29 May 2017 06:12:04 -0700 (PDT) Received: from localhost ([::1]:48714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKSm-0000a3-1Y for importer@patchew.org; Mon, 29 May 2017 09:12:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKQx-0007sN-QZ for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQv-0002BX-Kk for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40542) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQv-0002BQ-C4 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67C4F8123A for ; Mon, 29 May 2017 13:10:04 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43E4377EC7; Mon, 29 May 2017 13:10:00 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id AFDDB80CA6; Mon, 29 May 2017 15:09:58 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 67C4F8123A Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 67C4F8123A From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:49 +0200 Message-Id: <20170529130956.20297-3-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 29 May 2017 13:10:04 +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 Subject: [Qemu-devel] [PULL 2/9] usb: Deprecate the legacy -usbdevice option 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: Paolo Bonzini , Thomas Huth , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The '-usbdevice' option is considered as deprecated nowadays and we might want to remove these options in a future version of QEMU. So mark this options as deprecated in the documenation and print out a warning if it is used to tell the user what to use instead. While we're at it, improve also some other minor USB-related spots in qemu-options.hx that were not up to date anymore. Signed-off-by: Thomas Huth Reviewed-by: Paolo Bonzini Message-id: 1495175716-12735-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- vl.c | 2 ++ qemu-options.hx | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 3465121217..88d24d6b12 100644 --- a/vl.c +++ b/vl.c @@ -3759,6 +3759,8 @@ int main(int argc, char **argv, char **envp) qemu_opts_parse_noisily(olist, "usb=3Don", false); break; case QEMU_OPTION_usbdevice: + error_report("'-usbdevice' is deprecated, please use " + "'-device usb-...' instead"); olist =3D qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "usb=3Don", false); add_device_config(DEV_USB, optarg); diff --git a/qemu-options.hx b/qemu-options.hx index f63f7dc946..91b3df6d97 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -980,12 +980,12 @@ STEXI ETEXI =20 DEF("usb", 0, QEMU_OPTION_usb, - "-usb enable the USB driver (will be the default soon)\n", + "-usb enable the USB driver (if it is not used by default y= et)\n", QEMU_ARCH_ALL) STEXI @item -usb @findex -usb -Enable the USB driver (will be the default soon) +Enable the USB driver (if it is not used by default yet). ETEXI =20 DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice, @@ -995,7 +995,8 @@ STEXI =20 @item -usbdevice @var{devname} @findex -usbdevice -Add the USB device @var{devname}. @xref{usb_devices}. +Add the USB device @var{devname}. Note that this option is deprecated, +please use @code{-device usb-...} instead. @xref{usb_devices}. =20 @table @option =20 @@ -1373,7 +1374,7 @@ output such as guest graphics, guest console, and the= QEMU monitor in a window. With this option, you can have QEMU listen on VNC display @var{display} and redirect the VGA display over the VNC session. It is very useful to enable the usb tablet device when using this option -(option @option{-usbdevice tablet}). When using the VNC display, you +(option @option{-device usb-tablet}). When using the VNC display, you must use the @option{-k} parameter to set the keyboard layout if you are not using en-us. Valid syntax for the @var{display} is =20 --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063653066202.6350487887869; Mon, 29 May 2017 06:14:13 -0700 (PDT) Received: from localhost ([::1]:48722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKUt-0002em-MD for importer@patchew.org; Mon, 29 May 2017 09:14:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKQy-0007sW-3w for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQx-0002DH-6k for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43252) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQx-0002Bv-0l for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20552C04B320 for ; Mon, 29 May 2017 13:10:06 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C5C94D73F; Mon, 29 May 2017 13:10:00 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id C6ED180D46; Mon, 29 May 2017 15:09:58 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 20552C04B320 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 20552C04B320 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:50 +0200 Message-Id: <20170529130956.20297-4-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 29 May 2017 13:10:06 +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 Subject: [Qemu-devel] [PULL 3/9] usb: Deprecate HMP commands usb_add and usb_del 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: Paolo Bonzini , Thomas Huth , Gerd Hoffmann , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The commands 'device_add' and 'device_del' should be used nowadays instead. Signed-off-by: Thomas Huth Reviewed-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Message-id: 1495175803-12830-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- vl.c | 6 ++++++ hmp-commands.hx | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 88d24d6b12..92d1310b99 100644 --- a/vl.c +++ b/vl.c @@ -1436,6 +1436,9 @@ static int usb_parse(const char *cmdline) void hmp_usb_add(Monitor *mon, const QDict *qdict) { const char *devname =3D qdict_get_str(qdict, "devname"); + + error_report("usb_add is deprecated, please use device_add instead"); + if (usb_device_add(devname) < 0) { error_report("could not add USB device '%s'", devname); } @@ -1444,6 +1447,9 @@ void hmp_usb_add(Monitor *mon, const QDict *qdict) void hmp_usb_del(Monitor *mon, const QDict *qdict) { const char *devname =3D qdict_get_str(qdict, "devname"); + + error_report("usb_del is deprecated, please use device_del instead"); + if (usb_device_del(devname) < 0) { error_report("could not delete USB device '%s'", devname); } diff --git a/hmp-commands.hx b/hmp-commands.hx index baeac47a72..e763606fe5 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -676,7 +676,8 @@ ETEXI STEXI @item usb_add @var{devname} @findex usb_add -Add the USB device @var{devname}. For details of available devices see +Add the USB device @var{devname}. This command is deprecated, please +use @code{device_add} instead. For details of available devices see @ref{usb_devices} ETEXI =20 @@ -693,7 +694,8 @@ STEXI @findex usb_del Remove the USB device @var{devname} from the QEMU virtual USB hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor -command @code{info usb} to see the devices you can remove. +command @code{info usb} to see the devices you can remove. This +command is deprecated, please use @code{device_del} instead. ETEXI =20 { --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063908119569.6733985746257; Mon, 29 May 2017 06:18:28 -0700 (PDT) Received: from localhost ([::1]:48745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKZ0-0005eP-OY for importer@patchew.org; Mon, 29 May 2017 09:18:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKR3-0007yk-Vo for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKR0-0002I4-IK for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44644) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKR0-0002HR-CJ for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6265213A5D; Mon, 29 May 2017 13:10:09 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 556295C46D; Mon, 29 May 2017 13:10:00 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id D8C2B80D72; Mon, 29 May 2017 15:09:58 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6265213A5D Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6265213A5D From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:51 +0200 Message-Id: <20170529130956.20297-5-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 29 May 2017 13:10:09 +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 Subject: [Qemu-devel] [PULL 4/9] usb: Simplify the parameter parsing of the legacy usb serial device 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: Samuel Thibault , Thomas Huth , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Coverity complains about the current code, so let's get rid of the now unneeded while loop and simply always emit "unrecognized serial USB option" for all unsupported options. Signed-off-by: Thomas Huth Reviewed-by: Paolo Bonzini Message-id: 1495177204-16808-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/dev-serial.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 83a4f0e6fb..76ceca1f5c 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -516,27 +516,16 @@ static USBDevice *usb_serial_init(USBBus *bus, const = char *filename) char label[32]; static int index; =20 - while (*filename && *filename !=3D ':') { - const char *p; - - if (strstart(filename, "vendorid=3D", &p)) { - error_report("vendorid is not supported anymore"); - return NULL; - } else if (strstart(filename, "productid=3D", &p)) { - error_report("productid is not supported anymore"); - return NULL; - } else { - error_report("unrecognized serial USB option %s", filename); - return NULL; - } - while(*filename =3D=3D ',') - filename++; + if (*filename =3D=3D ':') { + filename++; + } else if (*filename) { + error_report("unrecognized serial USB option %s", filename); + return NULL; } if (!*filename) { error_report("character device specification needed"); return NULL; } - filename++; =20 snprintf(label, sizeof(label), "usbserial%d", index++); cdrv =3D qemu_chr_new(label, filename); --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063828378197.57727052679547; Mon, 29 May 2017 06:17:08 -0700 (PDT) Received: from localhost ([::1]:48741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKXi-0004iN-CI for importer@patchew.org; Mon, 29 May 2017 09:17:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKR0-0007vW-5W for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQx-0002Dn-OO for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQx-0002CF-Eh for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8835137E66 for ; Mon, 29 May 2017 13:10:06 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA3D3179E3; Mon, 29 May 2017 13:10:03 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id F250D80BFF; Mon, 29 May 2017 15:09:58 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8835137E66 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8835137E66 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:52 +0200 Message-Id: <20170529130956.20297-6-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 29 May 2017 13:10:06 +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 Subject: [Qemu-devel] [PULL 5/9] xhci: split into multiple files 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Moved structs and defines to hcd-xhci.h. Move nec controller variant to hcd-xhci-nec.c. No functional changes. Signed-off-by: Gerd Hoffmann Message-id: 20170517103313.8459-1-kraxel@redhat.com --- hw/usb/hcd-xhci.h | 226 +++++++++++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-xhci-nec.c | 63 +++++++++++++ hw/usb/hcd-xhci.c | 238 +---------------------------------------------= ---- hw/usb/Makefile.objs | 1 + 4 files changed, 292 insertions(+), 236 deletions(-) create mode 100644 hw/usb/hcd-xhci.h create mode 100644 hw/usb/hcd-xhci-nec.c diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h new file mode 100644 index 0000000000..fc36a4c787 --- /dev/null +++ b/hw/usb/hcd-xhci.h @@ -0,0 +1,226 @@ +/* + * USB xHCI controller emulation + * + * Copyright (c) 2011 Securiforest + * Date: 2011-05-11 ; Author: Hector Martin + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#define TYPE_XHCI "base-xhci" +#define TYPE_NEC_XHCI "nec-usb-xhci" +#define TYPE_QEMU_XHCI "qemu-xhci" + +#define XHCI(obj) \ + OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI) + +#define MAXPORTS_2 15 +#define MAXPORTS_3 15 + +#define MAXPORTS (MAXPORTS_2 + MAXPORTS_3) +#define MAXSLOTS 64 +#define MAXINTRS 16 + +/* Very pessimistic, let's hope it's enough for all cases */ +#define EV_QUEUE (((3 * 24) + 16) * MAXSLOTS) + +typedef struct XHCIState XHCIState; +typedef struct XHCIStreamContext XHCIStreamContext; +typedef struct XHCIEPContext XHCIEPContext; + +enum xhci_flags { + XHCI_FLAG_SS_FIRST =3D 1, + XHCI_FLAG_FORCE_PCIE_ENDCAP, + XHCI_FLAG_ENABLE_STREAMS, +}; + +typedef enum TRBType { + TRB_RESERVED =3D 0, + TR_NORMAL, + TR_SETUP, + TR_DATA, + TR_STATUS, + TR_ISOCH, + TR_LINK, + TR_EVDATA, + TR_NOOP, + CR_ENABLE_SLOT, + CR_DISABLE_SLOT, + CR_ADDRESS_DEVICE, + CR_CONFIGURE_ENDPOINT, + CR_EVALUATE_CONTEXT, + CR_RESET_ENDPOINT, + CR_STOP_ENDPOINT, + CR_SET_TR_DEQUEUE, + CR_RESET_DEVICE, + CR_FORCE_EVENT, + CR_NEGOTIATE_BW, + CR_SET_LATENCY_TOLERANCE, + CR_GET_PORT_BANDWIDTH, + CR_FORCE_HEADER, + CR_NOOP, + ER_TRANSFER =3D 32, + ER_COMMAND_COMPLETE, + ER_PORT_STATUS_CHANGE, + ER_BANDWIDTH_REQUEST, + ER_DOORBELL, + ER_HOST_CONTROLLER, + ER_DEVICE_NOTIFICATION, + ER_MFINDEX_WRAP, + /* vendor specific bits */ + CR_VENDOR_NEC_FIRMWARE_REVISION =3D 49, + CR_VENDOR_NEC_CHALLENGE_RESPONSE =3D 50, +} TRBType; + +typedef enum TRBCCode { + CC_INVALID =3D 0, + CC_SUCCESS, + CC_DATA_BUFFER_ERROR, + CC_BABBLE_DETECTED, + CC_USB_TRANSACTION_ERROR, + CC_TRB_ERROR, + CC_STALL_ERROR, + CC_RESOURCE_ERROR, + CC_BANDWIDTH_ERROR, + CC_NO_SLOTS_ERROR, + CC_INVALID_STREAM_TYPE_ERROR, + CC_SLOT_NOT_ENABLED_ERROR, + CC_EP_NOT_ENABLED_ERROR, + CC_SHORT_PACKET, + CC_RING_UNDERRUN, + CC_RING_OVERRUN, + CC_VF_ER_FULL, + CC_PARAMETER_ERROR, + CC_BANDWIDTH_OVERRUN, + CC_CONTEXT_STATE_ERROR, + CC_NO_PING_RESPONSE_ERROR, + CC_EVENT_RING_FULL_ERROR, + CC_INCOMPATIBLE_DEVICE_ERROR, + CC_MISSED_SERVICE_ERROR, + CC_COMMAND_RING_STOPPED, + CC_COMMAND_ABORTED, + CC_STOPPED, + CC_STOPPED_LENGTH_INVALID, + CC_MAX_EXIT_LATENCY_TOO_LARGE_ERROR =3D 29, + CC_ISOCH_BUFFER_OVERRUN =3D 31, + CC_EVENT_LOST_ERROR, + CC_UNDEFINED_ERROR, + CC_INVALID_STREAM_ID_ERROR, + CC_SECONDARY_BANDWIDTH_ERROR, + CC_SPLIT_TRANSACTION_ERROR +} TRBCCode; + +typedef struct XHCIRing { + dma_addr_t dequeue; + bool ccs; +} XHCIRing; + +typedef struct XHCIPort { + XHCIState *xhci; + uint32_t portsc; + uint32_t portnr; + USBPort *uport; + uint32_t speedmask; + char name[16]; + MemoryRegion mem; +} XHCIPort; + +typedef struct XHCISlot { + bool enabled; + bool addressed; + dma_addr_t ctx; + USBPort *uport; + XHCIEPContext *eps[31]; +} XHCISlot; + +typedef struct XHCIEvent { + TRBType type; + TRBCCode ccode; + uint64_t ptr; + uint32_t length; + uint32_t flags; + uint8_t slotid; + uint8_t epid; +} XHCIEvent; + +typedef struct XHCIInterrupter { + uint32_t iman; + uint32_t imod; + uint32_t erstsz; + uint32_t erstba_low; + uint32_t erstba_high; + uint32_t erdp_low; + uint32_t erdp_high; + + bool msix_used, er_pcs; + + dma_addr_t er_start; + uint32_t er_size; + unsigned int er_ep_idx; + + /* kept for live migration compat only */ + bool er_full_unused; + XHCIEvent ev_buffer[EV_QUEUE]; + unsigned int ev_buffer_put; + unsigned int ev_buffer_get; + +} XHCIInterrupter; + +struct XHCIState { + /*< private >*/ + PCIDevice parent_obj; + /*< public >*/ + + USBBus bus; + MemoryRegion mem; + MemoryRegion mem_cap; + MemoryRegion mem_oper; + MemoryRegion mem_runtime; + MemoryRegion mem_doorbell; + + /* properties */ + uint32_t numports_2; + uint32_t numports_3; + uint32_t numintrs; + uint32_t numslots; + uint32_t flags; + uint32_t max_pstreams_mask; + OnOffAuto msi; + OnOffAuto msix; + + /* Operational Registers */ + uint32_t usbcmd; + uint32_t usbsts; + uint32_t dnctrl; + uint32_t crcr_low; + uint32_t crcr_high; + uint32_t dcbaap_low; + uint32_t dcbaap_high; + uint32_t config; + + USBPort uports[MAX(MAXPORTS_2, MAXPORTS_3)]; + XHCIPort ports[MAXPORTS]; + XHCISlot slots[MAXSLOTS]; + uint32_t numports; + + /* Runtime Registers */ + int64_t mfindex_start; + QEMUTimer *mfwrap_timer; + XHCIInterrupter intr[MAXINTRS]; + + XHCIRing cmd_ring; + + bool nec_quirks; +}; diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c new file mode 100644 index 0000000000..75715a048a --- /dev/null +++ b/hw/usb/hcd-xhci-nec.c @@ -0,0 +1,63 @@ +/* + * USB xHCI controller emulation + * + * Copyright (c) 2011 Securiforest + * Date: 2011-05-11 ; Author: Hector Martin + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/hw.h" +#include "hw/usb.h" +#include "hw/pci/pci.h" + +#include "hcd-xhci.h" + +static Property nec_xhci_properties[] =3D { + DEFINE_PROP_ON_OFF_AUTO("msi", XHCIState, msi, ON_OFF_AUTO_AUTO), + DEFINE_PROP_ON_OFF_AUTO("msix", XHCIState, msix, ON_OFF_AUTO_AUTO), + DEFINE_PROP_BIT("superspeed-ports-first", + XHCIState, flags, XHCI_FLAG_SS_FIRST, true), + DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags, + XHCI_FLAG_FORCE_PCIE_ENDCAP, false), + DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS), + DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS), + DEFINE_PROP_END_OF_LIST(), +}; + +static void nec_xhci_class_init(ObjectClass *klass, void *data) +{ + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->props =3D nec_xhci_properties; + k->vendor_id =3D PCI_VENDOR_ID_NEC; + k->device_id =3D PCI_DEVICE_ID_NEC_UPD720200; + k->revision =3D 0x03; +} + +static const TypeInfo nec_xhci_info =3D { + .name =3D TYPE_NEC_XHCI, + .parent =3D TYPE_XHCI, + .class_init =3D nec_xhci_class_init, +}; + +static void nec_xhci_register_types(void) +{ + type_register_static(&nec_xhci_info); +} + +type_init(nec_xhci_register_types) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 77d8e1137a..a0c7960a7b 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -29,6 +29,8 @@ #include "trace.h" #include "qapi/error.h" =20 +#include "hcd-xhci.h" + //#define DEBUG_XHCI //#define DEBUG_DATA =20 @@ -40,16 +42,6 @@ #define FIXME(_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \ __func__, __LINE__, _msg); abort(); } whi= le (0) =20 -#define MAXPORTS_2 15 -#define MAXPORTS_3 15 - -#define MAXPORTS (MAXPORTS_2+MAXPORTS_3) -#define MAXSLOTS 64 -#define MAXINTRS 16 - -/* Very pessimistic, let's hope it's enough for all cases */ -#define EV_QUEUE (((3 * 24) + 16) * MAXSLOTS) - #define TRB_LINK_LIMIT 32 #define COMMAND_LIMIT 256 #define TRANSFER_LIMIT 256 @@ -164,84 +156,8 @@ enum { PLS_RESUME =3D 15, }; =20 -typedef enum TRBType { - TRB_RESERVED =3D 0, - TR_NORMAL, - TR_SETUP, - TR_DATA, - TR_STATUS, - TR_ISOCH, - TR_LINK, - TR_EVDATA, - TR_NOOP, - CR_ENABLE_SLOT, - CR_DISABLE_SLOT, - CR_ADDRESS_DEVICE, - CR_CONFIGURE_ENDPOINT, - CR_EVALUATE_CONTEXT, - CR_RESET_ENDPOINT, - CR_STOP_ENDPOINT, - CR_SET_TR_DEQUEUE, - CR_RESET_DEVICE, - CR_FORCE_EVENT, - CR_NEGOTIATE_BW, - CR_SET_LATENCY_TOLERANCE, - CR_GET_PORT_BANDWIDTH, - CR_FORCE_HEADER, - CR_NOOP, - ER_TRANSFER =3D 32, - ER_COMMAND_COMPLETE, - ER_PORT_STATUS_CHANGE, - ER_BANDWIDTH_REQUEST, - ER_DOORBELL, - ER_HOST_CONTROLLER, - ER_DEVICE_NOTIFICATION, - ER_MFINDEX_WRAP, - /* vendor specific bits */ - CR_VENDOR_NEC_FIRMWARE_REVISION =3D 49, - CR_VENDOR_NEC_CHALLENGE_RESPONSE =3D 50, -} TRBType; - #define CR_LINK TR_LINK =20 -typedef enum TRBCCode { - CC_INVALID =3D 0, - CC_SUCCESS, - CC_DATA_BUFFER_ERROR, - CC_BABBLE_DETECTED, - CC_USB_TRANSACTION_ERROR, - CC_TRB_ERROR, - CC_STALL_ERROR, - CC_RESOURCE_ERROR, - CC_BANDWIDTH_ERROR, - CC_NO_SLOTS_ERROR, - CC_INVALID_STREAM_TYPE_ERROR, - CC_SLOT_NOT_ENABLED_ERROR, - CC_EP_NOT_ENABLED_ERROR, - CC_SHORT_PACKET, - CC_RING_UNDERRUN, - CC_RING_OVERRUN, - CC_VF_ER_FULL, - CC_PARAMETER_ERROR, - CC_BANDWIDTH_OVERRUN, - CC_CONTEXT_STATE_ERROR, - CC_NO_PING_RESPONSE_ERROR, - CC_EVENT_RING_FULL_ERROR, - CC_INCOMPATIBLE_DEVICE_ERROR, - CC_MISSED_SERVICE_ERROR, - CC_COMMAND_RING_STOPPED, - CC_COMMAND_ABORTED, - CC_STOPPED, - CC_STOPPED_LENGTH_INVALID, - CC_MAX_EXIT_LATENCY_TOO_LARGE_ERROR =3D 29, - CC_ISOCH_BUFFER_OVERRUN =3D 31, - CC_EVENT_LOST_ERROR, - CC_UNDEFINED_ERROR, - CC_INVALID_STREAM_ID_ERROR, - CC_SECONDARY_BANDWIDTH_ERROR, - CC_SPLIT_TRANSACTION_ERROR -} TRBCCode; - #define TRB_C (1<<0) #define TRB_TYPE_SHIFT 10 #define TRB_TYPE_MASK 0x3f @@ -301,10 +217,6 @@ typedef enum TRBCCode { #define SLOT_CONTEXT_ENTRIES_MASK 0x1f #define SLOT_CONTEXT_ENTRIES_SHIFT 27 =20 -typedef struct XHCIState XHCIState; -typedef struct XHCIStreamContext XHCIStreamContext; -typedef struct XHCIEPContext XHCIEPContext; - #define get_field(data, field) \ (((data) >> field##_SHIFT) & field##_MASK) =20 @@ -326,21 +238,6 @@ typedef enum EPType { ET_INTR_IN, } EPType; =20 -typedef struct XHCIRing { - dma_addr_t dequeue; - bool ccs; -} XHCIRing; - -typedef struct XHCIPort { - XHCIState *xhci; - uint32_t portsc; - uint32_t portnr; - USBPort *uport; - uint32_t speedmask; - char name[16]; - MemoryRegion mem; -} XHCIPort; - typedef struct XHCITransfer { XHCIEPContext *epctx; USBPacket packet; @@ -402,101 +299,6 @@ struct XHCIEPContext { QEMUTimer *kick_timer; }; =20 -typedef struct XHCISlot { - bool enabled; - bool addressed; - dma_addr_t ctx; - USBPort *uport; - XHCIEPContext * eps[31]; -} XHCISlot; - -typedef struct XHCIEvent { - TRBType type; - TRBCCode ccode; - uint64_t ptr; - uint32_t length; - uint32_t flags; - uint8_t slotid; - uint8_t epid; -} XHCIEvent; - -typedef struct XHCIInterrupter { - uint32_t iman; - uint32_t imod; - uint32_t erstsz; - uint32_t erstba_low; - uint32_t erstba_high; - uint32_t erdp_low; - uint32_t erdp_high; - - bool msix_used, er_pcs; - - dma_addr_t er_start; - uint32_t er_size; - unsigned int er_ep_idx; - - /* kept for live migration compat only */ - bool er_full_unused; - XHCIEvent ev_buffer[EV_QUEUE]; - unsigned int ev_buffer_put; - unsigned int ev_buffer_get; - -} XHCIInterrupter; - -struct XHCIState { - /*< private >*/ - PCIDevice parent_obj; - /*< public >*/ - - USBBus bus; - MemoryRegion mem; - MemoryRegion mem_cap; - MemoryRegion mem_oper; - MemoryRegion mem_runtime; - MemoryRegion mem_doorbell; - - /* properties */ - uint32_t numports_2; - uint32_t numports_3; - uint32_t numintrs; - uint32_t numslots; - uint32_t flags; - uint32_t max_pstreams_mask; - OnOffAuto msi; - OnOffAuto msix; - - /* Operational Registers */ - uint32_t usbcmd; - uint32_t usbsts; - uint32_t dnctrl; - uint32_t crcr_low; - uint32_t crcr_high; - uint32_t dcbaap_low; - uint32_t dcbaap_high; - uint32_t config; - - USBPort uports[MAX(MAXPORTS_2, MAXPORTS_3)]; - XHCIPort ports[MAXPORTS]; - XHCISlot slots[MAXSLOTS]; - uint32_t numports; - - /* Runtime Registers */ - int64_t mfindex_start; - QEMUTimer *mfwrap_timer; - XHCIInterrupter intr[MAXINTRS]; - - XHCIRing cmd_ring; - - bool nec_quirks; -}; - -#define TYPE_XHCI "base-xhci" -#define TYPE_NEC_XHCI "nec-usb-xhci" -#define TYPE_QEMU_XHCI "qemu-xhci" - -#define XHCI(obj) \ - OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI) - typedef struct XHCIEvRingSeg { uint32_t addr_low; uint32_t addr_high; @@ -504,12 +306,6 @@ typedef struct XHCIEvRingSeg { uint32_t rsvd; } XHCIEvRingSeg; =20 -enum xhci_flags { - XHCI_FLAG_SS_FIRST =3D 1, - XHCI_FLAG_FORCE_PCIE_ENDCAP, - XHCI_FLAG_ENABLE_STREAMS, -}; - static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid, unsigned int streamid); static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid); @@ -3843,18 +3639,6 @@ static const VMStateDescription vmstate_xhci =3D { } }; =20 -static Property nec_xhci_properties[] =3D { - DEFINE_PROP_ON_OFF_AUTO("msi", XHCIState, msi, ON_OFF_AUTO_AUTO), - DEFINE_PROP_ON_OFF_AUTO("msix", XHCIState, msix, ON_OFF_AUTO_AUTO), - DEFINE_PROP_BIT("superspeed-ports-first", - XHCIState, flags, XHCI_FLAG_SS_FIRST, true), - DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags, - XHCI_FLAG_FORCE_PCIE_ENDCAP, false), - DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS), - DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS), - DEFINE_PROP_END_OF_LIST(), -}; - static Property xhci_properties[] =3D { DEFINE_PROP_BIT("streams", XHCIState, flags, XHCI_FLAG_ENABLE_STREAMS, true), @@ -3886,23 +3670,6 @@ static const TypeInfo xhci_info =3D { .abstract =3D true, }; =20 -static void nec_xhci_class_init(ObjectClass *klass, void *data) -{ - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - DeviceClass *dc =3D DEVICE_CLASS(klass); - - dc->props =3D nec_xhci_properties; - k->vendor_id =3D PCI_VENDOR_ID_NEC; - k->device_id =3D PCI_DEVICE_ID_NEC_UPD720200; - k->revision =3D 0x03; -} - -static const TypeInfo nec_xhci_info =3D { - .name =3D TYPE_NEC_XHCI, - .parent =3D TYPE_XHCI, - .class_init =3D nec_xhci_class_init, -}; - static void qemu_xhci_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); @@ -3933,7 +3700,6 @@ static const TypeInfo qemu_xhci_info =3D { static void xhci_register_types(void) { type_register_static(&xhci_info); - type_register_static(&nec_xhci_info); type_register_static(&qemu_xhci_info); } =20 diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index 5958be8ce3..249106f32d 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -8,6 +8,7 @@ common-obj-$(CONFIG_USB_OHCI) +=3D hcd-ohci.o common-obj-$(CONFIG_USB_EHCI) +=3D hcd-ehci.o hcd-ehci-pci.o common-obj-$(CONFIG_USB_EHCI_SYSBUS) +=3D hcd-ehci-sysbus.o common-obj-$(CONFIG_USB_XHCI) +=3D hcd-xhci.o +common-obj-$(CONFIG_USB_XHCI) +=3D hcd-xhci-nec.o common-obj-$(CONFIG_USB_MUSB) +=3D hcd-musb.o =20 obj-$(CONFIG_TUSB6010) +=3D tusb6010.o --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063655819229.773998733212; Mon, 29 May 2017 06:14:15 -0700 (PDT) Received: from localhost ([::1]:48723 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKUv-0002g7-3p for importer@patchew.org; Mon, 29 May 2017 09:14:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKR7-00081f-86 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKR4-0002Ik-MM for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKR4-0002Ib-GS for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:14 -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 8F84AC05678D for ; Mon, 29 May 2017 13:10:13 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id ECAF07F478; Mon, 29 May 2017 13:10:03 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 11FA880DC2; Mon, 29 May 2017 15:09:59 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F84AC05678D Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8F84AC05678D From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:53 +0200 Message-Id: <20170529130956.20297-7-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-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.32]); Mon, 29 May 2017 13:10:13 +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 Subject: [Qemu-devel] [PULL 6/9] xhci: add CONFIG_USB_XHCI_NEC option 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1451189 Signed-off-by: Gerd Hoffmann Message-id: 20170517103313.8459-2-kraxel@redhat.com --- default-configs/pci.mak | 1 + hw/usb/Makefile.objs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/default-configs/pci.mak b/default-configs/pci.mak index 60dc6510ec..3bbeb62d9a 100644 --- a/default-configs/pci.mak +++ b/default-configs/pci.mak @@ -7,6 +7,7 @@ CONFIG_USB_UHCI=3Dy CONFIG_USB_OHCI=3Dy CONFIG_USB_EHCI=3Dy CONFIG_USB_XHCI=3Dy +CONFIG_USB_XHCI_NEC=3Dy CONFIG_NE2000_PCI=3Dy CONFIG_EEPRO100_PCI=3Dy CONFIG_PCNET_PCI=3Dy diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index 249106f32d..97f1c4561a 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -8,7 +8,7 @@ common-obj-$(CONFIG_USB_OHCI) +=3D hcd-ohci.o common-obj-$(CONFIG_USB_EHCI) +=3D hcd-ehci.o hcd-ehci-pci.o common-obj-$(CONFIG_USB_EHCI_SYSBUS) +=3D hcd-ehci-sysbus.o common-obj-$(CONFIG_USB_XHCI) +=3D hcd-xhci.o -common-obj-$(CONFIG_USB_XHCI) +=3D hcd-xhci-nec.o +common-obj-$(CONFIG_USB_XHCI_NEC) +=3D hcd-xhci-nec.o common-obj-$(CONFIG_USB_MUSB) +=3D hcd-musb.o =20 obj-$(CONFIG_TUSB6010) +=3D tusb6010.o --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063531254299.6961569154133; Mon, 29 May 2017 06:12:11 -0700 (PDT) Received: from localhost ([::1]:48718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKSv-0000hQ-Gc for importer@patchew.org; Mon, 29 May 2017 09:12:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKR3-0007ym-Vm for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQy-0002Gt-OY for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53372) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQy-0002E6-I6 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D0C6C056787 for ; Mon, 29 May 2017 13:10:07 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21257187B8; Mon, 29 May 2017 13:10:05 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 237A180DE4; Mon, 29 May 2017 15:09:59 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9D0C6C056787 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9D0C6C056787 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:54 +0200 Message-Id: <20170529130956.20297-8-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 29 May 2017 13:10:07 +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 Subject: [Qemu-devel] [PULL 7/9] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up 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: Ladi Prosek , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ladi Prosek PORT_STAT_C_SUSPEND should be set even on host-initiated wake-up, i.e. on ClearPortFeature(PORT_SUSPEND). Windows is known to not work properly otherwise. Side note, since PORT_ENABLE looks similar and might appear to have the same issue: According to 11.24.2.7.2.2 C_PORT_ENABLE: "This bit is set when the PORT_ENABLE bit changes from one to zero as a result of a Port Error condition (see Section 11.8.1). This bit is not set on any other changes to PORT_ENABLE." Signed-off-by: Ladi Prosek Message-id: 20170522123325.2199-1-lprosek@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/dev-hub.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 47b7519910..e82a6a6c44 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -402,7 +402,20 @@ static void usb_hub_handle_control(USBDevice *dev, USB= Packet *p, port->wPortChange &=3D ~PORT_STAT_C_ENABLE; break; case PORT_SUSPEND: - port->wPortStatus &=3D ~PORT_STAT_SUSPEND; + if (port->wPortStatus & PORT_STAT_SUSPEND) { + port->wPortStatus &=3D ~PORT_STAT_SUSPEND; + + /* + * USB Spec rev2.0 11.24.2.7.2.3 C_PORT_SUSPEND + * "This bit is set on the following transitions: + * - On transition from the Resuming state to the + * SendEOP [sic] state" + * + * Note that this includes both remote wake-up and + * explicit ClearPortFeature(PORT_SUSPEND). + */ + port->wPortChange |=3D PORT_STAT_C_SUSPEND; + } break; case PORT_C_SUSPEND: port->wPortChange &=3D ~PORT_STAT_C_SUSPEND; --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063525878154.18337397558912; Mon, 29 May 2017 06:12:05 -0700 (PDT) Received: from localhost ([::1]:48715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKSq-0000cm-4p for importer@patchew.org; Mon, 29 May 2017 09:12:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKQz-0007v2-No for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQy-0002Go-OA for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45982) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQy-0002EA-Ie for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8E324E4C8 for ; Mon, 29 May 2017 13:10:07 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 285B9187BF; Mon, 29 May 2017 13:10:05 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 366CD80D9D; Mon, 29 May 2017 15:09:59 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A8E324E4C8 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A8E324E4C8 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:55 +0200 Message-Id: <20170529130956.20297-9-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 29 May 2017 13:10:07 +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 Subject: [Qemu-devel] [PULL 8/9] usb: don't wakeup during coldplug 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1452512 Signed-off-by: Gerd Hoffmann Message-id: 20170523084635.20062-1-kraxel@redhat.com --- hw/usb/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/usb/core.c b/hw/usb/core.c index 45fa00c517..241ae66b15 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -98,6 +98,14 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream) USBDevice *dev =3D ep->dev; USBBus *bus =3D usb_bus_from_device(dev); =20 + if (!qdev_hotplug) { + /* + * This is machine init cold plug. No need to wakeup anyone, + * all devices will be reset anyway. And trying to wakeup can + * cause problems due to hitting uninitialized devices. + */ + return; + } if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) { dev->port->ops->wakeup(dev->port); } --=20 2.9.3 From nobody Sun Apr 28 07:25:19 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063526291426.7902785949949; Mon, 29 May 2017 06:12:06 -0700 (PDT) Received: from localhost ([::1]:48717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKSp-0000cx-E5 for importer@patchew.org; Mon, 29 May 2017 09:12:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKQz-0007uz-M6 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQy-0002GX-J2 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQy-0002Dt-Du for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D07EC049D5D for ; Mon, 29 May 2017 13:10:07 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CA42187A9; Mon, 29 May 2017 13:10:05 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 49C7380E19; Mon, 29 May 2017 15:09:59 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8D07EC049D5D Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8D07EC049D5D From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:56 +0200 Message-Id: <20170529130956.20297-10-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 29 May 2017 13:10:07 +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 Subject: [Qemu-devel] [PULL 9/9] ehci: fix frame timer invocation. 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" ehci registers ehci_frame_timer as both timer and bottom half, which turned out to be a bad idea as it can be called as bottom half then while it is running as timer, and it isn't prepared to handle recursive calls. Change the timer func to just schedule the bottom half to avoid this. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1449609 Signed-off-by: Gerd Hoffmann Message-id: 20170519120428.25981-1-kraxel@redhat.com --- hw/usb/hcd-ehci.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index d7361e570f..17c572c55f 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2232,7 +2232,7 @@ static void ehci_update_frindex(EHCIState *ehci, int = uframes) ehci->frindex =3D (ehci->frindex + uframes) % 0x4000; } =20 -static void ehci_frame_timer(void *opaque) +static void ehci_work_bh(void *opaque) { EHCIState *ehci =3D opaque; int need_timer =3D 0; @@ -2324,6 +2324,13 @@ static void ehci_frame_timer(void *opaque) } } =20 +static void ehci_work_timer(void *opaque) +{ + EHCIState *ehci =3D opaque; + + qemu_bh_schedule(ehci->async_bh); +} + static const MemoryRegionOps ehci_mmio_caps_ops =3D { .read =3D ehci_caps_read, .write =3D ehci_caps_write, @@ -2478,8 +2485,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev,= Error **errp) s->ports[i].dev =3D 0; } =20 - s->frame_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_frame_timer, = s); - s->async_bh =3D qemu_bh_new(ehci_frame_timer, s); + s->frame_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s= ); + s->async_bh =3D qemu_bh_new(ehci_work_bh, s); s->device =3D dev; =20 s->vmstate =3D qemu_add_vm_change_state_handler(usb_ehci_vm_state_chan= ge, s); --=20 2.9.3