Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4157574pxk; Tue, 8 Sep 2020 12:08:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoefimNuoKZGeRqrl8fQOGpVd2j1Fd/MhinnbQpsbmyTwpGJVicngZ7/miY+wMWlyMbK2c X-Received: by 2002:a17:906:52c2:: with SMTP id w2mr28380128ejn.389.1599592131074; Tue, 08 Sep 2020 12:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599592131; cv=none; d=google.com; s=arc-20160816; b=wbuSStg1vrvVB8uZQePmKZSrhXz3kxiBo/O2DXiqQX/cBd1hh7Q+4wdwjBQ2UneBzn bjX/2/+kjQ1PZ32VdqHVy4ArUtyQV06HA82sp/u5DW7ig2ZQgexyf+5QxFKb9gy3vBlI OlsnDCwPGcCSUOdcFnpNX5c660iSyzntI9D8GQSjiyB3ECZGvVS5gnqmYFYaqZNaCR85 d7XhZrraebSjCoRfnBLraLAaUSPozveENvhMG5YBTJBM4c6cIMzLcZpWGtvtIPNu7ZOx pJGnbLIdLtjtr2of4FOFhIzpdS6VZGj2I1hz95z8BVAkVa0gi/ZukXTdPH/SUlX1h67D v2tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UZq+/0Vbusuf/dicpKnXQv9x0Iqinjc4EANqIrwFO3c=; b=FKKpZZxrv+muIGdSPahWlEMxKsfGNWTgB64lslScZpgkjFvcH3bayYX8oIlm3D54v+ biYJFDxNVC6nwfSoyOFjl90TvkEcGhP+3Wk4PSRXSAjaLYbBTRVXtY5ZSaG/3S6O7pr9 jFVdHt6VVQf9kggcTTobJRcw29+I/DjdAP3xAB1ePPeaN/J568p/EhuKG6iiFJv9hCpw rAuwLjWflOvCxqOtDvmBn6AhWAAQDx/n5kq78b1AAyOksVRrmzTdRZMvCzjD6K/C4f7Z m5ANsvtVOBzVISmIEUK4jA/hNIvUifd1wewF5J/r7ew1yVHFOzwPTizzs3i0W3bUVQj2 BOPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CNK4e6Ah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si13677594edv.594.2020.09.08.12.08.27; Tue, 08 Sep 2020 12:08:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CNK4e6Ah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731269AbgIHTFQ (ORCPT + 99 others); Tue, 8 Sep 2020 15:05:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:52182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731270AbgIHQH0 (ORCPT ); Tue, 8 Sep 2020 12:07:26 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B68F923E52; Tue, 8 Sep 2020 15:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580031; bh=6atoX8XP8FftWBIJU03GqQ6Sc/P+z9fAOVR09T3a6kQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNK4e6AhwBBjG+VWbLhxMdODC7SQlQpDRClQ+62w3oVlh3fgW49xcCGNDdXN3Yc0P HswaSYRVj5T7ytCBrpxw0fOIc2hn7vJ15Eza0rk1fg3Z+jEFIw9Paq8NPFsng+MJ5l APX2TNqpDkUUtM7nUS8qYTTCy+RKzjaY5DdQJBvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gustavo Pimentel , Vinod Koul Subject: [PATCH 5.4 111/129] dmaengine: dw-edma: Fix scatter-gather address calculation Date: Tue, 8 Sep 2020 17:25:52 +0200 Message-Id: <20200908152235.387749205@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gustavo Pimentel commit 05655541c9503bfd01af4e6cbd7f5a29ac748e6c upstream. Fix the source and destination physical address calculation of a peripheral device on scatter-gather implementation. This issue manifested during tests using a 64 bits architecture system. The abnormal behavior wasn't visible before due to all previous tests were done using 32 bits architecture system, that masked his effect. Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") Cc: stable@vger.kernel.org Signed-off-by: Gustavo Pimentel Link: https://lore.kernel.org/r/8d3ab7e2ba96563fe3495b32f60077fffb85307d.1597327623.git.gustavo.pimentel@synopsys.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/dw-edma/dw-edma-core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -391,7 +391,7 @@ dw_edma_device_transfer(struct dw_edma_t if (xfer->cyclic) { burst->dar = xfer->xfer.cyclic.paddr; } else { - burst->dar = sg_dma_address(sg); + burst->dar = dst_addr; /* Unlike the typical assumption by other * drivers/IPs the peripheral memory isn't * a FIFO memory, in this case, it's a @@ -399,14 +399,13 @@ dw_edma_device_transfer(struct dw_edma_t * and destination addresses are increased * by the same portion (data length) */ - src_addr += sg_dma_len(sg); } } else { burst->dar = dst_addr; if (xfer->cyclic) { burst->sar = xfer->xfer.cyclic.paddr; } else { - burst->sar = sg_dma_address(sg); + burst->sar = src_addr; /* Unlike the typical assumption by other * drivers/IPs the peripheral memory isn't * a FIFO memory, in this case, it's a @@ -414,12 +413,14 @@ dw_edma_device_transfer(struct dw_edma_t * and destination addresses are increased * by the same portion (data length) */ - dst_addr += sg_dma_len(sg); } } - if (!xfer->cyclic) + if (!xfer->cyclic) { + src_addr += sg_dma_len(sg); + dst_addr += sg_dma_len(sg); sg = sg_next(sg); + } } return vchan_tx_prep(&chan->vc, &desc->vd, xfer->flags);