Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp731664ybt; Fri, 19 Jun 2020 12:14:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCJCF9CFemGMnujQujH15kcEWgaUusJcuIQjHQEjosRoSsBDBaJcpdBpWqqIAVl1HWFzcJ X-Received: by 2002:a17:906:6403:: with SMTP id d3mr4888394ejm.386.1592594091525; Fri, 19 Jun 2020 12:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592594091; cv=none; d=google.com; s=arc-20160816; b=zW65mD9wDZRflrlm85cmaTk1r2jWxtMkbc281L4XHmTxPUjgdxnbwrPHZbfXqP+1qO F26oYOtAwFGGpQIzwY9WutTRaJr9Qv4i/b2Rc8Ww1j4QVw8q7fX6/i6GrH/MsOL+usbu mq4cngZZXjMUGZYyky3fYGWeO8MD25fhDjXjTirKGNfe0M5kUaTktZVI20uZ1vetB+J8 08r+teSzuuu21xA5qTpIiWzQ+av2CWXToI1vSeFi0VV2GE8nmYp4Q3Ok0C/tlG3MD+q0 Bcpkt76vKjmb3OyWC60ChekYDcqRj1fQFXcX62bito6RWvc6elmLqBP1wBhd0YOmxLVu Lrog== 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=tPU3WCvo8Swby3LFHSpBoVQhEqS6hyNEncVQK/Iw/nM=; b=kjxLh4Qvt6zkv0IH9EjmeoLXv314Wn8NOp/srt2+ll9OtfiSI0Z9m1KD5Y1K1kulcg rEptlhJ315vLmfnsn63ASaQGK4hnM48rinIpe98MIAzyUsYY6W9I0/EJ0culsnPobmXb Afov9Qrwru2wyIAFgrnYcVKP5sNuN92IRiL0MbemyhTN4inLP5qj/NlvkOpd2GObvy9r WG4btK2NoMgTGx/cg8kUQTUpPBZOoimVYlDIvDGA4T2zQ9yoxYRyZOld/v1eevSCuoYx JmmJfE5umn/7QAR4xgJfMjnSjlauQJSsNeGlLIZ8hLzL6Wl6rDD/Ym4S6HB6bWMdLIqd fmnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ZkdFH/9J"; 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 b2si4364773ejk.469.2020.06.19.12.14.29; Fri, 19 Jun 2020 12:14:51 -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="ZkdFH/9J"; 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 S2388365AbgFSOmY (ORCPT + 99 others); Fri, 19 Jun 2020 10:42:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:33036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388012AbgFSOmV (ORCPT ); Fri, 19 Jun 2020 10:42:21 -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 742E72158C; Fri, 19 Jun 2020 14:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577741; bh=kcCuyZoiJ+pUggvJQfB4raYkD2sDjxEX9vIpKv3z4/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkdFH/9J4HcyjZZcx6ti4oqKkK2XmIQP0bpeETotMOz31xCK23wJpfKKk2f5tMpan o4cH0ooSZxJv2Ycy6+eYU7Qxcj+A3BkwJMwAB0IvRolDbaWqkaSayBgc4Hk+SkWgKI HRpbnIxWA1o+Q4dlBozRUkJc/D17faoAAm4biadI= 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.9 071/128] media: platform: fcp: Set appropriate DMA parameters Date: Fri, 19 Jun 2020 16:32:45 +0200 Message-Id: <20200619141623.951415000@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141620.148019466@linuxfoundation.org> References: <20200619141620.148019466@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 f3a3f31cdfa9..8e9c3bd36d03 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); @@ -140,6 +142,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