Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2548627imu; Thu, 29 Nov 2018 06:44:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/WEI4a1EuRxghWo948AB5szfgzstsDdvHv8w0KVJ80NnL8WJu0Ho/rt9wpji1B78/WUKvo1 X-Received: by 2002:a62:8c11:: with SMTP id m17mr1647099pfd.224.1543502655906; Thu, 29 Nov 2018 06:44:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502655; cv=none; d=google.com; s=arc-20160816; b=VSqrKa45mLdx6cM5lKUxdz6b2WN/6N8w4RG8rcSWct6BXkC6VCbxYnyCgV2SGyscdk 47Mgs4Bo0mFiIvtFfMR9CASCqg92gfDWnKnHYY/2YULvs5g2LyydeKICabzeae2wWLoY wqPvfwzKPy0pDAfIA24NzJEz7RFjAKewJhHqv5PtUquc2v8L1dCOFqOuk0RcVGYRROtx 6c3oAZF5+wVymMp42mnnqNKyF49+IJZyIo+PEK4EZavx3RLr7hyUQyxvAxaiNZoyJhSr CJDGujEcg/8/qzEDf6GTnW3fWjlMPdE3cIcmZaiy/x3qjbCilOi5Rt9XtM7SK9Y6izpm asyQ== 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=eckJcny/cf4nXZGjStsczvp2JABAZxmB/lGr4Kk07JQ=; b=aIXcLfbMVMToqrMjRP5FufqSmVBZEObdj2N8gjioVyiitYe8tb82kaTrMehEb6t9N9 UZFTKlMn5s49mkP2GaS1r54ukUk8PDzVY804oCwO/kPpXlZbaEVOYB6I8nkDg+LLwfhy 3x5Fcq59rXdmAqhHDgd6CWo4DBJY3I8hY/Rq8gz3SF9qH7AeDXSP7IxOjNoYwMYprcBO lwB/77NT6Q4OIOAux9ezYyfktfw2cvp9aG7qtcGUutXSLpUbKefAfK/K77GOOLSBOlVA 7jwIU82nx1U1G1ngSA45IJXkMC7g4+kzQwallg5/hTqdJCs7lB/KF1Aw86NktyNsArQQ J44Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="B/OJBTsK"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e125si2467451pfe.14.2018.11.29.06.44.00; Thu, 29 Nov 2018 06:44:15 -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=@gmail.com header.s=20161025 header.b="B/OJBTsK"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388176AbeK3Bsk (ORCPT + 99 others); Thu, 29 Nov 2018 20:48:40 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:44701 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388089AbeK3Bsj (ORCPT ); Thu, 29 Nov 2018 20:48:39 -0500 Received: by mail-io1-f65.google.com with SMTP id r200so1728055iod.11; Thu, 29 Nov 2018 06:43:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eckJcny/cf4nXZGjStsczvp2JABAZxmB/lGr4Kk07JQ=; b=B/OJBTsKwFZNqvpEx8lBddJ1QBRak4GJQYK7YPSTr3EMd3Iofuncvvf0FQa+B4D4P5 pi0FXK2494XFQCJg7sp08t/pBwrqkpeDL9WOGRJOrVy6vEsUQKOuJuZYIAMlBgqJF9AX 4tTu45k8tvJWmOcs6nNwK4We5UHDnQo57itkoCxrQSsLfklDq6dUt2aDrAnPMt4ZiEw0 2InFZjkqMGR8ujqlPBOdp9SqMsd4TzW3vwxdGAxckYMYyVuf4N3UQfMV4C4UF+rq8d94 b1SUbhNqTQsz8Ts4aETk0+6208BV4kZ7AE/Cd3koMDTa83gjsoK3/1nNbpqBOq3hdUeZ W1QQ== 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=eckJcny/cf4nXZGjStsczvp2JABAZxmB/lGr4Kk07JQ=; b=jYb4JlK7sPGZYlCTSozylzGoEC2Kejl9xlLdPmhdDM1twgNJ43PsNGXTiVqlnrZObY vmTeUU2xGzAxuLmrJ4nfteP5cNq6bzdLAMdLbAZ53jcGlFUsVoGdGEWYipFgnbWNNgfq 5RnTpZlGIYODYC9cygp90zSzX5fR00C5DkqXwJLwu+bAQVVxVFPFsPz7uHNVuoBH6SGQ hx+cOZxtgiiVH6ZgrsSzlq+Qbc6IcWKxZfViBplf+U1kyI0UD1rEkHTP1XIVC9qxE7oL Yy2YuQwQBlDnj5WIUS9Py1gaWyEh/rpXnNSyHQnfu+62OguACDWRnFCSC6c6bt51rkBO tgng== X-Gm-Message-State: AA+aEWY1POzdqC84hscEnuWemS3iv7rXdrce4mxg0JiJzTapbU3N+3Tn +2BOYx9pI0BEYrK90/3YtUZhmyudY0Vcy4+ShQc= X-Received: by 2002:a6b:fc05:: with SMTP id r5mr1405591ioh.129.1543502583051; Thu, 29 Nov 2018 06:43:03 -0800 (PST) MIME-Version: 1.0 References: <20181129140315.28476-1-vivek.gautam@codeaurora.org> <20181129141429.GA22638@lst.de> In-Reply-To: From: Rob Clark Date: Thu, 29 Nov 2018 09:42:50 -0500 Message-ID: Subject: Re: [PATCH v3 1/1] drm: msm: Replace dma_map_sg with dma_sync_sg* To: hch@lst.de Cc: Vivek Gautam , David Airlie , dri-devel , Linux Kernel Mailing List , freedreno , Tomasz Figa , Archit Taneja , linux-arm-msm , Robin Murphy , Jordan Crouse , Sean Paul 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 Thu, Nov 29, 2018 at 9:25 AM Rob Clark wrote: > > On Thu, Nov 29, 2018 at 9:14 AM Christoph Hellwig wrote: > > > > On Thu, Nov 29, 2018 at 07:33:15PM +0530, Vivek Gautam wrote: > > > dma_map_sg() expects a DMA domain. However, the drm devices > > > have been traditionally using unmanaged iommu domain which > > > is non-dma type. Using dma mapping APIs with that domain is bad. > > > > > > Replace dma_map_sg() calls with dma_sync_sg_for_device{|cpu}() > > > to do the cache maintenance. > > > > As I told you before: hell no. If you spent the slightest amount of > > actually trying to understand what you are doing here you'd know this > > can't work. Just turn on dma debugging and this will blow up in your > > face. > > you can tone it down.. we weren't the ones who created the dma/iommu > mess, we are just trying to find a way to work around it > > > Either you use the DMA API properly, that is you use it to map and > > to sync, or you don't use it at all. Mix and match between iommu > > APIs and DMA APIs is simply not possible. > > I'd *love* nothing more to not use the dma api.. but on arm there is > no other way to do cache maint. btw, one of us will try this w/ dma debugging enabled.. Maybe the thing we need to do is just implement a blacklist of compatible strings for devices which should skip the automatic iommu/dma hookup. Maybe a bit ugly, but it would also solve a problem preventing us from enabling per-process pagetables for a5xx (where we need to control the domain/context-bank that is allocated by the dma api). Like I've said before, I'm open to other suggestions. But the automagic behind-the-scenes dma+iommu hookup really screwed us, and we need to find some sort of solution instead of downstream hacks. BR, -R