From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852895; cv=none; d=zohomail.com; s=zohoarc; b=cn8gkQQv6oYIe4EMoBlHIdKQGsn0Ef3+tGDT0M06B6z3J2v1mGQGEkM2RJ3qNR7Z85g4l5aZ6ZriYcwKmAk98h0DdJcwAY56xsrmSSK+ZG8VWY5aVxq2oVKobu/7p6C17ZhR6/ZTJdHZNHk4XjmayUcqfza0M+fb5JYiuY/m/Y4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852895; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=h/Rq0T4qHdj5P4fsrjuVBaKf49W5WppINvxKA/pkbYI=; b=MuaLZPo3GgyhVDUbi/+494FNgbn0A3piycocrn0qmnmzurvPfx2q6oB+5dgBdTnNq3aRKAzGK3nmPBIGOTpIzqmIOynQnoaHBPsyDnFYkhdU233XBvilKe/Vf0GNobCxU4GzN1+WN34LPm+YUYC5ZMrv7TnlULv0H10hVfyY9sA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654852895494643.0013926797335; Fri, 10 Jun 2022 02:21:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346076.571798 (Exim 4.92) (envelope-from ) id 1nzapL-00050W-88; Fri, 10 Jun 2022 09:21:11 +0000 Received: by outflank-mailman (output) from mailman id 346076.571798; Fri, 10 Jun 2022 09:21:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapL-00050P-4m; Fri, 10 Jun 2022 09:21:11 +0000 Received: by outflank-mailman (input) for mailman id 346076; Fri, 10 Jun 2022 09:21:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapK-00050F-J2 for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:10 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a8200d9a-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:07 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-nzXNfmnLMbOoxz3AGOvaGg-1; Fri, 10 Jun 2022 05:21:03 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 42C611C05AB3; Fri, 10 Jun 2022 09:21:02 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D13B42026D64; Fri, 10 Jun 2022 09:21:00 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CC0541800395; Fri, 10 Jun 2022 11:20:43 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a8200d9a-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h/Rq0T4qHdj5P4fsrjuVBaKf49W5WppINvxKA/pkbYI=; b=QvyYpERN/p0ov2jUXygGbS2X6GGDJaIh6HnnOVP2DnkcqqzU3kSyjASboULlUq/rZ6/szm Z8095fEqgAJ1NYI5MEvksbTZitOHFeu3zU3df7BbLkrs1xyGcUIosFdBnvdPImdE1X1BdO 57ev0atq/XWWtjaZoPleX/ahy5nCKVo= X-MC-Unique: nzXNfmnLMbOoxz3AGOvaGg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 01/17] ui/gtk-gl-area: implement GL context destruction Date: Fri, 10 Jun 2022 11:20:27 +0200 Message-Id: <20220610092043.1874654-2-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852897137100001 From: Volker R=C3=BCmelin The counterpart function for gd_gl_area_create_context() is currently empty. Implement the gd_gl_area_destroy_context() function to avoid GL context leaks. Signed-off-by: Volker R=C3=BCmelin Message-Id: <20220605085131.7711-1-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- ui/gtk-gl-area.c | 8 +++++++- ui/trace-events | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index fc5a082eb846..0e20ea031d34 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -201,7 +201,13 @@ QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *= dgc, =20 void gd_gl_area_destroy_context(DisplayGLCtx *dgc, QEMUGLContext ctx) { - /* FIXME */ + GdkGLContext *current_ctx =3D gdk_gl_context_get_current(); + + trace_gd_gl_area_destroy_context(ctx, current_ctx); + if (ctx =3D=3D current_ctx) { + gdk_gl_context_clear_current(); + } + g_clear_object(&ctx); } =20 void gd_gl_area_scanout_texture(DisplayChangeListener *dcl, diff --git a/ui/trace-events b/ui/trace-events index f78b5e66061f..1040ba0f88c7 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -26,6 +26,7 @@ gd_key_event(const char *tab, int gdk_keycode, int qkeyco= de, const char *action) gd_grab(const char *tab, const char *device, const char *reason) "tab=3D%s= , dev=3D%s, reason=3D%s" gd_ungrab(const char *tab, const char *device) "tab=3D%s, dev=3D%s" gd_keymap_windowing(const char *name) "backend=3D%s" +gd_gl_area_destroy_context(void *ctx, void *current_ctx) "ctx=3D%p, curren= t_ctx=3D%p" =20 # vnc-auth-sasl.c # vnc-auth-vencrypt.c --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852903; cv=none; d=zohomail.com; s=zohoarc; b=RUA+j9PIbvI8IixFNk79rTPdr6r5Vt2sNg3p94g+68bXrQ37rO1N28szDlfz9IBx1oOkEdS5Rh4vIqgr5LLByDXcfChEURMzi8+BbwNOXIXiab2MCF32uiMI+VXoOBjuhErTwFV7k7wDNGT0RoovCHy1U21whEoNFtJ6SsHqAL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852903; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wx3J1U/WRMVytLzUKnVNwgCHbbzsbHu+DjsV7mqclmI=; b=A28l+jJUQA4k67Qn3Dwidthqy3dknUKJEbZHjFiWm+FhpGjJl35id2OnW8H6eBNgnS0JTJ47S4QPjSSV8CkC/VMuLvmunmIXQjsN5RWWyjbNYfoPyXVQlyXIB3Wkb/2q4wtH9bckN2cSRQGqW2zdLmEkWCENqPXqfDrIeti/mqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654852903682939.5122625815007; Fri, 10 Jun 2022 02:21:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346080.571836 (Exim 4.92) (envelope-from ) id 1nzapV-0005y7-K5; Fri, 10 Jun 2022 09:21:21 +0000 Received: by outflank-mailman (output) from mailman id 346080.571836; Fri, 10 Jun 2022 09:21:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapV-0005x6-DH; Fri, 10 Jun 2022 09:21:21 +0000 Received: by outflank-mailman (input) for mailman id 346080; Fri, 10 Jun 2022 09:21:19 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapT-0005HE-Ht for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:19 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aec5ad2e-e89e-11ec-bd2c-47488cf2e6aa; Fri, 10 Jun 2022 11:21:18 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-422-L28HogynNE2lkWLrb52jaw-1; Fri, 10 Jun 2022 05:21:05 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BF36B85A583; Fri, 10 Jun 2022 09:21:04 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47D442026D64; Fri, 10 Jun 2022 09:21:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E61E518003A8; Fri, 10 Jun 2022 11:20:43 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: aec5ad2e-e89e-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wx3J1U/WRMVytLzUKnVNwgCHbbzsbHu+DjsV7mqclmI=; b=GAVWfEdkWHAjpcz0EjlFoBuvBbBkCQtb82r5ClL0gqZI+Fvr6RAA3clr1veUQ9/Kq7dWwm wzfrRxHF72Ty9oC0EiESB3kUs7EhT6SaA2bps+Z/xvtwxzqXT34hD8Z/FEW4JWn/lbpno4 HjxAC0NPxlPuzfzzAM8nhig+1S15wo0= X-MC-Unique: L28HogynNE2lkWLrb52jaw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 02/17] ui/gtk-gl-area: create the requested GL context version Date: Fri, 10 Jun 2022 11:20:28 +0200 Message-Id: <20220610092043.1874654-3-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852905176100006 From: Volker R=C3=BCmelin Since about 2018 virglrenderer (commit fa835b0f88 "vrend: don't hardcode context version") tries to open the highest available GL context version. This is done by creating the known GL context versions from the highest to the lowest until (*create_gl_context) returns a context !=3D NULL. This does not work properly with the current QEMU gd_gl_area_create_context() function, because gdk_gl_context_realize() on Wayland creates a version 3.0 legacy context if the requested GL context version can't be created. In order for virglrenderer to find the highest available GL context version, return NULL if the created context version is lower than the requested version. This fixes the following error: QEMU started with -device virtio-vga-gl -display gtk,gl=3Don. Under Wayland, the guest window remains black and the following information can be seen on the host. gl_version 30 - compat profile (qemu:5978): Gdk-WARNING **: 16:19:01.533: gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported. (qemu:5978): Gdk-WARNING **: 16:19:01.537: gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported. (qemu:5978): Gdk-WARNING **: 16:19:01.554: gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported. vrend_renderer_fill_caps: Entering with stale GL error: 1282 To reproduce this error, an OpenGL driver is required on the host that doesn't have the latest OpenGL extensions fully implemented. An example for this is the Intel i965 driver on a Haswell processor. Signed-off-by: Volker R=C3=BCmelin Message-Id: <20220605085131.7711-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- ui/gtk-gl-area.c | 31 ++++++++++++++++++++++++++++++- ui/trace-events | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 0e20ea031d34..2e0129c28cd4 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -170,6 +170,23 @@ void gd_gl_area_switch(DisplayChangeListener *dcl, } } =20 +static int gd_cmp_gl_context_version(int major, int minor, QEMUGLParams *p= arams) +{ + if (major > params->major_ver) { + return 1; + } + if (major < params->major_ver) { + return -1; + } + if (minor > params->minor_ver) { + return 1; + } + if (minor < params->minor_ver) { + return -1; + } + return 0; +} + QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *dgc, QEMUGLParams *params) { @@ -177,8 +194,8 @@ QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *d= gc, GdkWindow *window; GdkGLContext *ctx; GError *err =3D NULL; + int major, minor; =20 - gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); window =3D gtk_widget_get_window(vc->gfx.drawing_area); ctx =3D gdk_window_create_gl_context(window, &err); if (err) { @@ -196,6 +213,18 @@ QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *= dgc, g_clear_object(&ctx); return NULL; } + + gdk_gl_context_make_current(ctx); + gdk_gl_context_get_version(ctx, &major, &minor); + gdk_gl_context_clear_current(); + gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); + + if (gd_cmp_gl_context_version(major, minor, params) =3D=3D -1) { + /* created ctx version < requested version */ + g_clear_object(&ctx); + } + + trace_gd_gl_area_create_context(ctx, params->major_ver, params->minor_= ver); return ctx; } =20 diff --git a/ui/trace-events b/ui/trace-events index 1040ba0f88c7..a922f00e10b4 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -26,6 +26,7 @@ gd_key_event(const char *tab, int gdk_keycode, int qkeyco= de, const char *action) gd_grab(const char *tab, const char *device, const char *reason) "tab=3D%s= , dev=3D%s, reason=3D%s" gd_ungrab(const char *tab, const char *device) "tab=3D%s, dev=3D%s" gd_keymap_windowing(const char *name) "backend=3D%s" +gd_gl_area_create_context(void *ctx, int major, int minor) "ctx=3D%p, majo= r=3D%d, minor=3D%d" gd_gl_area_destroy_context(void *ctx, void *current_ctx) "ctx=3D%p, curren= t_ctx=3D%p" =20 # vnc-auth-sasl.c --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852897; cv=none; d=zohomail.com; s=zohoarc; b=SuOF4WD+pvnfYmyuWIAVGln4iIwOJkPdoogiyxza4RWZk25LZy63UOcAdAzP8a13RyuaibtbUAQZPtqjnT0y1RA0YzkXcNGnBMQZ1dRT/hd3sHqvePpo2g2IUcGZC6p5O5S/dn3V2K1NMQlt/Ft0Tu4Pgmeg4auSP2yk7WI9lkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852897; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qgE0u/psF+5HbFaMEFEBF+1+y1Gn5UXWEs7HICOeN3Q=; b=fefL1yaleR9MWBolLSvcxXkxsUhElw3xXKEo4SpuVlvBhpVnfN3rbzWiNtvJv4jf3A33TZacu1VFGQVKevDCx2chDC8ttIZW/nV9u3+FiNJ5Qpov0rKNq6f8qEhe+UfoVU+ZQwxt91hel/4bmgef/X99yrGxuT3jJhstPtHGkdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654852897580200.70480709918718; Fri, 10 Jun 2022 02:21:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346078.571820 (Exim 4.92) (envelope-from ) id 1nzapQ-0005Y7-RG; Fri, 10 Jun 2022 09:21:16 +0000 Received: by outflank-mailman (output) from mailman id 346078.571820; Fri, 10 Jun 2022 09:21:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapQ-0005Y0-Ms; Fri, 10 Jun 2022 09:21:16 +0000 Received: by outflank-mailman (input) for mailman id 346078; Fri, 10 Jun 2022 09:21:15 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapP-0005HE-NT for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:15 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id abd153a6-e89e-11ec-bd2c-47488cf2e6aa; Fri, 10 Jun 2022 11:21:14 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-326-7e0wnkN_M06CRWN5m6J7UQ-1; Fri, 10 Jun 2022 05:21:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59C6438149A2; Fri, 10 Jun 2022 09:21:08 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F6E52026D64; Fri, 10 Jun 2022 09:21:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 08DD818003BA; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: abd153a6-e89e-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qgE0u/psF+5HbFaMEFEBF+1+y1Gn5UXWEs7HICOeN3Q=; b=Bzpi+YnN2GH1XcdOhcem911qfpf67Z0BoCv+aJl0L6atMbT614KQxxsSyYPc1XQCXo+U36 TJyi0t50p5zDw5MLY0yCfhrIqUfPgGl6MNrYOajH01TeSdzzNkJ2xKpgyfJspLqHYRiQJx JV/6ZOL9jM/cDFxEETOzjBpb3VTeXUY= X-MC-Unique: 7e0wnkN_M06CRWN5m6J7UQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 03/17] ui/cocoa: Fix poweroff request code Date: Fri, 10 Jun 2022 11:20:29 +0200 Message-Id: <20220610092043.1874654-4-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852899174100001 From: Akihiko Odaki Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20220529082508.89097-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 09a62817f2a9..84c84e98fc5e 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -35,6 +35,7 @@ #include "ui/kbd-state.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" +#include "sysemu/runstate-action.h" #include "sysemu/cpu-throttle.h" #include "qapi/error.h" #include "qapi/qapi-commands-block.h" @@ -1290,7 +1291,10 @@ - (void)applicationWillTerminate:(NSNotification *)a= Notification { COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n"); =20 - qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); + with_iothread_lock(^{ + shutdown_action =3D SHUTDOWN_ACTION_POWEROFF; + qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); + }); =20 /* * Sleep here, because returning will cause OSX to kill us --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852902; cv=none; d=zohomail.com; s=zohoarc; b=CcARorV4sL4fn7a3OyJ6w1phcfArIR7Dpa+IxpEUX6c4cmzPWxreBYXA+D5enR3RjjgDKiYUkFjTN5bjXvgB1YH5G017yXJ2AEyp45eQ3w31RlbY+b7ID19vVTUSoFiJyq2X6UjlGV3k0RHlU3k2MIcR8vVSzIH5+WXjlDwWAkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852902; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ufj4JscCAW57Vs14x1NDo2rKzUHuAo6KJO/7yvjLaQA=; b=Yfx/ZiCLbLA62KkKMpe3IdntBvGKF4QFmim02rf9J/oPQY1i9Oqmof3j5r/yLbunESuc92J0T+zEtgjZJsfZS1bdBXexwWbLS4tPQ1a8mRvvXs7TT2ZCGQz3JuAsc/WotJ/n/kPpgcDMptjGEZknTrmVC02NuLeafBVWnmOj6w0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654852902007473.1456861203127; Fri, 10 Jun 2022 02:21:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346079.571831 (Exim 4.92) (envelope-from ) id 1nzapV-0005u8-52; Fri, 10 Jun 2022 09:21:21 +0000 Received: by outflank-mailman (output) from mailman id 346079.571831; Fri, 10 Jun 2022 09:21:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapV-0005u1-1H; Fri, 10 Jun 2022 09:21:21 +0000 Received: by outflank-mailman (input) for mailman id 346079; Fri, 10 Jun 2022 09:21:19 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapT-00050F-18 for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:19 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ae8c6d76-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:18 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498--HdTtoCQPHeme0T9yXjfvg-1; Fri, 10 Jun 2022 05:21:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54D40811E75; Fri, 10 Jun 2022 09:21:13 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13CD1404E4B5; Fri, 10 Jun 2022 09:21:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1FC3F180060A; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ae8c6d76-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ufj4JscCAW57Vs14x1NDo2rKzUHuAo6KJO/7yvjLaQA=; b=hRVA5tBZNrI28pxvTX90+JpQH7jccCsXIFoJhe3Vj2k9PEqbm+JAl6+tQsBadF0QemOp1C AIeeoh1H8DOOY+2onA/KjU+FipsLUTguWCeJrvr2+IdRNzGH3SM8i/s5RnlC69DH0jD0eZ VzJQdRAMjY4LGUVH2Xc+dHngw/374gM= X-MC-Unique: -HdTtoCQPHeme0T9yXjfvg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PULL 04/17] hw/audio/cs4231a: Const'ify global tables Date: Fri, 10 Jun 2022 11:20:30 +0200 Message-Id: <20220610092043.1874654-5-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852903167100003 From: Bernhard Beschow The tables contain spcifically crafted constants for algorithms, so make them immutable. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20220520180109.8224-3-shentey@gmail.com> Signed-off-by: Gerd Hoffmann --- hw/audio/cs4231a.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 0723e3943044..7f17a72a9cb7 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -84,7 +84,7 @@ struct CSState { int transferred; int aci_counter; SWVoiceOut *voice; - int16_t *tab; + const int16_t *tab; }; =20 #define MODE2 (1 << 6) @@ -142,13 +142,13 @@ enum { Capture_Lower_Base_Count }; =20 -static int freqs[2][8] =3D { +static const int freqs[2][8] =3D { { 8000, 16000, 27420, 32000, -1, -1, 48000, 9000 }, { 5510, 11025, 18900, 22050, 37800, 44100, 33075, 6620 } }; =20 /* Tables courtesy http://hazelware.luggle.com/tutorials/mulawcompression.= html */ -static int16_t MuLawDecompressTable[256] =3D +static const int16_t MuLawDecompressTable[256] =3D { -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956, -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764, @@ -184,7 +184,7 @@ static int16_t MuLawDecompressTable[256] =3D 56, 48, 40, 32, 24, 16, 8, 0 }; =20 -static int16_t ALawDecompressTable[256] =3D +static const int16_t ALawDecompressTable[256] =3D { -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852907; cv=none; d=zohomail.com; s=zohoarc; b=CdY5JVTIZ1yRiv53hAsr0lj1YK2rkyN2cTVL493P3d6x7/yE9smCjQGX0rNZWYWnis3rlC8l+miHQFLbRwA9zRCi+R51spNU0eJHzAfwv8ee464R4TOcBYJlveZMnOU+7sfmBtI19GFXAJWYvKCFa7M/bCeApS7XWbfK4q2D8hs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852907; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=70clork2yZyYjdUXKnsu9VZIWlpSX2dH9Nrdwr2C7Z4=; b=C3fHzysHWAlm0fgGvdwOyXl1iTeGNmvj1OoeShBZTIjnLtlNnfBfHplGsXMGZl0uqOEdaT6mt/hMCj/9QkqoaM4f4kKxEs6s3I1f37tuiAlk6KVDOiFS2mArXCPo7xSEqaMhLbnkoSdp5KLDLurtWTOqihEqhdd2MPPhBvFlUxk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654852907153171.80011982929238; Fri, 10 Jun 2022 02:21:47 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346081.571853 (Exim 4.92) (envelope-from ) id 1nzapY-0006W0-7w; Fri, 10 Jun 2022 09:21:24 +0000 Received: by outflank-mailman (output) from mailman id 346081.571853; Fri, 10 Jun 2022 09:21:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapY-0006Vc-1t; Fri, 10 Jun 2022 09:21:24 +0000 Received: by outflank-mailman (input) for mailman id 346081; Fri, 10 Jun 2022 09:21:23 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapW-0005HE-MT for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:22 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b0546c15-e89e-11ec-bd2c-47488cf2e6aa; Fri, 10 Jun 2022 11:21:21 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-x5pcDao3M1ak-miX3-1pIA-1; Fri, 10 Jun 2022 05:21:16 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16D8B1815CFA; Fri, 10 Jun 2022 09:21:16 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 804FD492C3B; Fri, 10 Jun 2022 09:21:15 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3F7DA180060E; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b0546c15-e89e-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=70clork2yZyYjdUXKnsu9VZIWlpSX2dH9Nrdwr2C7Z4=; b=f0xRjmLBpVbhJzur+gat9/hwX6oaX4+HTX754cDHFS2UsQInDzOIG6M4eSNRdJcaV0n/Xj AGpcEYA3iyfldUcmnzwwfeyuaSTwPuUzbqCla5+GH4CVP+N1je80PBvo7B1GEaTfZpBc0Z 6BSP4Q2HFlhG3s/cgzAyO3SvSKuQKPM= X-MC-Unique: x5pcDao3M1ak-miX3-1pIA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/17] hw/usb: Add CanoKey Implementation Date: Fri, 10 Jun 2022 11:20:31 +0200 Message-Id: <20220610092043.1874654-6-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852909221100001 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" This commit added a new emulated device called CanoKey to QEMU. CanoKey implements platform independent features in canokey-core https://github.com/canokeys/canokey-core, and leaves the USB implementation to the platform. In this commit the USB part was implemented in QEMU using QEMU's USB APIs, therefore the emulated CanoKey can communicate with the guest OS using USB. Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- hw/usb/canokey.h | 69 +++++++++++ hw/usb/canokey.c | 300 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 369 insertions(+) create mode 100644 hw/usb/canokey.h create mode 100644 hw/usb/canokey.c diff --git a/hw/usb/canokey.h b/hw/usb/canokey.h new file mode 100644 index 000000000000..24cf30420346 --- /dev/null +++ b/hw/usb/canokey.h @@ -0,0 +1,69 @@ +/* + * CanoKey QEMU device header. + * + * Copyright (c) 2021-2022 Canokeys.org + * Written by Hongren (Zenithal) Zheng + * + * This code is licensed under the Apache-2.0. + */ + +#ifndef CANOKEY_H +#define CANOKEY_H + +#include "hw/qdev-core.h" + +#define TYPE_CANOKEY "canokey" +#define CANOKEY(obj) \ + OBJECT_CHECK(CanoKeyState, (obj), TYPE_CANOKEY) + +/* + * State of Canokey (i.e. hw/canokey.c) + */ + +/* CTRL INTR BULK */ +#define CANOKEY_EP_NUM 3 +/* BULK/INTR IN can be up to 1352 bytes, e.g. get key info */ +#define CANOKEY_EP_IN_BUFFER_SIZE 2048 +/* BULK OUT can be up to 270 bytes, e.g. PIV import cert */ +#define CANOKEY_EP_OUT_BUFFER_SIZE 512 + +typedef enum { + CANOKEY_EP_IN_WAIT, + CANOKEY_EP_IN_READY, + CANOKEY_EP_IN_STALL +} CanoKeyEPState; + +typedef struct CanoKeyState { + USBDevice dev; + + /* IN packets from canokey device loop */ + uint8_t ep_in[CANOKEY_EP_NUM][CANOKEY_EP_IN_BUFFER_SIZE]; + /* + * See canokey_emu_transmit + * + * For large INTR IN, receive multiple data from canokey device loop + * in this case ep_in_size would increase with every call + */ + uint32_t ep_in_size[CANOKEY_EP_NUM]; + /* + * Used in canokey_handle_data + * for IN larger than p->iov.size, we would do multiple handle_data() + * + * The difference between ep_in_pos and ep_in_size: + * We first increase ep_in_size to fill ep_in buffer in device_loop, + * then use ep_in_pos to submit data from ep_in buffer in handle_data + */ + uint32_t ep_in_pos[CANOKEY_EP_NUM]; + CanoKeyEPState ep_in_state[CANOKEY_EP_NUM]; + + /* OUT pointer to canokey recv buffer */ + uint8_t *ep_out[CANOKEY_EP_NUM]; + uint32_t ep_out_size[CANOKEY_EP_NUM]; + /* For large BULK OUT, multiple write to ep_out is needed */ + uint8_t ep_out_buffer[CANOKEY_EP_NUM][CANOKEY_EP_OUT_BUFFER_SIZE]; + + /* Properties */ + char *file; /* canokey-file */ +} CanoKeyState; + +#endif /* CANOKEY_H */ diff --git a/hw/usb/canokey.c b/hw/usb/canokey.c new file mode 100644 index 000000000000..6cb8b7cdb089 --- /dev/null +++ b/hw/usb/canokey.c @@ -0,0 +1,300 @@ +/* + * CanoKey QEMU device implementation. + * + * Copyright (c) 2021-2022 Canokeys.org + * Written by Hongren (Zenithal) Zheng + * + * This code is licensed under the Apache-2.0. + */ + +#include "qemu/osdep.h" +#include + +#include "qemu/module.h" +#include "qapi/error.h" +#include "hw/usb.h" +#include "hw/qdev-properties.h" +#include "desc.h" +#include "canokey.h" + +#define CANOKEY_EP_IN(ep) ((ep) & 0x7F) + +#define CANOKEY_VENDOR_NUM 0x20a0 +#define CANOKEY_PRODUCT_NUM 0x42d2 + +/* + * placeholder, canokey-qemu implements its own usb desc + * Namely we do not use usb_desc_handle_contorl + */ +enum { + STR_MANUFACTURER =3D 1, + STR_PRODUCT, + STR_SERIALNUMBER +}; + +static const USBDescStrings desc_strings =3D { + [STR_MANUFACTURER] =3D "canokeys.org", + [STR_PRODUCT] =3D "CanoKey QEMU", + [STR_SERIALNUMBER] =3D "0" +}; + +static const USBDescDevice desc_device_canokey =3D { + .bcdUSB =3D 0x0, + .bMaxPacketSize0 =3D 16, + .bNumConfigurations =3D 0, + .confs =3D NULL, +}; + +static const USBDesc desc_canokey =3D { + .id =3D { + .idVendor =3D CANOKEY_VENDOR_NUM, + .idProduct =3D CANOKEY_PRODUCT_NUM, + .bcdDevice =3D 0x0100, + .iManufacturer =3D STR_MANUFACTURER, + .iProduct =3D STR_PRODUCT, + .iSerialNumber =3D STR_SERIALNUMBER, + }, + .full =3D &desc_device_canokey, + .high =3D &desc_device_canokey, + .str =3D desc_strings, +}; + + +/* + * libcanokey-qemu.so side functions + * All functions are called from canokey_emu_device_loop + */ +int canokey_emu_stall_ep(void *base, uint8_t ep) +{ + CanoKeyState *key =3D base; + uint8_t ep_in =3D CANOKEY_EP_IN(ep); /* INTR IN has ep 129 */ + key->ep_in_size[ep_in] =3D 0; + key->ep_in_state[ep_in] =3D CANOKEY_EP_IN_STALL; + return 0; +} + +int canokey_emu_set_address(void *base, uint8_t addr) +{ + CanoKeyState *key =3D base; + key->dev.addr =3D addr; + return 0; +} + +int canokey_emu_prepare_receive( + void *base, uint8_t ep, uint8_t *pbuf, uint16_t size) +{ + CanoKeyState *key =3D base; + key->ep_out[ep] =3D pbuf; + key->ep_out_size[ep] =3D size; + return 0; +} + +int canokey_emu_transmit( + void *base, uint8_t ep, const uint8_t *pbuf, uint16_t size) +{ + CanoKeyState *key =3D base; + uint8_t ep_in =3D CANOKEY_EP_IN(ep); /* INTR IN has ep 129 */ + memcpy(key->ep_in[ep_in] + key->ep_in_size[ep_in], + pbuf, size); + key->ep_in_size[ep_in] +=3D size; + key->ep_in_state[ep_in] =3D CANOKEY_EP_IN_READY; + /* + * ready for more data in device loop + * + * Note: this is a quirk for CanoKey CTAPHID + * because it calls multiple emu_transmit in one device_loop + * but w/o data_in it would stuck in device_loop + * This has no side effect for CCID as it is strictly + * OUT then IN transfer + * However it has side effect for Control transfer + */ + if (ep_in !=3D 0) { + canokey_emu_data_in(ep_in); + } + return 0; +} + +uint32_t canokey_emu_get_rx_data_size(void *base, uint8_t ep) +{ + CanoKeyState *key =3D base; + return key->ep_out_size[ep]; +} + +/* + * QEMU side functions + */ +static void canokey_handle_reset(USBDevice *dev) +{ + CanoKeyState *key =3D CANOKEY(dev); + for (int i =3D 0; i !=3D CANOKEY_EP_NUM; ++i) { + key->ep_in_state[i] =3D CANOKEY_EP_IN_WAIT; + key->ep_in_pos[i] =3D 0; + key->ep_in_size[i] =3D 0; + } + canokey_emu_reset(); +} + +static void canokey_handle_control(USBDevice *dev, USBPacket *p, + int request, int value, int index, int length, uint8_t *dat= a) +{ + CanoKeyState *key =3D CANOKEY(dev); + + canokey_emu_setup(request, value, index, length); + + uint32_t dir_in =3D request & DeviceRequest; + if (!dir_in) { + /* OUT */ + if (key->ep_out[0] !=3D NULL) { + memcpy(key->ep_out[0], data, length); + } + canokey_emu_data_out(p->ep->nr, data); + } + + canokey_emu_device_loop(); + + /* IN */ + switch (key->ep_in_state[0]) { + case CANOKEY_EP_IN_WAIT: + p->status =3D USB_RET_NAK; + break; + case CANOKEY_EP_IN_STALL: + p->status =3D USB_RET_STALL; + break; + case CANOKEY_EP_IN_READY: + memcpy(data, key->ep_in[0], key->ep_in_size[0]); + p->actual_length =3D key->ep_in_size[0]; + /* reset state */ + key->ep_in_state[0] =3D CANOKEY_EP_IN_WAIT; + key->ep_in_size[0] =3D 0; + key->ep_in_pos[0] =3D 0; + break; + } +} + +static void canokey_handle_data(USBDevice *dev, USBPacket *p) +{ + CanoKeyState *key =3D CANOKEY(dev); + + uint8_t ep_in =3D CANOKEY_EP_IN(p->ep->nr); + uint8_t ep_out =3D p->ep->nr; + uint32_t in_len; + uint32_t out_pos; + uint32_t out_len; + switch (p->pid) { + case USB_TOKEN_OUT: + usb_packet_copy(p, key->ep_out_buffer[ep_out], p->iov.size); + out_pos =3D 0; + while (out_pos !=3D p->iov.size) { + /* + * key->ep_out[ep_out] set by prepare_receive + * to be a buffer inside libcanokey-qemu.so + * key->ep_out_size[ep_out] set by prepare_receive + * to be the buffer length + */ + out_len =3D MIN(p->iov.size - out_pos, key->ep_out_size[ep_out= ]); + memcpy(key->ep_out[ep_out], + key->ep_out_buffer[ep_out] + out_pos, out_len); + out_pos +=3D out_len; + /* update ep_out_size to actual len */ + key->ep_out_size[ep_out] =3D out_len; + canokey_emu_data_out(ep_out, NULL); + } + break; + case USB_TOKEN_IN: + if (key->ep_in_pos[ep_in] =3D=3D 0) { /* first time IN */ + canokey_emu_data_in(ep_in); + canokey_emu_device_loop(); /* may call transmit multiple times= */ + } + switch (key->ep_in_state[ep_in]) { + case CANOKEY_EP_IN_WAIT: + /* NAK for early INTR IN */ + p->status =3D USB_RET_NAK; + break; + case CANOKEY_EP_IN_STALL: + p->status =3D USB_RET_STALL; + break; + case CANOKEY_EP_IN_READY: + /* submit part of ep_in buffer to USBPacket */ + in_len =3D MIN(key->ep_in_size[ep_in] - key->ep_in_pos[ep_in], + p->iov.size); + usb_packet_copy(p, + key->ep_in[ep_in] + key->ep_in_pos[ep_in], in_len); + key->ep_in_pos[ep_in] +=3D in_len; + /* reset state if all data submitted */ + if (key->ep_in_pos[ep_in] =3D=3D key->ep_in_size[ep_in]) { + key->ep_in_state[ep_in] =3D CANOKEY_EP_IN_WAIT; + key->ep_in_size[ep_in] =3D 0; + key->ep_in_pos[ep_in] =3D 0; + } + break; + } + break; + default: + p->status =3D USB_RET_STALL; + break; + } +} + +static void canokey_realize(USBDevice *base, Error **errp) +{ + CanoKeyState *key =3D CANOKEY(base); + + if (key->file =3D=3D NULL) { + error_setg(errp, "You must provide file=3D/path/to/canokey-file"); + return; + } + + usb_desc_init(base); + + for (int i =3D 0; i !=3D CANOKEY_EP_NUM; ++i) { + key->ep_in_state[i] =3D CANOKEY_EP_IN_WAIT; + key->ep_in_size[i] =3D 0; + key->ep_in_pos[i] =3D 0; + } + + if (canokey_emu_init(key, key->file)) { + error_setg(errp, "canokey can not create or read %s", key->file); + return; + } +} + +static void canokey_unrealize(USBDevice *base) +{ +} + +static Property canokey_properties[] =3D { + DEFINE_PROP_STRING("file", CanoKeyState, file), + DEFINE_PROP_END_OF_LIST(), +}; + +static void canokey_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + USBDeviceClass *uc =3D USB_DEVICE_CLASS(klass); + + uc->product_desc =3D "CanoKey QEMU"; + uc->usb_desc =3D &desc_canokey; + uc->handle_reset =3D canokey_handle_reset; + uc->handle_control =3D canokey_handle_control; + uc->handle_data =3D canokey_handle_data; + uc->handle_attach =3D usb_desc_attach; + uc->realize =3D canokey_realize; + uc->unrealize =3D canokey_unrealize; + dc->desc =3D "CanoKey QEMU"; + device_class_set_props(dc, canokey_properties); + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static const TypeInfo canokey_info =3D { + .name =3D TYPE_CANOKEY, + .parent =3D TYPE_USB_DEVICE, + .instance_size =3D sizeof(CanoKeyState), + .class_init =3D canokey_class_init +}; + +static void canokey_register_types(void) +{ + type_register_static(&canokey_info); +} + +type_init(canokey_register_types) --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852909; cv=none; d=zohomail.com; s=zohoarc; b=LAa08fVyZ0ni7JatulHC77JBYWan6FDA7cmz826jFNI/KNtF7E7HngLB1jb4Wou+rwI1UnvATHLRULgUheGdODz9Rd/2sPQJRGT+4dW8V9SneOMXOhIlnk7YRh52Jav5ZsZ/bYwu8judUFrfSJvJkdqfcaXSC48UbeUzOT6d0eo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852909; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XMFb51C69E0Si128czVwJqlqgwkrMEmsc4JCjQtiyLU=; b=F/i2yRrmKZF3KWDIWp00mfYEJ2FnoD+ZJIbj8rzjOM7VKEv8glwoTJQ7YFECnoQOAiJoSMyspb6nDHrI2exylKSyE5otDDBOzIPqdK8m8TppIAT/Wn6Ge2VufSwhaUvavl7To+b1pTiGFAnlNNmNiPnib+X1OcTvmo9YTzhlJtQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654852909861662.591886865648; Fri, 10 Jun 2022 02:21:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346082.571858 (Exim 4.92) (envelope-from ) id 1nzapY-0006Zu-Qw; Fri, 10 Jun 2022 09:21:24 +0000 Received: by outflank-mailman (output) from mailman id 346082.571858; Fri, 10 Jun 2022 09:21:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapY-0006ZG-GY; Fri, 10 Jun 2022 09:21:24 +0000 Received: by outflank-mailman (input) for mailman id 346082; Fri, 10 Jun 2022 09:21:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapW-00050F-Vf for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:23 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b0d4ffb3-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:21 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-478-kRjVILAqOIK_LUG1oE5DDg-1; Fri, 10 Jun 2022 05:21:17 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 406B1185A79C; Fri, 10 Jun 2022 09:21:17 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66EEC2026D64; Fri, 10 Jun 2022 09:21:16 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5BF6C1800620; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b0d4ffb3-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XMFb51C69E0Si128czVwJqlqgwkrMEmsc4JCjQtiyLU=; b=Xfq+KvCTOPaByo/w/CUyDPG4fOiQYWX6IJ61go8qwKeHWBFs6lKXeSqbizmS0OY2KnQB9g II2PNx8DJNY7EWGg1MxyPlJfZBAtgPVuaWJl9yONFAANc5DMKYyodY3zotMrFCAx60EOvn 1S9sdwhRbFhcbJzo12dRQgyNFz40/OA= X-MC-Unique: kRjVILAqOIK_LUG1oE5DDg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 06/17] hw/usb/canokey: Add trace events Date: Fri, 10 Jun 2022 11:20:32 +0200 Message-Id: <20220610092043.1874654-7-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852911247100004 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- hw/usb/canokey.c | 13 +++++++++++++ hw/usb/trace-events | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/hw/usb/canokey.c b/hw/usb/canokey.c index 6cb8b7cdb089..4a08b1cbd776 100644 --- a/hw/usb/canokey.c +++ b/hw/usb/canokey.c @@ -14,6 +14,7 @@ #include "qapi/error.h" #include "hw/usb.h" #include "hw/qdev-properties.h" +#include "trace.h" #include "desc.h" #include "canokey.h" =20 @@ -66,6 +67,7 @@ static const USBDesc desc_canokey =3D { */ int canokey_emu_stall_ep(void *base, uint8_t ep) { + trace_canokey_emu_stall_ep(ep); CanoKeyState *key =3D base; uint8_t ep_in =3D CANOKEY_EP_IN(ep); /* INTR IN has ep 129 */ key->ep_in_size[ep_in] =3D 0; @@ -75,6 +77,7 @@ int canokey_emu_stall_ep(void *base, uint8_t ep) =20 int canokey_emu_set_address(void *base, uint8_t addr) { + trace_canokey_emu_set_address(addr); CanoKeyState *key =3D base; key->dev.addr =3D addr; return 0; @@ -83,6 +86,7 @@ int canokey_emu_set_address(void *base, uint8_t addr) int canokey_emu_prepare_receive( void *base, uint8_t ep, uint8_t *pbuf, uint16_t size) { + trace_canokey_emu_prepare_receive(ep, size); CanoKeyState *key =3D base; key->ep_out[ep] =3D pbuf; key->ep_out_size[ep] =3D size; @@ -92,6 +96,7 @@ int canokey_emu_prepare_receive( int canokey_emu_transmit( void *base, uint8_t ep, const uint8_t *pbuf, uint16_t size) { + trace_canokey_emu_transmit(ep, size); CanoKeyState *key =3D base; uint8_t ep_in =3D CANOKEY_EP_IN(ep); /* INTR IN has ep 129 */ memcpy(key->ep_in[ep_in] + key->ep_in_size[ep_in], @@ -125,6 +130,7 @@ uint32_t canokey_emu_get_rx_data_size(void *base, uint8= _t ep) */ static void canokey_handle_reset(USBDevice *dev) { + trace_canokey_handle_reset(); CanoKeyState *key =3D CANOKEY(dev); for (int i =3D 0; i !=3D CANOKEY_EP_NUM; ++i) { key->ep_in_state[i] =3D CANOKEY_EP_IN_WAIT; @@ -137,6 +143,7 @@ static void canokey_handle_reset(USBDevice *dev) static void canokey_handle_control(USBDevice *dev, USBPacket *p, int request, int value, int index, int length, uint8_t *dat= a) { + trace_canokey_handle_control_setup(request, value, index, length); CanoKeyState *key =3D CANOKEY(dev); =20 canokey_emu_setup(request, value, index, length); @@ -144,6 +151,7 @@ static void canokey_handle_control(USBDevice *dev, USBP= acket *p, uint32_t dir_in =3D request & DeviceRequest; if (!dir_in) { /* OUT */ + trace_canokey_handle_control_out(); if (key->ep_out[0] !=3D NULL) { memcpy(key->ep_out[0], data, length); } @@ -163,6 +171,7 @@ static void canokey_handle_control(USBDevice *dev, USBP= acket *p, case CANOKEY_EP_IN_READY: memcpy(data, key->ep_in[0], key->ep_in_size[0]); p->actual_length =3D key->ep_in_size[0]; + trace_canokey_handle_control_in(p->actual_length); /* reset state */ key->ep_in_state[0] =3D CANOKEY_EP_IN_WAIT; key->ep_in_size[0] =3D 0; @@ -182,6 +191,7 @@ static void canokey_handle_data(USBDevice *dev, USBPack= et *p) uint32_t out_len; switch (p->pid) { case USB_TOKEN_OUT: + trace_canokey_handle_data_out(ep_out, p->iov.size); usb_packet_copy(p, key->ep_out_buffer[ep_out], p->iov.size); out_pos =3D 0; while (out_pos !=3D p->iov.size) { @@ -226,6 +236,7 @@ static void canokey_handle_data(USBDevice *dev, USBPack= et *p) key->ep_in_size[ep_in] =3D 0; key->ep_in_pos[ep_in] =3D 0; } + trace_canokey_handle_data_in(ep_in, in_len); break; } break; @@ -237,6 +248,7 @@ static void canokey_handle_data(USBDevice *dev, USBPack= et *p) =20 static void canokey_realize(USBDevice *base, Error **errp) { + trace_canokey_realize(); CanoKeyState *key =3D CANOKEY(base); =20 if (key->file =3D=3D NULL) { @@ -260,6 +272,7 @@ static void canokey_realize(USBDevice *base, Error **er= rp) =20 static void canokey_unrealize(USBDevice *base) { + trace_canokey_unrealize(); } =20 static Property canokey_properties[] =3D { diff --git a/hw/usb/trace-events b/hw/usb/trace-events index 9773cb53300d..914ca7166829 100644 --- a/hw/usb/trace-events +++ b/hw/usb/trace-events @@ -345,3 +345,19 @@ usb_serial_set_baud(int bus, int addr, int baud) "dev = %d:%u baud rate %d" usb_serial_set_data(int bus, int addr, int parity, int data, int stop) "de= v %d:%u parity %c, data bits %d, stop bits %d" usb_serial_set_flow_control(int bus, int addr, int index) "dev %d:%u flow = control %d" usb_serial_set_xonxoff(int bus, int addr, uint8_t xon, uint8_t xoff) "dev = %d:%u xon 0x%x xoff 0x%x" + +# canokey.c +canokey_emu_stall_ep(uint8_t ep) "ep %d" +canokey_emu_set_address(uint8_t addr) "addr %d" +canokey_emu_prepare_receive(uint8_t ep, uint16_t size) "ep %d size %d" +canokey_emu_transmit(uint8_t ep, uint16_t size) "ep %d size %d" +canokey_thread_start(void) +canokey_thread_stop(void) +canokey_handle_reset(void) +canokey_handle_control_setup(int request, int value, int index, int length= ) "request 0x%04X value 0x%04X index 0x%04X length 0x%04X" +canokey_handle_control_out(void) +canokey_handle_control_in(int actual_len) "len %d" +canokey_handle_data_out(uint8_t ep_out, uint32_t out_len) "ep %d len %d" +canokey_handle_data_in(uint8_t ep_in, uint32_t in_len) "ep %d len %d" +canokey_realize(void) +canokey_unrealize(void) --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852909; cv=none; d=zohomail.com; s=zohoarc; b=KZVreQlHSGA6YxPZ4UX0OhtFVMBmCdcGp04mfqjO2/rSwPCpNCPa3iydVcanAOwaHBTsr6rT+qnx6JfPL+UwZmB6Vd6SiXkbPj8pggXmc3m9fziTneMo6Fq9l1t2IPePtLarekiKYriwlkyUgyagJJWYoMu5mC+5/l/BSqrjXaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852909; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HZ4OtpGl92/4vTO64NR8x1+3AJHChGb6d9Bq7oyIeKQ=; b=Q4E0DfXTbGNUsffwMOapuUFrs2GcxBJl1HR2m04hCjUN9Vh7s80Ylo5e5J/CMxQ3IrhY1m23wEpZtRtSzIgDQefj3IezNzYzErZ3zbyqLWPZesHBW2qaR+Nn1Lk9ca+DeUmWDD/nAuh32E9CEHQ2k76E0E0ct09kURnl98AAvac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 165485290944235.98866735623744; Fri, 10 Jun 2022 02:21:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346089.571875 (Exim 4.92) (envelope-from ) id 1nzapd-0007N4-9O; Fri, 10 Jun 2022 09:21:29 +0000 Received: by outflank-mailman (output) from mailman id 346089.571875; Fri, 10 Jun 2022 09:21:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapd-0007Me-2J; Fri, 10 Jun 2022 09:21:29 +0000 Received: by outflank-mailman (input) for mailman id 346089; Fri, 10 Jun 2022 09:21:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapc-00050F-48 for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:28 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b3e62ad3-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:27 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-671-nr6FMJL-N2GlKoamkhxmQQ-1; Fri, 10 Jun 2022 05:21:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7FC30101E985; Fri, 10 Jun 2022 09:21:21 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A282C53360; Fri, 10 Jun 2022 09:21:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 83F931800622; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b3e62ad3-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HZ4OtpGl92/4vTO64NR8x1+3AJHChGb6d9Bq7oyIeKQ=; b=FRv0ac14hFJpcIVS3ef2wvDJBMweX5F+F+XiWM1bUQMZAB1z9Znf3r7YlSLoWt/0K6XWFJ 61GoaQMvTPElRSIknGgSZv6u9XFHP9dJYa1ATNS88SKNXIR4KGlD0pLSGrXIvAt/rOijaP dtTNBhKy1D/F7JAEtKUy0+699V1eAJk= X-MC-Unique: nr6FMJL-N2GlKoamkhxmQQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 07/17] meson: Add CanoKey Date: Fri, 10 Jun 2022 11:20:33 +0200 Message-Id: <20220610092043.1874654-8-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852911236100003 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- meson_options.txt | 2 ++ hw/usb/Kconfig | 5 +++++ hw/usb/meson.build | 5 +++++ meson.build | 6 ++++++ scripts/meson-buildoptions.sh | 3 +++ 5 files changed, 21 insertions(+) diff --git a/meson_options.txt b/meson_options.txt index 2de94af03712..0e8197386b99 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -189,6 +189,8 @@ option('spice_protocol', type : 'feature', value : 'aut= o', description: 'Spice protocol support') option('u2f', type : 'feature', value : 'auto', description: 'U2F emulation support') +option('canokey', type : 'feature', value : 'auto', + description: 'CanoKey support') option('usb_redir', type : 'feature', value : 'auto', description: 'libusbredir support') option('l2tpv3', type : 'feature', value : 'auto', diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig index 53f8283ffdc1..ce4f4339763e 100644 --- a/hw/usb/Kconfig +++ b/hw/usb/Kconfig @@ -119,6 +119,11 @@ config USB_U2F default y depends on USB =20 +config USB_CANOKEY + bool + default y + depends on USB + config IMX_USBPHY bool default y diff --git a/hw/usb/meson.build b/hw/usb/meson.build index de853d780dd8..793df42e2127 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -63,6 +63,11 @@ if u2f.found() softmmu_ss.add(when: 'CONFIG_USB_U2F', if_true: [u2f, files('u2f-emulate= d.c')]) endif =20 +# CanoKey +if canokey.found() + softmmu_ss.add(when: 'CONFIG_USB_CANOKEY', if_true: [canokey, files('can= okey.c')]) +endif + # usb redirect if usbredir.found() usbredir_ss =3D ss.source_set() diff --git a/meson.build b/meson.build index 21cd949082dc..0c2e11ff0715 100644 --- a/meson.build +++ b/meson.build @@ -1408,6 +1408,12 @@ if have_system method: 'pkg-config', kwargs: static_kwargs) endif +canokey =3D not_found +if have_system + canokey =3D dependency('canokey-qemu', required: get_option('canokey'), + method: 'pkg-config', + kwargs: static_kwargs) +endif usbredir =3D not_found if not get_option('usb_redir').auto() or have_system usbredir =3D dependency('libusbredirparser-0.5', required: get_option('u= sb_redir'), diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 00ea4d8cd169..1fc1d2e2c362 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -73,6 +73,7 @@ meson_options_help() { printf "%s\n" ' bpf eBPF support' printf "%s\n" ' brlapi brlapi character device driver' printf "%s\n" ' bzip2 bzip2 support for DMG images' + printf "%s\n" ' canokey CanoKey support' printf "%s\n" ' cap-ng cap_ng support' printf "%s\n" ' capstone Whether and how to find the capstone li= brary' printf "%s\n" ' cloop cloop image format support' @@ -204,6 +205,8 @@ _meson_option_parse() { --disable-brlapi) printf "%s" -Dbrlapi=3Ddisabled ;; --enable-bzip2) printf "%s" -Dbzip2=3Denabled ;; --disable-bzip2) printf "%s" -Dbzip2=3Ddisabled ;; + --enable-canokey) printf "%s" -Dcanokey=3Denabled ;; + --disable-canokey) printf "%s" -Dcanokey=3Ddisabled ;; --enable-cap-ng) printf "%s" -Dcap_ng=3Denabled ;; --disable-cap-ng) printf "%s" -Dcap_ng=3Ddisabled ;; --enable-capstone) printf "%s" -Dcapstone=3Denabled ;; --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852921; cv=none; d=zohomail.com; s=zohoarc; b=kKUuuOrV77CtOA5IbndzO7T9yxcgpZhmINSE06nIKN9VUG/R/BuZlBS5qoLQmTKgab7nO5HvvG4Us1wQ1UQtyrtg/n+BxAsJCyRx7tUskDmBO6CyzdobwYbOIKmS+fHR69FIGVsRtQH7AkYAGaBHANW7xLccSJG3Al9sI/t8IRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852921; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Iypp4lhP0vK8zaOIYv4YGS15C6hr5eRaL+NEXu7qlj4=; b=DrBD959dqDHpJ+nXuK1/lA2Zpt6042PLu6pAAQvHRixt++X/N3QaIq94bUjUZzF/BA9n0caToZMUQSG9eMJXebI0CM8SFNaDqGDwfCWCH2SUpusogrkrjyHhCUDtPgxHUpF5K6Ib3wiXACjLdWH4gsRNSHfvZwO/FU1HjxQegIM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654852921763595.29813272683; Fri, 10 Jun 2022 02:22:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346100.571885 (Exim 4.92) (envelope-from ) id 1nzapj-0008Bk-Tz; Fri, 10 Jun 2022 09:21:35 +0000 Received: by outflank-mailman (output) from mailman id 346100.571885; Fri, 10 Jun 2022 09:21:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapj-0008BP-Pj; Fri, 10 Jun 2022 09:21:35 +0000 Received: by outflank-mailman (input) for mailman id 346100; Fri, 10 Jun 2022 09:21:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapi-00050F-Sr for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:35 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b7d14d57-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:33 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-199-ie5LO4fzPN-Uj95gsVZ9kw-1; Fri, 10 Jun 2022 05:21:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E493938149A2; Fri, 10 Jun 2022 09:21:28 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E551C53360; Fri, 10 Jun 2022 09:21:28 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A169F180062F; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b7d14d57-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iypp4lhP0vK8zaOIYv4YGS15C6hr5eRaL+NEXu7qlj4=; b=FhB15AM2+IRbBqhTlkRbxzl+jI7PYkf+c5YybuLkZ4roa7T0rkisLF7ZTXEktPDty0Njfi PX2UQIBmGN5Vbbo7rRX0M5gn3hSunDjgQVD59qMYSZeul5OhbK4yvziAeHZO1GgdOmr1jI +qgmHLjv9cYdSFvOitX8qDUv1nkhF50= X-MC-Unique: ie5LO4fzPN-Uj95gsVZ9kw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 08/17] docs: Add CanoKey documentation Date: Fri, 10 Jun 2022 11:20:34 +0200 Message-Id: <20220610092043.1874654-9-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852923272100001 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- docs/system/device-emulation.rst | 1 + docs/system/devices/canokey.rst | 168 +++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 docs/system/devices/canokey.rst diff --git a/docs/system/device-emulation.rst b/docs/system/device-emulatio= n.rst index 3b729b920d7c..05060060563f 100644 --- a/docs/system/device-emulation.rst +++ b/docs/system/device-emulation.rst @@ -92,3 +92,4 @@ Emulated Devices devices/vhost-user.rst devices/virtio-pmem.rst devices/vhost-user-rng.rst + devices/canokey.rst diff --git a/docs/system/devices/canokey.rst b/docs/system/devices/canokey.= rst new file mode 100644 index 000000000000..169f99b8eb82 --- /dev/null +++ b/docs/system/devices/canokey.rst @@ -0,0 +1,168 @@ +.. _canokey: + +CanoKey QEMU +------------ + +CanoKey [1]_ is an open-source secure key with supports of + +* U2F / FIDO2 with Ed25519 and HMAC-secret +* OpenPGP Card V3.4 with RSA4096, Ed25519 and more [2]_ +* PIV (NIST SP 800-73-4) +* HOTP / TOTP +* NDEF + +All these platform-independent features are in canokey-core [3]_. + +For different platforms, CanoKey has different implementations, +including both hardware implementions and virtual cards: + +* CanoKey STM32 [4]_ +* CanoKey Pigeon [5]_ +* (virt-card) CanoKey USB/IP +* (virt-card) CanoKey FunctionFS + +In QEMU, yet another CanoKey virt-card is implemented. +CanoKey QEMU exposes itself as a USB device to the guest OS. + +With the same software configuration as a hardware key, +the guest OS can use all the functionalities of a secure key as if +there was actually an hardware key plugged in. + +CanoKey QEMU provides much convenience for debuging: + +* libcanokey-qemu supports debuging output thus developers can + inspect what happens inside a secure key +* CanoKey QEMU supports trace event thus event +* QEMU USB stack supports pcap thus USB packet between the guest + and key can be captured and analysed + +Then for developers: + +* For developers on software with secure key support (e.g. FIDO2, OpenPGP), + they can see what happens inside the secure key +* For secure key developers, USB packets between guest OS and CanoKey + can be easily captured and analysed + +Also since this is a virtual card, it can be easily used in CI for testing +on code coping with secure key. + +Building +=3D=3D=3D=3D=3D=3D=3D=3D + +libcanokey-qemu is required to use CanoKey QEMU. + +.. code-block:: shell + + git clone https://github.com/canokeys/canokey-qemu + mkdir canokey-qemu/build + pushd canokey-qemu/build + +If you want to install libcanokey-qemu in a different place, +add ``-DCMAKE_INSTALL_PREFIX=3D/path/to/your/place`` to cmake below. + +.. code-block:: shell + + cmake .. + make + make install # may need sudo + popd + +Then configuring and building: + +.. code-block:: shell + + # depending on your env, lib/pkgconfig can be lib64/pkgconfig + export PKG_CONFIG_PATH=3D/path/to/your/place/lib/pkgconfig:$PKG_CONFIG= _PATH + ./configure --enable-canokey && make + +Using CanoKey QEMU +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +CanoKey QEMU stores all its data on a file of the host specified by the ar= gument +when invoking qemu. + +.. parsed-literal:: + + |qemu_system| -usb -device canokey,file=3D$HOME/.canokey-file + +Note: you should keep this file carefully as it may contain your private k= ey! + +The first time when the file is used, it is created and initialized by Can= oKey, +afterwards CanoKey QEMU would just read this file. + +After the guest OS boots, you can check that there is a USB device. + +For example, If the guest OS is an Linux machine. You may invoke lsusb +and find CanoKey QEMU there: + +.. code-block:: shell + + $ lsusb + Bus 001 Device 002: ID 20a0:42d4 Clay Logic CanoKey QEMU + +You may setup the key as guided in [6]_. The console for the key is at [7]= _. + +Debuging +=3D=3D=3D=3D=3D=3D=3D=3D + +CanoKey QEMU consists of two parts, ``libcanokey-qemu.so`` and ``canokey.c= ``, +the latter of which resides in QEMU. The former provides core functionality +of a secure key while the latter provides platform-dependent functions: +USB packet handling. + +If you want to trace what happens inside the secure key, when compiling +libcanokey-qemu, you should add ``-DQEMU_DEBUG_OUTPUT=3DON`` in cmake comm= and +line: + +.. code-block:: shell + + cmake .. -DQEMU_DEBUG_OUTPUT=3DON + +If you want to trace events happened in canokey.c, use + +.. parsed-literal:: + + |qemu_system| --trace "canokey_*" \\ + -usb -device canokey,file=3D$HOME/.canokey-file + +If you want to capture USB packets between the guest and the host, you can: + +.. parsed-literal:: + + |qemu_system| -usb -device canokey,file=3D$HOME/.canokey-file,pcap=3Dk= ey.pcap + +Limitations +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Currently libcanokey-qemu.so has dozens of global variables as it was orig= inally +designed for embedded systems. Thus one qemu instance can not have +multiple CanoKey QEMU running, namely you can not + +.. parsed-literal:: + + |qemu_system| -usb -device canokey,file=3D$HOME/.canokey-file \\ + -device canokey,file=3D$HOME/.canokey-file2 + +Also, there is no lock on canokey-file, thus two CanoKey QEMU instance +can not read one canokey-file at the same time. + +Another limitation is that this device is not compatible with ``qemu-xhci`= `, +in that this device would hang when there are FIDO2 packets (traffic on +interrupt endpoints). If you do not use FIDO2 then it works as intended, +but for full functionality you should use old uhci/ehci bus and attach can= okey +to it, for example + +.. parsed-literal:: + + |qemu_system| -device piix3-usb-uhci,id=3Duhci -device canokey,bus=3Duh= ci.0 + +References +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +.. [1] ``_ +.. [2] `= `_ +.. [3] ``_ +.. [4] ``_ +.. [5] ``_ +.. [6] ``_ +.. [7] ``_ --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853020; cv=none; d=zohomail.com; s=zohoarc; b=dwsem66Ek1n/zQUBwfOIyeOPU/p6cEgR8l6LdbPqWvPV/0B+f5cOvTu7o26uTQznUE9BOe7FHsvAbYkdPcLhNokKcRFbi4xOT/YcVyy2SfFibLO73f8BfliD1XnRTK9WPIGDx26ejPg2RSGJUz56eg3J61BD+ByFZ8KN5824lxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853020; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TqkIe5B5GmtLHYDEQNksBwY0pKybp1zEh7xnID9ieAU=; b=oAplMGfVau+1N6KwnR/7fsqVgDqpPtYIXGjZq7/9gWltp9Bgl700uwcamzSePHoZs4hsY06MCkKzAMpryFUMtjxJijWXSi6KXhe1VY0+VTKdTs1SD2IWeOz+e/6DS5IGBaVrsXLeShuB4fRjqdandkA66ijuhtePhTa2WoJsDX0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853020968377.40915026415325; Fri, 10 Jun 2022 02:23:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346123.571919 (Exim 4.92) (envelope-from ) id 1nzarP-0002nE-VQ; Fri, 10 Jun 2022 09:23:19 +0000 Received: by outflank-mailman (output) from mailman id 346123.571919; Fri, 10 Jun 2022 09:23:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarP-0002n5-SI; Fri, 10 Jun 2022 09:23:19 +0000 Received: by outflank-mailman (input) for mailman id 346123; Fri, 10 Jun 2022 09:23:19 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapk-00050F-4w for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:36 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b7e64093-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:33 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-LsraNzfaMNKg3TlTAuhYSQ-1; Fri, 10 Jun 2022 05:21:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 012A12949BC0; Fri, 10 Jun 2022 09:21:27 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A00221121314; Fri, 10 Jun 2022 09:21:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B63451800630; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b7e64093-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TqkIe5B5GmtLHYDEQNksBwY0pKybp1zEh7xnID9ieAU=; b=OQXk/Vm0GieqbuUFeqMSD773bVNA63dESqRmao+niPl3IWghseXVloRfZ8tpv2EHIpwjYK Dhe/nSX3aVrHUYMTKWynglW18pnPYj5idswfdwGLzIaTlg3f4cW2M2bnun8sH9eQkzflTw 5Glpkh/Lrh6ti2hvMGUScnSTLaUvpec= X-MC-Unique: LsraNzfaMNKg3TlTAuhYSQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/17] docs/system/devices/usb: Add CanoKey to USB devices examples Date: Fri, 10 Jun 2022 11:20:35 +0200 Message-Id: <20220610092043.1874654-10-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853021722100002 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- docs/system/devices/usb.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/system/devices/usb.rst b/docs/system/devices/usb.rst index afb7d6c2268d..872d9167589b 100644 --- a/docs/system/devices/usb.rst +++ b/docs/system/devices/usb.rst @@ -199,6 +199,10 @@ option or the ``device_add`` monitor command. Availabl= e devices are: ``u2f-{emulated,passthru}`` Universal Second Factor device =20 +``canokey`` + An Open-source Secure Key implementing FIDO2, OpenPGP, PIV and more. + For more information, see :ref:`canokey`. + Physical port addressing ^^^^^^^^^^^^^^^^^^^^^^^^ =20 --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853016; cv=none; d=zohomail.com; s=zohoarc; b=NL1iW/g3NBALaKvVmS79VQq1ne1QA1Lk/YkrL7EseTrmRusClzcnCRocrukaLEh/mRIA3kQ/9a7p07TPeRxSlwqRESOvyp0ZGI46SSlfWk4heMGBcprwpJPEzQCu3V8/6o0Rcst0GFW4nX/XPnJS+jfLKoAuNSboqeAGq3Cqnp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853016; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o6vOmc4r9ui1udWdegwNJ5alAMO2M7wcYKQqptdB7KA=; b=LsYpI57Anhe6dwJueLADmXpERLz3rsEpvAIEx95vEDHzwR9qq2R86YO4JJZvVV59/b2ti6qRRJ8MJwDzpj9LtaP5QH73H6lr3zX9XnwVpEeDyOPtjKoVAHyheXjt68xv1b0Qw8D6xEJJOx91B2kB/KvS3r1QBQzcmw1WL2SBaZI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853016375157.93219047607602; Fri, 10 Jun 2022 02:23:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346119.571908 (Exim 4.92) (envelope-from ) id 1nzarI-0002PU-Lu; Fri, 10 Jun 2022 09:23:12 +0000 Received: by outflank-mailman (output) from mailman id 346119.571908; Fri, 10 Jun 2022 09:23:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarI-0002PN-Ii; Fri, 10 Jun 2022 09:23:12 +0000 Received: by outflank-mailman (input) for mailman id 346119; Fri, 10 Jun 2022 09:23:11 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapn-0005HE-9H for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:39 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ba6716f7-e89e-11ec-bd2c-47488cf2e6aa; Fri, 10 Jun 2022 11:21:38 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-271-OrbZa1CaOsm0-icMqDwwwA-1; Fri, 10 Jun 2022 05:21:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 17259101AA47; Fri, 10 Jun 2022 09:21:31 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6582C53360; Fri, 10 Jun 2022 09:21:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CCF041800634; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ba6716f7-e89e-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852896; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o6vOmc4r9ui1udWdegwNJ5alAMO2M7wcYKQqptdB7KA=; b=ggc3Vb20CnJEwmYZyMXpt+RhDFcZ7y7166LHQNnfbJ9/0rWwye2O+KStzjqyqQBSZfx7nB Nb3U4oZoeBcIVhC0+AbaR+QT1My13biDuE0CY/7KE/e9ypIxtFIl3DwUt20dWLc06Jo6hb fk/Mg/qFAEHf9tC+WLe7vBeJFYDq/5A= X-MC-Unique: OrbZa1CaOsm0-icMqDwwwA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/17] MAINTAINERS: add myself as CanoKey maintainer Date: Fri, 10 Jun 2022 11:20:36 +0200 Message-Id: <20220610092043.1874654-11-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853017837100001 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5580a36b68e1..4ae9d707d5b0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2425,6 +2425,14 @@ F: hw/intc/s390_flic*.c F: include/hw/s390x/s390_flic.h L: qemu-s390x@nongnu.org =20 +CanoKey +M: Hongren (Zenithal) Zheng +S: Maintained +R: Canokeys.org +F: hw/usb/canokey.c +F: hw/usb/canokey.h +F: docs/system/devices/canokey.rst + Subsystems ---------- Overall Audio backends --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853021; cv=none; d=zohomail.com; s=zohoarc; b=nNVjHm7N0mJ55oftqKAJZU3ZNuCtMCwu4Q/l9i6xY0plEREn0+vQPVLF+WYvbK0keBkENWL6TKyt/9fIuQLc/gU6AEGSo3TxtLOxAaN9A02tbMV6wVlaGQAsVYeFrntWlkZmBKnhSeOs4QkMA2GSZSLMaFiPIOY+H4pczWDHY38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853021; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=obSiKgR2g439N1NCymTkGuD5ZtC+AWQDUPf1CsA55V4=; b=LtMHDFOIxKhyKKQiIpXZEc2GEDWfgosD50FKbLkW4FI4h+mmt73eiS+Cd4qOz39bQslU0YBNYtg8r9tZL+3xcWVEKL5tK322QrKryUa8sZo8RDr4yFaJYPXc3l5e+kYfAWX0G+eFbiiFjqibEf0Wkgzjbtco/PDVOURSTm8oKNs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853021116999.0602171964695; Fri, 10 Jun 2022 02:23:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346125.571923 (Exim 4.92) (envelope-from ) id 1nzarQ-0002qw-Ca; Fri, 10 Jun 2022 09:23:20 +0000 Received: by outflank-mailman (output) from mailman id 346125.571923; Fri, 10 Jun 2022 09:23:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarQ-0002pl-4x; Fri, 10 Jun 2022 09:23:20 +0000 Received: by outflank-mailman (input) for mailman id 346125; Fri, 10 Jun 2022 09:23:19 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapp-00050F-C5 for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:41 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bac577b5-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:39 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-635-IJrpUXNAP_GdSGR8Vldk4g-1; Fri, 10 Jun 2022 05:21:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DFB9A811E75; Fri, 10 Jun 2022 09:21:30 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D1FC1121314; Fri, 10 Jun 2022 09:21:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E3E72180063C; Fri, 10 Jun 2022 11:20:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bac577b5-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=obSiKgR2g439N1NCymTkGuD5ZtC+AWQDUPf1CsA55V4=; b=A8KHt3jE/UCiWkmdPhylJnug3wxHG0GMdarfFZU0I97BTVe7IGgTZ+sEiBMtrSrwiFt9gm caMH7vKaomn22N2eDz69fU+QY1oNchh11G6RuXuGVAMymwZ7f9aoCov9XqSH/1xLx/zAvp LXAU/dFRIDCCGr+kQICBCYOSXi+kXFE= X-MC-Unique: IJrpUXNAP_GdSGR8Vldk4g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arnout Engelen Subject: [PULL 11/17] hw/usb/hcd-ehci: fix writeback order Date: Fri, 10 Jun 2022 11:20:37 +0200 Message-Id: <20220610092043.1874654-12-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853021714100001 Content-Type: text/plain; charset="utf-8" From: Arnout Engelen The 'active' bit passes control over a qTD between the guest and the controller: set to 1 by guest to enable execution by the controller, and the controller sets it to '0' to hand back control to the guest. ehci_state_writeback write two dwords to main memory using DMA: the third dword of the qTD (containing dt, total bytes to transfer, cpage, cerr and status) and the fourth dword of the qTD (containing the offset). This commit makes sure the fourth dword is written before the third, avoiding a race condition where a new offset written into the qTD by the guest after it observed the status going to go to '0' gets overwritten by a 'late' DMA writeback of the previous offset. This race condition could lead to 'cpage out of range (5)' errors, and reproduced by: ./qemu-system-x86_64 -enable-kvm -bios $SEABIOS/bios.bin -m 4096 -device us= b-ehci -blockdev driver=3Dfile,read-only=3Don,filename=3D/home/aengelen/Dow= nloads/openSUSE-Tumbleweed-DVD-i586-Snapshot20220428-Media.iso,node-name=3D= iso -device usb-storage,drive=3Diso,bootindex=3D0 -chardev pipe,id=3Dshell,= path=3D/tmp/pipe -device virtio-serial -device virtconsole,chardev=3Dshell = -device virtio-rng-pci -serial mon:stdio -nographic (press a key, select 'Installation' (2), and accept the default values. On my machine the 'cpage out of range' is reproduced while loading the Linux Kernel about once per 7 attempts. With the fix in this commit it no longer fails) This problem was previously reported as a seabios problem in https://mail.coreboot.org/hyperkitty/list/seabios@seabios.org/thread/OUTHT5= ISSQJGXPNTUPY3O5E5EPZJCHM3/ and as a nixos CI build failure in https://github.com/NixOS/nixpkgs/issues/170803 Signed-off-by: Arnout Engelen Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 33a8a377bd95..d4da8dcb8d15 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2011,7 +2011,10 @@ static int ehci_state_writeback(EHCIQueue *q) ehci_trace_qtd(q, NLPTR_GET(p->qtdaddr), (EHCIqtd *) &q->qh.next_qtd); qtd =3D (uint32_t *) &q->qh.next_qtd; addr =3D NLPTR_GET(p->qtdaddr); - put_dwords(q->ehci, addr + 2 * sizeof(uint32_t), qtd + 2, 2); + /* First write back the offset */ + put_dwords(q->ehci, addr + 3 * sizeof(uint32_t), qtd + 3, 1); + /* Then write back the token, clearing the 'active' bit */ + put_dwords(q->ehci, addr + 2 * sizeof(uint32_t), qtd + 2, 1); ehci_free_packet(p); =20 /* --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853033; cv=none; d=zohomail.com; s=zohoarc; b=NZKQsMkOtSn/bbNTlOvVPiSfqdtW7Fxp/fobDcKTWVRSHdc1ah5HTzf8Ra/XpnJ5IXtquOnFosvdUGAK1TJnMvCFITjfYe4cx+7b+Y2uWpq8QrahhqK1p3r9VItXEhWFkX2bcfSB9oCatgPGrgBmTNo4ydVnTOeHxM36PS3wyW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853033; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZStqjDDMtLMpDsz58F8O29JWAJ6F3RkNGXfWxICk7zU=; b=nGOk/Rb9ahy23Vk/DF1VTEiX+tkpiFFQj1DNLsXZKwNCk6jNOgLL6W5zwaEcQk3GeSd/XZtX5xnQrPefLTL56ik/dIOFLkSXHPsRXPS16KscMAcl+uSeszBWs+uaEtzjYHZ+QwbOsHyFB7RxadyzylhLg3cqU78JA2hSAdDcJ1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853033923331.8445136025059; Fri, 10 Jun 2022 02:23:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346136.571940 (Exim 4.92) (envelope-from ) id 1nzarc-0003mm-Nm; Fri, 10 Jun 2022 09:23:32 +0000 Received: by outflank-mailman (output) from mailman id 346136.571940; Fri, 10 Jun 2022 09:23:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarc-0003mS-Kw; Fri, 10 Jun 2022 09:23:32 +0000 Received: by outflank-mailman (input) for mailman id 346136; Fri, 10 Jun 2022 09:23:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzaps-00050F-Cg for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:44 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bd0a61dc-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:42 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-640-igR9nvgvPSaAq0gbeel8tQ-1; Fri, 10 Jun 2022 05:21:37 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E3CE0811E75; Fri, 10 Jun 2022 09:21:36 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97F71492C3B; Fri, 10 Jun 2022 09:21:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 07514180079D; Fri, 10 Jun 2022 11:20:45 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bd0a61dc-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZStqjDDMtLMpDsz58F8O29JWAJ6F3RkNGXfWxICk7zU=; b=QJzN87mIxhMgyH8BfBH31cgaeo22BmpSuZjKyl3DusL2/J6KxwPzWgGPorFuFjtKvlz3f8 LTUnERHgV9+l2GTRwZDh64dlwK6KvqykrGskATpBewReBq5KPfHyEs6Qn2pwJXB/DEk+0k vUgtw44FHaBT/9yboROB2MyOnoiA1sk= X-MC-Unique: igR9nvgvPSaAq0gbeel8tQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Joelle van Dyne Subject: [PULL 12/17] usbredir: avoid queuing hello packet on snapshot restore Date: Fri, 10 Jun 2022 11:20:38 +0200 Message-Id: <20220610092043.1874654-13-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853035835100001 Content-Type: text/plain; charset="utf-8" From: Joelle van Dyne When launching QEMU with "-loadvm", usbredir_create_parser() should avoid setting up the hello packet (just as with "-incoming". On the latest version of libusbredir, usbredirparser_unserialize() will return error if the parser is not "pristine." Signed-off-by: Joelle van Dyne Message-Id: <20220507041850.98716-1-j@getutm.app> Signed-off-by: Gerd Hoffmann --- hw/usb/redirect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index fd7df599bc0b..1bd30efc3ef0 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *de= v) } #endif =20 - if (runstate_check(RUN_STATE_INMIGRATE)) { + if (runstate_check(RUN_STATE_INMIGRATE) || + runstate_check(RUN_STATE_PRELAUNCH)) { flags |=3D usbredirparser_fl_no_hello; } usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE, --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853042; cv=none; d=zohomail.com; s=zohoarc; b=RH+SGpA5GtMNxHsk+6sdlqFBc5D7kT2dTbZReElmz1zdonMO0NXh7zvHRwyIG+qxiFvLGVJ/CIwAOnniMCe0l+T6N14HkEeh4bXpksiqDJIF8oL3ZaTGUALmmoaNBgwC24lp0SC2z6SkK4Zk1kEg/QG14gHrePgSQWYDsp8Cqns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853042; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nK8ui8MGXo28dreQTzjS6bbhtNnN1TEyDDyCd/Q1Dgo=; b=RoPN8MSE9beiudvpn2390gTnY2X8ndq116vcXHbfyYEUYYZbVxzGaz/Yhdfe2+Y3RP9ffhQQwfxAP9zywgyYFZuDuQIzkN/jRneTPIKbT9UU1Sa2f0dXMirSAin3EcpGHJ/RyxeKisZ7/bhqySG/PdntDK6Q1nkIgHpxPeI93cw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853042903457.12576548931986; Fri, 10 Jun 2022 02:24:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346171.571979 (Exim 4.92) (envelope-from ) id 1nzarn-0005Hc-AG; Fri, 10 Jun 2022 09:23:43 +0000 Received: by outflank-mailman (output) from mailman id 346171.571979; Fri, 10 Jun 2022 09:23:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarn-0005Fh-1e; Fri, 10 Jun 2022 09:23:43 +0000 Received: by outflank-mailman (input) for mailman id 346171; Fri, 10 Jun 2022 09:23:41 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapo-00050F-C0 for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:40 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ba55ec05-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:38 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-227-ruaRDZJFNMeO8ESM-paIQA-1; Fri, 10 Jun 2022 05:21:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 21ADC101E169; Fri, 10 Jun 2022 09:21:33 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B77D42026985; Fri, 10 Jun 2022 09:21:32 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1F29218007A4; Fri, 10 Jun 2022 11:20:45 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ba55ec05-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852896; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nK8ui8MGXo28dreQTzjS6bbhtNnN1TEyDDyCd/Q1Dgo=; b=BSTLxGAglSRdxtqPn9q3bMZgN5k6DfpdBu7pyPvmGZilsNFAJPa2OZ/ZHO6oVMj1aUgpow UXh6SFnXWS9ohLC3BX63qahD1K5iSmS4oq0DiGr4BHzrhXaYQvHtLLseF3vIQGYhb2GuWT 8Dm4cdaoEVz/DZ4jKuLALFZ+L/kRgEs= X-MC-Unique: ruaRDZJFNMeO8ESM-paIQA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Dongwon Kim , Vivek Kasireddy Subject: [PULL 13/17] virtio-gpu: update done only on the scanout associated with rect Date: Fri, 10 Jun 2022 11:20:39 +0200 Message-Id: <20220610092043.1874654-14-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853043869100001 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim It only needs to update the scanouts containing the rect area coming with the resource-flush request from the guest. Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim Message-Id: <20220505214030.4261-1-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index cd4a56056fd9..55c6dd576318 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -514,6 +514,9 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g, for (i =3D 0; i < g->parent_obj.conf.max_outputs; i++) { scanout =3D &g->parent_obj.scanout[i]; if (scanout->resource_id =3D=3D res->resource_id && + rf.r.x >=3D scanout->x && rf.r.y >=3D scanout->y && + rf.r.x + rf.r.width <=3D scanout->x + scanout->width && + rf.r.y + rf.r.height <=3D scanout->y + scanout->height && console_has_gl(scanout->con)) { dpy_gl_update(scanout->con, 0, 0, scanout->width, scanout->height); --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853044; cv=none; d=zohomail.com; s=zohoarc; b=L3twA6bU38cD9HApPn6EHwnyp1iLQiDmqpflY4LEKbdy72vHTrCpKyifc6B7z6SD7cLpmY6cZC1ZfiE67/18RJYLx0UN1WNjqFm9odZ6MpRI8qVqb4SZjZrzgLhTPyNUCyLB14rxW4Im1p3Ty6AcScbiGtjDqCpcAuU89762fG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853044; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fwmfDIy30DgQ0R3WnGybG8E0iUm2x/In8Zs4SMv8ftc=; b=Uc5pzL4hMeOkjiuFdRPEJ7c5TKWnYm474A3RA92NGkrlDv1CKaulv/dQEUOvy2Xzn1UYpZnQeoygozVF3XtTLwgXEU9DHyY0fnrQfX77Vx0OWHwOudz0pSmKCGdhBO7C3CvYupH6qyxOsF7t+e5IAtfsqhTSm3/V+JGnITj6gbc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853044698584.4562503122656; Fri, 10 Jun 2022 02:24:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346168.571974 (Exim 4.92) (envelope-from ) id 1nzarm-0005Cb-OX; Fri, 10 Jun 2022 09:23:42 +0000 Received: by outflank-mailman (output) from mailman id 346168.571974; Fri, 10 Jun 2022 09:23:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarm-0005B6-Je; Fri, 10 Jun 2022 09:23:42 +0000 Received: by outflank-mailman (input) for mailman id 346168; Fri, 10 Jun 2022 09:23:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapu-0005HE-Do for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:46 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id be6c05f9-e89e-11ec-bd2c-47488cf2e6aa; Fri, 10 Jun 2022 11:21:44 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-593-4WEDaO-dNm6StV-sVKdKFw-1; Fri, 10 Jun 2022 05:21:40 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B364880159B; Fri, 10 Jun 2022 09:21:39 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCC85492C3B; Fri, 10 Jun 2022 09:21:38 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3CE881800864; Fri, 10 Jun 2022 11:20:45 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: be6c05f9-e89e-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fwmfDIy30DgQ0R3WnGybG8E0iUm2x/In8Zs4SMv8ftc=; b=T0cXmCTHF4/eaV9iQFk01HlN/RT98TqSJJqrKtAqHJcSR7/Fuwq4IEWOlgQR8E2PEfyK9z x9xfLF2KxYACrgZVBPcS+y5j94aB+Co+z7QVXgfj7C7D4X2FgRerU6cWfd7o9wUUOefeAw Qi3dlmfhfAIMYa386XeedYpFuzNlvGI= X-MC-Unique: 4WEDaO-dNm6StV-sVKdKFw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 14/17] ui: move 'pc-bios/keymaps' to 'ui/keymaps' Date: Fri, 10 Jun 2022 11:20:40 +0200 Message-Id: <20220610092043.1874654-15-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853045908100003 From: Daniel P. Berrang=C3=A9 The 'keymaps' directory contents is nothing to do with the firmware blobs. The 'pc-bios/keymaps' directory appears to have been used previously as a convenience for getting the files installed into a subdir of the firmware install dir. This install time arrangement does not need to be reflected in the source tree arrangement. These keymaps logically belong with the UI code. Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20220426160150.812530-1-berrange@redhat.com> Signed-off-by: Gerd Hoffmann --- pc-bios/meson.build | 1 - {pc-bios =3D> ui}/keymaps/ar | 0 {pc-bios =3D> ui}/keymaps/bepo | 0 {pc-bios =3D> ui}/keymaps/cz | 0 {pc-bios =3D> ui}/keymaps/da | 0 {pc-bios =3D> ui}/keymaps/de | 0 {pc-bios =3D> ui}/keymaps/de-ch | 0 {pc-bios =3D> ui}/keymaps/en-gb | 0 {pc-bios =3D> ui}/keymaps/en-us | 0 {pc-bios =3D> ui}/keymaps/es | 0 {pc-bios =3D> ui}/keymaps/et | 0 {pc-bios =3D> ui}/keymaps/fi | 0 {pc-bios =3D> ui}/keymaps/fo | 0 {pc-bios =3D> ui}/keymaps/fr | 0 {pc-bios =3D> ui}/keymaps/fr-be | 0 {pc-bios =3D> ui}/keymaps/fr-ca | 0 {pc-bios =3D> ui}/keymaps/fr-ch | 0 {pc-bios =3D> ui}/keymaps/hr | 0 {pc-bios =3D> ui}/keymaps/hu | 0 {pc-bios =3D> ui}/keymaps/is | 0 {pc-bios =3D> ui}/keymaps/it | 0 {pc-bios =3D> ui}/keymaps/ja | 0 {pc-bios =3D> ui}/keymaps/lt | 0 {pc-bios =3D> ui}/keymaps/lv | 0 {pc-bios =3D> ui}/keymaps/meson.build | 0 {pc-bios =3D> ui}/keymaps/mk | 0 {pc-bios =3D> ui}/keymaps/nl | 0 {pc-bios =3D> ui}/keymaps/no | 0 {pc-bios =3D> ui}/keymaps/pl | 0 {pc-bios =3D> ui}/keymaps/pt | 0 {pc-bios =3D> ui}/keymaps/pt-br | 0 {pc-bios =3D> ui}/keymaps/ru | 0 {pc-bios =3D> ui}/keymaps/sl | 0 {pc-bios =3D> ui}/keymaps/sv | 0 {pc-bios =3D> ui}/keymaps/th | 0 {pc-bios =3D> ui}/keymaps/tr | 0 ui/meson.build | 1 + 37 files changed, 1 insertion(+), 1 deletion(-) rename {pc-bios =3D> ui}/keymaps/ar (100%) rename {pc-bios =3D> ui}/keymaps/bepo (100%) rename {pc-bios =3D> ui}/keymaps/cz (100%) rename {pc-bios =3D> ui}/keymaps/da (100%) rename {pc-bios =3D> ui}/keymaps/de (100%) rename {pc-bios =3D> ui}/keymaps/de-ch (100%) rename {pc-bios =3D> ui}/keymaps/en-gb (100%) rename {pc-bios =3D> ui}/keymaps/en-us (100%) rename {pc-bios =3D> ui}/keymaps/es (100%) rename {pc-bios =3D> ui}/keymaps/et (100%) rename {pc-bios =3D> ui}/keymaps/fi (100%) rename {pc-bios =3D> ui}/keymaps/fo (100%) rename {pc-bios =3D> ui}/keymaps/fr (100%) rename {pc-bios =3D> ui}/keymaps/fr-be (100%) rename {pc-bios =3D> ui}/keymaps/fr-ca (100%) rename {pc-bios =3D> ui}/keymaps/fr-ch (100%) rename {pc-bios =3D> ui}/keymaps/hr (100%) rename {pc-bios =3D> ui}/keymaps/hu (100%) rename {pc-bios =3D> ui}/keymaps/is (100%) rename {pc-bios =3D> ui}/keymaps/it (100%) rename {pc-bios =3D> ui}/keymaps/ja (100%) rename {pc-bios =3D> ui}/keymaps/lt (100%) rename {pc-bios =3D> ui}/keymaps/lv (100%) rename {pc-bios =3D> ui}/keymaps/meson.build (100%) rename {pc-bios =3D> ui}/keymaps/mk (100%) rename {pc-bios =3D> ui}/keymaps/nl (100%) rename {pc-bios =3D> ui}/keymaps/no (100%) rename {pc-bios =3D> ui}/keymaps/pl (100%) rename {pc-bios =3D> ui}/keymaps/pt (100%) rename {pc-bios =3D> ui}/keymaps/pt-br (100%) rename {pc-bios =3D> ui}/keymaps/ru (100%) rename {pc-bios =3D> ui}/keymaps/sl (100%) rename {pc-bios =3D> ui}/keymaps/sv (100%) rename {pc-bios =3D> ui}/keymaps/th (100%) rename {pc-bios =3D> ui}/keymaps/tr (100%) diff --git a/pc-bios/meson.build b/pc-bios/meson.build index 41ba1c0ec7ba..e49c0e5f56de 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -97,4 +97,3 @@ foreach f : blobs endforeach =20 subdir('descriptors') -subdir('keymaps') diff --git a/pc-bios/keymaps/ar b/ui/keymaps/ar similarity index 100% rename from pc-bios/keymaps/ar rename to ui/keymaps/ar diff --git a/pc-bios/keymaps/bepo b/ui/keymaps/bepo similarity index 100% rename from pc-bios/keymaps/bepo rename to ui/keymaps/bepo diff --git a/pc-bios/keymaps/cz b/ui/keymaps/cz similarity index 100% rename from pc-bios/keymaps/cz rename to ui/keymaps/cz diff --git a/pc-bios/keymaps/da b/ui/keymaps/da similarity index 100% rename from pc-bios/keymaps/da rename to ui/keymaps/da diff --git a/pc-bios/keymaps/de b/ui/keymaps/de similarity index 100% rename from pc-bios/keymaps/de rename to ui/keymaps/de diff --git a/pc-bios/keymaps/de-ch b/ui/keymaps/de-ch similarity index 100% rename from pc-bios/keymaps/de-ch rename to ui/keymaps/de-ch diff --git a/pc-bios/keymaps/en-gb b/ui/keymaps/en-gb similarity index 100% rename from pc-bios/keymaps/en-gb rename to ui/keymaps/en-gb diff --git a/pc-bios/keymaps/en-us b/ui/keymaps/en-us similarity index 100% rename from pc-bios/keymaps/en-us rename to ui/keymaps/en-us diff --git a/pc-bios/keymaps/es b/ui/keymaps/es similarity index 100% rename from pc-bios/keymaps/es rename to ui/keymaps/es diff --git a/pc-bios/keymaps/et b/ui/keymaps/et similarity index 100% rename from pc-bios/keymaps/et rename to ui/keymaps/et diff --git a/pc-bios/keymaps/fi b/ui/keymaps/fi similarity index 100% rename from pc-bios/keymaps/fi rename to ui/keymaps/fi diff --git a/pc-bios/keymaps/fo b/ui/keymaps/fo similarity index 100% rename from pc-bios/keymaps/fo rename to ui/keymaps/fo diff --git a/pc-bios/keymaps/fr b/ui/keymaps/fr similarity index 100% rename from pc-bios/keymaps/fr rename to ui/keymaps/fr diff --git a/pc-bios/keymaps/fr-be b/ui/keymaps/fr-be similarity index 100% rename from pc-bios/keymaps/fr-be rename to ui/keymaps/fr-be diff --git a/pc-bios/keymaps/fr-ca b/ui/keymaps/fr-ca similarity index 100% rename from pc-bios/keymaps/fr-ca rename to ui/keymaps/fr-ca diff --git a/pc-bios/keymaps/fr-ch b/ui/keymaps/fr-ch similarity index 100% rename from pc-bios/keymaps/fr-ch rename to ui/keymaps/fr-ch diff --git a/pc-bios/keymaps/hr b/ui/keymaps/hr similarity index 100% rename from pc-bios/keymaps/hr rename to ui/keymaps/hr diff --git a/pc-bios/keymaps/hu b/ui/keymaps/hu similarity index 100% rename from pc-bios/keymaps/hu rename to ui/keymaps/hu diff --git a/pc-bios/keymaps/is b/ui/keymaps/is similarity index 100% rename from pc-bios/keymaps/is rename to ui/keymaps/is diff --git a/pc-bios/keymaps/it b/ui/keymaps/it similarity index 100% rename from pc-bios/keymaps/it rename to ui/keymaps/it diff --git a/pc-bios/keymaps/ja b/ui/keymaps/ja similarity index 100% rename from pc-bios/keymaps/ja rename to ui/keymaps/ja diff --git a/pc-bios/keymaps/lt b/ui/keymaps/lt similarity index 100% rename from pc-bios/keymaps/lt rename to ui/keymaps/lt diff --git a/pc-bios/keymaps/lv b/ui/keymaps/lv similarity index 100% rename from pc-bios/keymaps/lv rename to ui/keymaps/lv diff --git a/pc-bios/keymaps/meson.build b/ui/keymaps/meson.build similarity index 100% rename from pc-bios/keymaps/meson.build rename to ui/keymaps/meson.build diff --git a/pc-bios/keymaps/mk b/ui/keymaps/mk similarity index 100% rename from pc-bios/keymaps/mk rename to ui/keymaps/mk diff --git a/pc-bios/keymaps/nl b/ui/keymaps/nl similarity index 100% rename from pc-bios/keymaps/nl rename to ui/keymaps/nl diff --git a/pc-bios/keymaps/no b/ui/keymaps/no similarity index 100% rename from pc-bios/keymaps/no rename to ui/keymaps/no diff --git a/pc-bios/keymaps/pl b/ui/keymaps/pl similarity index 100% rename from pc-bios/keymaps/pl rename to ui/keymaps/pl diff --git a/pc-bios/keymaps/pt b/ui/keymaps/pt similarity index 100% rename from pc-bios/keymaps/pt rename to ui/keymaps/pt diff --git a/pc-bios/keymaps/pt-br b/ui/keymaps/pt-br similarity index 100% rename from pc-bios/keymaps/pt-br rename to ui/keymaps/pt-br diff --git a/pc-bios/keymaps/ru b/ui/keymaps/ru similarity index 100% rename from pc-bios/keymaps/ru rename to ui/keymaps/ru diff --git a/pc-bios/keymaps/sl b/ui/keymaps/sl similarity index 100% rename from pc-bios/keymaps/sl rename to ui/keymaps/sl diff --git a/pc-bios/keymaps/sv b/ui/keymaps/sv similarity index 100% rename from pc-bios/keymaps/sv rename to ui/keymaps/sv diff --git a/pc-bios/keymaps/th b/ui/keymaps/th similarity index 100% rename from pc-bios/keymaps/th rename to ui/keymaps/th diff --git a/pc-bios/keymaps/tr b/ui/keymaps/tr similarity index 100% rename from pc-bios/keymaps/tr rename to ui/keymaps/tr diff --git a/ui/meson.build b/ui/meson.build index e9f48c531588..25c9a5ff8cd9 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -170,6 +170,7 @@ if have_system or xkbcommon.found() endif =20 subdir('shader') +subdir('keymaps') =20 if have_system subdir('icons') --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853047; cv=none; d=zohomail.com; s=zohoarc; b=n4VOpErLD+A8bBVdegmqToGxlsCFiJ6y5NmYsmjmTnj+UPtU23DLjYnBRcgxH3zgzfF2kn5V2ujfpw9JBcJ0OWV6sr+d/WDqN1cZdLjJrYL9i17joP4kRZBVARiaFX9uPb7EuTxXXPXIO6KrpEzu9dNTQtb6mQPtW57pLbt51F8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853047; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hTTJvnegxxvfJsWseZ7+SmUjba5GRnY9ME/e3uOvaP0=; b=nB2xD8ybtI+XYnFySL0Filktm4+uLR4gl5nPmgs/7jp6XIRg3jYfTd+HQOwU26YvyaMr9nP6H2CUQjXDW86D87QfSflj8FzSXEMTtkJlWg4EG6ybMUlN1jyKtiEoeBQQMF32hF50YYg/fdbUjY2+Us0C7rA08siYEv/uqFucaYQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853047715624.9010078481408; Fri, 10 Jun 2022 02:24:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346185.571996 (Exim 4.92) (envelope-from ) id 1nzarr-00067I-U6; Fri, 10 Jun 2022 09:23:47 +0000 Received: by outflank-mailman (output) from mailman id 346185.571996; Fri, 10 Jun 2022 09:23:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarr-00066b-Q5; Fri, 10 Jun 2022 09:23:47 +0000 Received: by outflank-mailman (input) for mailman id 346185; Fri, 10 Jun 2022 09:23:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapz-0005HE-TA for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:51 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c0e4520b-e89e-11ec-bd2c-47488cf2e6aa; Fri, 10 Jun 2022 11:21:48 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-299-qygipjx1NYupOP8hE8i2Jw-1; Fri, 10 Jun 2022 05:21:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F31F01C05AB7; Fri, 10 Jun 2022 09:21:41 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A49F140D2827; Fri, 10 Jun 2022 09:21:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6241F1800865; Fri, 10 Jun 2022 11:20:45 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c0e4520b-e89e-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hTTJvnegxxvfJsWseZ7+SmUjba5GRnY9ME/e3uOvaP0=; b=Qt6NfMk14JEmdOand/QTiTIIuXfF1Jgs0EqHsxUREWwDsniQpfSG6OQEjFI+ifaq3WHkac X7HdwbzHDBC2DB+gObn6Fu/DqU2tNY6WOcbmrwG24fm1V+K4H1tBIxYD5WMjs8tEDqUi2F jUe7oGV4MNQFjhs6gmA3LO4Wrc/uHko= X-MC-Unique: qygipjx1NYupOP8hE8i2Jw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 15/17] ui/console: Do not return a value with ui_info Date: Fri, 10 Jun 2022 11:20:41 +0200 Message-Id: <20220610092043.1874654-16-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853049899100001 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki The returned value is not used and misleading. Signed-off-by: Akihiko Odaki Message-Id: <20220226115516.59830-2-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 2 +- hw/display/virtio-gpu-base.c | 6 +++--- hw/display/virtio-vga.c | 5 ++--- hw/vfio/display.c | 8 +++----- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index c44b28a972ca..642d6f5248cf 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -432,7 +432,7 @@ typedef struct GraphicHwOps { bool gfx_update_async; /* if true, calls graphic_hw_update_done() */ void (*text_update)(void *opaque, console_ch_t *text); void (*update_interval)(void *opaque, uint64_t interval); - int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); + void (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); void (*gl_block)(void *opaque, bool block); } GraphicHwOps; =20 diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 790cec333c8c..b21d6e5b0be8 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -69,12 +69,12 @@ static void virtio_gpu_notify_event(VirtIOGPUBase *g, u= int32_t event_type) virtio_notify_config(&g->parent_obj); } =20 -static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) +static void virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *inf= o) { VirtIOGPUBase *g =3D opaque; =20 if (idx >=3D g->conf.max_outputs) { - return -1; + return; } =20 g->req_state[idx].x =3D info->xoff; @@ -92,7 +92,7 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx,= QemuUIInfo *info) =20 /* send event to guest */ virtio_gpu_notify_event(g, VIRTIO_GPU_EVENT_DISPLAY); - return 0; + return; } =20 static void diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index c206b5da384b..4dcb34c4a740 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -47,15 +47,14 @@ static void virtio_vga_base_text_update(void *opaque, c= onsole_ch_t *chardata) } } =20 -static int virtio_vga_base_ui_info(void *opaque, uint32_t idx, QemuUIInfo = *info) +static void virtio_vga_base_ui_info(void *opaque, uint32_t idx, QemuUIInfo= *info) { VirtIOVGABase *vvga =3D opaque; VirtIOGPUBase *g =3D vvga->vgpu; =20 if (g->hw_ops->ui_info) { - return g->hw_ops->ui_info(g, idx, info); + g->hw_ops->ui_info(g, idx, info); } - return -1; } =20 static void virtio_vga_base_gl_block(void *opaque, bool block) diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 89bc90508fb8..78f4d82c1c35 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -106,14 +106,14 @@ err: return; } =20 -static int vfio_display_edid_ui_info(void *opaque, uint32_t idx, - QemuUIInfo *info) +static void vfio_display_edid_ui_info(void *opaque, uint32_t idx, + QemuUIInfo *info) { VFIOPCIDevice *vdev =3D opaque; VFIODisplay *dpy =3D vdev->dpy; =20 if (!dpy->edid_regs) { - return 0; + return; } =20 if (info->width && info->height) { @@ -121,8 +121,6 @@ static int vfio_display_edid_ui_info(void *opaque, uint= 32_t idx, } else { vfio_display_edid_update(vdev, false, 0, 0); } - - return 0; } =20 static void vfio_display_edid_init(VFIOPCIDevice *vdev) --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853037; cv=none; d=zohomail.com; s=zohoarc; b=VCvESkD3EVtbm6RAkrG2M+jRehxaaIfFSgCTixy+8dF3vMwtAQl3hNTNtw5aZUt/j0PtojxnkdE/jEcpQ1iKm58Uuzwc7PEkD3pG1Yud8B62Q3Lnsuc+6La6UEWZFvLx4BhAHDNpQFTKTRQ9woZ75vIWjXQd2va5RhsfNuchQpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853037; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ebiRccH2awWxGwAppvEzoFJ/M1x++CURc9+zFzjg06Y=; b=nRQdX0VqE6A6wSJQ4P+Guh01ofwO+d+WlylOgwPFghiHLAN4oavARioZkOF3MjGgJloAmHHaZ3hl3uzqGHddW9yuSacYH+ZMrnG6kFg7fGEimK2sChr5DESp2HTWJl4JgNocqkdjDBDWN/E03zjJZCAa0D7SmTg3OgqzKklXIsw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16548530373731014.221192889615; Fri, 10 Jun 2022 02:23:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346152.571952 (Exim 4.92) (envelope-from ) id 1nzarh-0004LS-3G; Fri, 10 Jun 2022 09:23:37 +0000 Received: by outflank-mailman (output) from mailman id 346152.571952; Fri, 10 Jun 2022 09:23:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarg-0004LE-VF; Fri, 10 Jun 2022 09:23:36 +0000 Received: by outflank-mailman (input) for mailman id 346152; Fri, 10 Jun 2022 09:23:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapw-00050F-5x for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:48 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bfb29c08-e89e-11ec-8179-c7c2a468b362; Fri, 10 Jun 2022 11:21:46 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-654-_2Xh9ZlrMw-WSYMohO052Q-1; Fri, 10 Jun 2022 05:21:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2981A811E75; Fri, 10 Jun 2022 09:21:42 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F36440466A9; Fri, 10 Jun 2022 09:21:41 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9273F1800916; Fri, 10 Jun 2022 11:20:45 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bfb29c08-e89e-11ec-8179-c7c2a468b362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ebiRccH2awWxGwAppvEzoFJ/M1x++CURc9+zFzjg06Y=; b=Tg3pgGK+yzR4n3AgVD3t94NHF1h1EnLDBiRXAb9GjAxdVz0CvzVyQjCQzv7bduAJRvRUoS c0zLzYYnX90WmPufmBGYJ/9H7+k1pon2sJg/Le4067gJ0WM2gWgx602x5muJmi8wb6rIl9 peQ3AH4XmS7FImIcv/jWYGzDQhw56Co= X-MC-Unique: _2Xh9ZlrMw-WSYMohO052Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 16/17] ui: Deliver refresh rate via QemuUIInfo Date: Fri, 10 Jun 2022 11:20:42 +0200 Message-Id: <20220610092043.1874654-17-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853037856100003 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki This change adds a new member, refresh_rate to QemuUIInfo in include/ui/console.h. It represents the refresh rate of the physical display backend, and it is more appropriate than GUI update interval as the refresh rate which the emulated device reports: - sdl may set GUI update interval shorter than the refresh rate of the physical display to respond to user-generated events. - sdl and vnc aggressively changes GUI update interval, but a guests is typically not designed to respond to frequent refresh rate changes, or frequent "display mode" changes in general. The frequency of refresh rate changes of the physical display backend matches better to the guest's expectation. QemuUIInfo also has other members representing "display mode", which makes it suitable for refresh rate representation. It has a throttling of update notifications, and prevents frequent changes of the display mode. Signed-off-by: Akihiko Odaki Message-Id: <20220226115516.59830-3-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 2 +- include/ui/gtk.h | 2 +- hw/display/xenfb.c | 14 +++++++++++--- ui/console.c | 6 ------ ui/gtk-egl.c | 4 ++-- ui/gtk-gl-area.c | 3 +-- ui/gtk.c | 45 +++++++++++++++++++++++++------------------- 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 642d6f5248cf..b64d82436097 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -139,6 +139,7 @@ typedef struct QemuUIInfo { int yoff; uint32_t width; uint32_t height; + uint32_t refresh_rate; } QemuUIInfo; =20 /* cursor data format is 32bit RGBA */ @@ -431,7 +432,6 @@ typedef struct GraphicHwOps { void (*gfx_update)(void *opaque); bool gfx_update_async; /* if true, calls graphic_hw_update_done() */ void (*text_update)(void *opaque, console_ch_t *text); - void (*update_interval)(void *opaque, uint64_t interval); void (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); void (*gl_block)(void *opaque, bool block); } GraphicHwOps; diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 101b147d1b98..ae0f53740d19 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -155,7 +155,7 @@ extern bool gtk_use_gl_area; =20 /* ui/gtk.c */ void gd_update_windowsize(VirtualConsole *vc); -int gd_monitor_update_interval(GtkWidget *widget); +void gd_update_monitor_refresh_rate(VirtualConsole *vc, GtkWidget *widget); void gd_hw_gl_flushed(void *vc); =20 /* ui/gtk-egl.c */ diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index cea10fe3c780..50857cd97a0b 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -777,16 +777,24 @@ static void xenfb_update(void *opaque) xenfb->up_fullscreen =3D 0; } =20 -static void xenfb_update_interval(void *opaque, uint64_t interval) +static void xenfb_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) { struct XenFB *xenfb =3D opaque; + uint32_t refresh_rate; =20 if (xenfb->feature_update) { #ifdef XENFB_TYPE_REFRESH_PERIOD if (xenfb_queue_full(xenfb)) { return; } - xenfb_send_refresh_period(xenfb, interval); + + refresh_rate =3D info->refresh_rate; + if (!refresh_rate) { + refresh_rate =3D 75; + } + + /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ + xenfb_send_refresh_period(xenfb, 1000 * 1000 / refresh_rate); #endif } } @@ -983,5 +991,5 @@ struct XenDevOps xen_framebuffer_ops =3D { static const GraphicHwOps xenfb_ops =3D { .invalidate =3D xenfb_invalidate, .gfx_update =3D xenfb_update, - .update_interval =3D xenfb_update_interval, + .ui_info =3D xenfb_ui_info, }; diff --git a/ui/console.c b/ui/console.c index 36c80cd1de85..9331b85203a0 100644 --- a/ui/console.c +++ b/ui/console.c @@ -160,7 +160,6 @@ static void gui_update(void *opaque) uint64_t dcl_interval; DisplayState *ds =3D opaque; DisplayChangeListener *dcl; - QemuConsole *con; =20 ds->refreshing =3D true; dpy_refresh(ds); @@ -175,11 +174,6 @@ static void gui_update(void *opaque) } if (ds->update_interval !=3D interval) { ds->update_interval =3D interval; - QTAILQ_FOREACH(con, &consoles, next) { - if (con->hw_ops->update_interval) { - con->hw_ops->update_interval(con->hw, interval); - } - } trace_console_refresh(interval); } ds->last_update =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index e3bd4bc27431..b5bffbab2522 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -140,8 +140,8 @@ void gd_egl_refresh(DisplayChangeListener *dcl) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 - vc->gfx.dcl.update_interval =3D gd_monitor_update_interval( - vc->window ? vc->window : vc->gfx.drawing_area); + gd_update_monitor_refresh_rate( + vc, vc->window ? vc->window : vc->gfx.drawing_area); =20 if (!vc->gfx.esurface) { gd_egl_init(vc); diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 2e0129c28cd4..682638a197d2 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -121,8 +121,7 @@ void gd_gl_area_refresh(DisplayChangeListener *dcl) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 - vc->gfx.dcl.update_interval =3D gd_monitor_update_interval( - vc->window ? vc->window : vc->gfx.drawing_area); + gd_update_monitor_refresh_rate(vc, vc->window ? vc->window : vc->gfx.d= rawing_area); =20 if (!vc->gfx.gls) { if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { diff --git a/ui/gtk.c b/ui/gtk.c index c57c36749e0e..2a791dd2aa04 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -710,11 +710,20 @@ static gboolean gd_window_close(GtkWidget *widget, Gd= kEvent *event, return TRUE; } =20 -static void gd_set_ui_info(VirtualConsole *vc, gint width, gint height) +static void gd_set_ui_refresh_rate(VirtualConsole *vc, int refresh_rate) { QemuUIInfo info; =20 - memset(&info, 0, sizeof(info)); + info =3D *dpy_get_ui_info(vc->gfx.dcl.con); + info.refresh_rate =3D refresh_rate; + dpy_set_ui_info(vc->gfx.dcl.con, &info, true); +} + +static void gd_set_ui_size(VirtualConsole *vc, gint width, gint height) +{ + QemuUIInfo info; + + info =3D *dpy_get_ui_info(vc->gfx.dcl.con); info.width =3D width; info.height =3D height; dpy_set_ui_info(vc->gfx.dcl.con, &info, true); @@ -738,33 +747,32 @@ static void gd_resize_event(GtkGLArea *area, { VirtualConsole *vc =3D (void *)opaque; =20 - gd_set_ui_info(vc, width, height); + gd_set_ui_size(vc, width, height); } =20 #endif =20 -/* - * If available, return the update interval of the monitor in ms, - * else return 0 (the default update interval). - */ -int gd_monitor_update_interval(GtkWidget *widget) +void gd_update_monitor_refresh_rate(VirtualConsole *vc, GtkWidget *widget) { #ifdef GDK_VERSION_3_22 GdkWindow *win =3D gtk_widget_get_window(widget); + int refresh_rate; =20 if (win) { GdkDisplay *dpy =3D gtk_widget_get_display(widget); GdkMonitor *monitor =3D gdk_display_get_monitor_at_window(dpy, win= ); - int refresh_rate =3D gdk_monitor_get_refresh_rate(monitor); /* [mH= z] */ - - if (refresh_rate) { - /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ - return MIN(1000 * 1000 / refresh_rate, - GUI_REFRESH_INTERVAL_DEFAULT); - } + refresh_rate =3D gdk_monitor_get_refresh_rate(monitor); /* [mHz] */ + } else { + refresh_rate =3D 0; } + + gd_set_ui_refresh_rate(vc, refresh_rate); + + /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ + vc->gfx.dcl.update_interval =3D refresh_rate ? + MIN(1000 * 1000 / refresh_rate, GUI_REFRESH_INTERVAL_DEFAULT) : + GUI_REFRESH_INTERVAL_DEFAULT; #endif - return 0; } =20 static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque) @@ -801,8 +809,7 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_= t *cr, void *opaque) return FALSE; } =20 - vc->gfx.dcl.update_interval =3D - gd_monitor_update_interval(vc->window ? vc->window : s->window); + gd_update_monitor_refresh_rate(vc, vc->window ? vc->window : s->window= ); =20 fbw =3D surface_width(vc->gfx.ds); fbh =3D surface_height(vc->gfx.ds); @@ -1691,7 +1698,7 @@ static gboolean gd_configure(GtkWidget *widget, { VirtualConsole *vc =3D opaque; =20 - gd_set_ui_info(vc, cfg->width, cfg->height); + gd_set_ui_size(vc, cfg->width, cfg->height); return FALSE; } =20 --=20 2.36.1 From nobody Sun May 19 10:57:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654853038; cv=none; d=zohomail.com; s=zohoarc; b=jrDYoWaiKRhuCquBWCYCkpPKhMY1shlwLOyn7TZGFW2DcfCilUEkzWuBX8tEK2g20Ae+PwREEvqw1C4bRYjLtR5j0K2qfkhEL8Iq06Zm0SM+QtY29W65N/zCXXpGLvTO9VYaYnAVtq7qChmVt69iTik4eb9Zv2RX2L+g6ji7cU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654853038; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fjkT/ghvgIP+ASWCtRqN8cFZ3mDw+gAHZxFgoi4zHGM=; b=d+tjgkM97+VE+9Kq4Y5admMOkm0m8/fs3sA0/febP/KJ3SDm4Ao1cTBtQh7yYwEgEuN9PzDrYezoCNOdoCfP4gOUDoFTi+Dotijjr8g/Aw6LWRNUIk+mvTYxK44phw+z1hk+InFW5e1Imv9VTRVtoTlR632h7bAIj9SFD+EHhLY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1654853038928916.8840387132544; Fri, 10 Jun 2022 02:23:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346156.571963 (Exim 4.92) (envelope-from ) id 1nzarj-0004iN-Ch; Fri, 10 Jun 2022 09:23:39 +0000 Received: by outflank-mailman (output) from mailman id 346156.571963; Fri, 10 Jun 2022 09:23:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzarj-0004i1-8c; Fri, 10 Jun 2022 09:23:39 +0000 Received: by outflank-mailman (input) for mailman id 346156; Fri, 10 Jun 2022 09:23:37 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzapx-0005HE-V4 for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 09:21:49 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c0bd9420-e89e-11ec-bd2c-47488cf2e6aa; Fri, 10 Jun 2022 11:21:48 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-353-U1-fgaTYNJC2qVYGl5-reA-1; Fri, 10 Jun 2022 05:21:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DCDE0800971; Fri, 10 Jun 2022 09:21:43 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C9F22166B29; Fri, 10 Jun 2022 09:21:43 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B26AF180091C; Fri, 10 Jun 2022 11:20:45 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c0bd9420-e89e-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654852907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fjkT/ghvgIP+ASWCtRqN8cFZ3mDw+gAHZxFgoi4zHGM=; b=cG5Ik6AJ6C1McVqi6U77m0ezhnMX6gSZgJZoaWoceLI8BZYMTv+AVIOr9g3mF/F0qMvHJR eliTcOI2TOUFQl7j5YgdxkE14LAZkKdx4zml/5QwpJ6WP6Y7Vpvt/YY4n4LTGAY48pRZsq BgNrMrJicC6DKOoSvPK/kwS9gY50CsI= X-MC-Unique: U1-fgaTYNJC2qVYGl5-reA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Canokeys.org" , "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Akihiko Odaki , Peter Maydell , "Hongren (Zenithal) Zheng" , xen-devel@lists.xenproject.org, Alex Williamson , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 17/17] virtio-gpu: Respect UI refresh rate for EDID Date: Fri, 10 Jun 2022 11:20:43 +0200 Message-Id: <20220610092043.1874654-18-kraxel@redhat.com> In-Reply-To: <20220610092043.1874654-1-kraxel@redhat.com> References: <20220610092043.1874654-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654853039833100005 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki Signed-off-by: Akihiko Odaki Message-Id: <20220226115516.59830-4-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu-base.c | 1 + hw/display/virtio-gpu.c | 1 + 3 files changed, 3 insertions(+) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index afff9e158e31..2e28507efe21 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -80,6 +80,7 @@ struct virtio_gpu_scanout { struct virtio_gpu_requested_state { uint16_t width_mm, height_mm; uint32_t width, height; + uint32_t refresh_rate; int x, y; }; =20 diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index b21d6e5b0be8..a29f191aa82e 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -79,6 +79,7 @@ static void virtio_gpu_ui_info(void *opaque, uint32_t idx= , QemuUIInfo *info) =20 g->req_state[idx].x =3D info->xoff; g->req_state[idx].y =3D info->yoff; + g->req_state[idx].refresh_rate =3D info->refresh_rate; g->req_state[idx].width =3D info->width; g->req_state[idx].height =3D info->height; g->req_state[idx].width_mm =3D info->width_mm; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 55c6dd576318..20cc703dcc6e 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -217,6 +217,7 @@ virtio_gpu_generate_edid(VirtIOGPU *g, int scanout, .height_mm =3D b->req_state[scanout].height_mm, .prefx =3D b->req_state[scanout].width, .prefy =3D b->req_state[scanout].height, + .refresh_rate =3D b->req_state[scanout].refresh_rate, }; =20 edid->size =3D cpu_to_le32(sizeof(edid->edid)); --=20 2.36.1