Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp572469ybt; Fri, 19 Jun 2020 08:27:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHgw6xWOoQ9U6gcypxjxEVXD0vMVwrM1fxHeLfeKTnH19wuZAq7aepEqrPF/wL2VlCPMgq X-Received: by 2002:a17:906:4009:: with SMTP id v9mr3806832ejj.481.1592580436823; Fri, 19 Jun 2020 08:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592580436; cv=none; d=google.com; s=arc-20160816; b=HCCBZAHWDnBo+Egicy5ueyxdxKgkMuFEV4oUgVKUE+QRrJt4fV1TOv8JimMkGNfHVQ DBJ/pMuCZi/efHiksugdMlK+Lidtp9A3+1+Q02qV6QOGtrJsXB8K1/SFKTYw3IPRZsSs GD/DMmIQuP3/OY6TNoi4AE9jumI6UIAyadoser1uLWfenTUXRnjpLlvrBZ+ZA30/fJlF 2SYYasHifCTek3qw6Wq9hgUPYGS9ui7iVsfx1Pg1SUTdnvNqlSdum49va5XZTSuDixm2 9lrRNEvWBeHgENd46Uvh6NRISUu4f7McRAk89DjIG1flB6j357LUxhYZNAeV8ZPaiI7r xznQ== 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=Glw4fGIrV5SThd7in4ccdGCnrUVvYDqPgToUb66Cl+U=; b=Kw79b/jpDMhRBdBXeNsDFTVoHvWN8Ff2RyMKwTa+L2W6GJIVGXATGQicXip2KDCBto vdL6sssChLgbyCBzofO85OglFHepy7XSveJXeJaJ3zrDenCZ9+Uz5rHvJ3VJmGp0VsAv GONR2t5wHYHiSJJo4ZDi0llA43EblSLhHlhYm+3gcFSEfDGO+pDgtd0nODKnKykJSOcN 1CifATOHJWFF2biBzi7wauWQq+UnwmNDF5EfZD4hx2xE9eW/PGolHY++5Ur6SkfqBwym YTJds7ElHLAH1HBZ6O4XeEpxdbkMAzmojZ8nCQczjDWCx4AxJomI2knMpDkt8YsysML7 JBHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EQg8oztf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si4014061edy.603.2020.06.19.08.26.54; Fri, 19 Jun 2020 08:27:16 -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=EQg8oztf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390810AbgFSPYT (ORCPT + 99 others); Fri, 19 Jun 2020 11:24:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:52162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392754AbgFSPUv (ORCPT ); Fri, 19 Jun 2020 11:20:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1B75120706; Fri, 19 Jun 2020 15:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580050; bh=FmZBpMkmKEa+BWw2RykpSg1I5MeKBmsg8bPHuXEZEK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQg8oztfttqT6KFLEYPg5syx0nsNs1KNVpXktD6tYVvsCDR7EkWZxPMbJQzV5S2nB 910FXI57qKt9mf0D0fVezUKfDBMk40G3RDa+WN6bvAJJQ5K9FncrMnQCV/eL09pQL6 mQbWaedEdxnNTq6DkUCFPUjmts8Xi8rwkOR0sjlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Kieran Bingham , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.7 103/376] media: platform: fcp: Set appropriate DMA parameters Date: Fri, 19 Jun 2020 16:30:21 +0200 Message-Id: <20200619141715.222785776@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@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: Kieran Bingham [ Upstream commit dd844fb8e50b12e65bbdc5746c9876c6735500df ] Enabling CONFIG_DMA_API_DEBUG=y and CONFIG_DMA_API_DEBUG_SG=y will enable extra validation on DMA operations ensuring that the size restraints are met. When using the FCP in conjunction with the VSP1/DU, and display frames, the size of the DMA operations is larger than the default maximum segment size reported by the DMA core (64K). With the DMA debug enabled, this produces a warning such as the following: "DMA-API: rcar-fcp fea27000.fcp: mapping sg segment longer than device claims to support [len=3145728] [max=65536]" We have no specific limitation on the segment size which isn't already handled by the VSP1/DU which actually handles the DMA allcoations and buffer management, so define a maximum segment size of up to 4GB (a 32 bit mask). Reported-by: Geert Uytterhoeven Fixes: 7b49235e83b2 ("[media] v4l: Add Renesas R-Car FCP driver") Signed-off-by: Kieran Bingham Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/rcar-fcp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index 43c78620c9d8..5c6b00737fe7 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -21,6 +22,7 @@ struct rcar_fcp_device { struct list_head list; struct device *dev; + struct device_dma_parameters dma_parms; }; static LIST_HEAD(fcp_devices); @@ -136,6 +138,9 @@ static int rcar_fcp_probe(struct platform_device *pdev) fcp->dev = &pdev->dev; + fcp->dev->dma_parms = &fcp->dma_parms; + dma_set_max_seg_size(fcp->dev, DMA_BIT_MASK(32)); + pm_runtime_enable(&pdev->dev); mutex_lock(&fcp_lock); -- 2.25.1