Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3670557imu; Fri, 18 Jan 2019 14:53:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6du5rJIci6F9PNRK3yEb+Cqzf2x3s1uCKe6AdhP+Oi57NCzepPfN5fwwLYTokDnZidzBs2 X-Received: by 2002:a65:4683:: with SMTP id h3mr18728116pgr.225.1547852019537; Fri, 18 Jan 2019 14:53:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547852019; cv=none; d=google.com; s=arc-20160816; b=kfRTMK4/138O6aAzlY+6NR2vExYct40JEbO4kDYtWTP/knsYbh17uBpkJqNNMOcwSk IjuWodhLso4UTbvdRxPViUlSXAWE+33TOzw3+GdIke4YEp6x4LfQcNK7J2MnrHR3eXfM R1jvzdpzJuZgG92WCYxRaU23dqkYvxy4HqDHNwOnUVjBwUqP29EN9NigrthLQv5ZYyTg m0w0c61zFI9d6I/OcUBFyUOA/umuIOVYgC/ezdXtR/Ff704mY3uWw+How8jeDsco4nAA 9J8leDkl7rs85lZ8yJDR+0OTZ62C+kmma035Py+V/YTgskcw9Sc8Dwifr7rbTMMh9V0i GScw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=spoip0+3fKHMuffSDIO0NNyi5v4LsaENWyYz5KZcMMQ=; b=0DS56jUEb4OF+4TdTLFP/1O8T5Behe/7iOpXsvHXu90jwKiwBzh5pDhN2hRLMpzFGt aS/sC5AGd4BhmYi+UxQcDEv8RDAf6ufJlqc/CWXGTjtWRDKGW1J8f1xT4/9Y7wqEGzLs g5Schefl7Vq9wotFiD55JaXfZPcfEv927+SiXBDlhIajXOWyzDWdqYLFaGUbhcdU+Uz+ 9ecHUNHnZtrNmgOZYZPxjRR3n5wLAGfkwpKV2T5e7PntoSnglXv8pd94jLGyF03p14IJ OkB6sSi78O9IkO33w2l74yeXTodfy5SHXVqYa01J3t7j7i+5FdbV89agnnhYF2Xy+JX8 FMmw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15si5639917pgc.381.2019.01.18.14.53.24; Fri, 18 Jan 2019 14:53:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729941AbfARWpH (ORCPT + 99 others); Fri, 18 Jan 2019 17:45:07 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:43736 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729746AbfARWpG (ORCPT ); Fri, 18 Jan 2019 17:45:06 -0500 Received: by mail-qt1-f196.google.com with SMTP id i7so16997898qtj.10 for ; Fri, 18 Jan 2019 14:45:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=spoip0+3fKHMuffSDIO0NNyi5v4LsaENWyYz5KZcMMQ=; b=Y/KXsjQIUp8Fg2j9nl6HxaqpN5Ap3MLNQD7ZQncpbD1CF9RByfUb0keo+dAz3tW+Ae UxPn0FzbXSWy5ao1M6vhxAI2Pzd9uGAsf/FjWj+OxYsyktQsTVm0EnXuMW86DnxYOmns QK6E3LcQn83GF1LNRJnBPe29SCJSCB968ttDblhTfOSTZqt6yGy0lapRwmDnLR/Y+qXb TV7ldvsEbXYVJTBGeRvqgPh0KRZVBcSIYEXyR6lZ8botDe1N/E4coMAN/XfdpS0tSayB o0J1YpgkNWdRpblF4eNppZufteYTistirscmwF2u0b+NmntebYBSr0aKt1tEqmr2TYhJ lGew== X-Gm-Message-State: AJcUuke5tVG9rQJsrBPZGlB8IEH/FJwLPjH7/nfIklzZRBgNLvgABBS0 Y5ny4+weT+K5tA6E9JKWQE2Q4w== X-Received: by 2002:a0c:95b5:: with SMTP id s50mr17497526qvs.64.1547851505402; Fri, 18 Jan 2019 14:45:05 -0800 (PST) Received: from ?IPv6:2601:602:9800:dae6::fb21? ([2601:602:9800:dae6::fb21]) by smtp.gmail.com with ESMTPSA id p8sm62056975qtk.70.2019.01.18.14.45.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 14:45:04 -0800 (PST) Subject: Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes To: Liam Mark Cc: sumit.semwal@linaro.org, arve@android.com, tkjos@android.com, maco@android.com, joel@joelfernandes.org, christian@brauner.io, devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, afd@ti.com, john.stultz@linaro.org References: <1547836667-13695-1-git-send-email-lmark@codeaurora.org> <1547836667-13695-4-git-send-email-lmark@codeaurora.org> <9f654f36-08de-f5e8-c9b3-ff9b2954f0a6@redhat.com> From: Laura Abbott Message-ID: Date: Fri, 18 Jan 2019 14:45:02 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/18/19 1:32 PM, Liam Mark wrote: > On Fri, 18 Jan 2019, Laura Abbott wrote: > >> On 1/18/19 10:37 AM, Liam Mark wrote: >>> Add support for configuring dma mapping attributes when mapping >>> and unmapping memory through dma_buf_map_attachment and >>> dma_buf_unmap_attachment. >>> >>> Signed-off-by: Liam Mark >>> --- >>> include/linux/dma-buf.h | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h >>> index 58725f890b5b..59bf33e09e2d 100644 >>> --- a/include/linux/dma-buf.h >>> +++ b/include/linux/dma-buf.h >>> @@ -308,6 +308,8 @@ struct dma_buf { >>> * @dev: device attached to the buffer. >>> * @node: list of dma_buf_attachment. >>> * @priv: exporter specific attachment data. >>> + * @dma_map_attrs: DMA mapping attributes to be used in >>> + * dma_buf_map_attachment() and dma_buf_unmap_attachment(). >>> * >>> * This structure holds the attachment information between the dma_buf >>> buffer >>> * and its user device(s). The list contains one attachment struct per >>> device >>> @@ -323,6 +325,7 @@ struct dma_buf_attachment { >>> struct device *dev; >>> struct list_head node; >>> void *priv; >>> + unsigned long dma_map_attrs; >>> }; >>> /** >>> >> >> Did you miss part of this patch? This only adds it to the structure but >> doesn't >> add it to any API. The same commment applies to the follow up patch, >> I don't quite see how it's being used. >> > > Were you asking for a cleaner DMA-buf API to set this field or were you > asking for a change to an upstream client to make use of this field? > > I have clients set the dma_map_attrs field directly on their > dma_buf_attachment struct before calling dma_buf_map_attachment (if they > need this functionality). > Of course this is all being used in Android for out of tree drivers, but > I assume it is just as useful to everyone else who has cached ION buffers > which aren't always accessed by the CPU. > > My understanding is that AOSP Android on Hikey 960 also is currently > suffering from too many CMOs due to dma_map_attachemnt always applying > CMOs, so this support should help them avoid it. > Ahhhh I see how you intend this to be used now! I was missing that clients would do attachment->dma_map_attrs = blah and that was how it would be stored as opposed to passing it in at the top level for dma_buf_map. I'll give this some more thought but I think it could work if Sumit is okay with the approach. Thanks, Laura