From nobody Thu Dec 18 19:30:10 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=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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1586168341; cv=none; d=zohomail.com; s=zohoarc; b=bhDj2C1B4pEwEexQWQFAjLGZSs5KTsla9XJwr6kVQxSsqvbaWYe/u3DzJDMgYZqSD7com4dEbORZDeXGtXpGtQ2+Em3JOiSEL7fqfTCeR3GBRSZ7dFtYVOllxuj3e8HBys+akPCJO5k58VyRvXC6EmvWPxzhmD8UhU/0Lh1nNZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586168341; h=Content-Transfer-Encoding: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=lJK5pRrZeOgvwi0MkqfizMKvlaa5ce7cwoPnkorTG8c=; b=YYlduT7aZygBNPlomwfk9J6uTjj/n2kZR8mG8MXuiOReo0+FvWMtv3c+KI+XhnqdnlFpyztiajo7viMhAbcFYZ48Y9EJgc1DoNF6ruKcC+EiasoZnIIX7R6r1Dmwx6DbxS8488DwcBazwYwUsZ/pqEaMyOJ5mn20gI12TIqj/Fo= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586168341272227.6520800589641; Mon, 6 Apr 2020 03:19:01 -0700 (PDT) Received: from localhost ([::1]:58160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLOqJ-0000u9-MH for importer@patchew.org; Mon, 06 Apr 2020 06:18:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50171) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLOjt-0006pe-5l for qemu-devel@nongnu.org; Mon, 06 Apr 2020 06:12:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLOjr-0002vB-Qp for qemu-devel@nongnu.org; Mon, 06 Apr 2020 06:12:21 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:38752) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLOjr-0002uW-KV for qemu-devel@nongnu.org; Mon, 06 Apr 2020 06:12:19 -0400 Received: by mail-wm1-x342.google.com with SMTP id f20so6118490wmh.3 for ; Mon, 06 Apr 2020 03:12:19 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f187sm25163765wme.9.2020.04.06.03.12.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 03:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=lJK5pRrZeOgvwi0MkqfizMKvlaa5ce7cwoPnkorTG8c=; b=ySiyOg+o85M2Kc9stcp62VnsFU8RHu0dQlx1PuxTRFZqgMy4dXokc7KfAvb6Lzugxe TyE9nHTfv5gtD9A8+CyTq5AbGaXAoswtbb8hmx/1UiD6m5+GtzJhDuph8gg6LvDwEh7D 5nT8njMPELJ7k5in10d2SnO1A3nxtw9yzSGklPkrWzxOM3h3Q6Zq/487yrQ9b3W59fdt PlckIznLiZA9Jh6g2vaHrf3g2r7v1DCQnFCwpgcHp3mPscSArxXG1VFVfk3A/oH8TgQr wuIL2K2BGZ42lKj6QbYaCh00ldBa6rNVfedz67PQAzxqpd6TJ94W0IB31JtI4iRNMslG dM0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lJK5pRrZeOgvwi0MkqfizMKvlaa5ce7cwoPnkorTG8c=; b=YHbbNHc5Akir6x/cWgid7evOHSvbzyeWyB2FUv1zFr3f5FOe5Qtobr/cyVc5lEmJrn HBDCiFDRMMWvwyPFRl0kd1n+m3mCcQ1rAJqcQYBDIjcJ7s5bMBezESbI8ZYVZvpZJWAQ Tbw6aggP4ClTChUTDB2Ukrqffo6ME/UW00iJeLgHgKFjPJDK0Lb4BjHnK6G02GQ971l6 +Vee3DZPW0uvhbYNpjJeoFXzTtPbN2xj7Eod8DVa6NGqm8AOUH7JWV9YZZrPudJ1KBSh OA7lWB1/wXxVr7oGRPOTOrU45LGwBw2zRwjMQ3/wOpWpUvUlKRQPV+Ar7fSr/mJrstTU pITw== X-Gm-Message-State: AGi0Pub4rRGqh04Iftr/r5mIyf63aMErSX7mRL6vntHGRV2I7Eplf6Fv dyHFSOteIfvMhRRqnrA6b7BJ+zQJF6d2Aw== X-Google-Smtp-Source: APiQypKFzEnKbj8ESttpcGR7zgUpUelah9zcEWwHP6ZI1wMNauknyToK3HlFtTkBoKANWVh8ekgjuQ== X-Received: by 2002:a1c:2002:: with SMTP id g2mr9047886wmg.109.1586167938289; Mon, 06 Apr 2020 03:12:18 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/11] dma/xlnx-zdma: Reorg to fix CUR_DSCR Date: Mon, 6 Apr 2020 11:12:05 +0100 Message-Id: <20200406101205.23027-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200406101205.23027-1-peter.maydell@linaro.org> References: <20200406101205.23027-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Reorganize the descriptor handling so that CUR_DSCR always points to the next descriptor to be processed. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis Reviewed-by: Francisco Iglesias Message-id: 20200402134721.27863-6-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell --- hw/dma/xlnx-zdma.c | 47 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c index e856d233f2d..1c45367f3c6 100644 --- a/hw/dma/xlnx-zdma.c +++ b/hw/dma/xlnx-zdma.c @@ -333,10 +333,28 @@ static void zdma_load_src_descriptor(XlnxZDMA *s) } } =20 +static void zdma_update_descr_addr(XlnxZDMA *s, bool type, + unsigned int basereg) +{ + uint64_t addr, next; + + if (type =3D=3D DTYPE_LINEAR) { + addr =3D zdma_get_regaddr64(s, basereg); + next =3D addr + sizeof(s->dsc_dst); + } else { + addr =3D zdma_get_regaddr64(s, basereg); + addr +=3D sizeof(s->dsc_dst); + address_space_read(s->dma_as, addr, s->attr, (void *) &next, 8); + } + + zdma_put_regaddr64(s, basereg, next); +} + static void zdma_load_dst_descriptor(XlnxZDMA *s) { uint64_t dst_addr; unsigned int ptype =3D ARRAY_FIELD_EX32(s->regs, ZDMA_CH_CTRL0, POINT_= TYPE); + bool dst_type; =20 if (ptype =3D=3D PT_REG) { memcpy(&s->dsc_dst, &s->regs[R_ZDMA_CH_DST_DSCR_WORD0], @@ -349,24 +367,10 @@ static void zdma_load_dst_descriptor(XlnxZDMA *s) if (!zdma_load_descriptor(s, dst_addr, &s->dsc_dst)) { ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, AXI_RD_DST_DSCR, true); } -} =20 -static uint64_t zdma_update_descr_addr(XlnxZDMA *s, bool type, - unsigned int basereg) -{ - uint64_t addr, next; - - if (type =3D=3D DTYPE_LINEAR) { - next =3D zdma_get_regaddr64(s, basereg); - next +=3D sizeof(s->dsc_dst); - zdma_put_regaddr64(s, basereg, next); - } else { - addr =3D zdma_get_regaddr64(s, basereg); - addr +=3D sizeof(s->dsc_dst); - address_space_read(s->dma_as, addr, s->attr, &next, 8); - zdma_put_regaddr64(s, basereg, next); - } - return next; + /* Advance the descriptor pointer. */ + dst_type =3D FIELD_EX32(s->dsc_dst.words[3], ZDMA_CH_DST_DSCR_WORD3, T= YPE); + zdma_update_descr_addr(s, dst_type, R_ZDMA_CH_DST_CUR_DSCR_LSB); } =20 static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len) @@ -387,14 +391,7 @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, = uint32_t len) dst_size =3D FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_WORD= 2, SIZE); if (dst_size =3D=3D 0 && ptype =3D=3D PT_MEM) { - uint64_t next; - bool dst_type =3D FIELD_EX32(s->dsc_dst.words[3], - ZDMA_CH_DST_DSCR_WORD3, - TYPE); - - next =3D zdma_update_descr_addr(s, dst_type, - R_ZDMA_CH_DST_CUR_DSCR_LSB); - zdma_load_descriptor(s, next, &s->dsc_dst); + zdma_load_dst_descriptor(s); dst_size =3D FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_= WORD2, SIZE); } --=20 2.20.1