Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1648924imu; Wed, 12 Dec 2018 01:42:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/WTfZkxcc4E7rBN76xU8C1eiRqUGlyGiI2/jEZV0VJrmL5UG93mqxfEwoUPjgdVfOPF5ZXj X-Received: by 2002:a17:902:780a:: with SMTP id p10mr19736053pll.54.1544607771818; Wed, 12 Dec 2018 01:42:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544607771; cv=none; d=google.com; s=arc-20160816; b=wGO/nX0UIg5tmToB9IpostfznUyxr0TNPZnReJaPlzYNFm5XqC101Yd4NGXO7uixwl 6+jFw1SHGdsAI+d7IldDPN9HO0hQ/vgmv/pXrs8bEKcvWc9fBC95+P76NThXZCep75Lp 7vDP8k8sGo/V6j18UoXqS9A5gKQGLOjf0alXwvpR94yCeV93zraXc9wQep9WQHDzpsSX OHBsuXQABbGrw97iCDqZVJ76GviMVAXL8prPHmYH7UXcqFcnGr5hmOXDSLUxEjQHYX2k 5dUWBc+qI7mjwuprt+Qj55kvs7D1uu4PACfDmngTe0A3gzrtZ4BnNukvXIuz8sIu0/ZU EX6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AbgKSGoQLXbqknnhWCy8p4/YHmSVhPq4mWk8V9y6LOs=; b=wNCkTHCYBKW5DJDm3yJv90vRU1pYk7TSxFZWgNUwt9U1cnrKFxZzM21KqeRv7CEUib 6MHQdKeUqgsRh/b0Dn/FN5M39HDjoU0qNek9wP+ttMP9PGmwGIDmg0hUsCpr526vWMY2 ZB1lT0QX/clgc0WLUMl/EfSg4v6diuGMDy3Pimn/A8CUCqNVB+4/g4t0DaQjGij7RgaM 23qwuhzSUG699RkQzJUTd8VF70t4Cc9B7TXsJrcJXn/Xli9lWSFzKLF+tl/JTwWVtJnO GCFjKr+HTW73mirdiOO0lIFEMXZUfN24kalxhge/5g6G7shDbZo7+5H3EjDMXxlNdo5H 6zjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YTbPpDFl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si15380629plk.333.2018.12.12.01.42.35; Wed, 12 Dec 2018 01:42:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YTbPpDFl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbeLLJll (ORCPT + 99 others); Wed, 12 Dec 2018 04:41:41 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:36315 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726519AbeLLJlk (ORCPT ); Wed, 12 Dec 2018 04:41:40 -0500 Received: by mail-yw1-f65.google.com with SMTP id y194so6692011ywg.3 for ; Wed, 12 Dec 2018 01:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AbgKSGoQLXbqknnhWCy8p4/YHmSVhPq4mWk8V9y6LOs=; b=YTbPpDFlWLkgSEAI9LmQALNcCACDIfD7IR3dHDDJvMUJQO6lw4Sm91V7Vw3z+VY8QW L+Yc2P+zIeRiU/iIDfehcfLIPF96DUDpcFNUm9vsvJK+sb/q2WCTaKTMRb5IskFDkYen U7DjnsZq1SIFsgL/EnCQ5gpQYxp7wA5lvxTGU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AbgKSGoQLXbqknnhWCy8p4/YHmSVhPq4mWk8V9y6LOs=; b=mBT2xx+Sln2TyoAj3MneMv64HhdlfX2OJcUs/Hz5H31itstju3CteNxJA332i+oLKR lro3xUx0mHHFdZEvoKXarooyIhDSR8p+g7j7haXcmHwxXJBDMYR9pvMyU/xHM5UZHg3Q cQqCOJQhnjfPhQGsmgBWlkeOGsw6mgMdlWhAOt/gSDw4L16ySVqK6hqjJ3ulaHuspQn7 /4GPpZ62JSV/6ulzVHRVEHB1CObdB4y2GUBGGwOBUciRc7h7Ur+5h33zL3VzEOnr13ny k+Ecf/1Lm3/neB5SShKZulUfxGKijx2hg80cuHdZo72x23go0SjaSBCsTrmntFjQwz3J aNwg== X-Gm-Message-State: AA+aEWYmQx7fwIXWbdNgxdXocf2dCmepvgd48ga3qDabgs/C87u/U7J5 g9o7S7z1o3YOIttyAqpWpg6sqSmz6byFzg== X-Received: by 2002:a81:8886:: with SMTP id y128mr15026016ywf.107.1544607699810; Wed, 12 Dec 2018 01:41:39 -0800 (PST) Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com. [209.85.219.180]) by smtp.gmail.com with ESMTPSA id h62sm5280811ywe.100.2018.12.12.01.41.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 01:41:39 -0800 (PST) Received: by mail-yb1-f180.google.com with SMTP id s15so7949854ybk.6 for ; Wed, 12 Dec 2018 01:41:39 -0800 (PST) X-Received: by 2002:a25:84c6:: with SMTP id x6mr14232621ybm.293.1544607276754; Wed, 12 Dec 2018 01:34:36 -0800 (PST) MIME-Version: 1.0 References: <20180821170629.18408-1-matwey@sai.msu.ru> <20180821170629.18408-3-matwey@sai.msu.ru> <2213616.rQm4DhIJ7U@avalon> <20181207152502.GA30455@infradead.org> <20181212090917.GA30598@infradead.org> In-Reply-To: <20181212090917.GA30598@infradead.org> From: Tomasz Figa Date: Wed, 12 Dec 2018 18:34:25 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 2/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer To: Christoph Hellwig Cc: Laurent Pinchart , "Matwey V. Kornilov" , Linux Media Mailing List , Linux Kernel Mailing List , "Matwey V. Kornilov" , Alan Stern , Ezequiel Garcia , hdegoede@redhat.com, Hans Verkuil , Mauro Carvalho Chehab , rostedt@goodmis.org, mingo@redhat.com, Mike Isely , Bhumika Goyal , Colin King , Kieran Bingham , keiichiw@chromium.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 12, 2018 at 6:09 PM Christoph Hellwig wrote: > > On Wed, Dec 12, 2018 at 05:57:02PM +0900, Tomasz Figa wrote: > > How about dma_sync_sg_*()? I'd expect some drivers to export/import > > such memory via sg, since that's the typical way of describing memory > > in DMA-buf. > > The way it is implemented dma_sync_sg_* would just work, however there > really should be no need to have sglists for buffers created by this > API. The typical DMA-buf import/export flow is as follows: 1) Driver X allocates buffer A using this API for device x and gets a DMA address inside x's DMA (or IOVA) address space. 2) Driver X creates a dma_buf D(A), backed by buffer A and gives the user space process a file descriptor FD(A) referring to it. 3) Driver Y gets FD(A) from the user space and needs to map it into the DMA/IOVA address space of device y. It doe it by calling dma_buf_map_attachment() which returns an sg_table describing the mapping. And then I realized that actually there is no need for the importer (driver Y) to call dma_sync_*() on its own, since the exporter (driver X) is expected to map and sync in its .map_dma_buf() dma_buf_ops callback. But there is still a need to have an sg_table created for the buffer, because it's what dma_buf_map_attachment() returns. > > > Sounds good to me. Thanks for working on this. I'd be happy to be on > > CC and help with review when you post the patches later. > > The patches were already posted here: > > https://lists.linuxfoundation.org/pipermail/iommu/2018-December/031982.html Okay, thanks. I can see it in my inbox. Best regards, Tomasz