Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbbKQMPR (ORCPT ); Tue, 17 Nov 2015 07:15:17 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47580 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751350AbbKQMPO (ORCPT ); Tue, 17 Nov 2015 07:15:14 -0500 X-AuditID: cbfec7f5-f794b6d000001495-87-564b1a4f3732 Subject: Re: [RFC/PATCH] media: omap3isp: Set maximum DMA segment size To: Laurent Pinchart , linux-media@vger.kernel.org References: <1444742316-27986-1-git-send-email-laurent.pinchart@ideasonboard.com> <1560214.1Y1q0qLZA4@avalon> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, robin.murphy@arm.com, Lars-Peter Clausen , sakari.ailus@iki.fi, Shuah Khan From: Marek Szyprowski Message-id: <564B1A4E.7040001@samsung.com> Date: Tue, 17 Nov 2015 13:15:10 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-version: 1.0 In-reply-to: <1560214.1Y1q0qLZA4@avalon> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t/xy7r+Ut5hBp0zdSwW7Le2WDJ5PqtF 58Ql7BabHl9jtbi8aw6bRc+GrawWBz88YbU4s38lm8XXnw4OnB5r5q1h9Ng56y67x+yOmawe h78uZPHYvKTeY/KN5YweS94cYvX4vEkugCOKyyYlNSezLLVI3y6BK+PYxYdMBQ8lKg6sWcfa wLhfpIuRk0NCwESiZeMdFghbTOLCvfVsXYxcHEICSxklnk8+D+U8Z5TY0zCRDaRKWMBNovnQ dFYQW0QgXOLyvq9gtpBAocS+H3tYQRqYBR4ySsy8fAOsgU3AUKLrbReYzSugJdG8dxaYzSKg KnHm9Gew1aICMRLvN61ihKgRlPgx+R5YnFNAQ6L961cmEJtZwEziy8vDrBC2vMTmNW+ZJzAK zELSMgtJ2SwkZQsYmVcxiqaWJhcUJ6XnGukVJ+YWl+al6yXn525ihETF1x2MS49ZHWIU4GBU 4uHdfcQrTIg1say4MvcQowQHs5IIb/EroBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHembvehwgJ pCeWpGanphakFsFkmTg4pRoYG3i2adTJfTyweX3q7WV7M8RcXh74evPI9MZ4wx1J0lcevgu/ Vs3k+j77Zv8dTe67GzavU2fL3KXcnrl6zfSlxcqmh6ulJjTMFF8zK6RiZV1TgCdzfOFvjkcT jYz5vFOXJ23748YYHb/WYNfuvV/2L4r7ckuiOaJ8k0mgbGNNGGvl3RNLuSfnK7EUZyQaajEX FScCAHSUAJSGAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3332 Lines: 87 Hi Laurent, I really have no idea how this problem should be addressed. I've already proposed to handle it in videobuf2-dc, but this has been rejected. Maybe the only way will be to add dma_set_max_seg_size(isp->dev, DMA_BIT_MASK(32)) to every v4l2 driver, which use videobuf2-dc and add a check in videobuf2-dc. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland On 2015-11-09 15:18, Laurent Pinchart wrote: > Hello everybody, > > Ping ? > > On Tuesday 13 October 2015 16:18:36 Laurent Pinchart wrote: >> The maximum DMA segment size controls the IOMMU mapping granularity. Its >> default value is 64kB, resulting in potentially non-contiguous IOMMU >> mappings. Configure it to 4GB to ensure that buffers get mapped >> contiguously. >> >> Signed-off-by: Laurent Pinchart >> --- >> drivers/media/platform/omap3isp/isp.c | 4 ++++ >> drivers/media/platform/omap3isp/isp.h | 1 + >> 2 files changed, 5 insertions(+) >> >> I'm posting this as an RFC because I'm not happy with the patch, even if it >> gets the job done. >> >> On ARM the maximum DMA segment size is used when creating IOMMU mappings. As >> a large number of devices require contiguous memory buffers (this is a very >> common requirement for video-related embedded devices) the default 64kB >> value doesn't work. >> >> I haven't investigated the history behind this API in details but I have a >> feeling something is not quite right. We force most drivers to explicitly >> set the maximum segment size from a default that seems valid for specific >> use cases only. Furthermore, as the DMA parameters are not stored directly >> in struct device this require allocation of external memory for which we >> have no proper management rule, making automatic handling of the DMA >> parameters in frameworks or helper functions cumbersome (for a discussion >> on this topic see http://www.spinics.net/lists/linux-media/msg92467.html >> and http://lists.infradead.org/pipermail/linux-arm-kernel/2014-> November/305913.html). >> >> Is it time to fix this mess ? >> >> diff --git a/drivers/media/platform/omap3isp/isp.c >> b/drivers/media/platform/omap3isp/isp.c index 17430a6ed85a..ebf7dc76e94d >> 100644 >> --- a/drivers/media/platform/omap3isp/isp.c >> +++ b/drivers/media/platform/omap3isp/isp.c >> @@ -2444,6 +2444,10 @@ static int isp_probe(struct platform_device *pdev) >> if (ret) >> goto error; >> >> + isp->dev->dma_parms = &isp->dma_parms; >> + dma_set_max_seg_size(isp->dev, DMA_BIT_MASK(32)); >> + dma_set_seg_boundary(isp->dev, 0xffffffff); >> + >> platform_set_drvdata(pdev, isp); >> >> /* Regulators */ >> diff --git a/drivers/media/platform/omap3isp/isp.h >> b/drivers/media/platform/omap3isp/isp.h index e579943175c4..4b2231cf01be >> 100644 >> --- a/drivers/media/platform/omap3isp/isp.h >> +++ b/drivers/media/platform/omap3isp/isp.h >> @@ -193,6 +193,7 @@ struct isp_device { >> u32 syscon_offset; >> u32 phy_type; >> >> + struct device_dma_parameters dma_parms; >> struct dma_iommu_mapping *mapping; >> >> /* ISP Obj */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/