From nobody Thu Nov 13 10:43:08 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1579899679; cv=none; d=zohomail.com; s=zohoarc; b=PbnUWxQAC1pVutRvxLXQ+gMvqRl2N25wm3zWQ+ZWUe9d6IwTD2FaUXNDvfPRRzUHwb5lEeeNnYao6/Zsh0VA6Prkb1/eWT9eilL8st3gBXbA2I2h7vXcpClp363cP25mnx8j/CbCrtPnt8b/3HX8OLxVtqGmNuVRGvRv2zGdYcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579899679; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=nvLSajf7VeF8a/esJ1gtMK1lnzR41dh9lcqpXL8on/w=; b=b/Tq2e6mjrJQL6GI3VRC696MJYx0r2Wmf/EnCUrHlJobSPAc5upP8kQcCNz5MEE0V+4NZVOpuCuTzNoKZBwdkKwE7tC8GFQFEuDJEV9qF69X62M0pEWUiAdcQrZCddJT3AJv+4INcFIvYwlyyogWuyrD5OsWzpBw3X80iIVTHco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579899678802303.40413677579807; Fri, 24 Jan 2020 13:01:18 -0800 (PST) Received: from localhost ([::1]:48050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv64r-0001Av-Av for importer@patchew.org; Fri, 24 Jan 2020 16:01:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33547) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv4oZ-0000iC-Ri for qemu-devel@nongnu.org; Fri, 24 Jan 2020 14:40:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iv4oY-0007Ei-RF for qemu-devel@nongnu.org; Fri, 24 Jan 2020 14:40:23 -0500 Received: from mail1435c50.megamailservers.eu ([91.136.14.35]:47996 helo=mail263c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iv4oV-0007BJ-Ly; Fri, 24 Jan 2020 14:40:20 -0500 Received: from desktop2.localnet (178-21-1-177.ilmprovider.net [178.21.1.177]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 00OHtQO8027697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 24 Jan 2020 17:55:28 +0000 X-Authenticated-User: 017626146082@o2online.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1579888529; bh=msyG0+vgYVYZwtyOlvLTdyb7wfWrEyYcTNuAHZIeYUw=; h=From:To:Cc:Subject:Date:From; b=eT1I9sn5WbSdZ1/3B7nj+TUuJIwzNnC12NXg/fcKIMIn/UqnlZ5OAoexvzKOSIJsf OBu3CMrh5xEkhMpasm043sAUhpw1lGxFhWVpXztigEOMepV7SBtuv5nk8V/5aWFBxc /Kn+zsgwvn8yZJfDGSgAxSqJJhyjfzJoUQYNh8H0= Feedback-ID: rsta2@o2online. From: Rene Stange To: qemu-devel@nongnu.org Subject: [PATCH] bcm2835_dma: Fix TD mode Date: Fri, 24 Jan 2020 18:55:25 +0100 Message-ID: <5099495.CBsx362VbF@desktop2> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CTCH-RefID: str=0001.0A0B0204.5E2B2F91.0003, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=II989TnG c=1 sm=1 tr=0 a=oFQkuSNlBNCQRuITVo1IXg==:117 a=oFQkuSNlBNCQRuITVo1IXg==:17 a=kj9zAlcOel0A:10 a=KlKTeOmF2TGtJzamOh8A:9 a=CjuIK1q_8ugA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.14.35 X-Mailman-Approved-At: Fri, 24 Jan 2020 16:00:10 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Philippe =?ISO-8859-1?Q?Mathieu=2DDaud=E9?= , Andrew Baumann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" TD (two dimensions) DMA mode did not work, because the xlen variable has not been re-initialized before each additional ylen run through in bcm2835_dma_update(). Furthermore ylen has to be increased by one after reading it from the TXFR_LEN register, because a value of zero has to result in one run through of the ylen loop. Both issues have been fixed. Signed-off-by: Rene Stange --- hw/dma/bcm2835_dma.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c index 1e458d7fba..0881c9506e 100644 --- a/hw/dma/bcm2835_dma.c +++ b/hw/dma/bcm2835_dma.c @@ -54,7 +54,7 @@ static void bcm2835_dma_update(BCM2835DMAState *s, unsigned c) { BCM2835DMAChan *ch =3D &s->chan[c]; - uint32_t data, xlen, ylen; + uint32_t data, xlen, xlen_td, ylen; int16_t dst_stride, src_stride; =20 if (!(s->enable & (1 << c))) { @@ -72,13 +72,13 @@ static void bcm2835_dma_update(BCM2835DMAState *s, unsi= gned c) =20 if (ch->ti & BCM2708_DMA_TDMODE) { /* 2D transfer mode */ - ylen =3D (ch->txfr_len >> 16) & 0x3fff; - xlen =3D ch->txfr_len & 0xffff; + ylen =3D ((ch->txfr_len >> 16) & 0x3fff) + 1; + xlen_td =3D xlen =3D ch->txfr_len & 0xffff; dst_stride =3D ch->stride >> 16; src_stride =3D ch->stride & 0xffff; } else { ylen =3D 1; - xlen =3D ch->txfr_len; + xlen_td =3D xlen =3D ch->txfr_len; dst_stride =3D 0; src_stride =3D 0; } @@ -117,6 +117,7 @@ static void bcm2835_dma_update(BCM2835DMAState *s, unsi= gned c) if (--ylen !=3D 0) { ch->source_ad +=3D src_stride; ch->dest_ad +=3D dst_stride; + xlen =3D xlen_td; } } ch->cs |=3D BCM2708_DMA_END; --=20 2.16.4