From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665644357; cv=none; d=zohomail.com; s=zohoarc; b=bzLnNaaylzOutZBOwYh43zRau0ACjaAX+IaAWzLTX630CNifJbnZPw4JaGLfcVm7fHFnSW2asy3YRwftCriFX7w55rvVxJVsbai/wlC/vw9pA2nwddz721iqurRuE6XD/5W8w1DSxM4YCCc7+eTcT0gjRw8iBfPl3E5fLHw4Tfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665644357; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IqYykLpsWy7mnomN9/W5L+PfGO1/B21WKaL4Tr3EfxM=; b=U2BHDaX9urBM20ODmIu4zo53SbZp7c6RO4R1DmcoKLwi6rJlYeoIIt1/lLBLz94sp6h4yWRwTL/8mEkHytuW9FQ8ynydggC5+lMIaHaMbffTB5/SaOXqX529tvdzikXBMrQA8IEiLdulJ8ehPPdRBW0C+TPAWlsa0RC2vDreVAI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665644357559505.86981796904786; Wed, 12 Oct 2022 23:59:17 -0700 (PDT) Received: from localhost ([::1]:40346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisBY-0008Pn-Fi for importer@patchew.org; Thu, 13 Oct 2022 02:59:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois56-00055U-V2 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois53-0006lW-HC for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:35 -0400 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-142-RygBbv0zMoC6FnfTmVHx3g-1; Thu, 13 Oct 2022 02:52:28 -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 0B636299E77D; Thu, 13 Oct 2022 06:52:28 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7090E112C071; Thu, 13 Oct 2022 06:52:27 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5B3D718003A8; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643952; 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=IqYykLpsWy7mnomN9/W5L+PfGO1/B21WKaL4Tr3EfxM=; b=YAsAXWJGS/HBJ/3/I1T6mLtO1bb7A+AZzIhgaczUU18Cut9y41/G63KmaOfET1lq/ppb6O ujr1lxYez4jfLoXOABHEHdjY5qcxGt2aIqSC2OJKjlXhdP0B1dGqUU2KnfReGMiXJUEpqg Givb5ltXEIFofYKT8kHyUif8QHVYJ6k= X-MC-Unique: RygBbv0zMoC6FnfTmVHx3g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 01/26] audio: refactor code in audio_run_out() Date: Thu, 13 Oct 2022 08:51:59 +0200 Message-Id: <20221013065224.1864145-2-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665644359428100001 From: Volker R=C3=BCmelin Refactoring the code in audio_run_out() avoids code duplication in the next patch. There's no functional change. Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-1-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index df6818ed5598..08aec51e7085 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1121,8 +1121,12 @@ static void audio_run_out (AudioState *s) HWVoiceOut *hw =3D NULL; SWVoiceOut *sw; =20 - if (!audio_get_pdo_out(s->dev)->mixing_engine) { - while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { + while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { + size_t played, live, prev_rpos; + size_t hw_free =3D audio_pcm_hw_get_free(hw); + int nb_live; + + if (!audio_get_pdo_out(s->dev)->mixing_engine) { /* there is exactly 1 sw for each hw with no mixeng */ sw =3D hw->sw_head.lh_first; =20 @@ -1137,14 +1141,9 @@ static void audio_run_out (AudioState *s) if (sw->active) { sw->callback.fn(sw->callback.opaque, INT_MAX); } - } - return; - } =20 - while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { - size_t played, live, prev_rpos; - size_t hw_free =3D audio_pcm_hw_get_free(hw); - int nb_live; + continue; + } =20 for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { if (sw->active) { --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665645139; cv=none; d=zohomail.com; s=zohoarc; b=NtikYPe0jr0SElL36N1QR220JK+7PH/8fbB9sC+s97geTGDtUb2cace2FZ2cuSETb1Bjfa+zWrE+fUgcs40vSzpWtkIH2Ad6WYTBsl3cT44n2YzPjWmUL6JKA1EFPrkTXQdoJ3zntpMDKO2z2ADpUCCY3Flofl95bOCtma85M6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665645139; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PbSSy1DRof+fZnCCEXiNYrAAHxMWp1x0ZyKl5mVxys4=; b=Ys+AjC2oQeM0efPApahKUZHB3m3OK54CcuODAASNsyq2TlC8MDRMixNL3cG8seXLE7NDjL2V+2F+Gcq94Uctu9BijJYJcUo+naa+RStEkBfuBAUPbzxQ+w5/WvmF5bEaoM230Gb3XfMQHylgtnQ3BtuNG+fqeQKjbhp6iupIOo0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665645139086974.0836300443207; Thu, 13 Oct 2022 00:12:19 -0700 (PDT) Received: from localhost ([::1]:44956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisO6-0006Vo-AW for importer@patchew.org; Thu, 13 Oct 2022 03:12:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5B-0005Ft-EO for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois58-0006mh-Md for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:40 -0400 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-228-CCzY-uxNN1yHOZB2Px0p7w-1; Thu, 13 Oct 2022 02:52:33 -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 77D63811E81; Thu, 13 Oct 2022 06:52:33 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 099222166BA3; Thu, 13 Oct 2022 06:52:33 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 67E931800605; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643958; 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=PbSSy1DRof+fZnCCEXiNYrAAHxMWp1x0ZyKl5mVxys4=; b=b6ZHTRFnUMG6qFex9hcC9IHOpFY3FwpeoD1Q01K3h2oGilfGSE8LCAfc5j7Fmwt8LHZ648 coc/JW+T/XJ99VVZeq9QEqhRvbVWJyfyDhNOrL7AUlwsaU4441L4pNOnPJJQqvuINXNrds VNeVxJ5k8VoCPrze6SSPszh0C1jDOBQ= X-MC-Unique: CCzY-uxNN1yHOZB2Px0p7w-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 02/26] audio: fix GUS audio playback with out.mixing-engine=off Date: Thu, 13 Oct 2022 08:52:00 +0200 Message-Id: <20221013065224.1864145-3-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665645304958100001 From: Volker R=C3=BCmelin Fix GUS audio playback with out.mixing-engine=3Doff. The GUS audio device needs to know the amount of samples to produce in advance. To reproduce start qemu with -parallel none -device gus,audiodev=3Daudio0 -audiodev pa,id=3Daudio0,out.mixing-engine=3Doff and start the cartoon.exe demo in a FreeDOS guest. The demo file is available on the download page of the GUSemu32 author. Signed-off-by: Volker R=C3=BCmelin Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 08aec51e7085..29da359b416b 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1139,7 +1139,8 @@ static void audio_run_out (AudioState *s) } =20 if (sw->active) { - sw->callback.fn(sw->callback.opaque, INT_MAX); + sw->callback.fn(sw->callback.opaque, + hw_free * sw->info.bytes_per_frame); } =20 continue; --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665645677; cv=none; d=zohomail.com; s=zohoarc; b=h5Wo7KUnQOc+dfGEPmA/J2ujbdZjoEmYPEzd9MXXkkBLv1T12U+L8Svex7QNeS90ZxiX10deEKp6P7pktAbxzKG+wTe6LSU3VG/atoMA4PDGgmX5ZnehGukp9ZRcBKFWKL8OnKDUvp/t+Ws6OUmTu1cyQIF9xMmWV9Qf6TKtm4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665645677; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4+aV8cwUpP4Ab/cg1wz5vfBJnkqaJmgBOg4hBVfa+Zw=; b=Oglharbkb5k6P3D+Ul3FaRwPQZi1j3glWRJoPxJ115ECeQxUsq8mvh/dYXP3c47DasNIwLBqS3tFu2h7Y8ozML2W0pYi4jYRWepig9wtJ4HeJMw8mBkInnPnzCq8iu+RoCZd1Rqdxaimy2Rn1x76cyGkHCUq+YPXrCLr/fuudng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665645677810952.4773851541328; Thu, 13 Oct 2022 00:21:17 -0700 (PDT) Received: from localhost ([::1]:35822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisWp-0004Mn-Kc for importer@patchew.org; Thu, 13 Oct 2022 03:21:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5C-0005Ip-OS for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5B-0006nF-8Q for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:42 -0400 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-470-u-o7f8EPOcCFmN40JKbB9Q-1; Thu, 13 Oct 2022 02:52:34 -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 5251885A59D; Thu, 13 Oct 2022 06:52:34 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3E692017DF0; Thu, 13 Oct 2022 06:52:32 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 74D361800620; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643960; 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=4+aV8cwUpP4Ab/cg1wz5vfBJnkqaJmgBOg4hBVfa+Zw=; b=Xiei9O8XmKezO7hqYffUXzrH+zneDb6T/wmX/ELDtrpsbVmPoUve0fjDY5I9ZgxOA82QFq wbbvY9RPLp1Ljtr/Eb7kEu6tD99X992e4UdjbyrN/wk9ZGzABBwHkwaapDYfS/xYFqS55+ sxG4OkJBBeG/jGFNOWEkYjhzhZ2GQyA= X-MC-Unique: u-o7f8EPOcCFmN40JKbB9Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 03/26] audio: run downstream playback queue unconditionally Date: Thu, 13 Oct 2022 08:52:01 +0200 Message-Id: <20221013065224.1864145-4-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665645841335100001 From: Volker R=C3=BCmelin Run the downstream playback queue even if the emulated audio device didn't write new samples. There still may be buffered audio samples downstream. This is for the -audiodev out.mixing-engine=3Doff case. Commit a8a98cfd42 ("audio: run downstream playback queue uncondition- ally") fixed the out.mixing-engine=3Don case. Signed-off-by: Volker R=C3=BCmelin Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-3-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 29da359b416b..567f953e66f9 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1143,6 +1143,10 @@ static void audio_run_out (AudioState *s) hw_free * sw->info.bytes_per_frame); } =20 + if (hw->pcm_ops->run_buffer_out) { + hw->pcm_ops->run_buffer_out(hw); + } + continue; } =20 @@ -1501,10 +1505,6 @@ size_t audio_generic_write(HWVoiceOut *hw, void *buf= , size_t size) } } =20 - if (hw->pcm_ops->run_buffer_out) { - hw->pcm_ops->run_buffer_out(hw); - } - return total; } =20 --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665646311; cv=none; d=zohomail.com; s=zohoarc; b=h1Q1tPceCp6EiJHao+bUHCwdDeZChhqXSwThdgmQJaVt2sOw3K20Xf66qWWovuctGqNvZRO4M6seBD+8mB6SRlPh6fjL8S6TgAQdU0XgD+IQEjhdco3ZYxS3q/NQa+rbRXQ6xZwWhZ6vT0pO3TVH9KQpsWuYQYrNLCzNSBuicb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665646311; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=22pBYRTIMvEPA0Y2kGJFhykaWUMI7kqIIgn167stpvc=; b=VuolBr1LxGNYiSSJEMh03bTZgedyDMXRvIJjk1zHMA2exx3VHfoDh0uj+10TbIArfzZ5vOa269CkbdOR6MlkixVz5U4iYBUiXwxWiQ6ezOO0bkjgfg3cweqBTeYjVSm319+WCB3zIH6WeUOc5ympoxRXpaigeRg6NP+eVUoARSo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665646311791608.2307624816286; Thu, 13 Oct 2022 00:31:51 -0700 (PDT) Received: from localhost ([::1]:37702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisgx-0002Az-Jp for importer@patchew.org; Thu, 13 Oct 2022 03:31:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5C-0005J7-UF for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5B-0006nH-8p for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:52:42 -0400 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-498-AsYnbbXWPB2xkgMuqHcWcg-1; Thu, 13 Oct 2022 02:52:37 -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 D501F3806703; Thu, 13 Oct 2022 06:52:36 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 74B742166BA3; Thu, 13 Oct 2022 06:52:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 81AF5180062C; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643960; 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=22pBYRTIMvEPA0Y2kGJFhykaWUMI7kqIIgn167stpvc=; b=BS5JyL3r1BhSeBTWip6y6mWyCNlVAJ238qhHnZGMm1QMJZN+mmszuwIjaycr1XNxI5khuX OhLbVqd6kBLDNyMojkvYv4iytjijIzolIHGx2KPhPal4kamspEQ8PKXrZzDzA1St6E3quN 7ebWvCPwBgnQ9EqX/atzZJinsNKGLAY= X-MC-Unique: AsYnbbXWPB2xkgMuqHcWcg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 04/26] alsaaudio: reduce playback latency Date: Thu, 13 Oct 2022 08:52:02 +0200 Message-Id: <20221013065224.1864145-5-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665646432712100001 From: Volker R=C3=BCmelin Change the buffer_get_free pcm_ops function to report the free ALSA playback buffer. The generic buffer becomes a temporary buffer and is empty after a call to audio_run_out(). Signed-off-by: Volker R=C3=BCmelin Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-4-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/alsaaudio.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 4a61378cd757..7a2a94cd427d 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -602,6 +602,42 @@ static int alsa_open(bool in, struct alsa_params_req *= req, return -1; } =20 +static size_t alsa_buffer_get_free(HWVoiceOut *hw) +{ + ALSAVoiceOut *alsa =3D (ALSAVoiceOut *)hw; + snd_pcm_sframes_t avail; + size_t alsa_free, generic_free, generic_in_use; + + avail =3D snd_pcm_avail_update(alsa->handle); + if (avail < 0) { + if (avail =3D=3D -EPIPE) { + if (!alsa_recover(alsa->handle)) { + avail =3D snd_pcm_avail_update(alsa->handle); + } + } + if (avail < 0) { + alsa_logerr(avail, + "Could not obtain number of available frames\n"); + avail =3D 0; + } + } + + alsa_free =3D avail * hw->info.bytes_per_frame; + generic_free =3D audio_generic_buffer_get_free(hw); + generic_in_use =3D hw->samples * hw->info.bytes_per_frame - generic_fr= ee; + if (generic_in_use) { + /* + * This code can only be reached in the unlikely case that + * snd_pcm_avail_update() returned a larger number of frames + * than snd_pcm_writei() could write. Make sure that all + * remaining bytes in the generic buffer can be written. + */ + alsa_free =3D alsa_free > generic_in_use ? alsa_free - generic_in_= use : 0; + } + + return alsa_free; +} + static size_t alsa_write(HWVoiceOut *hw, void *buf, size_t len) { ALSAVoiceOut *alsa =3D (ALSAVoiceOut *) hw; @@ -916,7 +952,7 @@ static struct audio_pcm_ops alsa_pcm_ops =3D { .init_out =3D alsa_init_out, .fini_out =3D alsa_fini_out, .write =3D alsa_write, - .buffer_get_free =3D audio_generic_buffer_get_free, + .buffer_get_free =3D alsa_buffer_get_free, .run_buffer_out =3D audio_generic_run_buffer_out, .enable_out =3D alsa_enable_out, =20 --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665645900; cv=none; d=zohomail.com; s=zohoarc; b=P9CEOefCBPjAVKmIZ5BMKZkwvvbgu52DT7INwvu2qYxz+x5xB9+yV0hwfDJ8dsk8crxwoDmblI+dFPfRU7Wue5bsbWi7hxF9qlXRX45JOMaGf7N64KuUsEgYb6yRIzm2asRmrA1RHlWw3W6MLcjYI/eQZYH+dkWL3H8z2cgaMrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665645900; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FHpvsuC9U4sCqZdndPcAdcKhz8SwEBsvj7g1gDTuuEw=; b=eMDjO2OHAG7TTi1vU5scjBz/BGhUofuhjfZJ2sTP4CYs7zffRKrrgEKcfvYbDZNwEWNggY7Bu6/iMp40hHTeFxurFx5BMkzZyBkOX5IB/vpBuPU/QG5tQhl/YthkYHs6WJpQAJortDRHlCDBQK5f6Ce09jGbqCPo8dtv3/8toA8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665645900042153.07068898599982; Thu, 13 Oct 2022 00:25:00 -0700 (PDT) Received: from localhost ([::1]:49536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisaQ-0006cr-TG for importer@patchew.org; Thu, 13 Oct 2022 03:24:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5h-0005Sb-DJ for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5f-0006qH-46 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:12 -0400 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-586-Ig2ZqQOlMLiNsyFbNvZgSA-1; Thu, 13 Oct 2022 02:53:07 -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 9AB3C101A5DC; Thu, 13 Oct 2022 06:52:56 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADB4A40C2064; Thu, 13 Oct 2022 06:52:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 908DE1800634; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643990; 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=FHpvsuC9U4sCqZdndPcAdcKhz8SwEBsvj7g1gDTuuEw=; b=R+/Cv+kM5TxMtvMIzGPQo9I2tA+jZq1pDiZc0HWtcFzyShXfsIHr8hYM81qq9fgNA+vQRY f2LHUxKcoGhB8bKUEs55w6YqnGHKyeXHCNuqejT02y8dG4/TXNm9vt+RAOcvsKAt+pMHp+ qheh+NTA78XSzcb5osIR/xi1KBrazv8= X-MC-Unique: Ig2ZqQOlMLiNsyFbNvZgSA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 05/26] audio: add more audio rate control functions Date: Thu, 13 Oct 2022 08:52:03 +0200 Message-Id: <20221013065224.1864145-6-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665646063407100001 From: Volker R=C3=BCmelin The next patch needs two new rate control functions. The first one returns the bytes needed at call time to maintain the selected rate. The second one adjusts the bytes actually sent. Split the audio_rate_get_bytes() function into these two functions and reintroduce audio_rate_get_bytes(). Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-5-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio_int.h | 2 ++ audio/audio.c | 35 ++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 2a6914d2aa65..97e20e842927 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -263,6 +263,8 @@ typedef struct RateCtl { } RateCtl; =20 void audio_rate_start(RateCtl *rate); +size_t audio_rate_peek_bytes(RateCtl *rate, struct audio_pcm_info *info); +void audio_rate_add_bytes(RateCtl *rate, size_t bytes_used); size_t audio_rate_get_bytes(struct audio_pcm_info *info, RateCtl *rate, size_t bytes_avail); =20 diff --git a/audio/audio.c b/audio/audio.c index 567f953e66f9..61cdd73df5aa 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2251,26 +2251,39 @@ void audio_rate_start(RateCtl *rate) rate->start_ticks =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); } =20 -size_t audio_rate_get_bytes(struct audio_pcm_info *info, RateCtl *rate, - size_t bytes_avail) +size_t audio_rate_peek_bytes(RateCtl *rate, struct audio_pcm_info *info) { int64_t now; int64_t ticks; int64_t bytes; - int64_t samples; - size_t ret; + int64_t frames; =20 now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ticks =3D now - rate->start_ticks; bytes =3D muldiv64(ticks, info->bytes_per_second, NANOSECONDS_PER_SECO= ND); - samples =3D (bytes - rate->bytes_sent) / info->bytes_per_frame; - if (samples < 0 || samples > 65536) { - AUD_log(NULL, "Resetting rate control (%" PRId64 " samples)\n", sa= mples); + frames =3D (bytes - rate->bytes_sent) / info->bytes_per_frame; + if (frames < 0 || frames > 65536) { + AUD_log(NULL, "Resetting rate control (%" PRId64 " frames)\n", fra= mes); audio_rate_start(rate); - samples =3D 0; + frames =3D 0; } =20 - ret =3D MIN(samples * info->bytes_per_frame, bytes_avail); - rate->bytes_sent +=3D ret; - return ret; + return frames * info->bytes_per_frame; +} + +void audio_rate_add_bytes(RateCtl *rate, size_t bytes_used) +{ + rate->bytes_sent +=3D bytes_used; +} + +size_t audio_rate_get_bytes(struct audio_pcm_info *info, RateCtl *rate, + size_t bytes_avail) +{ + size_t bytes; + + bytes =3D audio_rate_peek_bytes(rate, info); + bytes =3D MIN(bytes, bytes_avail); + audio_rate_add_bytes(rate, bytes); + + return bytes; } --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665644690; cv=none; d=zohomail.com; s=zohoarc; b=f0hOnhP6wuqu5eT0YH99UJd+UQ3gUiDWC4Ph5/L/USvBTEtIOaE7DFDzMMKq7wNFShruIzdODjPLyl672g8lfbntdhR+REX6/z60ODA8o7OBwOU3DKErAwgfm9Mr5jJCtoN/Owj89f4KpoO76/kZB2MuFD4BVUwUulowfrDls18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665644690; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2NWDorLfic0TPnK8g2a/41AqpcyAcvzd3Rv0Q6FjG6c=; b=Kwy1WR3PbImMJiqc/ODGGGbe8LUwdv875Vx3+GnjZJ5mDWmxFHrAxyDeMKf+HDkBH576vOIbcJhFoI+El3kMbolB8RVENiBK5d2ugv0n41k0fn+2BV+JKxibrBdJ/Pz2v+UaYJLWPMhhmwYYU3wU3CZrAJp3gcxs/WmhsC1dhFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665644690239494.6849614208055; Thu, 13 Oct 2022 00:04:50 -0700 (PDT) Received: from localhost ([::1]:37464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisGu-0002PI-IA for importer@patchew.org; Thu, 13 Oct 2022 03:04:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5W-0005R7-PQ for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5U-0006p9-Ro for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:02 -0400 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-604-rH4DsIx_P-G4TFeKUnUMiw-1; Thu, 13 Oct 2022 02:52:57 -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 61A841C075A0; Thu, 13 Oct 2022 06:52:46 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B11442166BA3; Thu, 13 Oct 2022 06:52:38 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9D54C180079B; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643980; 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=2NWDorLfic0TPnK8g2a/41AqpcyAcvzd3Rv0Q6FjG6c=; b=b+H3q8m/kObuchOoomfTglg3h0fdK4dqDDZH/mgpOcCjF3O/Wbanof8eoIxzbpl80vwDfu xY7I9NEa2yOSbwaWlhoUJEmZao0oCFfsThwpJ9RoxdnYQaU2B01yHS1atV1DczbIruo27O Ze5InQtrh1Q/96CEpoxatEFgmJfXS6U= X-MC-Unique: rH4DsIx_P-G4TFeKUnUMiw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 06/26] spiceaudio: add a pcm_ops buffer_get_free function Date: Thu, 13 Oct 2022 08:52:04 +0200 Message-Id: <20221013065224.1864145-7-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665644692112100001 From: Volker R=C3=BCmelin It seems there is a demand [1] for low latency playback over SPICE. Add a pcm_ops buffer_get_free function to reduce the playback latency. The mixing engine buffer becomes a temporary buffer. [1] https://lists.nongnu.org/archive/html/qemu-devel/2022-01/msg01644.html Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-6-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/spiceaudio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index a8d370fe6f31..22892a7b9d42 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -120,6 +120,13 @@ static void line_out_fini (HWVoiceOut *hw) spice_server_remove_interface (&out->sin.base); } =20 +static size_t line_out_get_free(HWVoiceOut *hw) +{ + SpiceVoiceOut *out =3D container_of(hw, SpiceVoiceOut, hw); + + return audio_rate_peek_bytes(&out->rate, &hw->info); +} + static void *line_out_get_buffer(HWVoiceOut *hw, size_t *size) { SpiceVoiceOut *out =3D container_of(hw, SpiceVoiceOut, hw); @@ -133,8 +140,6 @@ static void *line_out_get_buffer(HWVoiceOut *hw, size_t= *size) *size =3D MIN((out->fsize - out->fpos) << 2, *size); } =20 - *size =3D audio_rate_get_bytes(&hw->info, &out->rate, *size); - return out->frame + out->fpos; } =20 @@ -142,6 +147,8 @@ static size_t line_out_put_buffer(HWVoiceOut *hw, void = *buf, size_t size) { SpiceVoiceOut *out =3D container_of(hw, SpiceVoiceOut, hw); =20 + audio_rate_add_bytes(&out->rate, size); + if (buf) { assert(buf =3D=3D out->frame + out->fpos && out->fpos <=3D out->fs= ize); out->fpos +=3D size >> 2; @@ -282,6 +289,7 @@ static struct audio_pcm_ops audio_callbacks =3D { .init_out =3D line_out_init, .fini_out =3D line_out_fini, .write =3D audio_generic_write, + .buffer_get_free =3D line_out_get_free, .get_buffer_out =3D line_out_get_buffer, .put_buffer_out =3D line_out_put_buffer, .enable_out =3D line_out_enable, --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665646985; cv=none; d=zohomail.com; s=zohoarc; b=lLHBnN+Q3E3T20QhYR8mAbNAcdzedL6kRX9Bp9JiHXvDR7iAGZWn9XYwLVdqH/migDf6+sIaGGhAuRr0kMJIwjoYZXPbSwXS7l83mOoq4H5OeAb89fSuLfAm/MkeQMTHpI7nHmeVnotBXOCI7mwBQmUWa6KmySFfP7gkG9irArU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665646985; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8KJpmXXivAzMAj+7n3xd/6yospCM+cYvTpxf5uK4ct8=; b=YhyxvO5DyLZ/dWjhpk7m6BKAQFymymCQE5HrMMX+lw0mnlTewEHtwyOj50YttfPDX/xhxyZCztNRKVBQp08TL5+tX98bMbQE5cnFnco1cvdgJ0wl2utdmHWOLqPPKz0a6sgGPaqfU5kxGTEvesQZ+LChsRcfgFxic6dT4ibhh+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665646985558190.23044656023092; Thu, 13 Oct 2022 00:43:05 -0700 (PDT) Received: from localhost ([::1]:58270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisrw-0000RI-C8 for importer@patchew.org; Thu, 13 Oct 2022 03:43:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5a-0005S1-6B for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32118) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5Y-0006pg-Oh for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:05 -0400 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-347-b6rzuUJ3PrOgERbw299yJQ-1; Thu, 13 Oct 2022 02:53:00 -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 C2E5A1871D9C; Thu, 13 Oct 2022 06:52:54 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65F594B3FEC; Thu, 13 Oct 2022 06:52:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AA0001800917; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643984; 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=8KJpmXXivAzMAj+7n3xd/6yospCM+cYvTpxf5uK4ct8=; b=Xhi5y1rrEWn2wiGIGaIU14JonRRIMthsHGxu99tvwW+ikfebc8c9kwSqC5aT21G6eIF1l5 qEcu168XNV/M68WdLitfQLRLtCSMWyITiBx++9/Auck04AwZJzdkyW0HBclwF9RmjLxnDh b3DvJFdM9/++Bz+FbazlTP2VI+jPMRE= X-MC-Unique: b6rzuUJ3PrOgERbw299yJQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 07/26] spiceaudio: update comment Date: Thu, 13 Oct 2022 08:52:05 +0200 Message-Id: <20221013065224.1864145-8-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665646987903100001 From: Volker R=C3=BCmelin Replace a comment with a question with the answer. Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-7-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/spiceaudio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 22892a7b9d42..f52f3a8bbb66 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -242,7 +242,10 @@ static size_t line_in_read(HWVoiceIn *hw, void *buf, s= ize_t len) uint64_t to_read =3D audio_rate_get_bytes(&hw->info, &in->rate, len) >= > 2; size_t ready =3D spice_server_record_get_samples(&in->sin, buf, to_rea= d); =20 - /* XXX: do we need this? */ + /* + * If the client didn't send new frames, it most likely disconnected. + * Generate silence in this case to avoid a stalled audio stream. + */ if (ready =3D=3D 0) { memset(buf, 0, to_read << 2); ready =3D to_read; --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665646659; cv=none; d=zohomail.com; s=zohoarc; b=Wp22yOcxsFm6d1y0js2/PS4SRAJPVuegnDpJsESBNdkR0XTXEsugi6xdlMecAoMBLXYJJMojs1aUEYA57vSIS0pmuwh9NHf/VxuV1BlGZinBj0//5LlLBFAvWBCjwSCiy6FoBDrIGagKSjwsJTXzoRkTgYGLAcAZuFNPRryTBaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665646659; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cfD8WOxu84cCbW8HYO0WD4LOWgInjSMMpU0eJWzRzKU=; b=H+TX9J0vqmLKSNrJDHFt9TDWzaEPxEwctVxqqFYQ67QebPVZa/xYvV4zp24iLLHoiuqfNgCm3b/ZyS2snp9D6od2dxsVSy7LPnmKBiQwrk6eLCjdMaDK8J0NvrwgdvDBlkrhhEmz/Nucol3EcaTeMzeE0HHd549V+bTqMieck98= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665646659196279.27700372694585; Thu, 13 Oct 2022 00:37:39 -0700 (PDT) Received: from localhost ([::1]:51926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oismg-0005Cq-3U for importer@patchew.org; Thu, 13 Oct 2022 03:37:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5X-0005RB-VN for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5V-0006pD-Fm for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:03 -0400 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-77-LpUVLOJxMk2XyYfON6BuOg-1; Thu, 13 Oct 2022 02:52:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B73348630CB; Thu, 13 Oct 2022 06:52:57 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF2E384426; Thu, 13 Oct 2022 06:52:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C293F1800919; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643980; 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=cfD8WOxu84cCbW8HYO0WD4LOWgInjSMMpU0eJWzRzKU=; b=ftbyhUrm80N0Gd4BFFYtHbayhnTb8f8F3IqsspLKynr5DtuO79GUbr5pOPWaYE7+eeKNwG 6Xh+KOhgidPRmh4eCVvQrHLUalmfsKZHhOUGr6w7KfWSjzJ+j+2L1o/t4MOfs8fxTr3RrR FOe6pxfch+LCIDY0bNc1wRBkJ/jpAlY= X-MC-Unique: LpUVLOJxMk2XyYfON6BuOg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 08/26] audio: swap audio_rate_get_bytes() function parameters Date: Thu, 13 Oct 2022 08:52:06 +0200 Message-Id: <20221013065224.1864145-9-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665646835342100001 From: Volker R=C3=BCmelin Swap the rate and info parameters of the audio_rate_get_bytes() function to align the parameter order with the rest of the audio_rate_*() functions. Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-8-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio_int.h | 2 +- audio/audio.c | 2 +- audio/dbusaudio.c | 4 ++-- audio/noaudio.c | 4 ++-- audio/spiceaudio.c | 2 +- audio/wavaudio.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 97e20e842927..e87ce014a04b 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -265,7 +265,7 @@ typedef struct RateCtl { void audio_rate_start(RateCtl *rate); size_t audio_rate_peek_bytes(RateCtl *rate, struct audio_pcm_info *info); void audio_rate_add_bytes(RateCtl *rate, size_t bytes_used); -size_t audio_rate_get_bytes(struct audio_pcm_info *info, RateCtl *rate, +size_t audio_rate_get_bytes(RateCtl *rate, struct audio_pcm_info *info, size_t bytes_avail); =20 static inline size_t audio_ring_dist(size_t dst, size_t src, size_t len) diff --git a/audio/audio.c b/audio/audio.c index 61cdd73df5aa..7213f8bf07ca 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2276,7 +2276,7 @@ void audio_rate_add_bytes(RateCtl *rate, size_t bytes= _used) rate->bytes_sent +=3D bytes_used; } =20 -size_t audio_rate_get_bytes(struct audio_pcm_info *info, RateCtl *rate, +size_t audio_rate_get_bytes(RateCtl *rate, struct audio_pcm_info *info, size_t bytes_avail) { size_t bytes; diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index a3d656d3b017..722df0355e1e 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -82,7 +82,7 @@ static void *dbus_get_buffer_out(HWVoiceOut *hw, size_t *= size) } =20 *size =3D MIN(vo->buf_size - vo->buf_pos, *size); - *size =3D audio_rate_get_bytes(&hw->info, &vo->rate, *size); + *size =3D audio_rate_get_bytes(&vo->rate, &hw->info, *size); =20 return vo->buf + vo->buf_pos; =20 @@ -343,7 +343,7 @@ dbus_read(HWVoiceIn *hw, void *buf, size_t size) =20 trace_dbus_audio_read(size); =20 - /* size =3D audio_rate_get_bytes(&hw->info, &vo->rate, size); */ + /* size =3D audio_rate_get_bytes(&vo->rate, &hw->info, size); */ =20 g_hash_table_iter_init(&iter, da->in_listeners); while (g_hash_table_iter_next(&iter, NULL, (void **)&listener)) { diff --git a/audio/noaudio.c b/audio/noaudio.c index 84a6bfbb1c87..4fdee5adecff 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -44,7 +44,7 @@ typedef struct NoVoiceIn { static size_t no_write(HWVoiceOut *hw, void *buf, size_t len) { NoVoiceOut *no =3D (NoVoiceOut *) hw; - return audio_rate_get_bytes(&hw->info, &no->rate, len); + return audio_rate_get_bytes(&no->rate, &hw->info, len); } =20 static int no_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_o= paque) @@ -89,7 +89,7 @@ static void no_fini_in (HWVoiceIn *hw) static size_t no_read(HWVoiceIn *hw, void *buf, size_t size) { NoVoiceIn *no =3D (NoVoiceIn *) hw; - int64_t bytes =3D audio_rate_get_bytes(&hw->info, &no->rate, size); + int64_t bytes =3D audio_rate_get_bytes(&no->rate, &hw->info, size); =20 audio_pcm_info_clear_buf(&hw->info, buf, bytes / hw->info.bytes_per_fr= ame); return bytes; diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index f52f3a8bbb66..d17ef1a25efb 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -239,7 +239,7 @@ static void line_in_fini (HWVoiceIn *hw) static size_t line_in_read(HWVoiceIn *hw, void *buf, size_t len) { SpiceVoiceIn *in =3D container_of (hw, SpiceVoiceIn, hw); - uint64_t to_read =3D audio_rate_get_bytes(&hw->info, &in->rate, len) >= > 2; + uint64_t to_read =3D audio_rate_get_bytes(&in->rate, &hw->info, len) >= > 2; size_t ready =3D spice_server_record_get_samples(&in->sin, buf, to_rea= d); =20 /* diff --git a/audio/wavaudio.c b/audio/wavaudio.c index ac666335c783..3e1d84db83ee 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -42,7 +42,7 @@ typedef struct WAVVoiceOut { static size_t wav_write_out(HWVoiceOut *hw, void *buf, size_t len) { WAVVoiceOut *wav =3D (WAVVoiceOut *) hw; - int64_t bytes =3D audio_rate_get_bytes(&hw->info, &wav->rate, len); + int64_t bytes =3D audio_rate_get_bytes(&wav->rate, &hw->info, len); assert(bytes % hw->info.bytes_per_frame =3D=3D 0); =20 if (bytes && fwrite(buf, bytes, 1, wav->f) !=3D 1) { --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665647547; cv=none; d=zohomail.com; s=zohoarc; b=QUaB5tATKu7wzNnYHmHIwWB16qi+5WG7ARc68rbb9n3cKII2APbXAVWMBYz1IAExMWsc/HO+fS8xc2tN9WnnhslYhJXID+4Vdtn1oRFaWyIwEB4XUFSyT4GWlE4d+Bx8XE68d08OJIvU4JXCK0FCbVNx4DWq5h4lZMpTHrtV71s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665647547; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3NjuP7msiZQKgw04bfFBCvc+opey6RGEMdNOIBvRLWI=; b=lGKwBIJGB2zxuHjhTHRhhx16oJI/jSNg+uHX49W1SO7wmT6hwxnZG+EGowHUlOAUJOAkMSVS+FUddg2yTSnYtvQM8xqMSBMosfWMy0/8AnA/up486L9hbKkKlk9zlQwpMgOreU4ml5hEL0OFuH4CfUh5vwlKOykHrxvzX3S1efo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665647547874957.2514339378317; Thu, 13 Oct 2022 00:52:27 -0700 (PDT) Received: from localhost ([::1]:46230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oit0y-0006WH-VP for importer@patchew.org; Thu, 13 Oct 2022 03:52:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5f-0005SV-KM for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5e-0006qA-5H for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:11 -0400 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-658-twVefpS_OcyZ9tGuOD6JJA-1; Thu, 13 Oct 2022 02:53:05 -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 BAE138631F4; Thu, 13 Oct 2022 06:53:04 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 305712166BC0; Thu, 13 Oct 2022 06:52:57 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D2FDA180093B; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643989; 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=3NjuP7msiZQKgw04bfFBCvc+opey6RGEMdNOIBvRLWI=; b=iP0thDt4BkUZgVXrqkPd/LX5zFZgr97458fcNmVS3lIIxCu+FBhuZWCuBye87eeiOsS/Ku 6pjzpht+sQj99ti8tlZ1Ta3eU+oL5UPCpQke8bs+UZSlpuAjpXEQ0Esl6lw5Swy2D1WjuB gXoxQQMaaciDdNBLIBjotKGpnovWH0I= X-MC-Unique: twVefpS_OcyZ9tGuOD6JJA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 09/26] audio: rename audio_sw_bytes_free() Date: Thu, 13 Oct 2022 08:52:07 +0200 Message-Id: <20221013065224.1864145-10-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665647551451100001 From: Volker R=C3=BCmelin Rename and refactor audio_sw_bytes_free(). This function is not limited to calculate the free audio buffer size. The renamed function returns the number of frames instead of bytes. Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-9-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 7213f8bf07ca..28262ffd58a5 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1010,9 +1010,16 @@ static size_t audio_get_avail (SWVoiceIn *sw) return (((int64_t) live << 32) / sw->ratio) * sw->info.bytes_per_frame; } =20 -static size_t audio_sw_bytes_free(SWVoiceOut *sw, size_t free) +/** + * audio_frontend_frames_out() - returns the number of frames needed to + * get frames_out frames after resampling + * + * @sw: audio playback frontend + * @frames_out: number of frames + */ +static size_t audio_frontend_frames_out(SWVoiceOut *sw, size_t frames_out) { - return (((int64_t)free << 32) / sw->ratio) * sw->info.bytes_per_frame; + return ((int64_t)frames_out << 32) / sw->ratio; } =20 static size_t audio_get_free(SWVoiceOut *sw) @@ -1034,8 +1041,8 @@ static size_t audio_get_free(SWVoiceOut *sw) dead =3D sw->hw->mix_buf->size - live; =20 #ifdef DEBUG_OUT - dolog("%s: get_free live %zu dead %zu sw_bytes %zu\n", - SW_NAME(sw), live, dead, audio_sw_bytes_free(sw, dead)); + dolog("%s: get_free live %zu dead %zu frontend frames %zu\n", + SW_NAME(sw), live, dead, audio_frontend_frames_out(sw, dead)); #endif =20 return dead; @@ -1156,13 +1163,14 @@ static void audio_run_out (AudioState *s) size_t free; =20 if (hw_free > sw->total_hw_samples_mixed) { - free =3D audio_sw_bytes_free(sw, + free =3D audio_frontend_frames_out(sw, MIN(sw_free, hw_free - sw->total_hw_samples_mixed)= ); } else { free =3D 0; } if (free > 0) { - sw->callback.fn(sw->callback.opaque, free); + sw->callback.fn(sw->callback.opaque, + free * sw->info.bytes_per_frame); } } } --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665647177; cv=none; d=zohomail.com; s=zohoarc; b=TqkE8WyybiJ5eWb83tWhoTauiZ3wZjPq1QkSTfrBwnBHTbWSX8bpX3lWa0pWy6s03ubjQg/2bvM8f+6poQV737ZiKsIqC934sQq6mDKoynPRH5JHIFru61Kcq02GTtIGH42+NaVk+MvGCl6TQt/SSS4I6fC/F1xsQkMwRf+K8Bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665647177; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VaoOLD866Vv+iJJJCfZMtkIRjPcnzma/W44vHVgYlKo=; b=Bzz8S9MqXjdXg8jWW8esXioZ9IcYEpsts4fqQSBOgVeOlLDcz23BbiUevqb+psuZ6RtMZ4ztPcVfGavJHWv5NeRiI614/rLR7XTDVrh2ov56m/m3/+NVtyDELpRW0kMVsk+l9O6Q5OFZOK5BAsgu09c66y5v7yaRmwRNM/0PIxw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665647176993705.5764122074054; Thu, 13 Oct 2022 00:46:16 -0700 (PDT) Received: from localhost ([::1]:55142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisv1-0003Ed-TL for importer@patchew.org; Thu, 13 Oct 2022 03:46:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois60-0005Tv-M1 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35159) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5x-0006rb-Uj for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:32 -0400 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-6-X32Mbye9MHqJwt2nPS02iA-1; Thu, 13 Oct 2022 02:53:25 -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 BA8F81C075AA; Thu, 13 Oct 2022 06:53:09 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06BC6492B0F; Thu, 13 Oct 2022 06:52:58 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DFCC118009A2; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644009; 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=VaoOLD866Vv+iJJJCfZMtkIRjPcnzma/W44vHVgYlKo=; b=XD7gVDsjY5IIzqnuk9x7Qzl4B0yw1xA+5CaJDF5G0elxMkoTC8ILENMbvOw3YR1B525xm5 PlAba8zC4bFpgg+kR7d9v9OlMoDM0RS41REeEMfRnu0qcxIr+7oocEnhZ9FLn0RFgI7K8Z bOUWU5sQ2IM2Vd6OwBHEAD8pB3R3Tyk= X-MC-Unique: X32Mbye9MHqJwt2nPS02iA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 10/26] audio: refactor audio_get_avail() Date: Thu, 13 Oct 2022 08:52:08 +0200 Message-Id: <20221013065224.1864145-11-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665647178749100001 From: Volker R=C3=BCmelin Split out the code in audio_get_avail() that calculates the buffer size that the audio frontend can read. This is similar to the code changes in audio_get_free(). Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-10-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 28262ffd58a5..ed2b9d5f7e15 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -986,6 +986,18 @@ void AUD_set_active_in (SWVoiceIn *sw, int on) } } =20 +/** + * audio_frontend_frames_in() - returns the number of frames the resampling + * code generates from frames_in frames + * + * @sw: audio recording frontend + * @frames_in: number of frames + */ +static size_t audio_frontend_frames_in(SWVoiceIn *sw, size_t frames_in) +{ + return ((int64_t)frames_in << 32) / sw->ratio; +} + static size_t audio_get_avail (SWVoiceIn *sw) { size_t live; @@ -1002,12 +1014,12 @@ static size_t audio_get_avail (SWVoiceIn *sw) } =20 ldebug ( - "%s: get_avail live %zu ret %" PRId64 "\n", + "%s: get_avail live %zu frontend frames %zu\n", SW_NAME (sw), - live, (((int64_t) live << 32) / sw->ratio) * sw->info.bytes_per_fr= ame + live, audio_frontend_frames_in(sw, live) ); =20 - return (((int64_t) live << 32) / sw->ratio) * sw->info.bytes_per_frame; + return live; } =20 /** @@ -1309,11 +1321,13 @@ static void audio_run_in (AudioState *s) sw->total_hw_samples_acquired -=3D min; =20 if (sw->active) { + size_t sw_avail =3D audio_get_avail(sw); size_t avail; =20 - avail =3D audio_get_avail (sw); + avail =3D audio_frontend_frames_in(sw, sw_avail); if (avail > 0) { - sw->callback.fn (sw->callback.opaque, avail); + sw->callback.fn(sw->callback.opaque, + avail * sw->info.bytes_per_frame); } } } --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665645240; cv=none; d=zohomail.com; s=zohoarc; b=H1w6Kdtbv9yLxtsddZc2vQX5FT/fEqqVPMFJ13I8mGM/WwpfsMjVLphgGOLUGu3gn5j9S3NvCswD6e2MHR4wU1C20bvhmN5xBHGjQhZf0ottf7db2o6p2nQvpYFvsNSzTiKmIPYb/dvdQtGRlfyD9QZHrk3YElgr+EMG4/1UG6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665645240; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oe/bA1NghX+pkkJCL4QRBTkli058N6Ldvjf7q2z7Zbk=; b=SzxpDOAf9q9NeioY+FeS3ZJvkoa6hJotAu3PM9l/B1ghAH4Dps1dwrPxQfqdOJ897WMTTYyZ9UFa0FCnktucQSLGgkUSgIAR0+ox48lIS8svO5249QgshnR5SUYRCRoLVtE9KXympnIEeoLDAsS87CE7kJ7xQZ1iK45ip0MjaZw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665645240560917.1910883204356; Thu, 13 Oct 2022 00:14:00 -0700 (PDT) Received: from localhost ([::1]:60018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisPm-0000aw-H2 for importer@patchew.org; Thu, 13 Oct 2022 03:13:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5j-0005Sf-IT for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois5c-0006px-GH for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:15 -0400 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-591-mQJPigrYMKuuL_mt72V94A-1; Thu, 13 Oct 2022 02:53:06 -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 E768C857020; Thu, 13 Oct 2022 06:53:05 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69904112C070; Thu, 13 Oct 2022 06:53:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EE7FD18009BF; Thu, 13 Oct 2022 08:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665643987; 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=oe/bA1NghX+pkkJCL4QRBTkli058N6Ldvjf7q2z7Zbk=; b=MKoTrKt0H2u5hKdols94972nxgUtVv2ZgWBmVgDUQi1OTbe4pBrzZJu1hZxi9Hqk+YU+aK 7dbCaY3fPALEoA+2s/QDxapPZU1VHRIs166pHlxM35Ny3BnA0GZ4kiTj48K3eyyLHWvKEM 05fYNXq9VWA8nO83E5fEvvnTAM2vRQs= X-MC-Unique: mQJPigrYMKuuL_mt72V94A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 11/26] audio: fix sw->buf size for audio recording Date: Thu, 13 Oct 2022 08:52:09 +0200 Message-Id: <20221013065224.1864145-12-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665645345774100001 From: Volker R=C3=BCmelin The calculation of the buffer size needed to store audio samples after resampling is wrong for audio recording. For audio recording sw->ratio is calculated as sw->ratio =3D frontend sample rate / backend sample rate. From this follows frontend samples =3D frontend sample rate / backend sample rate * backend samples frontend samples =3D sw->ratio * backend samples In 2 of 3 places in the audio recording code where sw->ratio is used in a calculation to get the number of frontend frames, the calculation is wrong. Fix this. The 3rd formula in audio_pcm_sw_read() is correct. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/71 Signed-off-by: Volker R=C3=BCmelin Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220923183640.8314-11-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/audio_template.h | 4 ++++ audio/audio.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index 98ab557684d8..720a32e57e7d 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -110,7 +110,11 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) = (SW *sw) return 0; } =20 +#ifdef DAC samples =3D ((int64_t) sw->HWBUF->size << 32) / sw->ratio; +#else + samples =3D (int64_t)sw->HWBUF->size * sw->ratio >> 32; +#endif =20 sw->buf =3D audio_calloc(__func__, samples, sizeof(struct st_sample)); if (!sw->buf) { diff --git a/audio/audio.c b/audio/audio.c index ed2b9d5f7e15..886725747bda 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -995,7 +995,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on) */ static size_t audio_frontend_frames_in(SWVoiceIn *sw, size_t frames_in) { - return ((int64_t)frames_in << 32) / sw->ratio; + return (int64_t)frames_in * sw->ratio >> 32; } =20 static size_t audio_get_avail (SWVoiceIn *sw) --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665647947; cv=none; d=zohomail.com; s=zohoarc; b=L4Xfu69TkNjCImvbN2Dts9fndCUmaM8Jqitb16CSd5LTXL4jWB7ocyCwWEOf4yBTJHcMtW7sM3UX7ukBV0fHCwBQohvc3e+z/7Al7ZeDvNZ4U3a4WWA59Ab5CLn6lYrb6g/NhkZRH6seHU3+PT5xYLLT1fHYNOcKEVzRMSYARvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665647947; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dFY53AzsJRcBKruII2zUrxQtmZw/doxyqTmRmsjsMuo=; b=m23dKcCuYlzFpiTpN5tQe/1PA72zSdhgV/LytwnlTP+QJqKGzNSvXJzwNP5BPSr3MfYlsclaMLIUxs3flYlIjO6HFR+PI5LR2ahOb1pUNByBQgk5IB+seqpJd2dm2QDt2JJTh64dJ48TtU4TSdJ3yGeggZj5lYX1aaysDU+cqy0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166564794789696.99773029391133; Thu, 13 Oct 2022 00:59:07 -0700 (PDT) Received: from localhost ([::1]:55222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oit7S-0003zz-KE for importer@patchew.org; Thu, 13 Oct 2022 03:59:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois64-0005V6-PT for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26227) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois63-0006tH-5K for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:36 -0400 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-296-379P_Xt5ObuQKdTq1rHIig-1; Thu, 13 Oct 2022 02:53:31 -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 A236986EB4B; Thu, 13 Oct 2022 06:53:19 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7241B2166BDB; Thu, 13 Oct 2022 06:53:10 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0D5AD18009C1; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644014; 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=dFY53AzsJRcBKruII2zUrxQtmZw/doxyqTmRmsjsMuo=; b=AyMCRtoAhn1tuB8IHUtQYqGJQQFKZx849hkfVaR5Oa+znwGLCwTK0zPGNnUdmhocCCSOhC iRcaeHIJEAlZvItIMcCounn9bAAAwj5+5k0DiZL+UPCYwLNpZNIRiqilPcrdg1uOzt2WkU 0/VgyZppOP6QBJAI8baC7l1CkuE/hR0= X-MC-Unique: 379P_Xt5ObuQKdTq1rHIig-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 12/26] audio: prevent an integer overflow in resampling code Date: Thu, 13 Oct 2022 08:52:10 +0200 Message-Id: <20221013065224.1864145-13-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665647950051100001 From: Volker R=C3=BCmelin There are corner cases where rate->opos can overflow. For example, if QEMU is started with -audiodev pa,id=3Daudio0, out.frequency=3D11025 -device ich9-intel-hda -device hda-duplex, audiodev=3Daudio0 and the guest plays audio with a sampling frequency of 44100Hz, rate->opos will overflow after 27.05h and the audio stream will be silent for a long time. To prevent a rate->opos and also a rate->ipos overflow, both are wrapped around after a short time. The wrap around point rate->ipos >=3D 0x10001 is an arbitrarily selected value and can be any small value, 0 and 1 included. The comment that an ipos overflow will result in an infinite loop has been removed, because in this case the resampling code only generates no more output samples and the audio stream stalls. However, there is no infinite loop. Signed-off-by: Volker R=C3=BCmelin Message-Id: <20220923183640.8314-12-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- audio/rate_template.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/audio/rate_template.h b/audio/rate_template.h index f94c940c61b1..b432719ebbaa 100644 --- a/audio/rate_template.h +++ b/audio/rate_template.h @@ -72,11 +72,6 @@ void NAME (void *opaque, struct st_sample *ibuf, struct = st_sample *obuf, ilast =3D *ibuf++; rate->ipos++; =20 - /* if ipos overflow, there is a infinite loop */ - if (rate->ipos =3D=3D 0xffffffff) { - rate->ipos =3D 1; - rate->opos =3D rate->opos & 0xffffffff; - } /* See if we finished the input buffer yet */ if (ibuf >=3D iend) { goto the_end; @@ -85,6 +80,12 @@ void NAME (void *opaque, struct st_sample *ibuf, struct = st_sample *obuf, =20 icur =3D *ibuf; =20 + /* wrap ipos and opos around long before they overflow */ + if (rate->ipos >=3D 0x10001) { + rate->ipos =3D 1; + rate->opos &=3D 0xffffffff; + } + /* interpolate */ #ifdef FLOAT_MIXENG #ifdef RECIPROCAL --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665649457; cv=none; d=zohomail.com; s=zohoarc; b=DcuF0gdSmGQfYpumI7Wqp+nq3pdXdgHmo57YTJn4OOKBWmCSyMj776spWD2e40vuY1+mVlV7IRt4jugZMTJ+nYBE/MqfJZEEHKOc8iwPLpmk7yxBdg7IqPktjk1KpjZycMGJiez/phj7stBquoUqrVaYer6iaLvn3LYm1sOTQ3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665649457; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ikFCKxzwAATzDhF0GILYkTYichUaaKdjHXijr3jLnvo=; b=kisT0TlruKw7JrEMd174RepBErS6h1j/SuXNVdxCtqO5Znz2rrRMzWCv2KoxSJTMztDtfrAuc/ahmn9VHNpSjVa9yzVNrJHhJCRELTFvvQ+CN49dAFRSHEAGMS7Uq6fS3Hq5X2xzX0cd6ODtnwHkNn5OwbfsvbMNPGWAT7z8RaQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665649457605548.1665852433485; Thu, 13 Oct 2022 01:24:17 -0700 (PDT) Received: from localhost ([::1]:42864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oitVn-0008Hc-V7 for importer@patchew.org; Thu, 13 Oct 2022 04:24:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6E-0005Wk-2e for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27217) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois69-0006u6-8p for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:42 -0400 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-423-vYT_5PLqPiO1Wxj6klbu4g-1; Thu, 13 Oct 2022 02:53:34 -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 55FEA29DD994; Thu, 13 Oct 2022 06:53:18 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC8C6492B05; Thu, 13 Oct 2022 06:53:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 19DF818009C2; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644020; 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=ikFCKxzwAATzDhF0GILYkTYichUaaKdjHXijr3jLnvo=; b=EoLF5magveIwRDEZJCdIwz3A/3iHfXxO1E0AnUBbFtlO0xcqpmbj6V5cIW+n2/azQzu+R1 bNC/pgR5OE1xB7VXxOZK5PD/ma3UcrBW59Lx4JFATvCa57Tfy36/Y6K2uzm9ToO1x7wb4b XD0M8VY6oB6KPhMLPLyAymqIgAeuMjQ= X-MC-Unique: vYT_5PLqPiO1Wxj6klbu4g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Mauro Matteo Cascella , TangPeng Subject: [PULL 13/26] ui/vnc-clipboard: fix integer underflow in vnc_client_cut_text_ext Date: Thu, 13 Oct 2022 08:52:11 +0200 Message-Id: <20221013065224.1864145-14-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665649460915100001 Content-Type: text/plain; charset="utf-8" From: Mauro Matteo Cascella Extended ClientCutText messages start with a 4-byte header. If len < 4, an integer underflow occurs in vnc_client_cut_text_ext. The result is used to decompress data in a while loop in inflate_buffer, leading to CPU consumption and denial of service. Prevent this by checking dlen in protocol_client_msg. Fixes: CVE-2022-3165 Fixes: 0bf41cab93e5 ("ui/vnc: clipboard support") Reported-by: TangPeng Signed-off-by: Mauro Matteo Cascella Message-Id: <20220925204511.1103214-1-mcascell@redhat.com> Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 6a05d061479e..acb3629cd8e2 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2442,8 +2442,8 @@ static int protocol_client_msg(VncState *vs, uint8_t = *data, size_t len) if (len =3D=3D 1) { return 8; } + uint32_t dlen =3D abs(read_s32(data, 4)); if (len =3D=3D 8) { - uint32_t dlen =3D abs(read_s32(data, 4)); if (dlen > (1 << 20)) { error_report("vnc: client_cut_text msg payload has %u byte= s" " which exceeds our limit of 1MB.", dlen); @@ -2456,8 +2456,13 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) } =20 if (read_s32(data, 4) < 0) { - vnc_client_cut_text_ext(vs, abs(read_s32(data, 4)), - read_u32(data, 8), data + 12); + if (dlen < 4) { + error_report("vnc: malformed payload (header less than 4 b= ytes)" + " in extended clipboard pseudo-encoding."); + vnc_client_error(vs); + break; + } + vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12= ); break; } vnc_client_cut_text(vs, read_u32(data, 4), data + 8); --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665647097; cv=none; d=zohomail.com; s=zohoarc; b=ZGKrPULjZTNGnzKiJZMK/VPwmeHwo7QtunRACXnkL+ocqBm9mxegokQgU0awIahKC/cJSEM03T1YlO0f9ve5gFkOQDqN4wsRPAn/Ywkbyr1gerTrDwAnnvFZ/4C0CGQopGv8arVueqfmr1pWAu9awZWh0Kp7tOVXLiTAN5xiHVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665647097; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=75aaRgM87BFiU3rnRHF1gDGcnxHnw1Bq62+6vjBmCu0=; b=U2ef/4FUQf1fooIHZ5NwRyTmJLtsewEv9vno8umpZ0jdh/PcFou40DbKEXGqco2PgeYXmkIKwYjdYS8ZGJXhSQWEXfdTgU766ROmp/w+slS62I+3RUbTejcNHoxZOJMKginIKwQ0ZyGQAzCO4agnseYjz++VZNkn4GmuH4joPwI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665647097077261.1692072121525; Thu, 13 Oct 2022 00:44:57 -0700 (PDT) Received: from localhost ([::1]:59578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisth-00026c-Id for importer@patchew.org; Thu, 13 Oct 2022 03:44:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois68-0005Vx-PQ for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:30713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois66-0006tf-UU for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:40 -0400 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-319-xZSsFKy6PeW339ik0obOOg-1; Thu, 13 Oct 2022 02:53:36 -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 7339A86EB2D; Thu, 13 Oct 2022 06:53:31 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09B8E40CA41C; Thu, 13 Oct 2022 06:53:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 26A6B18009DA; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644018; 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=75aaRgM87BFiU3rnRHF1gDGcnxHnw1Bq62+6vjBmCu0=; b=h5dWkXHdBFIiFxQlihN71RDABphEOtX3mlG3tnKpVPKDNDDp2zdVgeI3DwMYBRdP6E6Ytk T8AdU7qVB9mZGiycPWGZvs6m/KClGs68aEXvg+bqW4ynzFipQjvxXaka0LoCvCl/Qzq9Rd OdJuuYJHtaCkYhBUlBVEUp1dg27e3OM= X-MC-Unique: xZSsFKy6PeW339ik0obOOg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Dongwon Kim Subject: [PULL 14/26] ui/gtk-egl: egl context needs to be unbound in the end of gd_egl_switch Date: Thu, 13 Oct 2022 08:52:12 +0200 Message-Id: <20221013065224.1864145-15-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665647098083100001 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim A thread often fails to bind an egl context to itself after guest VM is rebooted because the context is still owned by another thread. It is not very clear what condition makes this happen but this can be prevented by unbinding the context from the thread in the end of gd_egl_switch. Cc: Gerd Hoffmann Signed-off-by: Dongwon Kim Message-Id: <20220928215805.4661-1-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann --- ui/gtk-egl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index b5bffbab2522..35f917ceb15e 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -195,6 +195,9 @@ void gd_egl_switch(DisplayChangeListener *dcl, if (resized) { gd_update_windowsize(vc); } + + eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); } =20 QEMUGLContext gd_egl_create_context(DisplayGLCtx *dgc, --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665645150; cv=none; d=zohomail.com; s=zohoarc; b=WVKZDN/83j34XpnhLK8KW8dsD8dCqjfgqehCGsivFUfIaAED88XdeadZVsedLvKbAxCgDMPUD42G0uK5HfINI8wDOXQbjGL0lcY276cEy4NCC+14dJFm+eL0+ljf+wvMft2BkEmkuPS0Ln3FmLu1PWD2cJcql//Ycuzn8Vtj4j8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665645150; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Zz+Qt34oE4M5mrMgManCQwGhH1+sbvEnpgqeJuJljuY=; b=fCJbmoTiwVTcjwbl6t3Ih3VfJjBAjcuXhRLbvMzOgv8qVaRgxezZSA+R6QTo+YKVXs/RWa12aVeR2kqvSgXJQMNEP/MIm8I1rgWyXM9ki+8h2OFALxT+oxEcTmHilP9sX2r9MrH+33iGCi4qcAPVY/pwAjg5dGJK95bgsWR8p8g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665645150489832.87788902161; Thu, 13 Oct 2022 00:12:30 -0700 (PDT) Received: from localhost ([::1]:41002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisOH-0006fG-Ek for importer@patchew.org; Thu, 13 Oct 2022 03:12:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois68-0005W4-PJ for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois67-0006tj-1x for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:40 -0400 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-0HHEpvmUNPqxI2T_vu6GLg-1; Thu, 13 Oct 2022 02:53:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFAB929DD9AF; Thu, 13 Oct 2022 06:53:23 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FAE8140EBF3; Thu, 13 Oct 2022 06:53:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3318718009DB; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644018; 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=Zz+Qt34oE4M5mrMgManCQwGhH1+sbvEnpgqeJuJljuY=; b=SGXfSgcgMb3XSKbQ7mAhURCgP7pbwzATpsArTSDbcQezF/IiDy0HYbfuE/AvzeVPRbVmi3 xAXyC3uIn8YzToXzBSWh13BgSktPyF2bupAX8IgvbtkWXHWYIcWHoGjAb9GLm0hdF4WAXs aUMpf/oa6u0vL6HgE3MTdC958E0tZec= X-MC-Unique: 0HHEpvmUNPqxI2T_vu6GLg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , lu zhipeng Subject: [PULL 15/26] cirrus_vga: fix potential memory overflow Date: Thu, 13 Oct 2022 08:52:13 +0200 Message-Id: <20221013065224.1864145-16-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665645321466100001 Content-Type: text/plain; charset="utf-8" From: lu zhipeng Signed-off-by: lu zhipeng Message-Id: <20220929122352.1891-1-luzhipeng@cestc.cn> Signed-off-by: Gerd Hoffmann --- hw/display/cirrus_vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 3bb6a58698c1..2577005d03ce 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -834,7 +834,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAStat= e * s) word alignment, so we keep them for the next line */ /* XXX: keep alignment to speed up transfer */ end_ptr =3D s->cirrus_bltbuf + s->cirrus_blt_srcpitch; - copy_count =3D s->cirrus_srcptr_end - end_ptr; + copy_count =3D MIN(s->cirrus_srcptr_end - end_ptr, CIRRUS_= BLTBUFSIZE); memmove(s->cirrus_bltbuf, end_ptr, copy_count); s->cirrus_srcptr =3D s->cirrus_bltbuf + copy_count; s->cirrus_srcptr_end =3D s->cirrus_bltbuf + s->cirrus_blt_= srcpitch; --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665646595; cv=none; d=zohomail.com; s=zohoarc; b=k0HXjrbpwThhEYxYZolELOLWlXfdHbhOj66bTpj4WMZBdHTGhOR+M4ALtPQWsBlw/aoZETtWHShK0qbQlSAqcm605lZwROZt2lPVu9u2OogaDID7h1QcWGZ0wfBsJmM5B9ZoB5LVCCTU4aaG1Ot7BJvvpG6iSXzJ63JpGhhwlrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665646595; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9vPzUD7JjyVy8PFTQACn2r3YXj5SoY9IZjSsTzOKOOs=; b=QjQSTcqKC/QFoZhLdQZkq6ApqoFRj8q7kAhpkrfc5cHMa8yPOkRixSbCwXUyGxbQPagL84lfytMVTAT57i/4NHb1GlR+aGSoFoa+cuVY5mu2Sn38lr2ftf2CH8INDoVVO2eNXxSsa7B56xcR6QWrsD88mAR9eEQ+oq4StwN6DM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665646595075443.0183190644059; Thu, 13 Oct 2022 00:36:35 -0700 (PDT) Received: from localhost ([::1]:59406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oislH-0004Of-Hl for importer@patchew.org; Thu, 13 Oct 2022 03:36:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6A-0005Wl-T1 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:30299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois69-0006u4-Ch for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:42 -0400 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-169-ujabm6BdOCGcu-COkbT2VQ-1; Thu, 13 Oct 2022 02:53:35 -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 37946857F8F; Thu, 13 Oct 2022 06:53:35 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9E4B492B0F; Thu, 13 Oct 2022 06:53:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 413D418009E5; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644020; 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=9vPzUD7JjyVy8PFTQACn2r3YXj5SoY9IZjSsTzOKOOs=; b=IJO+BCX181pZypKRruk9wbSObeqgDH5nXaYOLm7p36TX7GS/vT559yhgRvsS8APf0n1Zw/ tkdLE0iRYIsONXp494wDlhpgMADU7ZWpzTrPYbGB9BIhb0IiteE18XHCaPSD0G09hbpQHE 4tox9JwB+W+fUCgdrUallF+1aNqhUY8= X-MC-Unique: ujabm6BdOCGcu-COkbT2VQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake Subject: [PULL 16/26] docs: add firmware feature flags Date: Thu, 13 Oct 2022 08:52:14 +0200 Message-Id: <20221013065224.1864145-17-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665646814443100001 Content-Type: text/plain; charset="utf-8" Add new firmware feature flags for the recently added confidential computing operating modes by amd and intel. While being at it also fix the path to the amd sev documentation. Signed-off-by: Gerd Hoffmann Reviewed-by: Kashyap Chamarthy Message-Id: <20220930133220.1771336-1-kraxel@redhat.com> --- docs/interop/firmware.json | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/interop/firmware.json b/docs/interop/firmware.json index 4e049b1c7ca0..56814f02b3c0 100644 --- a/docs/interop/firmware.json +++ b/docs/interop/firmware.json @@ -113,13 +113,22 @@ # Virtualization, as specified in the AMD64 Architecture # Programmer's Manual. QEMU command line options related to # this feature are documented in -# "docs/amd-memory-encryption.txt". +# "docs/system/i386/amd-memory-encryption.rst". # # @amd-sev-es: The firmware supports running under AMD Secure Encrypted # Virtualization - Encrypted State, as specified in the AMD64 # Architecture Programmer's Manual. QEMU command line options # related to this feature are documented in -# "docs/amd-memory-encryption.txt". +# "docs/system/i386/amd-memory-encryption.rst". +# +# @amd-sev-snp: The firmware supports running under AMD Secure Encrypted +# Virtualization - Secure Nested Paging, as specified in the +# AMD64 Architecture Programmer's Manual. QEMU command line +# options related to this feature are documented in +# "docs/system/i386/amd-memory-encryption.rst". +# +# @intel-tdx: The firmware supports running under Intel Trust Domain +# Extensions (TDX). # # @enrolled-keys: The variable store (NVRAM) template associated with # the firmware binary has the UEFI Secure Boot @@ -185,9 +194,11 @@ # Since: 3.0 ## { 'enum' : 'FirmwareFeature', - 'data' : [ 'acpi-s3', 'acpi-s4', 'amd-sev', 'amd-sev-es', 'enrolled-keys= ', - 'requires-smm', 'secure-boot', 'verbose-dynamic', - 'verbose-static' ] } + 'data' : [ 'acpi-s3', 'acpi-s4', + 'amd-sev', 'amd-sev-es', 'amd-sev-snp', + 'intel-tdx', + 'enrolled-keys', 'requires-smm', 'secure-boot', + 'verbose-dynamic', 'verbose-static' ] } =20 ## # @FirmwareFlashFile: --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665647770; cv=none; d=zohomail.com; s=zohoarc; b=he1XOPPhzG4UJQRye2qTX8RO8TGPofjt20f4SlieMGzIKFSWYyihx3CnRBTibUeY1HPPoV3MvPa9dao0tjZcAktdVrAiCLvgX5AtXJCktrmJbJ56ismr3kSdHOdVa5HA9DFLTC5TD13ZV2qoLaJbfsEHuNEH/Mrtlqe0s6Rw314= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665647770; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=orj1cWEpHZrryYGgIml/yIel5Qox1PVeAwkSFDP8qQc=; b=YPW4IGleT6XB0e0WyLGG7dpQBnr6VuIYE9rSsAP5Hh281qY5DECyXv7aTfusQo3AcolLJsIVPAaNV3RgEcXTc/EqflEu/o1Ujefp7oaBn1COBB1r6RV/6HXHcz58Ab6Rz6HFDieSGshaUbCAQMwO/JuL/SOEXf2Wbw7ymqdW6q0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665647770739420.7993733425311; Thu, 13 Oct 2022 00:56:10 -0700 (PDT) Received: from localhost ([::1]:39544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oit4b-00015w-Jg for importer@patchew.org; Thu, 13 Oct 2022 03:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois67-0005Vc-Li for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois65-0006tX-J5 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:38 -0400 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-402-E35dspHcNMGt7DD-Cjvueg-1; Thu, 13 Oct 2022 02:53:33 -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 7C68881F46A; Thu, 13 Oct 2022 06:53:33 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7ACDF492B0F; Thu, 13 Oct 2022 06:53:28 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 50AE518009F6; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644017; 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=orj1cWEpHZrryYGgIml/yIel5Qox1PVeAwkSFDP8qQc=; b=C9eV6H5wI6alOEbVDKdohkpNhGFpHA2DOtjm1B9FNiZKZ2eJzKzauHixBiWNY1dlyRjQmd OgdKa4d0vdccnYPlYuymjm11S0nWm3HhVQwNJCiXhoAEA0RA7m65BY/81K1ahmIL8DBB9v +8h/sXcUbpczWY7kbhksFjUW4gbgBkk= X-MC-Unique: E35dspHcNMGt7DD-Cjvueg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake Subject: [PULL 17/26] pci-ids: drop PCI_DEVICE_ID_VIRTIO_IOMMU Date: Thu, 13 Oct 2022 08:52:15 +0200 Message-Id: <20221013065224.1864145-18-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665647772288100001 Content-Type: text/plain; charset="utf-8" Not needed for a virtio 1.0 device. virtio_pci_device_plugged() overrides them anyway (so no functional change). Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Auger Tested-by: Eric Auger Message-Id: <20221004112100.301935-2-kraxel@redhat.com> --- include/hw/pci/pci.h | 1 - hw/virtio/virtio-iommu-pci.c | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index b54b6ef88fc3..89eaca429389 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -85,7 +85,6 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 #define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013 -#define PCI_DEVICE_ID_VIRTIO_IOMMU 0x1014 #define PCI_DEVICE_ID_VIRTIO_MEM 0x1015 =20 #define PCI_VENDOR_ID_REDHAT 0x1b36 diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 844d64770406..79ea8334f04e 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -74,8 +74,6 @@ static void virtio_iommu_pci_class_init(ObjectClass *klas= s, void *data) k->realize =3D virtio_iommu_pci_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); device_class_set_props(dc, virtio_iommu_pci_properties); - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_IOMMU; pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; pcidev_k->class_id =3D PCI_CLASS_OTHERS; dc->hotpluggable =3D false; @@ -90,7 +88,7 @@ static void virtio_iommu_pci_instance_init(Object *obj) } =20 static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info =3D { - .generic_name =3D TYPE_VIRTIO_IOMMU_PCI, + .generic_name =3D TYPE_VIRTIO_IOMMU_PCI, .instance_size =3D sizeof(VirtIOIOMMUPCI), .instance_init =3D virtio_iommu_pci_instance_init, .class_init =3D virtio_iommu_pci_class_init, --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665649788; cv=none; d=zohomail.com; s=zohoarc; b=BXXGaTnGYC8fejNz4TsFBOD435Daqh3/CsAv5Ur7mfBa2wZxDdl/UQBwkCKvkmBzH0f8SeJanTLmaBLiLSf7yVA9OgfDR+FSmwGSMO9gk33MenwpBD4tw1/yj7MUKXAnS3IoSBk6PEpO1CwPNAYhcLGyQZTW5ZNTkBFyyl2aeQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665649788; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wNXvzNQ+lYdZkGoCnac3t6rOsi+CI0MNgBQej2TW9AI=; b=f4Bww1eM02uuXB35M6kavNS5WEWprF02HDEVvQnWCCOBOOvZOMBC+Ni3okgxqNfX0A5u9/E4lX2q2kou7fNWH9lBYCVJl8HuLUU7PBptO4jd9fs9t117yXfIaC+HvSKBdpVIsTsgAWieReuSIwRwevamAEZ34X8qfPMu2cag51Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665649787999464.4730026806636; Thu, 13 Oct 2022 01:29:47 -0700 (PDT) Received: from localhost ([::1]:48404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oitb8-0005qB-Ts for importer@patchew.org; Thu, 13 Oct 2022 04:29:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6E-0005Wo-Tn for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45242) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois69-0006uA-Hv for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:43 -0400 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-554-APy7Fw7qNsKoNvvidE1MOQ-1; Thu, 13 Oct 2022 02:53:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4775E3C0F235; Thu, 13 Oct 2022 06:53:37 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B76287AE5; Thu, 13 Oct 2022 06:53:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5FD821800D40; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644020; 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=wNXvzNQ+lYdZkGoCnac3t6rOsi+CI0MNgBQej2TW9AI=; b=VGQhMVhCdhLWdkeyEX66uTjjGddtoWHHTal8xakxV1MjgK6CbpjRPkfmyZmMrge2PSmWvt j6UgmQEvJTLMRh6lfIgd83rK7NYtfv+FRnGLU1st8K+HxE3EGkNUa1J9fkOB235vnin0ES JMIcvn32+im6to8aY9OwW/1fiHEFJ44= X-MC-Unique: APy7Fw7qNsKoNvvidE1MOQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake Subject: [PULL 18/26] pci-ids: drop PCI_DEVICE_ID_VIRTIO_MEM Date: Thu, 13 Oct 2022 08:52:16 +0200 Message-Id: <20221013065224.1864145-19-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665649788764100001 Content-Type: text/plain; charset="utf-8" Not needed for a virtio 1.0 device. virtio_pci_device_plugged() overrides them anyway (so no functional change). Signed-off-by: Gerd Hoffmann Reviewed-by: David Hildenbrand Message-Id: <20221004112100.301935-3-kraxel@redhat.com> --- include/hw/pci/pci.h | 1 - hw/virtio/virtio-mem-pci.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 89eaca429389..b6aefb33fb17 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -85,7 +85,6 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 #define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013 -#define PCI_DEVICE_ID_VIRTIO_MEM 0x1015 =20 #define PCI_VENDOR_ID_REDHAT 0x1b36 #define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001 diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index be2383b0c522..5c5c1e3ae3da 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -104,8 +104,6 @@ static void virtio_mem_pci_class_init(ObjectClass *klas= s, void *data) =20 k->realize =3D virtio_mem_pci_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_MEM; pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; pcidev_k->class_id =3D PCI_CLASS_OTHERS; =20 --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665646223; cv=none; d=zohomail.com; s=zohoarc; b=jUM8KP5tDnywM1xGIPjIAYkhBzZhXoQ4CKiPhpgZOvnFlKWIwZ/TeHCY9y27fZlaeYe6eUMRxdMt4GPAc2p1Kfcp/tCZ79g8GV3ClKicIIOsRxqD7+OCdvwR6TejhSYiRTYQnZ4DWnVcWyN9SM70ty4kKe+mSZqvImH/YavoZhw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665646223; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4gI1fLccebbUVqqPVjGWv+XNJrT4nWYODgDu80gP414=; b=LHs/wa9ruY8mK/a7cdvYlWftQ0mqg9spgawUpK07Jnx7UY3eUFaUr3D2YjfaUjwE2iUJ3x6tYVQ0hIgeBg/raCMgcV3ubw+a4RWZ3qV10Mx2s8iYnSJfUwajzYZzlXxXwGzoWihD8Fu3oeDZxplEDApQaoBgrQw/CR0WT2GVIb4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665646223283368.06589897475567; Thu, 13 Oct 2022 00:30:23 -0700 (PDT) Received: from localhost ([::1]:57446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisfe-0001ro-4D for importer@patchew.org; Thu, 13 Oct 2022 03:30:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6K-0005YM-90 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6E-0006uZ-Lr for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:48 -0400 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-348-QBFUYuhpPoKPD55AqD9OJA-1; Thu, 13 Oct 2022 02:53:40 -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 A76C986C046; Thu, 13 Oct 2022 06:53:39 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2FB412086F7A; Thu, 13 Oct 2022 06:53:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6F1921800D44; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644024; 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=4gI1fLccebbUVqqPVjGWv+XNJrT4nWYODgDu80gP414=; b=SficZLCGOujX++wk0kEHLi0gzIJfuMA9CSJr0xGkz9ORw5P5y6b25AxkIE4UOYz7hHyyUz WBy9jtLSm0akuULzevPFwZUBk7AgcjYp3WAKiI4GEkVPrb8lPBR/uEuBYRldGVUH3E6gl2 +fTEGyLpUQ+BGtOBZdOrOWiaoD2JG7w= X-MC-Unique: QBFUYuhpPoKPD55AqD9OJA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Pankaj Gupta Subject: [PULL 19/26] pci-ids: drop PCI_DEVICE_ID_VIRTIO_PMEM Date: Thu, 13 Oct 2022 08:52:17 +0200 Message-Id: <20221013065224.1864145-20-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665646341828100001 Content-Type: text/plain; charset="utf-8" Not needed for a virtio 1.0 device. virtio_pci_device_plugged() overrides them anyway (so no functional change). Signed-off-by: Gerd Hoffmann Reviewed-by: David Hildenbrand Reviewed-by: Pankaj Gupta Tested-by: Pankaj Gupta Message-Id: <20221004112100.301935-4-kraxel@redhat.com> --- include/hw/pci/pci.h | 1 - hw/virtio/virtio-pmem-pci.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index b6aefb33fb17..42c83cb5ed00 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -84,7 +84,6 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_RNG 0x1005 #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 -#define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013 =20 #define PCI_VENDOR_ID_REDHAT 0x1b36 #define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001 diff --git a/hw/virtio/virtio-pmem-pci.c b/hw/virtio/virtio-pmem-pci.c index 2b2a0b1eae10..7d9f4ec189b9 100644 --- a/hw/virtio/virtio-pmem-pci.c +++ b/hw/virtio/virtio-pmem-pci.c @@ -90,8 +90,6 @@ static void virtio_pmem_pci_class_init(ObjectClass *klass= , void *data) =20 k->realize =3D virtio_pmem_pci_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_PMEM; pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; pcidev_k->class_id =3D PCI_CLASS_OTHERS; =20 --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665648684; cv=none; d=zohomail.com; s=zohoarc; b=bnNFkWzRt3ybMKB4WXDfpeRy+Ptjn1qG/kpvIq6G3iO/P3KJ9D1Ng+2SwtQsBfp84Tl4AXImacwQV6duzxPDIegqAUyLkZHjadPNnZhzErtE7EWLgFVTTPJIVCgXNTdBV4P0eoOYn7aKTtYAipbva4Ef7GhqE+96QibrmoEM1rI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665648684; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HVRGforIOSrop9TS6FZkictES+zjhFwXTuBWX+p4rkQ=; b=N7No6UiQIL9/0k+pcl8eOO26APOsc5dDtjnpG74CLlDK2g5nz2GUg1giY2UOtxeA0hrN6H7a15nTxoA2pm5yINP8zR+zwLDPEErmWIbhK4m4JLZne9WlLP2IWd4Bpa8aSsq26ErkWNhblocpAs0RQkqNi9/XrE3x+dhCUNJGx8o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665648684861322.26291641833166; Thu, 13 Oct 2022 01:11:24 -0700 (PDT) Received: from localhost ([::1]:58718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oitJL-0001dc-7j for importer@patchew.org; Thu, 13 Oct 2022 04:11:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6E-0005Wp-Tc for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6A-0006uG-6p for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:46 -0400 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-399-K8Yk280YN5C9a5DQ3DYhfQ-1; Thu, 13 Oct 2022 02:53:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9ED1286C043; Thu, 13 Oct 2022 06:53:39 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F9DB7AE5; Thu, 13 Oct 2022 06:53:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7C6131800D53; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644021; 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=HVRGforIOSrop9TS6FZkictES+zjhFwXTuBWX+p4rkQ=; b=JRG6DmyTFvLh8/GIV1veFjvYp/avFnFO6XlZICZACwqQiQsMBC0/77dR+Ddf9tf9RjXkAw /zqZZ9nJ+rG2SWcjzbdPISwldYzFyPjEfa7rvpCaP08QKHVj5T4Vmue/gQzpc6uXpNcVkD TnF+ABg6aJMkYTZLx+ei9xgdspad/p0= X-MC-Unique: K8Yk280YN5C9a5DQ3DYhfQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake Subject: [PULL 20/26] pci-ids: drop list of modern virtio devices Date: Thu, 13 Oct 2022 08:52:18 +0200 Message-Id: <20221013065224.1864145-21-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665648687316100001 Content-Type: text/plain; charset="utf-8" Drop the list of modern virtio devices and explain how they are calculated instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Auger Message-Id: <20221004112100.301935-5-kraxel@redhat.com> --- docs/specs/pci-ids.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt index dd6859d039d0..e463c4cb3a22 100644 --- a/docs/specs/pci-ids.txt +++ b/docs/specs/pci-ids.txt @@ -22,16 +22,14 @@ maintained as part of the virtio specification. 1af4:1004 SCSI host bus adapter device (legacy) 1af4:1005 entropy generator device (legacy) 1af4:1009 9p filesystem device (legacy) +1af4:1012 vsock device (bug compatibility) =20 -1af4:1041 network device (modern) -1af4:1042 block device (modern) -1af4:1043 console device (modern) -1af4:1044 entropy generator device (modern) -1af4:1045 balloon device (modern) -1af4:1048 SCSI host bus adapter device (modern) -1af4:1049 9p filesystem device (modern) -1af4:1050 virtio gpu device (modern) -1af4:1052 virtio input device (modern) +1af4:1040 Start of ID range for modern virtio devices. The PCI device + to ID is calculated from the virtio device ID by adding the +1af4:10ef 0x1040 offset. The virtio IDs are defined in the virtio + specification. The Linux kernel has a header file with + defines for all virtio IDs (linux/virtio_ids.h), qemu has a + copy in include/standard-headers/. =20 1af4:10f0 Available for experimental usage without registration. Must get to official ID when the code leaves the test lab (i.e. when seeking --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665648173; cv=none; d=zohomail.com; s=zohoarc; b=PoIkt4nrenecL/6FzSuzh52u0jw7RP0ooiTuW2csEv9cF+owcev5yHep1bR+qm9RxX/fCtMc9WGxRVDKABYVk9h90HTN0ItNteMa0PLLyWQgQuwKqeIWNDzCVD+XU0mrcTDcCJLt5+HDUROvzlvFzQHDHOOI1RJ3e7vuh6kgkrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665648173; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3TFNT0UF/29ZYG3Iovs5QCCFjKpnZTnvzRsmSk8wX3g=; b=XxOtIS6UpzTHMLx47alrLzj/oW3CFxFWp22t2cN2SDc85AeX2PBknL923xIRwNWJEbvE5cZz7lXelDdy5omYVWf+AJaBT0vlTI4JraQieFZ/GvW1jzfhnxZ2S0NF+W3pHEgf6UboE9s8pKE+R9nOIN8pMEFbKY2oszQ0qTmZXzY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665648173866251.39972547467244; Thu, 13 Oct 2022 01:02:53 -0700 (PDT) Received: from localhost ([::1]:46398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oitB6-0006to-LL for importer@patchew.org; Thu, 13 Oct 2022 04:02:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6G-0005Wx-Uj for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6F-0006ul-Bt for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:48 -0400 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-441-M8LjOHYTN5OS83EFEKuNRQ-1; Thu, 13 Oct 2022 02:53: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 3CC1B86F131; Thu, 13 Oct 2022 06:53:42 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CACD7414A809; Thu, 13 Oct 2022 06:53:41 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8BD361800D54; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644026; 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=3TFNT0UF/29ZYG3Iovs5QCCFjKpnZTnvzRsmSk8wX3g=; b=Xh9l6+/3ja3WEbRXoFgAT/XdVQqa4Ex+5P2WiHjt+1SyMJH5dnTBHiiqStXemchClw7Fhx Md9pN44KHSufvfSHGSsVJu0FomVJJYA3YbfJ9mRvA0mPn5SJzsVH5HPwdfG4nv3QvLA7j6 wtUMVOLkmDh5kgnKKqkFkhMeWp+PANA= X-MC-Unique: M8LjOHYTN5OS83EFEKuNRQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake Subject: [PULL 21/26] pci-ids: document modern virtio-pci ids in pci.h too Date: Thu, 13 Oct 2022 08:52:19 +0200 Message-Id: <20221013065224.1864145-22-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665648175728100001 Content-Type: text/plain; charset="utf-8" While being at it add a #define for the magic 0x1040 number. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Auger Message-Id: <20221004112100.301935-6-kraxel@redhat.com> --- include/hw/pci/pci.h | 10 ++++++++++ hw/virtio/virtio-pci.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 42c83cb5ed00..d1ac308574f1 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -76,6 +76,7 @@ extern bool pci_available; #define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4 #define PCI_SUBDEVICE_ID_QEMU 0x1100 =20 +/* legacy virtio-pci devices */ #define PCI_DEVICE_ID_VIRTIO_NET 0x1000 #define PCI_DEVICE_ID_VIRTIO_BLOCK 0x1001 #define PCI_DEVICE_ID_VIRTIO_BALLOON 0x1002 @@ -85,6 +86,15 @@ extern bool pci_available; #define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012 =20 +/* + * modern virtio-pci devices get their id assigned automatically, + * there is no need to add #defines here. It gets calculated as + * + * PCI_DEVICE_ID =3D PCI_DEVICE_ID_VIRTIO_10_BASE + + * virtio_bus_get_vdev_id(bus) + */ +#define PCI_DEVICE_ID_VIRTIO_10_BASE 0x1040 + #define PCI_VENDOR_ID_REDHAT 0x1b36 #define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001 #define PCI_DEVICE_ID_REDHAT_SERIAL 0x0002 diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index a50c5a57d7e5..e7d80242b73f 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1688,7 +1688,7 @@ static void virtio_pci_device_plugged(DeviceState *d,= Error **errp) pci_set_word(config + PCI_VENDOR_ID, PCI_VENDOR_ID_REDHAT_QUMRANET); pci_set_word(config + PCI_DEVICE_ID, - 0x1040 + virtio_bus_get_vdev_id(bus)); + PCI_DEVICE_ID_VIRTIO_10_BASE + virtio_bus_get_vdev_id= (bus)); pci_config_set_revision(config, 1); } config[PCI_INTERRUPT_PIN] =3D 1; --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665645670; cv=none; d=zohomail.com; s=zohoarc; b=c+7Qmn36tH25A9i3JXhQlwa2xAYY/j21Z02DpJJ5z4oK0MwqLmdQk1olIhWlzskl8cOc9Y0cLyfL1T5aUm9ArO9BbbYNbtk0KokLcuPHu+7VTYN6QAFYVgiLjzK622Y+Zg6mOMySGkATbj9g9dqTIKlX2n5d0624wiZBCVWeq+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665645670; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4MzkiQ/sH44QWYKfHCb/ilLhOtedG8MbjbTBT3JxfhY=; b=MhhqU6Cc20gyPyT7GoQRxmdcXiUPaIhQJpNXPYm6+tir6o2m4kgEbgXwB7MjP7vbeDv4E8SQ5FQO2BM5FIX9qwS+qjXk3muxprJas8QvE8RxChB64+JN5jz1uvFGDoK9CKkEw9riVX1v/A/TNvdZ/sGNFBL74nwXgbL3HGy8WXA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665645670434434.2137773638942; Thu, 13 Oct 2022 00:21:10 -0700 (PDT) Received: from localhost ([::1]:48512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisWj-0004Dv-6C for importer@patchew.org; Thu, 13 Oct 2022 03:21:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6K-0005YA-4e for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6G-0006uv-C8 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:49 -0400 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-596-qjVaNvQpMEyOZ6HLlggcUw-1; Thu, 13 Oct 2022 02:53:43 -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 3BDDF185A79C; Thu, 13 Oct 2022 06:53:43 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD068C15BB5; Thu, 13 Oct 2022 06:53:41 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 984F81800D58; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644027; 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=4MzkiQ/sH44QWYKfHCb/ilLhOtedG8MbjbTBT3JxfhY=; b=i3Er8hNmKt/F+eCBhf7WBGO+qQPbL9j6q05VI7T6XSxEi8L4hS+Cqu1zkgSl8gsoUscCVv QsY1yxg8By4HLh12F1Z7YJcCPtW8dNQxnMIZdMh3ZU9YhWKMo7DHML/iugnsag6xwITfWW qFwcx6ZjMzrOonu121Mk4VieZVj5AQg= X-MC-Unique: qjVaNvQpMEyOZ6HLlggcUw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Akihiko Odaki Subject: [PULL 22/26] ui/gtk: Fix the implicit mouse ungrabbing logic Date: Thu, 13 Oct 2022 08:52:20 +0200 Message-Id: <20221013065224.1864145-23-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665645828646100001 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki Although the grab menu item represents the tabbed displays, the old implicit mouse ungrabbing logic changes the grab menu item even for an untabbed display. Leave the grab menu item when implicitly ungrabbing mouse for an untabbed display. The new ungrabbing logic introduced in gd_mouse_mode_change() strictly follows the corresponding grabbing logic found in gd_button_event(). Signed-off-by: Akihiko Odaki Message-Id: <20221008140116.11473-1-akihiko.odaki@daynix.com> Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 1467b8c7d7f0..6fc2e2396393 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -681,9 +681,13 @@ static void gd_mouse_mode_change(Notifier *notify, voi= d *data) =20 s =3D container_of(notify, GtkDisplayState, mouse_mode_notifier); /* release the grab at switching to absolute mode */ - if (qemu_input_is_absolute() && gd_is_grab_active(s)) { - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), - FALSE); + if (qemu_input_is_absolute() && s->ptr_owner) { + if (!s->ptr_owner->window) { + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_ite= m), + FALSE); + } else { + gd_ungrab_pointer(s); + } } for (i =3D 0; i < s->nb_vcs; i++) { VirtualConsole *vc =3D &s->vc[i]; --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665649009; cv=none; d=zohomail.com; s=zohoarc; b=jvay3pCU//6W5+n/q46otpiGetynhHw39YXfPhZHj877G92at12HuhIS2Hxxcd3pCCOUW+1iluwWrI8lmEBDDGgtD7XA6HG5LdbRylnfl1OJxtYVfzhs2eSogPOlinrAKn3cfd4A125pXD4AZRsTvb+d5c9MzG5/0SlHlckelnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665649009; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PkixRhiE0Ds4x5lGUNAGmbnjj6jQbmiEDsVvhApVZ4w=; b=TE1OAkYKQAFMLKVJRuFFIvhsLBAUQkctrhM0Buydn4ig9KOr0gYjqUkSYUMxKrLQrl9AJWvUZ4LJKxkxnrn59F0KSbd9smYPXyi6GMwgUCRk2B1n2U0lXsNHTw7Hx2JFJUEO3j7iZdCqTNu7dt55u3O7umxJ6AEd+PkW7oZU8vk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665649009049707.5491215132284; Thu, 13 Oct 2022 01:16:49 -0700 (PDT) Received: from localhost ([::1]:59002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oitOZ-00058q-Hz for importer@patchew.org; Thu, 13 Oct 2022 04:16:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6L-0005ai-Cb for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6J-0006v0-QP for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:53 -0400 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-501-tK9XQJvDOHeyY01I18nzsA-1; Thu, 13 Oct 2022 02:53:45 -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 A4FEA101A528; Thu, 13 Oct 2022 06:53:44 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3332E2166BA3; Thu, 13 Oct 2022 06:53:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A4C581800D62; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644028; 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=PkixRhiE0Ds4x5lGUNAGmbnjj6jQbmiEDsVvhApVZ4w=; b=dc1wR7AtRMxewSyQZBtGD0b4jtFXvIwf8HhgddEkoA3ez4ptyHbJlkOKDaFHrkQJXdWtRu SdoAdq98VNKuBLMxCt1if22kwwBiSKPlYPzjYo5rrCUpnseE3KFy/iNAkGxTR0Z21KmcpM 7ktNs/8ERl6p9L7uZ0dEbF1bEkO3v/s= X-MC-Unique: tK9XQJvDOHeyY01I18nzsA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Sebastian Mitterle , Thomas Huth Subject: [PULL 23/26] qemu-edid: Restrict input parameter -d to avoid division by zero Date: Thu, 13 Oct 2022 08:52:21 +0200 Message-Id: <20221013065224.1864145-24-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665649010209100001 Content-Type: text/plain; charset="utf-8" From: Sebastian Mitterle A zero value for dpi will lead to a division by zero in qemu_edid_dpi_to_mm= (). Tested by runnig qemu-edid -dX, X =3D 0, 100. Resolves: qemu-project/qemu#1249 Suggested-by: Thomas Huth Signed-off-by: Sebastian Mitterle Message-Id: <20221011151216.64897-1-smitterl@redhat.com> Signed-off-by: Gerd Hoffmann --- qemu-edid.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qemu-edid.c b/qemu-edid.c index 20c958d9c7eb..92e1a660a76b 100644 --- a/qemu-edid.c +++ b/qemu-edid.c @@ -92,6 +92,10 @@ int main(int argc, char *argv[]) fprintf(stderr, "not a number: %s\n", optarg); exit(1); } + if (dpi =3D=3D 0) { + fprintf(stderr, "cannot be zero: %s\n", optarg); + exit(1); + } break; case 'v': info.vendor =3D optarg; --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665646936; cv=none; d=zohomail.com; s=zohoarc; b=hJBHgNB/s/qGayI4xzDMVSwDoxVIfyLI0KI89CspzDpiBzjYxRPj8NBODbnMJjIgIdOScG0IvRaG66by6BNhYm55B8jSSQyew+dBOUCgFiA7bFEzK21AmKkB/3vePnITq1Uj9kwGg7rrdFePruzJBvhYLNsguQzDfB+7jVegtXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665646936; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2Uu2Xsk9Yp33EWnQ/CLL6TL/MCM7gFTiwhrEHEOEHqg=; b=Dm37UFU9i4/TjN54qR+h3rBNI1dX1UvhUeWAt4JcP9YmLy3BhNolHLBQGoXt3+kD11cRbZ/hogMhPWiH/yV1OBn8fPcHtICpXvjldKuhaQ/T1nutxJyDdTPYxg79+d3X14fRMQ6A6nUyRCxGXzJigQ5HlXULNton4YDF4eQIAFo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665646936760473.7802536734472; Thu, 13 Oct 2022 00:42:16 -0700 (PDT) Received: from localhost ([::1]:53206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oisr9-0008Qv-GN for importer@patchew.org; Thu, 13 Oct 2022 03:42:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6R-0005h0-J3 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6N-0006vv-JK for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:58 -0400 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-457-I9B4PNs_NGuV6W_O0xjJ2A-1; Thu, 13 Oct 2022 02:53:48 -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 5D4E31C0515F; Thu, 13 Oct 2022 06:53:47 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10AF02166BA3; Thu, 13 Oct 2022 06:53:45 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B6AEB1800D67; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644034; 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=2Uu2Xsk9Yp33EWnQ/CLL6TL/MCM7gFTiwhrEHEOEHqg=; b=JSTGtjMJIiskejKXgSPj8TsZjzQya+KfbAgn3uw4iWsS2KIBlEFpg9deyYKvPbHBTdF4eY 88BsnpL0IafX/KA2AsqkqylTBNITt0qMsWqWT3p6OBdAer7gycGMxMOKjIgGRzQnIw2jbA Xy3bQbVlUNN9hD1JkOhkSCOS8vmHoYg= X-MC-Unique: I9B4PNs_NGuV6W_O0xjJ2A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Bryce Mills Subject: [PULL 24/26] gtk: Add show_menubar=on|off command line option. Date: Thu, 13 Oct 2022 08:52:22 +0200 Message-Id: <20221013065224.1864145-25-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665646938958100001 Content-Type: text/plain; charset="utf-8" From: Bryce Mills The patch adds "show_menubar" command line option for GTK UI similar to "show_tabs". This option allows to hide menu bar initially, it still can be toggled by shortcut and other shortcuts still work. Signed-off-by: Bryce Mills Acked-by: Markus Armbruster Message-Id: Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 15 ++++++++++----- qapi/ui.json | 5 ++++- qemu-options.hx | 3 +++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 6fc2e2396393..92daaa6a6edb 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2171,7 +2171,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, return group; } =20 -static GtkWidget *gd_create_menu_view(GtkDisplayState *s) +static GtkWidget *gd_create_menu_view(GtkDisplayState *s, DisplayOptions *= opts) { GSList *group =3D NULL; GtkWidget *view_menu; @@ -2269,7 +2269,8 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState= *s) s->show_menubar_item =3D gtk_check_menu_item_new_with_mnemonic( _("Show Menubar")); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->show_menubar_ite= m), - TRUE); + !opts->u.gtk.has_show_menubar || + opts->u.gtk.show_menubar); gtk_accel_group_connect(s->accel_group, GDK_KEY_m, HOTKEY_MODIFIERS, 0, g_cclosure_new_swap(G_CALLBACK(gd_accel_show_menubar), s, NULL= )); gtk_accel_label_set_accel( @@ -2280,13 +2281,13 @@ static GtkWidget *gd_create_menu_view(GtkDisplaySta= te *s) return view_menu; } =20 -static void gd_create_menus(GtkDisplayState *s) +static void gd_create_menus(GtkDisplayState *s, DisplayOptions *opts) { GtkSettings *settings; =20 s->accel_group =3D gtk_accel_group_new(); s->machine_menu =3D gd_create_menu_machine(s); - s->view_menu =3D gd_create_menu_view(s); + s->view_menu =3D gd_create_menu_view(s, opts); =20 s->machine_menu_item =3D gtk_menu_item_new_with_mnemonic(_("_Machine")= ); gtk_menu_item_set_submenu(GTK_MENU_ITEM(s->machine_menu_item), @@ -2363,7 +2364,7 @@ static void gtk_display_init(DisplayState *ds, Displa= yOptions *opts) =20 gtk_window_set_icon_name(GTK_WINDOW(s->window), "qemu"); =20 - gd_create_menus(s); + gd_create_menus(s, opts); =20 gd_connect_signals(s); =20 @@ -2378,6 +2379,10 @@ static void gtk_display_init(DisplayState *ds, Displ= ayOptions *opts) gtk_container_add(GTK_CONTAINER(s->window), s->vbox); =20 gtk_widget_show_all(s->window); + if (opts->u.gtk.has_show_menubar && + !opts->u.gtk.show_menubar) { + gtk_widget_hide(s->menu_bar); + } =20 vc =3D gd_vc_find_current(s); gtk_widget_set_sensitive(s->view_menu, vc !=3D NULL); diff --git a/qapi/ui.json b/qapi/ui.json index 286c5731d1c3..0abba3e930a4 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1199,13 +1199,16 @@ # interfaces (e.g. VGA and virtual console character devices) # by default. # Since 7.1 +# @show-menubar: Display the main window menubar. Defaults to "on". +# Since 8.0 # # Since: 2.12 ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', '*zoom-to-fit' : 'bool', - '*show-tabs' : 'bool' } } + '*show-tabs' : 'bool', + '*show-menubar' : 'bool' } } =20 ## # @DisplayEGLHeadless: diff --git a/qemu-options.hx b/qemu-options.hx index 95b998a13b01..bb0979bef908 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1969,6 +1969,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, #if defined(CONFIG_GTK) "-display gtk[,full-screen=3Don|off][,gl=3Don|off][,grab-on-hover=3Don= |off]\n" " [,show-tabs=3Don|off][,show-cursor=3Don|off][,window-clos= e=3Don|off]\n" + " [,show-menubar=3Don|off]\n" #endif #if defined(CONFIG_VNC) "-display vnc=3D[,]\n" @@ -2061,6 +2062,8 @@ SRST =20 ``window-close=3Don|off`` : Allow to quit qemu with window close b= utton =20 + ``show-menubar=3Don|off`` : Display the main window menubar, defau= lts to "on" + ``curses[,charset=3D]`` Display video output via curses. For graphics device models which support a text mode, QEMU can display this output using a --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665647996; cv=none; d=zohomail.com; s=zohoarc; b=g2Ba0ItGAUTo2HQSbFCaaiPVkyvV3Yg+jW5yp5b8w+dFzZzesZN8lOcIWsz9FYNTpOARMXwOZu8zyKwQPZoEswIv70t4kCEQXiyJvZXp5upemzouJrxU3R7RR2Ip/viaEgqFUWqVjtGDsEW7GxG2359lVyq6FNNR47i+1MJKT1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665647996; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KcvysvS16jg8b7qI+8vVDZX6OytDKc1WzDvj3buz0Sg=; b=Drj9DMrImO7lQp9MBgd2PVjPMV45jPop763fia6OMyE4nTU0Y7zOn+j+xtImMQScjEiJPD76jCvof08dbGhflX1MS/N5XRwRpcvij9hxMCKz1F3dhHuYjXRXI6VTS6bJld+Fv/mP61NjXcFCfl02ZVwZ93W4mYerANoeHbnAcms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1665647996417733.110446469219; Thu, 13 Oct 2022 00:59:56 -0700 (PDT) Received: from localhost ([::1]:48902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oit8F-0005Mr-8e for importer@patchew.org; Thu, 13 Oct 2022 03:59:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6S-0005jR-M1 for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:54:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58879) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6P-0006wD-OJ for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:54:00 -0400 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-82-sen0u0BfPF6XHORx9Eb5dA-1; Thu, 13 Oct 2022 02:53:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF34229DD99A; Thu, 13 Oct 2022 06:53:53 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 869827AE5; Thu, 13 Oct 2022 06:53:53 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C33531800D68; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644037; 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=KcvysvS16jg8b7qI+8vVDZX6OytDKc1WzDvj3buz0Sg=; b=MNDJJLSQ02zsQCb12lFJon+dV+3MslkDPRY8w8y9f++6uGgskRdyPklkDZJdkkihppgkar aUhen567jYAtzbImIBigX12MJWBMHamw9LMdBpP6kqyRRsSn0PhHG1X1Z5dI4IzfK0MCjv +XdPMr7VWF3iBgQS4CctJ6FrNhHESxs= X-MC-Unique: sen0u0BfPF6XHORx9Eb5dA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Helge Konetzka Subject: [PULL 25/26] audio: fix in.voices test Date: Thu, 13 Oct 2022 08:52:23 +0200 Message-Id: <20221013065224.1864145-26-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665647998456100001 From: Helge Konetzka Calling qemu with valid -audiodev ...,in.voices=3D0 results in an obsolete warning: audio: Bogus number of capture voices 0, setting to 0 This patch fixes the in.voices test. Signed-off-by: Helge Konetzka Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20221012114925.5084-2-hk@zapateado.de> Signed-off-by: Gerd Hoffmann --- audio/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 886725747bda..1ecdbc4191f2 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1778,7 +1778,7 @@ static AudioState *audio_init(Audiodev *dev, const ch= ar *name) s->nb_hw_voices_out =3D 1; } =20 - if (s->nb_hw_voices_in <=3D 0) { + if (s->nb_hw_voices_in < 0) { dolog ("Bogus number of capture voices %d, setting to 0\n", s->nb_hw_voices_in); s->nb_hw_voices_in =3D 0; --=20 2.37.3 From nobody Mon Feb 9 01:11:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665647649; cv=none; d=zohomail.com; s=zohoarc; b=bCRjxTq4K10cycs6KLZif8I8sBK2bDJ5WTNC7PslV3ehxB/wIk/ezKKN/EosxuuN0FQjQOeFdmlI+RcW/RWHvW2rLf2W30i+A7r+QTlr3YlJhgbnyD57sFRO/tgUqETIZllzYehGFJ68YDo6dl5s+WWX3AuHVE1Hi8ColnTMn3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665647649; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V7FQvrM1MyTYm+sV5Ldq1J8dLe5UvxEH64yK6VuzIL0=; b=nZoMdjXeTbyuxXhPXhagmq1s3EuFSebllxRXW8Ebi3hCWjFr3cbXSFj0oCi3DIm4mFXK+vAf0lyw4dU1SeHrbm4UcgV4uyQbL/T+lczHGzyLxuE1nhg3fgDPk8YYoIP6Oh0rz5tlOgaCSj79pp/Gd/Ylhg+o79zEiWaeO7yEJ7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166564764996573.41383528767824; Thu, 13 Oct 2022 00:54:09 -0700 (PDT) Received: from localhost ([::1]:41900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oit2e-00082L-Gv for importer@patchew.org; Thu, 13 Oct 2022 03:54:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6S-0005j5-EP for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:54:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51410) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ois6O-0006vy-Nf for qemu-devel@nongnu.org; Thu, 13 Oct 2022 02:53:59 -0400 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-616-tL0wMvRhMiqj13-Bpytt4Q-1; Thu, 13 Oct 2022 02:53:51 -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 92F922999B5F; Thu, 13 Oct 2022 06:53:51 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7BB862017DF0; Thu, 13 Oct 2022 06:53:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CF9141800D6A; Thu, 13 Oct 2022 08:52:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665644035; 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=V7FQvrM1MyTYm+sV5Ldq1J8dLe5UvxEH64yK6VuzIL0=; b=SX3lRhtUQ6d1zdzI0U0DIZtxn+1lQlJ6i7q1VcQ4vINgGk8d1qMZFO5K6x7Qeo0M3m5/gA OIzIZrnOdgS6v7QXuvX/ckZR+SCBlFlAL6pqoiZCVNzDbDHiO47hrDXQjWRns+piUeMPLW SLdEhyRb9Eq0xDuMVJll77e5TYxJugs= X-MC-Unique: tL0wMvRhMiqj13-Bpytt4Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: David Hildenbrand , Gerd Hoffmann , Kashyap Chamarthy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Eric Auger , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , "Michael S. Tsirkin" , Eric Blake , Helge Konetzka Subject: [PULL 26/26] audio: improve out.voices test Date: Thu, 13 Oct 2022 08:52:24 +0200 Message-Id: <20221013065224.1864145-27-kraxel@redhat.com> In-Reply-To: <20221013065224.1864145-1-kraxel@redhat.com> References: <20221013065224.1864145-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665647651251100001 From: Helge Konetzka Improve readability of audio out.voices test: If 1 is logged and set after positive test, 1 should be tested. Signed-off-by: Helge Konetzka Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20221012114925.5084-3-hk@zapateado.de> Signed-off-by: Gerd Hoffmann --- audio/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 1ecdbc4191f2..cc664271ebb5 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1772,7 +1772,7 @@ static AudioState *audio_init(Audiodev *dev, const ch= ar *name) s->nb_hw_voices_out =3D audio_get_pdo_out(dev)->voices; s->nb_hw_voices_in =3D audio_get_pdo_in(dev)->voices; =20 - if (s->nb_hw_voices_out <=3D 0) { + if (s->nb_hw_voices_out < 1) { dolog ("Bogus number of playback voices %d, setting to 1\n", s->nb_hw_voices_out); s->nb_hw_voices_out =3D 1; --=20 2.37.3