From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932266AbbHXUPQ (ORCPT ); Mon, 24 Aug 2015 16:15:16 -0400 Received: from mail-io0-f170.google.com ([209.85.223.170]:33867 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754548AbbHXUPK (ORCPT ); Mon, 24 Aug 2015 16:15:10 -0400 Message-ID: <55DB7B4C.4010804@kernel.dk> Date: Mon, 24 Aug 2015 14:15:08 -0600 From: Jens Axboe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Robert Jarzmik , Russell King - ARM Linux , Guennadi Liakhovetski , Andrew Morton CC: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: Re: [PATCH] lib: scatterlist: add sg splitting function References: <1439023450-2689-1-git-send-email-robert.jarzmik@free.fr> In-Reply-To: <1439023450-2689-1-git-send-email-robert.jarzmik@free.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/08/2015 02:44 AM, Robert Jarzmik wrote: > Sometimes a scatter-gather has to be split into several chunks, or sub > scatter lists. This happens for example if a scatter list will be > handled by multiple DMA channels, each one filling a part of it. > > A concrete example comes with the media V4L2 API, where the scatter list > is allocated from userspace to hold an image, regardless of the > knowledge of how many DMAs will fill it : > - in a simple RGB565 case, one DMA will pump data from the camera ISP > to memory > - in the trickier YUV422 case, 3 DMAs will pump data from the camera > ISP pipes, one for pipe Y, one for pipe U and one for pipe V > > For these cases, it is necessary to split the original scatter list into > multiple scatter lists, which is the purpose of this patch. > > The guarantees that are required for this patch are : > - the intersection of spans of any couple of resulting scatter lists is > empty. > - the union of spans of all resulting scatter lists is a subrange of > the span of the original scatter list. > - streaming DMA API operations (mapping, unmapping) should not happen > both on both the resulting and the original scatter list. It's either > the first or the later ones. > - the caller is reponsible to call kfree() on the resulting > scatterlists. > > Signed-off-by: Robert Jarzmik I think this looks fine. But do we really need the Kconfig option? It's not a lot of code, and it seems silly to put the onus on the driver for having to enable something that is a subset of the SG api. -- Jens Axboe