From nobody Tue Feb 10 16:43:57 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=1697005938; cv=none; d=zohomail.com; s=zohoarc; b=f61/zjXpOqbamqqFK2uOVOBCuHpOrj9oftNFzn5eCQv0i7Nx/4o+tc4/vEwilS3/TelWhZ61mvoJEpMfM+o3G7GkdeyqdBDlUHBO6ommZuSD2x5YS9NPlHnkWi3afccfhV9wBBeUTxyRKhCXSDkVNy+XvCZ0JQKYeEtbw6ZAJUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005938; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UVm9nEWfBVHV0TWOUNy9M417MZyEmmdt261AL01UI4o=; b=ZHTSX+urMvigiBrZK4FwyQp9imZrEcn4H5iEvt2xIcTEQSmttShQEKc4fexQ9Bat2xllUlydnG8QNtgCKruWJHXIDrINPQ6pOZXzdszJTYC2frx+oPQk8nMbJOmU1HBElBmwHhPgaQTcSVS3AJ79XXOdZtLuegcEsr6nv13vGd0= 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 1697005938027180.96858608122977; Tue, 10 Oct 2023 23:32:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSkb-0001r2-Rk; Wed, 11 Oct 2023 02:31:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkU-0001q3-Cg for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkS-0006rG-PI for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:14 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-503-BpK8owk9MtGY1lKOOCXBDQ-1; Wed, 11 Oct 2023 02:31:10 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD7043857B72; Wed, 11 Oct 2023 06:31:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 094A41C060DF; Wed, 11 Oct 2023 06:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005871; 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=UVm9nEWfBVHV0TWOUNy9M417MZyEmmdt261AL01UI4o=; b=Zq1i9j24hsKyi9YLuJforcTgarEIP1e6f9Xlj/prkvTdz2O8mNBeDhftDG5XqTeP6z1r+P m4fCEmgwp/6yVu+vHX2UZI2wKGd2J8ORt2nbB21i1jhq/dmK4bTCm8PMYhJzWwIXZ05Sby 28R2zRmXDBJNBZYDssY8Fa379vRNJcg= X-MC-Unique: BpK8owk9MtGY1lKOOCXBDQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 1/8] hw/audio/es1370: reset current sample counter Date: Wed, 11 Oct 2023 10:30:54 +0400 Message-ID: <20231011063101.258955-2-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.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=marcandre.lureau@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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005938352100001 From: Volker R=C3=BCmelin Reset the current sample counter when writing the Channel Sample Count Register. The Linux ens1370 driver and the AROS sb128 driver expect the current sample counter counts down from sample count to 0 after a write to the Channel Sample Count Register. Currently the current sample counter starts from 0 after a reset or the last count when the counter was stopped. The current sample counter is used to raise an interrupt whenever a complete buffer was transferred. When the counter starts with a value lower than the reload value, the interrupt triggeres before the buffer was completly transferred. This may lead to corrupted audio streams. Tested-by: Rene Engel Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-1-vr_qemu@t-online.de> --- hw/audio/es1370.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 90f73d4c23..0567721eb7 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -502,7 +502,7 @@ static void es1370_write(void *opaque, hwaddr addr, uin= t64_t val, unsigned size) case ES1370_REG_DAC2_SCOUNT: case ES1370_REG_ADC_SCOUNT: d +=3D (addr - ES1370_REG_DAC1_SCOUNT) >> 2; - d->scount =3D (val & 0xffff) | (d->scount & ~0xffff); + d->scount =3D (val & 0xffff) << 16 | (val & 0xffff); ldebug ("chan %td CURR_SAMP_CT %d, SAMP_CT %d\n", d - &s->chan[0], val >> 16, (val & 0xffff)); break; --=20 2.41.0 From nobody Tue Feb 10 16:43:57 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=1697005946; cv=none; d=zohomail.com; s=zohoarc; b=JRNvMLWrsdLR6Ss85BlDL3hauCRzcBjv836vLyVRwXgF9ZkGUnLEDqdrvY2iqM5SvZU1Rq3ykdmTDfdaIkXmmOIws3TqnG/WnqyUjNLNox6781OyfVB+nVt2FcIMbpkeTrxZJA9J9avx87u1A2sJgYDM3jtXsl7RM62GmZh1nEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005946; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=caJEKmVWujjpSVdvPkOZgpYPoU/SvErrK0p0KeF9Zio=; b=PKCMHftIEfexsSJ3j6UBs7XWp5mwscNI/ZCShLloDRzaHLqEs7wE0r1mirlRpiitze63rXQgwTBdOP4CKcCmsG28hT9MQGZ46Ok7QFUht3DA9Y4ZGku4CFkclJgoMG3SmTupcHM1KEBsEOr7LzgjfKHxMmeDv9Y3ezQ0bzgkoGQ= 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 1697005946560718.5035464938084; Tue, 10 Oct 2023 23:32:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSkh-0001s2-Ly; Wed, 11 Oct 2023 02:31:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkc-0001rT-Ac for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkZ-0006rw-Dp for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:21 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-128-roYU94WtNTOOOou7xTrTqQ-1; Wed, 11 Oct 2023 02:31:14 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 945021C0896A; Wed, 11 Oct 2023 06:31:14 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B794C5796D; Wed, 11 Oct 2023 06:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005878; 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=caJEKmVWujjpSVdvPkOZgpYPoU/SvErrK0p0KeF9Zio=; b=PC/uGN/m31u0zL6YzZ0GGcca2jZ1ddRmSf9JzIBEZnWuYjvamnrDr0YbQqIAQR9e8IxCLA Jg9jKK77eNsq6JAMMhh03h/b1fynW6Ye17qAD1senV0QZHrX7TbmDAv367cpwu4hA6lcpj Edxb0TCiF0rzhsbPrZ46kZzlejjh7Gw= X-MC-Unique: roYU94WtNTOOOou7xTrTqQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 2/8] hw/audio/es1370: replace bit-rotted code with tracepoints Date: Wed, 11 Oct 2023 10:30:55 +0400 Message-ID: <20231011063101.258955-3-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@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.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=marcandre.lureau@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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005948379100003 From: Volker R=C3=BCmelin It seems that nobody has enabled the debug code of the ES1370 device for a long time. Since then, the code has bit-rotted. Replace the bit-rotten code with tracepoints. Tested-by: Rene Engel Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-2-vr_qemu@t-online.de> --- hw/audio/es1370.c | 55 ++++++++++++++----------------------------- hw/audio/trace-events | 10 ++++++++ 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 0567721eb7..2b55e31a9a 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -34,6 +34,7 @@ #include "qemu/module.h" #include "sysemu/dma.h" #include "qom/object.h" +#include "trace.h" =20 /* Missing stuff: SCTRL_P[12](END|ST)INC @@ -166,8 +167,6 @@ static void es1370_adc_callback (void *opaque, int avai= l); =20 #ifdef DEBUG_ES1370 =20 -#define ldebug(...) AUD_log ("es1370", __VA_ARGS__) - static void print_ctl (uint32_t val) { char buf[1024]; @@ -239,7 +238,6 @@ static void print_sctl (uint32_t val) ); } #else -#define ldebug(...) #define print_ctl(...) #define print_sctl(...) #endif @@ -411,12 +409,9 @@ static void es1370_update_voices (ES1370State *s, uint= 32_t ctl, uint32_t sctl) =20 if ((old_fmt !=3D new_fmt) || (old_freq !=3D new_freq)) { d->shift =3D (new_fmt & 1) + (new_fmt >> 1); - ldebug ("channel %zu, freq =3D %d, nchannels %d, fmt %d, shift= %d\n", - i, - new_freq, - 1 << (new_fmt & 1), - (new_fmt & 2) ? AUDIO_FORMAT_S16 : AUDIO_FORMAT_U8, - d->shift); + trace_es1370_stream_format(i, new_freq, + new_fmt & 2 ? "s16" : "u8", new_fmt & 1 ? "stereo" : "mono= ", + d->shift); if (new_freq) { struct audsettings as; =20 @@ -503,8 +498,8 @@ static void es1370_write(void *opaque, hwaddr addr, uin= t64_t val, unsigned size) case ES1370_REG_ADC_SCOUNT: d +=3D (addr - ES1370_REG_DAC1_SCOUNT) >> 2; d->scount =3D (val & 0xffff) << 16 | (val & 0xffff); - ldebug ("chan %td CURR_SAMP_CT %d, SAMP_CT %d\n", - d - &s->chan[0], val >> 16, (val & 0xffff)); + trace_es1370_sample_count_wr(d - &s->chan[0], + d->scount >> 16, d->scount & 0xffff); break; =20 case ES1370_REG_ADC_FRAMEADR: @@ -515,7 +510,7 @@ static void es1370_write(void *opaque, hwaddr addr, uin= t64_t val, unsigned size) d +=3D (addr - ES1370_REG_DAC1_FRAMEADR) >> 3; frameadr: d->frame_addr =3D val; - ldebug ("chan %td frame address %#x\n", d - &s->chan[0], val); + trace_es1370_frame_address_wr(d - &s->chan[0], d->frame_addr); break; =20 case ES1370_REG_PHANTOM_FRAMECNT: @@ -534,8 +529,8 @@ static void es1370_write(void *opaque, hwaddr addr, uin= t64_t val, unsigned size) framecnt: d->frame_cnt =3D val; d->leftover =3D 0; - ldebug ("chan %td frame count %d, buffer size %d\n", - d - &s->chan[0], val >> 16, val & 0xffff); + trace_es1370_frame_count_wr(d - &s->chan[0], + d->frame_cnt >> 16, d->frame_cnt & 0xffff); break; =20 default: @@ -573,17 +568,9 @@ static uint64_t es1370_read(void *opaque, hwaddr addr,= unsigned size) case ES1370_REG_DAC2_SCOUNT: case ES1370_REG_ADC_SCOUNT: d +=3D (addr - ES1370_REG_DAC1_SCOUNT) >> 2; + trace_es1370_sample_count_rd(d - &s->chan[0], + d->scount >> 16, d->scount & 0xffff); val =3D d->scount; -#ifdef DEBUG_ES1370 - { - uint32_t curr_count =3D d->scount >> 16; - uint32_t count =3D d->scount & 0xffff; - - curr_count <<=3D d->shift; - count <<=3D d->shift; - dolog ("read scount curr %d, total %d\n", curr_count, count); - } -#endif break; =20 case ES1370_REG_ADC_FRAMECNT: @@ -593,17 +580,9 @@ static uint64_t es1370_read(void *opaque, hwaddr addr,= unsigned size) case ES1370_REG_DAC2_FRAMECNT: d +=3D (addr - ES1370_REG_DAC1_FRAMECNT) >> 3; framecnt: + trace_es1370_frame_count_rd(d - &s->chan[0], + d->frame_cnt >> 16, d->frame_cnt & 0xffff); val =3D d->frame_cnt; -#ifdef DEBUG_ES1370 - { - uint32_t size =3D ((d->frame_cnt & 0xffff) + 1) << 2; - uint32_t curr =3D ((d->frame_cnt >> 16) + 1) << 2; - if (curr > size) { - dolog ("read framecnt curr %d, size %d %d\n", curr, size, - curr > size); - } - } -#endif break; =20 case ES1370_REG_ADC_FRAMEADR: @@ -613,6 +592,7 @@ static uint64_t es1370_read(void *opaque, hwaddr addr, = unsigned size) case ES1370_REG_DAC2_FRAMEADR: d +=3D (addr - ES1370_REG_DAC1_FRAMEADR) >> 3; frameadr: + trace_es1370_frame_address_rd(d - &s->chan[0], d->frame_addr); val =3D d->frame_addr; break; =20 @@ -689,9 +669,6 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, if (csc_bytes =3D=3D transferred) { *irq =3D 1; d->scount =3D sc | (sc << 16); - ldebug ("sc =3D %d, rate =3D %f\n", - (sc + 1) << d->shift, - (sc + 1) / (double) 44100); } else { *irq =3D 0; @@ -713,6 +690,10 @@ static void es1370_transfer_audio (ES1370State *s, str= uct chan *d, int loop_sel, } =20 d->leftover =3D (transferred + d->leftover) & 3; + trace_es1370_transfer_audio(index, + d->frame_cnt >> 16, d->frame_cnt & 0xffff, + d->scount >> 16, d->scount & 0xffff, + d->leftover, *irq); } =20 static void es1370_run_channel (ES1370State *s, size_t chan, int free_or_a= vail) diff --git a/hw/audio/trace-events b/hw/audio/trace-events index 89ef2996e5..9ae2f717b6 100644 --- a/hw/audio/trace-events +++ b/hw/audio/trace-events @@ -6,6 +6,16 @@ cs4231_mem_readl_reg(uint32_t reg, uint32_t ret) "read reg= %d: 0x%08x" cs4231_mem_writel_reg(uint32_t reg, uint32_t old, uint32_t val) "write reg= %d: 0x%08x -> 0x%08x" cs4231_mem_writel_dreg(uint32_t reg, uint32_t old, uint32_t val) "write dr= eg %d: 0x%02x -> 0x%02x" =20 +# es1370.c +es1370_frame_address_rd(int ch, uint32_t addr) "ch=3D%d addr=3D0x%08x" +es1370_frame_address_wr(int ch, uint32_t addr) "ch=3D%d addr=3D0x%08x" +es1370_frame_count_rd(int ch, uint32_t curr, uint32_t size) "ch=3D%d CURR_= CT=3D%u BUF_SIZE=3D%u" +es1370_frame_count_wr(int ch, uint32_t curr, uint32_t size) "ch=3D%d CURR_= CT=3D%u BUF_SIZE=3D%u" +es1370_sample_count_rd(int ch, uint32_t curr, uint32_t num) "ch=3D%d CURR_= SAMP_CT=3D%u SAMP_CT=3D%u" +es1370_sample_count_wr(int ch, uint32_t curr, uint32_t num) "ch=3D%d CURR_= SAMP_CT=3D%u SAMP_CT=3D%u" +es1370_stream_format(int ch, uint32_t freq, const char *fmt, const char *m= ode, uint32_t shift) "ch=3D%d fmt=3D%u:%s:%s shift=3D%u" +es1370_transfer_audio(int ch, uint32_t f_curr, uint32_t f_size, uint32_t s= _curr, uint32_t s_num, uint32_t leftover, int irq) "ch=3D%d CURR_CT=3D%u BU= F_SIZE=3D%u CURR_SAMP_CT=3D%u SAMP_CT=3D%u leftover=3D%u irq=3D%d" + # hda-codec.c hda_audio_running(const char *stream, int nr, bool running) "st %s, nr %d,= run %d" hda_audio_format(const char *stream, int chan, const char *fmt, int freq) = "st %s, %d x %s @ %d Hz" --=20 2.41.0 From nobody Tue Feb 10 16:43:57 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=1697005933; cv=none; d=zohomail.com; s=zohoarc; b=AllV4G8EFDy9o5QXQCmR2l3s+QDZd3hK5rgtiuYf+4wiFCjHfDjCAkxrrN766yPvF4AM02Fplr+S5rqPBNyELSra3R4Dj+ad1EBgVHN2uICrX4w5KKp/OcYieh15RCSnTtv2JXX+++Zu4W/CJmo92SmSp2RyFDfiaMNwLRyoBns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005933; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D25CzooUJ7v1YqwcBdHB5VeRjwWXGUOkNrkeDmGkRvY=; b=ISaa65HJmAnY3vvtrpuiTWR9ABZcQ+LpNEJKWd5j6RLUS2B07KCVHEXpnUcsla8SxKD+icZBPuPGBzMyckNBBV9Laiwi6D/mSx9iX+pF7PdONaGK/rql9iO8QPtH+6N6CTFj0vuxbrzCI9GaF6q3+5MeE0lT3H9YX+3i/tnZm8Y= 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 1697005933358904.0300351765519; Tue, 10 Oct 2023 23:32:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSkw-0001u3-Bx; Wed, 11 Oct 2023 02:31:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkm-0001su-Pv for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkl-0006t1-Bh for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:32 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-75-Ou8rWIp0OV2dxZMrjXDCJg-1; Wed, 11 Oct 2023 02:31:19 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7B393857B63; Wed, 11 Oct 2023 06:31:18 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CC14492B04; Wed, 11 Oct 2023 06:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005890; 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=D25CzooUJ7v1YqwcBdHB5VeRjwWXGUOkNrkeDmGkRvY=; b=LlrxKJEgvwMJVHf4ygUgXYNug8B58E/Zc0QKxSdO5Td/6CcpEwYIc/kJogXT/DVRDrDAnG sgiHD0/niAN0USGmpXOh8nOjH8c+7B5FEJUZc8g+cdTJF03XTcPg/D7QRY46ovoIPcYG0Q +sqy+JcRF/NI14w5byYbUwG09tX+Nog= X-MC-Unique: Ou8rWIp0OV2dxZMrjXDCJg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 3/8] hw/audio/es1370: remove unused dolog macro Date: Wed, 11 Oct 2023 10:30:56 +0400 Message-ID: <20231011063101.258955-4-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@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=marcandre.lureau@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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005934381100001 From: Volker R=C3=BCmelin The dolog macro is unused. Remove the macro and use the now unused ES1370_VERBOSE macro to replace its inverse ES1370_SILENT macro. Tested-by: Rene Engel Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-3-vr_qemu@t-online.de> --- hw/audio/es1370.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 2b55e31a9a..dd09fd59e1 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -24,7 +24,6 @@ =20 /* #define DEBUG_ES1370 */ /* #define VERBOSE_ES1370 */ -#define SILENT_ES1370 =20 #include "qemu/osdep.h" #include "hw/audio/soundhw.h" @@ -243,12 +242,6 @@ static void print_sctl (uint32_t val) #endif =20 #ifdef VERBOSE_ES1370 -#define dolog(...) AUD_log ("es1370", __VA_ARGS__) -#else -#define dolog(...) -#endif - -#ifndef SILENT_ES1370 #define lwarn(...) AUD_log ("es1370: warning", __VA_ARGS__) #else #define lwarn(...) --=20 2.41.0 From nobody Tue Feb 10 16:43:57 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=1697005973; cv=none; d=zohomail.com; s=zohoarc; b=j2vQXGtxto1MIBk28KymJj8yzof12OxUJmhUADRvHsr7b/BR+Bxbr42QFVzrXwPkyJhz4A+UTZHQWHgekx/gMU6bUB+19DiUa4pd9ypjbUm2h6p3kgszJoGlw4lWpxmab5df0mcQiqBOf6+E6mBCDesPytxs9igD6GmG/UxIOMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005973; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TLJnKgNtxYx5qH6WK1NFc/hsEV6CbfDgzhHL3lI4hFY=; b=Wx1AYIQuWnh5w6pltRKKil7/VLm56V1HfSdh+jVMcUjRyOkYlxy+YaNFahsPA6vLlxkHQqwZeYxGq22NnGXh1jC+as818P3JcOg2oMVVxrDH0LoTKhhElFNXenBfhtrS3Wzu6tz1m3aKyrJDJvX3Nw8vlU7dtqbKMdPFkXS7zpo= 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 1697005973085448.9593904056809; Tue, 10 Oct 2023 23:32:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSl7-0001vx-CU; Wed, 11 Oct 2023 02:31:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkt-0001tg-Cj for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkr-0006tX-Dl for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:38 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-455-Z7BOjUvEP3aT4WfjQ2DtgA-1; Wed, 11 Oct 2023 02:31:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F5522825E95; Wed, 11 Oct 2023 06:31:23 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DB041C060DF; Wed, 11 Oct 2023 06:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005896; 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=TLJnKgNtxYx5qH6WK1NFc/hsEV6CbfDgzhHL3lI4hFY=; b=h44Ig2ecQ0iWIvagEJPsfssZImcEKpcAcRdnassBqqi1kFepAkTCvfehEErlVMdeevZyQK edrkkRRrLIYVIQGqLPeGP9x43J/qBRi5l5cJtO7OOoS1E22JxoguS4BXD/cjh5ZClEcwbY wzMj2Ym5L8b4CSzRjBYxVc7qcGb6Thw= X-MC-Unique: Z7BOjUvEP3aT4WfjQ2DtgA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 4/8] hw/audio/es1370: remove #ifdef ES1370_DEBUG to avoid bit rot Date: Wed, 11 Oct 2023 10:30:57 +0400 Message-ID: <20231011063101.258955-5-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.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=marcandre.lureau@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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005974467100008 From: Volker R=C3=BCmelin Replace the #ifdef ES1370_DEBUG code with code that the compiler can optimize away to avoid bit rot. While at it, replace strcat() with pstrcat(). Tested-by: Rene Engel Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-4-vr_qemu@t-online.de> --- hw/audio/es1370.c | 135 +++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 69 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index dd09fd59e1..f111206709 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ =20 -/* #define DEBUG_ES1370 */ +#define DEBUG_ES1370 0 /* #define VERBOSE_ES1370 */ =20 #include "qemu/osdep.h" @@ -30,6 +30,7 @@ #include "audio/audio.h" #include "hw/pci/pci_device.h" #include "migration/vmstate.h" +#include "qemu/cutils.h" #include "qemu/module.h" #include "sysemu/dma.h" #include "qom/object.h" @@ -164,82 +165,78 @@ static void es1370_dac1_callback (void *opaque, int f= ree); static void es1370_dac2_callback (void *opaque, int free); static void es1370_adc_callback (void *opaque, int avail); =20 -#ifdef DEBUG_ES1370 - -static void print_ctl (uint32_t val) +static void print_ctl(uint32_t val) { - char buf[1024]; - - buf[0] =3D '\0'; -#define a(n) if (val & CTRL_##n) strcat (buf, " "#n) - a (ADC_STOP); - a (XCTL1); - a (OPEN); - a (MSFMTSEL); - a (M_SBB); - a (DAC_SYNC); - a (CCB_INTRM); - a (M_CB); - a (XCTL0); - a (BREQ); - a (DAC1_EN); - a (DAC2_EN); - a (ADC_EN); - a (UART_EN); - a (JYSTK_EN); - a (CDC_EN); - a (SERR_DIS); + if (DEBUG_ES1370) { + char buf[1024]; + + buf[0] =3D '\0'; +#define a(n) if (val & CTRL_##n) pstrcat(buf, sizeof(buf), " "#n) + a(ADC_STOP); + a(XCTL1); + a(OPEN); + a(MSFMTSEL); + a(M_SBB); + a(DAC_SYNC); + a(CCB_INTRM); + a(M_CB); + a(XCTL0); + a(BREQ); + a(DAC1_EN); + a(DAC2_EN); + a(ADC_EN); + a(UART_EN); + a(JYSTK_EN); + a(CDC_EN); + a(SERR_DIS); #undef a - AUD_log ("es1370", "ctl - PCLKDIV %d(DAC2 freq %d), freq %d,%s\n", - (val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV, - DAC2_DIVTOSR ((val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), - dac1_samplerate[(val & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], - buf); + AUD_log("es1370", "ctl - PCLKDIV %d(DAC2 freq %d), freq %d,%s\n", + (val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV, + DAC2_DIVTOSR((val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), + dac1_samplerate[(val & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], + buf); + } } =20 -static void print_sctl (uint32_t val) +static void print_sctl(uint32_t val) { - static const char *fmt_names[] =3D {"8M", "8S", "16M", "16S"}; - char buf[1024]; - - buf[0] =3D '\0'; - -#define a(n) if (val & SCTRL_##n) strcat (buf, " "#n) -#define b(n) if (!(val & SCTRL_##n)) strcat (buf, " "#n) - b (R1LOOPSEL); - b (P2LOOPSEL); - b (P1LOOPSEL); - a (P2PAUSE); - a (P1PAUSE); - a (R1INTEN); - a (P2INTEN); - a (P1INTEN); - a (P1SCTRLD); - a (P2DACSEN); - if (buf[0]) { - strcat (buf, "\n "); - } - else { - buf[0] =3D ' '; - buf[1] =3D '\0'; - } + if (DEBUG_ES1370) { + static const char *fmt_names[] =3D {"8M", "8S", "16M", "16S"}; + char buf[1024]; + + buf[0] =3D '\0'; + +#define a(n) if (val & SCTRL_##n) pstrcat(buf, sizeof(buf), " "#n) +#define b(n) if (!(val & SCTRL_##n)) pstrcat(buf, sizeof(buf), " "#n) + b(R1LOOPSEL); + b(P2LOOPSEL); + b(P1LOOPSEL); + a(P2PAUSE); + a(P1PAUSE); + a(R1INTEN); + a(P2INTEN); + a(P1INTEN); + a(P1SCTRLD); + a(P2DACSEN); + if (buf[0]) { + pstrcat(buf, sizeof(buf), "\n "); + } else { + buf[0] =3D ' '; + buf[1] =3D '\0'; + } #undef b #undef a - AUD_log ("es1370", - "%s" - "p2_end_inc %d, p2_st_inc %d, r1_fmt %s, p2_fmt %s, p1_fmt %s= \n", - buf, - (val & SCTRL_P2ENDINC) >> SCTRL_SH_P2ENDINC, - (val & SCTRL_P2STINC) >> SCTRL_SH_P2STINC, - fmt_names [(val >> SCTRL_SH_R1FMT) & 3], - fmt_names [(val >> SCTRL_SH_P2FMT) & 3], - fmt_names [(val >> SCTRL_SH_P1FMT) & 3] - ); + AUD_log("es1370", + "%s p2_end_inc %d, p2_st_inc %d," + " r1_fmt %s, p2_fmt %s, p1_fmt %s\n", + buf, + (val & SCTRL_P2ENDINC) >> SCTRL_SH_P2ENDINC, + (val & SCTRL_P2STINC) >> SCTRL_SH_P2STINC, + fmt_names[(val >> SCTRL_SH_R1FMT) & 3], + fmt_names[(val >> SCTRL_SH_P2FMT) & 3], + fmt_names[(val >> SCTRL_SH_P1FMT) & 3]); + } } -#else -#define print_ctl(...) -#define print_sctl(...) -#endif =20 #ifdef VERBOSE_ES1370 #define lwarn(...) AUD_log ("es1370: warning", __VA_ARGS__) --=20 2.41.0 From nobody Tue Feb 10 16:43:57 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=1697005972; cv=none; d=zohomail.com; s=zohoarc; b=eTKJVRFjsSb5/TsCTtUmyLohKzL87+5HxNCnqjhxOO9jgt4ffSCUMIAsetNAP/WhkeSQk5E7Gm1JJ7BDTYmTm46MGtJmDrkOWcOr06bGrpBu0ifz4dzxDlFWNwMlrGudKq2q5MhLCf6yjyYjYsHQnErP0J3QcHwRznedzEKnmMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005972; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m+FLYQxnmVSLsdyLhreAOGPPDup+InzDKwiOlqO6PcE=; b=E7hEtW1aoNYwLVCq7dLgW7EF+DHuAGLOqh331q1Z+T0V0+QI783S3Jg3ZFXsZHt/WcgYXU8zkfirbE1RiYB0EYC7wNkPGg3TftbhR3lA95xcWBfmOMlfjy2i/EZ3XkKfWitL+EryTbMBAzvqQa53KlQFyOg5MTniA2a+c1AM4BI= 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 1697005972922104.82484304038007; Tue, 10 Oct 2023 23:32:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSlL-00020U-7D; Wed, 11 Oct 2023 02:32:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSky-0001uM-9w for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSkw-0006va-Po for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:44 -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-541-Y3trbaSROPGJsv8G5g7xlw-1; Wed, 11 Oct 2023 02:31:28 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 656A08007A4; Wed, 11 Oct 2023 06:31:28 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D8F7207526F; Wed, 11 Oct 2023 06:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005902; 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=m+FLYQxnmVSLsdyLhreAOGPPDup+InzDKwiOlqO6PcE=; b=MDe2YbcWrVugL9if2z4M9eXku/E0msycBgCTUGm0flOSUiZAhHzCMWiU20moSdvpXosbiT SdWmGUB069kCtNH+QEbwiNs8vjJnHRX2RyZ7nvZnkjNba8BqPuhZ09l/Jij1T9U5zqh1r9 lyDhs4dRktSxM9hPtvifAwCaYqBdUIQ= X-MC-Unique: Y3trbaSROPGJsv8G5g7xlw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 5/8] hw/audio/es1370: remove #ifdef ES1370_VERBOSE to avoid bit rot Date: Wed, 11 Oct 2023 10:30:58 +0400 Message-ID: <20231011063101.258955-6-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@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.129.124; envelope-from=marcandre.lureau@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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005974472100009 From: Volker R=C3=BCmelin Replace the #ifdef ES1370_VERBOSE code with code that the compiler can optimize away to avoid bit rot and fix the already rotten code. Tested-by: Rene Engel Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-5-vr_qemu@t-online.de> --- hw/audio/es1370.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index f111206709..7c58337076 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -23,7 +23,7 @@ */ =20 #define DEBUG_ES1370 0 -/* #define VERBOSE_ES1370 */ +#define VERBOSE_ES1370 0 =20 #include "qemu/osdep.h" #include "hw/audio/soundhw.h" @@ -238,11 +238,12 @@ static void print_sctl(uint32_t val) } } =20 -#ifdef VERBOSE_ES1370 -#define lwarn(...) AUD_log ("es1370: warning", __VA_ARGS__) -#else -#define lwarn(...) -#endif +#define lwarn(...) \ +do { \ + if (VERBOSE_ES1370) { \ + AUD_log("es1370: warning", __VA_ARGS__); \ + } \ +} while (0) =20 #define TYPE_ES1370 "ES1370" OBJECT_DECLARE_SIMPLE_TYPE(ES1370State, ES1370) @@ -504,10 +505,10 @@ static void es1370_write(void *opaque, hwaddr addr, u= int64_t val, unsigned size) break; =20 case ES1370_REG_PHANTOM_FRAMECNT: - lwarn ("writing to phantom frame count %#x\n", val); + lwarn("writing to phantom frame count 0x%" PRIx64 "\n", val); break; case ES1370_REG_PHANTOM_FRAMEADR: - lwarn ("writing to phantom frame address %#x\n", val); + lwarn("writing to phantom frame address 0x%" PRIx64 "\n", val); break; =20 case ES1370_REG_ADC_FRAMECNT: @@ -524,7 +525,7 @@ static void es1370_write(void *opaque, hwaddr addr, uin= t64_t val, unsigned size) break; =20 default: - lwarn ("writel %#x <- %#x\n", addr, val); + lwarn("writel 0x%" PRIx64 " <- 0x%" PRIx64 "\n", addr, val); break; } } @@ -588,16 +589,16 @@ static uint64_t es1370_read(void *opaque, hwaddr addr= , unsigned size) =20 case ES1370_REG_PHANTOM_FRAMECNT: val =3D ~0U; - lwarn ("reading from phantom frame count\n"); + lwarn("reading from phantom frame count\n"); break; case ES1370_REG_PHANTOM_FRAMEADR: val =3D ~0U; - lwarn ("reading from phantom frame address\n"); + lwarn("reading from phantom frame address\n"); break; =20 default: val =3D ~0U; - lwarn ("readl %#x -> %#x\n", addr, val); + lwarn("readl 0x%" PRIx64 " -> 0x%x\n", addr, val); break; } return val; --=20 2.41.0 From nobody Tue Feb 10 16:43:57 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=1697005972; cv=none; d=zohomail.com; s=zohoarc; b=BAaSEJGqFpl05mVLts2ISe3RQCt5KKBtwZVyE/uCw/4VXTRzc5tgYjZHHTuzxf0cJhtkue7f/EvX8x8/jTU0Tye3XcPXkMjcvwnRbtfe02CvHeBCiZnF40TtX30IzjNoopa8hPXU88bO1nvb/HAjaGQt+q1b9MN7n07XKg05q+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005972; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tWqwVQF3157amZZ5ksaSk/rCTrrBE0eeyc4Y+fPAp80=; b=kDT7avBHvVe9p/g4+9suQlmjwy6yVyzp4KayZRQG7YpJpQFRVLKhzq0yfD6DZL+S6pREl9h4ZHFBrcm1cgZU02PxPs2EdkXOvnw/dqeMdT7rPhBflsa2NPalGF3cixxYN30Jr692ut3nbhhPSZxQn6Vfv3HaUxQHaiFla8qfDpI= 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 1697005972591249.10406209015355; Tue, 10 Oct 2023 23:32:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSlO-00022C-3M; Wed, 11 Oct 2023 02:32:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSl4-0001uy-1Y for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSl1-0006vv-Be for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31: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-622-ijDaAIM4OYyieC_3tIpkCw-1; Wed, 11 Oct 2023 02:31:33 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB986185A790; Wed, 11 Oct 2023 06:31:32 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id A38861C060DF; Wed, 11 Oct 2023 06:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005904; 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=tWqwVQF3157amZZ5ksaSk/rCTrrBE0eeyc4Y+fPAp80=; b=haghCBCbjx/y3maO/ZBNpyCE8QaSqeJtyQ3K2F3gh5iHTPVkj47Z9pIyf46w7RBmGkM/3e V7LnwIfE1fFoGX7TaJsZqzAWzliAjKANJ8EKiRsQZYtNebXp/Q4WNfT2QgaKRfZPQ1Rf88 E1OHpOH1UMP80IbiDkICeP99tIneZsE= X-MC-Unique: ijDaAIM4OYyieC_3tIpkCw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 6/8] hw/audio/es1370: block structure coding style fixes Date: Wed, 11 Oct 2023 10:30:59 +0400 Message-ID: <20231011063101.258955-7-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.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.133.124; envelope-from=marcandre.lureau@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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005974466100007 From: Volker R=C3=BCmelin Change the block structure according to the QEMU Coding Style documentation. Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-6-vr_qemu@t-online.de> --- hw/audio/es1370.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 7c58337076..b4c00df189 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -309,8 +309,7 @@ static void es1370_update_status (ES1370State *s, uint3= 2_t new_status) =20 if (level) { s->status =3D new_status | STAT_INTR; - } - else { + } else { s->status =3D new_status & ~STAT_INTR; } pci_set_irq(&s->dev, !!level); @@ -333,8 +332,7 @@ static void es1370_reset (ES1370State *s) if (i =3D=3D ADC_CHANNEL) { AUD_close_in (&s->card, s->adc_voice); s->adc_voice =3D NULL; - } - else { + } else { AUD_close_out (&s->card, s->dac_voice[i]); s->dac_voice[i] =3D NULL; } @@ -421,8 +419,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) es1370_adc_callback, &as ); - } - else { + } else { s->dac_voice[i] =3D AUD_open_out ( &s->card, @@ -442,8 +439,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) =20 if (i =3D=3D ADC_CHANNEL) { AUD_set_active_in (s->adc_voice, on); - } - else { + } else { AUD_set_active_out (s->dac_voice[i], on); } } @@ -456,8 +452,9 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) static inline uint32_t es1370_fixup (ES1370State *s, uint32_t addr) { addr &=3D 0xff; - if (addr >=3D 0x30 && addr <=3D 0x3f) + if (addr >=3D 0x30 && addr <=3D 0x3f) { addr |=3D s->mempage << 8; + } return addr; } =20 @@ -630,8 +627,9 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, =20 to_copy =3D MIN ((size_t) temp, sizeof (tmpbuf)); acquired =3D AUD_read (s->adc_voice, tmpbuf, to_copy); - if (!acquired) + if (!acquired) { break; + } =20 pci_dma_write (&s->dev, addr, tmpbuf, acquired); =20 @@ -639,8 +637,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, addr +=3D acquired; transferred +=3D acquired; } - } - else { + } else { SWVoiceOut *voice =3D s->dac_voice[index]; =20 while (temp > 0) { @@ -649,8 +646,9 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, to_copy =3D MIN ((size_t) temp, sizeof (tmpbuf)); pci_dma_read (&s->dev, addr, tmpbuf, to_copy); copied =3D AUD_write (voice, tmpbuf, to_copy); - if (!copied) + if (!copied) { break; + } temp -=3D copied; addr +=3D copied; transferred +=3D copied; @@ -660,8 +658,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, if (csc_bytes =3D=3D transferred) { *irq =3D 1; d->scount =3D sc | (sc << 16); - } - else { + } else { *irq =3D 0; d->scount =3D sc | (((csc_bytes - transferred - 1) >> d->shift) <<= 16); } @@ -672,12 +669,12 @@ static void es1370_transfer_audio (ES1370State *s, st= ruct chan *d, int loop_sel, /* Bah, how stupid is that having a 0 represent true value? i just spent few hours on this shit */ AUD_log ("es1370: warning", "non looping mode\n"); - } - else { + } else { d->frame_cnt =3D size; =20 - if ((uint32_t) cnt <=3D d->frame_cnt) + if ((uint32_t) cnt <=3D d->frame_cnt) { d->frame_cnt |=3D cnt << 16; + } } =20 d->leftover =3D (transferred + d->leftover) & 3; @@ -778,8 +775,7 @@ static int es1370_post_load (void *opaque, int version_= id) AUD_close_in (&s->card, s->adc_voice); s->adc_voice =3D NULL; } - } - else { + } else { if (s->dac_voice[i]) { AUD_close_out (&s->card, s->dac_voice[i]); s->dac_voice[i] =3D NULL; --=20 2.41.0 From nobody Tue Feb 10 16:43:57 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=1697005969; cv=none; d=zohomail.com; s=zohoarc; b=VGQEtmml/a+HzxBB0qRJLaHhhg6ReAaKD+J6esYSfQuggxECIpA72PUorEGbXn/2oWRN5bPkkgRoamVRNmjuCv4dNs1cdBYC37/B5spthiS9Sn5dpgBjpb8ppo0mlRMiBO5xb8HlBA3LFEyAPSyFj0QFLupxH7HVvkyCzHwfCrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005969; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bQ2NwFRR4WHYGU0xF7Yq73z3DjZ8+wH2HJ0y6d4oYgc=; b=PJ/dHAhGnLm5oswAHmFF0I9gRC5GZ1R6wJsm/YCJP79wgEGR286L/MrWanJV8rjUbr51CGWUOQNfwc380ZjLiZtyzUhpnNJWfvJzQrZgz0XSrV6HRIwz9ByLpkZ9dWLF/akcPjXwOgHj7/CxIEwTuW1V8lr2mMq+ptN3SBQAais= 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 1697005969181214.58137471603902; Tue, 10 Oct 2023 23:32:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSlM-00022A-Hs; Wed, 11 Oct 2023 02:32:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSlC-0001y0-KG for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:32:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSlA-0006wx-UU for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:58 -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-349-dugO3877NxGTowrB33lx6Q-1; Wed, 11 Oct 2023 02:31:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E0AD8F5DA3; Wed, 11 Oct 2023 06:31:36 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E53C111CD23; Wed, 11 Oct 2023 06:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005916; 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=bQ2NwFRR4WHYGU0xF7Yq73z3DjZ8+wH2HJ0y6d4oYgc=; b=UntguH6CI2iGFf+wnjKDiYbvJo7fwU0l75AfHFRYtsoQ+uuABmL569858bbutizmBlXWLH mwr2IrB7gP9B9ItbB0R17YWuEhMsq675A81y/60wAmQZODohLvOcfr7UIf5R3s0Rh72mvZ 0PKwwRWWKhsxtTW0HOXrdo1mDEwYeKE= X-MC-Unique: dugO3877NxGTowrB33lx6Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 7/8] hw/audio/es1370: change variable type and name Date: Wed, 11 Oct 2023 10:31:00 +0400 Message-ID: <20231011063101.258955-8-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@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=marcandre.lureau@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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005970451100001 From: Volker R=C3=BCmelin Change the type of the variable temp to size_t to avoid a type cast. While at it, rename the variable name to to_transfer. This improves the readability of the code. Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-7-vr_qemu@t-online.de> --- hw/audio/es1370.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index b4c00df189..b47794f786 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -605,6 +605,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, int max, int *irq) { uint8_t tmpbuf[4096]; + size_t to_transfer; uint32_t addr =3D d->frame_addr; int sc =3D d->scount & 0xffff; int csc =3D d->scount >> 16; @@ -616,16 +617,16 @@ static void es1370_transfer_audio (ES1370State *s, st= ruct chan *d, int loop_sel, } int left =3D ((size - cnt + 1) << 2) + d->leftover; int transferred =3D 0; - int temp =3D MIN (max, MIN (left, csc_bytes)); int index =3D d - &s->chan[0]; =20 + to_transfer =3D MIN(max, MIN(left, csc_bytes)); addr +=3D (cnt << 2) + d->leftover; =20 if (index =3D=3D ADC_CHANNEL) { - while (temp > 0) { + while (to_transfer > 0) { int acquired, to_copy; =20 - to_copy =3D MIN ((size_t) temp, sizeof (tmpbuf)); + to_copy =3D MIN(to_transfer, sizeof(tmpbuf)); acquired =3D AUD_read (s->adc_voice, tmpbuf, to_copy); if (!acquired) { break; @@ -633,23 +634,23 @@ static void es1370_transfer_audio (ES1370State *s, st= ruct chan *d, int loop_sel, =20 pci_dma_write (&s->dev, addr, tmpbuf, acquired); =20 - temp -=3D acquired; + to_transfer -=3D acquired; addr +=3D acquired; transferred +=3D acquired; } } else { SWVoiceOut *voice =3D s->dac_voice[index]; =20 - while (temp > 0) { + while (to_transfer > 0) { int copied, to_copy; =20 - to_copy =3D MIN ((size_t) temp, sizeof (tmpbuf)); + to_copy =3D MIN(to_transfer, sizeof(tmpbuf)); pci_dma_read (&s->dev, addr, tmpbuf, to_copy); copied =3D AUD_write (voice, tmpbuf, to_copy); if (!copied) { break; } - temp -=3D copied; + to_transfer -=3D copied; addr +=3D copied; transferred +=3D copied; } --=20 2.41.0 From nobody Tue Feb 10 16:43:57 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=1697005959; cv=none; d=zohomail.com; s=zohoarc; b=LwYxAaVTiV0kUf5901BlwHwfwPWTbIHeZg/raTDAzqdEh1mA7HZdUxsAQBz6Xhu8QzOih6kiG7AgonQWm77S3pH+B9z6GncSsnu579Y3zKruvlARKlyEBIHNT8Q6OFO+2wo8G2UcX1WK/zp2YojTXiqFzWz5kUPCPVr3ASk0DGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697005959; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=G44gyNiz8GhAVa1gvei7fQjgrYxKV9EzbY/xkhUjfLY=; b=OlDpP0kZ3PQx3xIGrs2B3yJvWCgPsUFks4/EHLBfBCAW+UqBTFe5jgEvMjtd0bLyoXSZB6OYdnjRMwQCQhgw1by3BJwXtSx8D3lTy+2N5sic72ZTn5TzydzkQ0jQFsh1fWX/D3QFVtfh2jiPWhlE/5PuSPe4GsFEg42EBnqxZTc= 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 1697005959238644.8705229854183; Tue, 10 Oct 2023 23:32:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqSlJ-0001w6-Bf; Wed, 11 Oct 2023 02:32:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSl4-0001uz-1N for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqSl1-0006w1-Cv for qemu-devel@nongnu.org; Wed, 11 Oct 2023 02:31: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-320-kg7hM2uePGKsjpSE6ZDPyw-1; Wed, 11 Oct 2023 02:31:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0661C101AA44; Wed, 11 Oct 2023 06:31:41 +0000 (UTC) Received: from localhost (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10F6D10F1BE7; Wed, 11 Oct 2023 06:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697005905; 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=G44gyNiz8GhAVa1gvei7fQjgrYxKV9EzbY/xkhUjfLY=; b=CCKO87Tmk7OVEyhbT+qr2GqXbFuOyoqJeYz9G2gA6Xy2OC04CGMBMGZfh7zcUpMtAlwpKY 3hLprpln9jookHbG8Y4ooAeCQ48ICcXgvcjHp8v8y3Cp0OKFL5FK98L0jnLIpnPMgyG9ZK ResU3w/BLQ0nXtKi+7VBU8zi9qJnFWg= X-MC-Unique: kg7hM2uePGKsjpSE6ZDPyw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, stefanha@redhat.com, vr_qemu@t-online.de Subject: [PULL 8/8] hw/audio/es1370: trace lost interrupts Date: Wed, 11 Oct 2023 10:31:01 +0400 Message-ID: <20231011063101.258955-9-marcandre.lureau@redhat.com> In-Reply-To: <20231011063101.258955-1-marcandre.lureau@redhat.com> References: <20231011063101.258955-1-marcandre.lureau@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=marcandre.lureau@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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697005960426100001 From: Volker R=C3=BCmelin It turns out that there are drivers which assume that interrupts can't be lost. E.g. the AROS sb128 driver is such a driver. Add a lost interrupt tracepoint to debug this kind of issues. Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: BALATON Zoltan Message-Id: <20230917065813.6692-8-vr_qemu@t-online.de> --- hw/audio/es1370.c | 14 ++++++++++---- hw/audio/trace-events | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index b47794f786..91c47330ad 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -602,7 +602,7 @@ static uint64_t es1370_read(void *opaque, hwaddr addr, = unsigned size) } =20 static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loo= p_sel, - int max, int *irq) + int max, bool *irq) { uint8_t tmpbuf[4096]; size_t to_transfer; @@ -657,10 +657,13 @@ static void es1370_transfer_audio (ES1370State *s, st= ruct chan *d, int loop_sel, } =20 if (csc_bytes =3D=3D transferred) { - *irq =3D 1; + if (*irq) { + trace_es1370_lost_interrupt(index); + } + *irq =3D true; d->scount =3D sc | (sc << 16); } else { - *irq =3D 0; + *irq =3D false; d->scount =3D sc | (((csc_bytes - transferred - 1) >> d->shift) <<= 16); } =20 @@ -688,7 +691,8 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, static void es1370_run_channel (ES1370State *s, size_t chan, int free_or_a= vail) { uint32_t new_status =3D s->status; - int max_bytes, irq; + int max_bytes; + bool irq; struct chan *d =3D &s->chan[chan]; const struct chan_bits *b =3D &es1370_chan_bits[chan]; =20 @@ -702,6 +706,8 @@ static void es1370_run_channel (ES1370State *s, size_t = chan, int free_or_avail) return; } =20 + irq =3D s->sctl & b->sctl_inten && s->status & b->stat_int; + es1370_transfer_audio (s, d, b->sctl_loopsel, max_bytes, &irq); =20 if (irq) { diff --git a/hw/audio/trace-events b/hw/audio/trace-events index 9ae2f717b6..059ce451f5 100644 --- a/hw/audio/trace-events +++ b/hw/audio/trace-events @@ -11,10 +11,11 @@ es1370_frame_address_rd(int ch, uint32_t addr) "ch=3D%d= addr=3D0x%08x" es1370_frame_address_wr(int ch, uint32_t addr) "ch=3D%d addr=3D0x%08x" es1370_frame_count_rd(int ch, uint32_t curr, uint32_t size) "ch=3D%d CURR_= CT=3D%u BUF_SIZE=3D%u" es1370_frame_count_wr(int ch, uint32_t curr, uint32_t size) "ch=3D%d CURR_= CT=3D%u BUF_SIZE=3D%u" +es1370_lost_interrupt(int ch) "ch=3D%d lost interrupt" es1370_sample_count_rd(int ch, uint32_t curr, uint32_t num) "ch=3D%d CURR_= SAMP_CT=3D%u SAMP_CT=3D%u" es1370_sample_count_wr(int ch, uint32_t curr, uint32_t num) "ch=3D%d CURR_= SAMP_CT=3D%u SAMP_CT=3D%u" es1370_stream_format(int ch, uint32_t freq, const char *fmt, const char *m= ode, uint32_t shift) "ch=3D%d fmt=3D%u:%s:%s shift=3D%u" -es1370_transfer_audio(int ch, uint32_t f_curr, uint32_t f_size, uint32_t s= _curr, uint32_t s_num, uint32_t leftover, int irq) "ch=3D%d CURR_CT=3D%u BU= F_SIZE=3D%u CURR_SAMP_CT=3D%u SAMP_CT=3D%u leftover=3D%u irq=3D%d" +es1370_transfer_audio(int ch, uint32_t f_curr, uint32_t f_size, uint32_t s= _curr, uint32_t s_num, uint32_t leftover, bool irq) "ch=3D%d CURR_CT=3D%u B= UF_SIZE=3D%u CURR_SAMP_CT=3D%u SAMP_CT=3D%u leftover=3D%u irq=3D%d" =20 # hda-codec.c hda_audio_running(const char *stream, int nr, bool running) "st %s, nr %d,= run %d" --=20 2.41.0