Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp997890ybt; Fri, 19 Jun 2020 21:04:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/+zgRSRPaaVA99iYeDj1UDgTnlr3suWA1aiuzruvsgSv9ZKisrO6jvAjYIixMLjytXeg8 X-Received: by 2002:a17:906:58c:: with SMTP id 12mr2349654ejn.311.1592625860619; Fri, 19 Jun 2020 21:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592625860; cv=none; d=google.com; s=arc-20160816; b=fMxu7yeTv8b4znCy+nXHrAme/loESzxaax9Y7BrnyBiZgdNzdhCryNrLq9asTo0JDt M5wO30QYRAb4+z9I5TdztcaJjbUy6WrMqqnHU3KVC3cq+2wob6ZWiNe9A6uak42B2nrQ AWngvvVSjm/mkMJmJC1c8zFK5rVKvfU67Hn92v/Ir3P65Mr9k5ymAOc+RMafOuY5ClfO rXX5bcMsqjDfTidsqLtXguOYtlYzmPv1pDhv/zBg0e59GKVSXKc+IclCGTQFUfELKkQe bYzlH4lSm7JQwxNQu0c4BEE20qy2PMub4vjBcUEpl3LuKrtFiN+B7dOneAy/X0k0NZUz +LKw== 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=yPMImwN0kUH9c4dwaJ4xz8WwMU7rkHmvhlaAAfdJkeY=; b=Tzwkga9nqd/kqGMP5rIj7Gf/4wFa0dOiIh+X57RKlmF/Yix6LwH1N7ScBfr0nlUo0b e1in+AtCmDOAV0XeuWbLvgcEhmLLj3yVi7gobBx8Qhhc6ks4TyYA3n9CC86iX4Bk3CZ4 uonfWntAjArG1IH4zp08A+fugEVQL6buY6bofrtyWH+T730r2n/Py7pOlqCcoOY1BEjk bfhdJOw3N3UWq8xhSmHOBKetmdh58q4/0yXQW1jZrdDULKUJMUbAbZsjcPUvcTFuYb5q QKoHeouHjkW0tvJ2mUmNgs1h3e5bZlhVckV8OvS7gKaV4HClk3CldcwnsSidjzoWOkGd oDHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BXkRcPsj; 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 t22si5251689edt.28.2020.06.19.21.03.59; Fri, 19 Jun 2020 21:04: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=BXkRcPsj; 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 S2395284AbgFSQgY (ORCPT + 99 others); Fri, 19 Jun 2020 12:36:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:41724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389195AbgFSOtJ (ORCPT ); Fri, 19 Jun 2020 10:49:09 -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 250352158C; Fri, 19 Jun 2020 14:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578149; bh=gurwdtib4L861NscFcX0tABfxzET9woljcbtDY2AjP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXkRcPsjjHZbg++neV+3vH/3QR0xVO7WBlE85XdZcMYCkt1AqByQmo34TshBGtPKg xzxD35v4YkyxINMZJhq4/rIvH2uC1oqyfmkJtxKl/NVYKNLcrYCPFHymgdpzz76Sbd nxutiVfIstmypNis4zav44xrKFhAgzkjZM7CvoQI= 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 4.14 102/190] media: platform: fcp: Set appropriate DMA parameters Date: Fri, 19 Jun 2020 16:32:27 +0200 Message-Id: <20200619141638.677857052@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141633.446429600@linuxfoundation.org> References: <20200619141633.446429600@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 2988031d285d..0047d144c932 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -24,6 +25,7 @@ struct rcar_fcp_device { struct list_head list; struct device *dev; + struct device_dma_parameters dma_parms; }; static LIST_HEAD(fcp_devices); @@ -139,6 +141,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