Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp115902ybg; Mon, 8 Jun 2020 18:03:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCxplyRYFPTq9GVxfDa6GMOZ04EfadUJ8IbK6+8pzBeYBsMu+rBt1SuJm+kCIlE5+mWRjp X-Received: by 2002:a17:906:2e9a:: with SMTP id o26mr22827183eji.538.1591664600550; Mon, 08 Jun 2020 18:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664600; cv=none; d=google.com; s=arc-20160816; b=wyxokxqKbeLs1vvI3hS8YgXYIvjg3c2+GwDKl25e67R6RXWuL2hWbdEO9cR2x8GPPY j5EgNfq8E7FG8e1hKpxgSQUVxmjywX5wrV2ZetxUXm9sutEKgmDN87CICk3a3sct9qmL qxyx9KaDFDeVompEVFwVe1Y5jDyNB9bs7/KuksR/nvz+7gE4Hx4qFtQ4J81GtWRqERtk KY/l4kh3vOBSdnic7++NlVh6iMEt26DPHQn8oNq3D1maYrMlceiOfce34FHd8onGVMRG /z9clLafq4vL4ea+AowmaqEm38pdlGT9N5qj0x7TKkg8dVIyapK9XfAwgadGfbLpU2IS B24w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Glw4fGIrV5SThd7in4ccdGCnrUVvYDqPgToUb66Cl+U=; b=b+Hshm/S2pYZ03w+ey85xrlUBmV+mhXcTIBqJB+NxcvCGXCWtT++2++WUFmTrChKI2 mb46zxd+lNhfCsEF/AriougdcBmIyxp0VsCUggJqjeu6t9a9b2m0K1emX1OY3j9heubs Rb+6OniwVWUH836MtcZbT2j8SF8NR0f5kAF2CUTeUzKthtDb/sgOPMVo55s4HARsH+cx B7y2HxPeFV0uUcEg21bktntoqL3raq8W8tZE3xtGt1zUJlBQbP4X0E7grLiOpHXwmqOi 71CZXpq54zmKtQNhxajSwaJ+/29OkI+p7Ap8Jo003E8/Vr3aSe5yxjanY2ZoyLwwfFtY dKpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W6rJQxXl; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q9si10165731edb.473.2020.06.08.18.02.57; Mon, 08 Jun 2020 18:03:20 -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=W6rJQxXl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729121AbgFIA71 (ORCPT + 99 others); Mon, 8 Jun 2020 20:59:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:54028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728198AbgFHXIh (ORCPT ); Mon, 8 Jun 2020 19:08:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5376A2086A; Mon, 8 Jun 2020 23:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657717; bh=FmZBpMkmKEa+BWw2RykpSg1I5MeKBmsg8bPHuXEZEK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W6rJQxXlXjAc6JHfSj3g+msk86nQMQ/0uy8joQExtx0+6ZXEydKKqv+4pdOYFI4Jm l0Kp0u90Fxcj1sy470gnqMabTahGul1mNJgZlLvyRsG9VgYORvSi/io2tOxlFzuZLf TPm/aDgogJGEyXAaP33CUPEx7ZlY2VO5xwTZ6XBc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kieran Bingham , Geert Uytterhoeven , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 111/274] media: platform: fcp: Set appropriate DMA parameters Date: Mon, 8 Jun 2020 19:03:24 -0400 Message-Id: <20200608230607.3361041-111-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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