Received: by 10.192.165.156 with SMTP id m28csp860358imm; Wed, 11 Apr 2018 08:21:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/cWgE7NgSwiAa5uR50ofOXpRSqqRC55V1ZnR0zBBgIdn5oujl0FVh/LR/Srg2VCvb1S+/L X-Received: by 2002:a17:902:1744:: with SMTP id i62-v6mr5640667pli.62.1523460065844; Wed, 11 Apr 2018 08:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523460065; cv=none; d=google.com; s=arc-20160816; b=nZVayX/2AZ5IIg56cBNt6Wi5tNQmo7BkAIDjwAlN2Oe+AkdmMHSFFV/8E0ws2VM+lR 6RfpdeOzgSUQ3WRZDN7R1llXDQEAZX3Wf8/6p6x/MxXsWWUN5KF+jjMe8R68yg4cUJM4 wAQkquNIlVM8rnpBAAVbjAZszRqc0d3KR7mMwCNFhP08fARJsX9AxsEVxlPcIgP7LWdB MihNmw2lHDKjElqnAPhflE05+JpY+SKTLOkG7+EYOfczY4mITvr44m2PRlMGolppJzN0 DV5iQChZxCd6amNG8fWe9wwnIT9mFudUWRNlOUA05f6buzldl0tpB194MtXexV2j2kcZ GF8Q== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=otD+Uitao306J+PT+SKJsrqguHl9JIrLoABjWXXZDFc=; b=CHYxImkPTDR2u/6U7cCRTcZTGUlvEiGWnwgtRf2wycnp+QnIZ+flSsAexbN5IL5H+u Djmktk+NeJfiWmnKJ0o7+1+j6GxW6iM2dREnUJxqUcbD0jACjjfy1sn6nFuBx8PaHHkP H8N9XvXbtkqxW/rNFdzhRX0dxdjBtyoeLvo49dddMNzQxiP3bkwF+MAQ4WSJK/Q+hHKU 9fkwe+wHGUTeHVpv5vmZKaOjbfja4KXKpW7bX4aV0zreMtkDSz8ovTXrndbfbXrhsBD0 8vEUSa7/wokqtOSyKiKgbWBacRVtWGbxurPcLQJykShUnPZWe1cKDQXeLiyKQbi5S7oM Lp1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si879168pgc.497.2018.04.11.08.20.28; Wed, 11 Apr 2018 08:21:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753136AbeDKPO2 (ORCPT + 99 others); Wed, 11 Apr 2018 11:14:28 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50532 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbeDKPO1 (ORCPT ); Wed, 11 Apr 2018 11:14:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E35E31435; Wed, 11 Apr 2018 08:14:26 -0700 (PDT) Received: from [10.1.210.88] (e110467-lin.cambridge.arm.com [10.1.210.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5AFD43F592; Wed, 11 Apr 2018 08:14:25 -0700 (PDT) Subject: Re: [PATCH v2 1/2] dmaengine: stm32-mdma: align TLEN and buffer length on burst To: Pierre-Yves MORDRET , Vinod Koul , Maxime Coquelin , Alexandre Torgue , Dan Williams , M'boumba Cedric Madianga , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1523457879-9869-1-git-send-email-pierre-yves.mordret@st.com> <1523457879-9869-2-git-send-email-pierre-yves.mordret@st.com> From: Robin Murphy Message-ID: <9a2a267c-2b0b-0d6a-c762-47e7d37f84ea@arm.com> Date: Wed, 11 Apr 2018 16:14:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1523457879-9869-2-git-send-email-pierre-yves.mordret@st.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/04/18 15:44, Pierre-Yves MORDRET wrote: > Both buffer Transfer Length (TLEN if any) and transfer size have to be > aligned on burst size (burst beats*bus width). > > Signed-off-by: Pierre-Yves MORDRET > --- > Version history: > v1: > * Initial > v2: > --- > --- > drivers/dma/stm32-mdma.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c > index daa1602..fbcffa2 100644 > --- a/drivers/dma/stm32-mdma.c > +++ b/drivers/dma/stm32-mdma.c > @@ -413,7 +413,7 @@ static u32 stm32_mdma_get_best_burst(u32 buf_len, u32 tlen, u32 max_burst, > u32 best_burst = max_burst; > u32 burst_len = best_burst * width; > > - while ((burst_len > 0) && (tlen % burst_len)) { > + while ((burst_len > 0) && (((tlen | buf_len) & (burst_len - 1)) != 0)) { > best_burst = best_burst >> 1; > burst_len = best_burst * width; > } FWIW, doesn't that whole loop come down to just: burst_len = min(ffs(tlen | buf_len), max_burst * width); ? Robin.