Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5683359rwl; Tue, 4 Apr 2023 01:59:13 -0700 (PDT) X-Google-Smtp-Source: AKy350aUwhvD+SRmNSiL3qS+NECPN/pvwH/XN6eRSEhdA5hxHS0YZQkWUZxehPnAJCUjL5ip1u+D X-Received: by 2002:a05:6402:688:b0:4fc:782c:dca3 with SMTP id f8-20020a056402068800b004fc782cdca3mr1732490edy.28.1680598753424; Tue, 04 Apr 2023 01:59:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680598753; cv=pass; d=google.com; s=arc-20160816; b=ZGTJkCP0Qmby7Ca0zLBAwLyP0ArDJh8Pu51ejLGAy8CwEpCTAJyKRdMLPkHIgfn3B+ xCaag+1XEbmxV3XCjD2cQNPYZOpuqG86gBLnbmD7skjRkqOIrD+7R6WLoToOk8g/mj2D 0TCWM+dt+f0nnX1LPPUHWg6W1yieJZa3KmIUFldvfPxRMJQzolMZoPpbn4SkSuskpACC 6/Yw38OWlidCmA5Kd+AheslwdpHFEYRL+XkO9e/azNRIBLMReD/bw4x7I8YQIGGOiyxb HWeLcBN0nhWMVM+SzUbbKmpg+a+F28dHYUQT0IyAQqM1k15cuOjfeYzwWa/+EHAVK9j9 h3jg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=8FAOgb0ZuQYpU1C9FVOQOQ/sS2a+fKHxaC/jUDzvyZE=; b=CuvyNeTlOI7T8B+1BIIQG1JNfu4hQy3AiGmdZYjvnyt4+qW/cFIqGsHiowcOmQ8Iam Al0yyuwDM9VMn1Z9nsVO4fKqH0PXNZQRgLbRQU+h4IshKk4MJtpzeGBJtvds/WmRVFjd xcmqnc99SNBvgaW7qwGbN8H34o6sR0yFz8fsA0ggdll+UL2Gfq3eVHpRVY8NsRheyq7k p8ywajCoHq31lL+R15GYXURXhrh8qoN5REw/KW7+o3erph1TDKQV4ZPh6hZnbLLbpS+1 4Ajebj8qcyDEM07fMsOmW0pfusuZ5c8j7w5kYO6mxKb1oOnYd9u51UzKbzyL2vDG1Yzk wFMw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=cUTxmSNd; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020aa7c497000000b004fd16f5aa1bsi8334684edq.103.2023.04.04.01.58.47; Tue, 04 Apr 2023 01:59:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=cUTxmSNd; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234160AbjDDIyf (ORCPT + 99 others); Tue, 4 Apr 2023 04:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233979AbjDDIy0 (ORCPT ); Tue, 4 Apr 2023 04:54:26 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20618.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eab::618]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D381FF2; Tue, 4 Apr 2023 01:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LAr0NqjBBUdxmcNjJaGPpw0L6ZL5F9siziHT6zJDU40buuEcHQVaLTWjA8YrDPXUasbYDTJcNtySbJsKvRhJbFIEiq6C7swwH5V1pCDyfemWjQ+h091RZff2HeKcgOvCLhKru1Bk1ea23NdTFvMvGapEMSL0mOICBAWIn8CBUYM4Gv/LTRJj3i5r/P1bB9GagUFbo/URGdQPGL0eop/tkCrSRLkyXdJZTohLLOPZmAfzgyNYftj3FRKCqJjnJYAUC5oUjBilr6ZTfMu+2T+sBnPwOoF7FuPmb9+i4v60TlzfALfOIYNGaauXofHKdWNxK8jFL31Drbdf3To08quJ3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8FAOgb0ZuQYpU1C9FVOQOQ/sS2a+fKHxaC/jUDzvyZE=; b=UZ9bUvZD8G+hRLH0xOcQDZDK67zwYJMsEPgnloP5CnnBxwJ54SZVvMbJm/kVgX6rdpiC8S8D0iVXynnUpJQZkiA1RC0IrZDOY6jRQR28TAisq9TsWKcB6EbaKyVmMr/HgH0GPByVavS06lik+Fm3Mr1sIY15U52loFhHGS8JcXAW+2yrEyHSujy5TSlAmW+XRR0C6/bpf13VxbYYmRkl6JTDvjJjWNdHyQ1i31gkLcfhVOWnkxK61ozBKrlIba5ZSRnEjFjjKRfJNnavj76g4dqmdtn7/teZbG/+8aJxeO3kg3ry0IaZN1kZJa22DWpZuLk457xdwzwS5NAJ3XuRaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8FAOgb0ZuQYpU1C9FVOQOQ/sS2a+fKHxaC/jUDzvyZE=; b=cUTxmSNdE8QpG+06zW9wf4ATjBOvwz9lctOQOH1baKwyofB9YZIVGaMeG6NWIpIpKFfhfURxDrmIPAxIT74OpRuYg2SkWoZGqBffSpUyt47/hbIFuKhyEJf9MId7Os0VLChm4Payuikz6nCAk3+8eZuCUFrb7H6G5NJvyfV3opA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) by DM4PR12MB8521.namprd12.prod.outlook.com (2603:10b6:8:17e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Tue, 4 Apr 2023 08:54:19 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::4624:dc39:943e:6ae]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::4624:dc39:943e:6ae%5]) with mapi id 15.20.6254.035; Tue, 4 Apr 2023 08:54:19 +0000 Message-ID: Date: Tue, 4 Apr 2023 10:54:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v3 01/11] dmaengine: Add API function dmaengine_prep_slave_dma_array() Content-Language: en-US To: Paul Cercueil , Hillf Danton Cc: Jonathan Cameron , Lars-Peter Clausen , Vinod Koul , Michael Hennerich , =?UTF-8?Q?Nuno_S=c3=a1?= , Sumit Semwal , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org References: <20230403154800.215924-1-paul@crapouillou.net> <20230404015944.502-1-hdanton@sina.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0072.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::9) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB3587:EE_|DM4PR12MB8521:EE_ X-MS-Office365-Filtering-Correlation-Id: 59bc0b0c-c1dd-4320-9645-08db34ea2d5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mOwncSXMbBBXBVLiitG2czFxR0U6DRyO7EDrYtew12m0UzI5D0vHEqlIID8pDm+RUnXU5gNJ0sfPLNTosi9GKozos/anXovbUpk5Bm16RuanXMKWllbWclIL9qXMyACvX5354CFdS3M1vFQXAZ+atwq692KIicc5er8adubVfdiF+Ntw9ldK7LnZYg/v+iRdU1bgMDKdGS29hRs1sm/yvW0d4Bk+vWm4sSbN9a2SkG/NKXiPTGUXLAnFsTwwDDf2VPVuO6L3WMSQgCoOa1WbbgFk1BrFqmP+sqd1UMn5dZC6x1YrRu60UCIzBLiQa+xOtNksid0v5su+qMFWC70aw/JZDCZ415IaMq+7QyErek5goWRYwVYNFQ2AHWyp8JcQst9kh7c/wLJbeC0HZEfZycGTcvhwekeHzVCsZNengJ1kDkEKT/u+e2w9AyaapqhOPZjAaHceg9C9OF8zp5UkX7LdU0BISLjGhbmAw1jrBpS17Fn+CuMgzS3CBKoJd15cBoRTJp+hRrj0unWxH2M2Ks93F0MDze9Ch30HEjqPMop82KXNVc40IRcOhX+QYp4Rs6fQXhpV37tQ/iqmoqoqjeECwja42yG89Qb8l+136h42wJxpLcQRjevid4XZ/9p7MN+3R8wQQotJkVxADMom3A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB3587.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(366004)(376002)(39860400002)(396003)(451199021)(38100700002)(5660300002)(7416002)(2616005)(31696002)(54906003)(6506007)(316002)(110136005)(6486002)(186003)(6666004)(478600001)(86362001)(26005)(6512007)(36756003)(4326008)(8676002)(41300700001)(8936002)(66946007)(66476007)(66556008)(31686004)(2906002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NWZXYVczcXdEWmJQaFpXODhyaTFiN2VXVlRyYldiK1RNb1hpNmcxZjhrcWNG?= =?utf-8?B?NzVCckhzQzhjTjluQ0lOZG5takZ4b09mOVVuOG9adm8zRGxVK2ZpK0h4QUdP?= =?utf-8?B?UXovUVVsS1hrM3h1TW1HUFJLVzFyYlhpbHMwUUd4YWV2T3pmbVQyU00vMVQ4?= =?utf-8?B?aVJEa0Nkdk9ueTBORW1WNkVFMVFWbzhBYWJTdGE3cUl6b0o3Qi9oZ3J4OTBo?= =?utf-8?B?b016WG1hTERHZ0FrYm0vQ3VlMDNCZkRSTjhTbWwraSt2UFNnV1JLZjlaaFk1?= =?utf-8?B?ZTllNlNoU2VBRThZMy9oRjN2WDJmOXdDWmdBOUJPeWVrS0JhREZjUDEzRU9K?= =?utf-8?B?eUE4QXRoenJPOGFpTjV6Ly94MGE3RnZBdFA0dEFyRGFsN0FJT2JRLy9PaWM5?= =?utf-8?B?QWdBajVLWTUzR045Sk8rbVR3bVJ4eVU2dDNXaUdtaCtSRHlWRk5LR0kwMUpR?= =?utf-8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xQXBLdGZ0?= =?utf-8?B?SjBXQXQveExHNnlXRFU2VmFjaHBnNkhtTGlyZnNUbzdFNUFOTjN2U2w1SXRM?= =?utf-8?B?YU16QjNWcS9nTzRqS0YwcEJzbXg2TDJBQnVmekdldm80QTErdnRZUE9nVnNl?= =?utf-8?B?dm5RbUwwemtmd1oxaUpaZkNCaVJtUC92UnJ2NTNyS3NmL0VBR0t6WDA5VmRa?= =?utf-8?B?WTVLN0R5UjVvNnVDdzNmRXJUNGtqY2FveW9kaU5XTGI5T1FBQ1hOeUFXcVNr?= =?utf-8?B?bXNQNU1zT3BiZVZUTmxpTldVOE5Ka1VWQUFvYklmZkYvdXBzaGVWYkhtdGFH?= =?utf-8?B?WkxzMU5ZSFgxOFpJRTZCSm5ERXJwc2pORk5iVGZSeHpZUHJhSy9JellMUW1C?= =?utf-8?B?T1pKcWw0Q1h0d00xWTZsZC9pai93Z1EvcjhJb3ZTaGRnQ3JJZk00c3YyWmxH?= =?utf-8?B?dzdNVHdENFNOQWlOTmpYZ1g3dlF6VkNIdXJJcHpUeE5TMXpTUDM4VlNNNUpU?= =?utf-8?B?aTVGV256OFRuOTdTUmdhQkdBSXY3d3lLNHZoYzRUYWRNVzJ4aUNMYWxldGUy?= =?utf-8?B?Y2xNbFhqZEowc0huVmFZUThtQmk1M3IyMGZXTlYrUnpvSkFBbXVnSmwvczI4?= =?utf-8?B?ZU1jNjRDWDlTNUtIYjZsSGNoYkNpTkNoeitTOXk1dm9RSy8xMTZEZUlKdm9U?= =?utf-8?B?Z1dKMU5iNVBGK09vdlJPMTNuaEIzTDNCWnRUQTZIZFFCb2haK1JLb1hPRFZa?= =?utf-8?Q?WN0c=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59bc0b0c-c1dd-4320-9645-08db34ea2d5c X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 08:54:19.3579 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EFk3236ISv2jdvj8fTS1rwMIpheEma2zmSSDnareet4EN/BYTYcb07JgR6DGYARm X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8521 X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 04.04.23 um 09:42 schrieb Paul Cercueil: > Hi Hillf, > > Le mardi 04 avril 2023 à 09:59 +0800, Hillf Danton a écrit : >> On 3 Apr 2023 17:47:50 +0200 Paul Cercueil >>> This function can be used to initiate a scatter-gather DMA transfer >>> where the DMA addresses and lengths are located inside arrays. >>> >>> The major difference with dmaengine_prep_slave_sg() is that it >>> supports >>> specifying the lengths of each DMA transfer; as trying to override >>> the >>> length of the transfer with dmaengine_prep_slave_sg() is a very >>> tedious >>> process. The introduction of a new API function is also justified >>> by the >>> fact that scatterlists are on their way out. >> Given sg's wayout and conceptually iovec and kvec (in >> include/linux/uio.h), >> what you add should have been dma_vec to ease people making use of >> it. >> >>         struct dma_vec { >>                 dma_addr_t      addr; >>                 size_t          len; >>         }; > Well it's not too late ;) Yeah adding that is pretty much the job I have on my TODO list for quite some time. I wouldn't mind if you start adding that and provide helper functions in DMA-buf to convert from/to an sg_table. This way we can migrate the interface over to a new design over time. Regards, Christian. > > Thanks for the feedback. > > Cheers, > -Paul > >>> Signed-off-by: Paul Cercueil >>> >>> --- >>> v3: New patch >>> --- >>>  include/linux/dmaengine.h | 16 ++++++++++++++++ >>>  1 file changed, 16 insertions(+) >>> >>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h >>> index c3656e590213..62efa28c009a 100644 >>> --- a/include/linux/dmaengine.h >>> +++ b/include/linux/dmaengine.h >>> @@ -912,6 +912,11 @@ struct dma_device { >>>         struct dma_async_tx_descriptor >>> *(*device_prep_dma_interrupt)( >>>                 struct dma_chan *chan, unsigned long flags); >>> >>> +       struct dma_async_tx_descriptor >>> *(*device_prep_slave_dma_array)( >>> +               struct dma_chan *chan, dma_addr_t *addrs, >>> +               size_t *lengths, size_t nb, >>> +               enum dma_transfer_direction direction, >>> +               unsigned long flags); >> Then the callback looks like >> >>         struct dma_async_tx_descriptor *(*device_prep_slave_vec)( >>                 struct dma_chan *chan, >>                 struct dma_vec *vec, >>                 int nvec, >>                 enum dma_transfer_direction direction, >>                 unsigned long flags);