From nobody Thu May 2 15:48:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15057335623681005.7213234944935; Mon, 18 Sep 2017 04:19:22 -0700 (PDT) Received: from localhost ([::1]:35810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtu5B-0005zU-GP for importer@patchew.org; Mon, 18 Sep 2017 07:19:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtu3q-0005MS-ML for qemu-devel@nongnu.org; Mon, 18 Sep 2017 07:17:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dtu3m-00054x-KQ for qemu-devel@nongnu.org; Mon, 18 Sep 2017 07:17:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39854) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dtu3m-00054e-EF for qemu-devel@nongnu.org; Mon, 18 Sep 2017 07:17:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DFC4356F6 for ; Mon, 18 Sep 2017 11:17:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-116.ams2.redhat.com [10.36.116.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FEE35D6A6; Mon, 18 Sep 2017 11:17:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A6611386; Mon, 18 Sep 2017 13:17:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8DFC4356F6 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 18 Sep 2017 13:17:49 +0200 Message-Id: <20170918111750.15965-2-kraxel@redhat.com> In-Reply-To: <20170918111750.15965-1-kraxel@redhat.com> References: <20170918111750.15965-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 18 Sep 2017 11:17:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/2] wm8750: add record buffer underrun check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reported-by: niuguoxiang@huawei.com Signed-off-by: Gerd Hoffmann Message-id: 20170901131409.6712-1-kraxel@redhat.com --- hw/audio/wm8750.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index f8b5bebfc2..d2bf2e1da1 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -680,8 +680,12 @@ uint32_t wm8750_adc_dat(void *opaque) WM8750State *s =3D (WM8750State *) opaque; uint32_t *data; =20 - if (s->idx_in >=3D sizeof(s->data_in)) + if (s->idx_in >=3D sizeof(s->data_in)) { wm8750_in_load(s); + if (s->idx_in >=3D sizeof(s->data_in)) { + return 0x80008000; /* silence in AUD_FMT_S16 sample format */ + } + } =20 data =3D (uint32_t *) &s->data_in[s->idx_in]; s->req_in -=3D 4; --=20 2.9.3 From nobody Thu May 2 15:48:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505733560815706.9286791761639; Mon, 18 Sep 2017 04:19:20 -0700 (PDT) Received: from localhost ([::1]:35808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtu59-0005yD-FI for importer@patchew.org; Mon, 18 Sep 2017 07:19:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtu3q-0005MQ-LS for qemu-devel@nongnu.org; Mon, 18 Sep 2017 07:17:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dtu3n-00055G-4R for qemu-devel@nongnu.org; Mon, 18 Sep 2017 07:17:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39738) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dtu3m-00054r-Sr for qemu-devel@nongnu.org; Mon, 18 Sep 2017 07:17:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 131B4C0587DE; Mon, 18 Sep 2017 11:17:54 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-116.ams2.redhat.com [10.36.116.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7849B60468; Mon, 18 Sep 2017 11:17:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AD59D31EB9; Mon, 18 Sep 2017 13:17:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 131B4C0587DE Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 18 Sep 2017 13:17:50 +0200 Message-Id: <20170918111750.15965-3-kraxel@redhat.com> In-Reply-To: <20170918111750.15965-1-kraxel@redhat.com> References: <20170918111750.15965-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 18 Sep 2017 11:17:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/2] audio: intel-hda: do not use old_mmio accesses X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Parker , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matt Parker intel-hda is currently using the old_mmio accessors for io. This updates the device to use .read and .write accessors instead. Signed-off-by: Matt Parker Message-id: 20170827192038.28930-1-mtparkr@gmail.com Signed-off-by: Gerd Hoffmann --- hw/audio/intel-hda.c | 58 ++++++++++--------------------------------------= ---- 1 file changed, 11 insertions(+), 47 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 06acc98f7b..18a50a8f83 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -22,6 +22,7 @@ #include "hw/pci/pci.h" #include "hw/pci/msi.h" #include "qemu/timer.h" +#include "qemu/bitops.h" #include "hw/audio/soundhw.h" #include "intel-hda.h" #include "intel-hda-defs.h" @@ -1043,66 +1044,29 @@ static void intel_hda_regs_reset(IntelHDAState *d) =20 /* --------------------------------------------------------------------- */ =20 -static void intel_hda_mmio_writeb(void *opaque, hwaddr addr, uint32_t val) +static void intel_hda_mmio_write(void *opaque, hwaddr addr, uint64_t val, + unsigned size) { IntelHDAState *d =3D opaque; const IntelHDAReg *reg =3D intel_hda_reg_find(d, addr); =20 - intel_hda_reg_write(d, reg, val, 0xff); + intel_hda_reg_write(d, reg, val, MAKE_64BIT_MASK(0, size * 8)); } =20 -static void intel_hda_mmio_writew(void *opaque, hwaddr addr, uint32_t val) +static uint64_t intel_hda_mmio_read(void *opaque, hwaddr addr, unsigned si= ze) { IntelHDAState *d =3D opaque; const IntelHDAReg *reg =3D intel_hda_reg_find(d, addr); =20 - intel_hda_reg_write(d, reg, val, 0xffff); -} - -static void intel_hda_mmio_writel(void *opaque, hwaddr addr, uint32_t val) -{ - IntelHDAState *d =3D opaque; - const IntelHDAReg *reg =3D intel_hda_reg_find(d, addr); - - intel_hda_reg_write(d, reg, val, 0xffffffff); -} - -static uint32_t intel_hda_mmio_readb(void *opaque, hwaddr addr) -{ - IntelHDAState *d =3D opaque; - const IntelHDAReg *reg =3D intel_hda_reg_find(d, addr); - - return intel_hda_reg_read(d, reg, 0xff); -} - -static uint32_t intel_hda_mmio_readw(void *opaque, hwaddr addr) -{ - IntelHDAState *d =3D opaque; - const IntelHDAReg *reg =3D intel_hda_reg_find(d, addr); - - return intel_hda_reg_read(d, reg, 0xffff); -} - -static uint32_t intel_hda_mmio_readl(void *opaque, hwaddr addr) -{ - IntelHDAState *d =3D opaque; - const IntelHDAReg *reg =3D intel_hda_reg_find(d, addr); - - return intel_hda_reg_read(d, reg, 0xffffffff); + return intel_hda_reg_read(d, reg, MAKE_64BIT_MASK(0, size * 8)); } =20 static const MemoryRegionOps intel_hda_mmio_ops =3D { - .old_mmio =3D { - .read =3D { - intel_hda_mmio_readb, - intel_hda_mmio_readw, - intel_hda_mmio_readl, - }, - .write =3D { - intel_hda_mmio_writeb, - intel_hda_mmio_writew, - intel_hda_mmio_writel, - }, + .read =3D intel_hda_mmio_read, + .write =3D intel_hda_mmio_write, + .impl =3D { + .min_access_size =3D 1, + .max_access_size =3D 4, }, .endianness =3D DEVICE_NATIVE_ENDIAN, }; --=20 2.9.3