Received: by 10.192.165.156 with SMTP id m28csp499533imm; Fri, 13 Apr 2018 02:57:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx494vtb5RXzrZGYpEf+9kQKX27Q9cwlvvOFe3Ag3eI9qf7k6RU59l0pjQN0vzUhwnfn7hEJX X-Received: by 10.98.32.87 with SMTP id g84mr10816304pfg.28.1523613472969; Fri, 13 Apr 2018 02:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523613472; cv=none; d=google.com; s=arc-20160816; b=Y27/AQ1IqgVGrMYvEJZpPJwaHRy+Ml5uT9s1PDljJFvnZlpIrLkjX4z33b6PxLhkyx wEuBEs/PuRhKcNjN7LtCZInWDhwF9adwt45iMjCL3N4l0g4t9QizwMU/v8TYXV6aCwzs RoDsl3NzPDi11UFX5kaGwK1ysTxZuYexLcyTd4LUMiTw7NSRDM1gBJ+6FAKRMWmc7oOz CeVBNeWC5gsYdUf/RBzRePkj7y6OAVGyIVMXaOD5GuQPV8JK1wethQvxnY3EcCurNg29 GPovULTdi6U0O7AGcXwfVjpoOKHzYde2MUDtqH2OfuzNi9QzoupbswwtvFiYGbS8SDgi PQtQ== 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=0wPvjE9mRFk57QOFT9XXonHD1N7ea25wUzAXO20XfKc=; b=GRfNuE3xJA6atgarY+7rc49EltYLuf1RyiZYr3S8tu+zN4QOU2nljA1LpTnEQ/63y4 a3dwKoJ2Qb5FdgDQiUAprsZBwIovZ303q8BSRlbhnHz4TgJSF4Qgd9onoJGE6rEe8AYh xfNJVOQxRVqcXndofDHMYWC9tMpLCztWzYgiJo+8KGsinkUIEHRb64KhCrXEPcXKxtn0 XpZh1P66mT+rO8RCNEl10r7xtWIjF/7ipQsPBoteB66MllJqOEucfNheB3m2pH4nCLCu GEi0zKIP+LXIZ1869V/qqJlaePv605bhqJX0pT5S8mPtIRZvhAdtOtmXF0OwPOK3jD1O XjyA== 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 q11-v6si5297879pli.667.2018.04.13.02.57.39; Fri, 13 Apr 2018 02:57:52 -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 S1754163AbeDMJrI (ORCPT + 99 others); Fri, 13 Apr 2018 05:47:08 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:47607 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753254AbeDMJrG (ORCPT ); Fri, 13 Apr 2018 05:47:06 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3D9hrME032369; Fri, 13 Apr 2018 11:46:45 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2h9hc9mtwc-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 13 Apr 2018 11:46:45 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 652AC13B; Fri, 13 Apr 2018 09:45:45 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node2.st.com [10.75.127.14]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 17C1123F7; Fri, 13 Apr 2018 09:45:45 +0000 (GMT) Received: from [10.201.23.236] (10.75.127.50) by SFHDAG5NODE2.st.com (10.75.127.14) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 13 Apr 2018 11:45:44 +0200 Subject: Re: [PATCH v2 1/2] dmaengine: stm32-mdma: align TLEN and buffer length on burst To: Robin Murphy , Vinod Koul , Maxime Coquelin , Alexandre Torgue , Dan Williams , "M'boumba Cedric Madianga" , , , References: <1523457879-9869-1-git-send-email-pierre-yves.mordret@st.com> <1523457879-9869-2-git-send-email-pierre-yves.mordret@st.com> <9a2a267c-2b0b-0d6a-c762-47e7d37f84ea@arm.com> From: Pierre Yves MORDRET Message-ID: <22bd0af7-9820-57c5-9215-8185839d7d27@st.com> Date: Fri, 13 Apr 2018 11:45:44 +0200 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: <9a2a267c-2b0b-0d6a-c762-47e7d37f84ea@arm.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG4NODE3.st.com (10.75.127.12) To SFHDAG5NODE2.st.com (10.75.127.14) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-13_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Robin On 04/11/2018 05:14 PM, Robin Murphy wrote: > 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); No sure it ends as expected. or I miss something or don't understand this statement I tried with "relevant value" : i.e. best_burst = 32, Tlen=128(default) and buf_len = 64, width= 4. This statements gets me something wrong output => 7 instead of 16 * 4. I doubt :) > > ? > > Robin. >