Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp306784ybm; Thu, 28 May 2020 03:18:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXN379QSpdR9rsiUg7dliHi2pmDjVxYLZR2cQiHIQtMUgRP/dOXt2Pef1Yu/FlHmbAmiYf X-Received: by 2002:a17:906:858b:: with SMTP id v11mr2219236ejx.348.1590661082129; Thu, 28 May 2020 03:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590661082; cv=none; d=google.com; s=arc-20160816; b=fDJWgO/CDl7KQoUaqnvH5C7mo2L5JReEwAuJFclxtgkhK7MYMBgJa9IrKP9qKX6J/i ZW4Xnv3jldnuI+Wdg5IHbIl6WctBC17uiHxGVIRCN9ITsfWIAGnp2AnCetgif0yQnuuc Bny6rl/i4Bi9iXH5bbDjUz4zzvbpYI6D2y/6nrY1f72iH0nEvWHh7TDL2F91RciUvVxj L1p4HZpdexj074eo6NsE4L8hS7Qag9o8jagnsKV0ksaicIWsi1q9TVB4O0j9rbpm/8ED ITlO9A7t60rXQqqo1vDHnQs2mZgtd9/KIzckgamOHL7cpvwCIpJesW1EfHLcyNZNY2KF 7NfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NnFvkEinSu8JNeeiaCqqDDP3KthjxwCRXHN9I0khteE=; b=jVcgpd1ALAMxIvcIhwhPZcvGsc1I4S4dBj99RIREv+qSlqKrr+OzUU0eqQ0jBY+t57 yZaaw1m/MQDJG1sjSulegHLzqJnG7jlChY/DImp0D5SkcQJScr2gTg0xApWlHP5tdP/L Mm8HgUmVtfxYR0j6KBpjUdVZrK3ciWFgOdCtzlEkc6xumE598K29hK4wuLYx7cq5/iSb VpkjQUOFgsFBFU1/5GR4MR337yUJALVZdR75NQ3NoxPdgcb5BPMlb+eh5OhLX70ax43x DYADYXzMdjFNywPt97E+QO3sBGPlUAXBk9apWV+a+nmd3pn2aHg8YQJMs1YZH2wVK8BK 2NVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JKXLgYnR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si3425719ejq.18.2020.05.28.03.17.38; Thu, 28 May 2020 03:18:02 -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=@linaro.org header.s=google header.b=JKXLgYnR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387778AbgE1KPa (ORCPT + 99 others); Thu, 28 May 2020 06:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387769AbgE1KPG (ORCPT ); Thu, 28 May 2020 06:15:06 -0400 Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9869C08C5C8 for ; Thu, 28 May 2020 03:15:06 -0700 (PDT) Received: by mail-vs1-xe41.google.com with SMTP id 1so15423596vsl.9 for ; Thu, 28 May 2020 03:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NnFvkEinSu8JNeeiaCqqDDP3KthjxwCRXHN9I0khteE=; b=JKXLgYnRrXprs68FC8fP4Hq7I9VPldQJYeOyc/9tZMIvKGkf3t5OoImS5K4atsMnAN r27FPxAuUszQNOJP2Mc0e0W6PepVkbJr7xfkUcfmu59eRZHeKzQsqFqgPrCLjhZ2QcZm B98a7+5hvdsR4PehdNAbX2Q5Irc8IRfgouLxpRWRu9GLQmRxE+zYRiXyI51m7zoRSkTJ +rswdazaCjsE26eujh5yTeYERp1E0iZsmhEVLg3VEOfm4tqR8fEEMp3c4DUPAf0RW48B 6C4TICJ1VGKAY2wPQ1LKT6XGF2yPvJNdhTWDNUDY6Dvh2AZDUdM0GPcSLgQ5yRXyb7ex BfEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NnFvkEinSu8JNeeiaCqqDDP3KthjxwCRXHN9I0khteE=; b=Bu6mHaahRUsZ6fKEuNbR4FaAoje7NZwZxWR5RlgOc9360meIOYinlrLphFAh01e+ft HyYx56F6dVDfL3YlT2acd66p5B9dvZ4z9B/4N0PciP4Pr9FWWXcceGqQ/GCbTKSZuQJx GSC7v+y2+aV0FXHsn8rgFuy2ACh9XXtC8BkJZsrk4HdxZAmyhyotLVGisxpHedfwdP0p uaFHHK+yVsU8ALdLR/0GsZyKcttBB+z/V7odYqlzehfciucml1MnG/0vCur/yk+duyG8 /+4Y24EhyeSYzy4cEAFnYGD7+ObPO7i1kcuMdaukgkABeqhSqSimhXONo6Uf7zv4xL7/ OzNg== X-Gm-Message-State: AOAM530X4+Sq7ASyK4g6ZFD048eQB0EoQpHZa/LbaD77ZaEDrol5+WSq 4iGYV58r/5YkmXDipOvu3PNBnkFbtA9F7oVIX+u4YxG0MAk= X-Received: by 2002:a67:ec58:: with SMTP id z24mr1378822vso.200.1590660905952; Thu, 28 May 2020 03:15:05 -0700 (PDT) MIME-Version: 1.0 References: <20200526155103.12514-1-ludovic.barre@st.com> <20200526155103.12514-3-ludovic.barre@st.com> In-Reply-To: <20200526155103.12514-3-ludovic.barre@st.com> From: Ulf Hansson Date: Thu, 28 May 2020 12:14:28 +0200 Message-ID: Subject: Re: [PATCH 2/2] mmc: mmci_sdmmc: fix DMA API warning max segment size To: Ludovic Barre Cc: Rob Herring , Srini Kandagatla , Maxime Coquelin , Alexandre Torgue , Linux ARM , Linux Kernel Mailing List , DTML , "linux-mmc@vger.kernel.org" , linux-stm32@st-md-mailman.stormreply.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 May 2020 at 17:51, Ludovic Barre wrote: > > Turning on CONFIG_DMA_API_DEBUG_SG results in the following warning: > WARNING: CPU: 1 PID: 85 at kernel/dma/debug.c:1302 debug_dma_map_sg+0x2a0/0x3cc > mmci-pl18x 58005000.sdmmc: DMA-API: mapping sg segment longer than device claims to support [len=126976] [max=65536] > > dma api debug checks and compares the segment size to > dma_get_max_seg_size (dev->dma_parms->max_segment_size), > the sdmmc variant has an internal DMA and should define > its max_segment_size constraint to avoid this warning. > > This Patch defines the dev->dma_parms->max_segment_size > with the constraint already set for mmc core > (host->mmc->max_seg_size). > > Signed-off-by: Ludovic Barre Applied for next, thanks! Note, a manual backport is needed for stable, as dma_set_max_seg_size() will fail for older kernels. We needed to revert 9495b7e92f7 ("driver core: platform: Initialize dma_parms for platform devices"), for stable kernels [1]. Kind regards Uffe [1] https://lkml.org/lkml/2020/5/26/1216 > --- > drivers/mmc/host/mmci_stm32_sdmmc.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c > index 2965b1c062e1..51db30acf4dc 100644 > --- a/drivers/mmc/host/mmci_stm32_sdmmc.c > +++ b/drivers/mmc/host/mmci_stm32_sdmmc.c > @@ -119,20 +119,19 @@ static void sdmmc_idma_unprep_data(struct mmci_host *host, > static int sdmmc_idma_setup(struct mmci_host *host) > { > struct sdmmc_idma *idma; > + struct device *dev = mmc_dev(host->mmc); > > - idma = devm_kzalloc(mmc_dev(host->mmc), sizeof(*idma), GFP_KERNEL); > + idma = devm_kzalloc(dev, sizeof(*idma), GFP_KERNEL); > if (!idma) > return -ENOMEM; > > host->dma_priv = idma; > > if (host->variant->dma_lli) { > - idma->sg_cpu = dmam_alloc_coherent(mmc_dev(host->mmc), > - SDMMC_LLI_BUF_LEN, > + idma->sg_cpu = dmam_alloc_coherent(dev, SDMMC_LLI_BUF_LEN, > &idma->sg_dma, GFP_KERNEL); > if (!idma->sg_cpu) { > - dev_err(mmc_dev(host->mmc), > - "Failed to alloc IDMA descriptor\n"); > + dev_err(dev, "Failed to alloc IDMA descriptor\n"); > return -ENOMEM; > } > host->mmc->max_segs = SDMMC_LLI_BUF_LEN / > @@ -143,7 +142,7 @@ static int sdmmc_idma_setup(struct mmci_host *host) > host->mmc->max_seg_size = host->mmc->max_req_size; > } > > - return 0; > + return dma_set_max_seg_size(dev, host->mmc->max_seg_size); > } > > static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl) > -- > 2.17.1 >