Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2247469imu; Thu, 29 Nov 2018 01:47:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/WNmd4GZE4kpba2y6+YbrTaNehPJbp2w8g0TlZtWN+arXr+CuA2IvpycZHvWfIhq44opIIM X-Received: by 2002:a62:4bcf:: with SMTP id d76mr761790pfj.170.1543484822392; Thu, 29 Nov 2018 01:47:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543484822; cv=none; d=google.com; s=arc-20160816; b=T3POs8/ZGViCiFFijtotJA/OPSjGgtM9iaYRLzQGMNTDPetRkoIJ7WTDy6iIiLBbpW RZC2NVGBjarSMDMNwkaSCgIYzqChSp5x7wy+EIQbBiwBy32AK1OEOaPt3BLyQhkcnnKr K8/of/+mgwyUVyck+uT/1EIJSYad9rOjoQE9doKOBS8d2IOVCGypQZKpSF72Bd5LG4F2 q6KCd9ClNXIIga49fjspfZnMKBns1hG/7wSfvdNnuo4KlYkui9MhURYHeKr0buYD/XrM KnQCv+dteS2MwEO96xjeWk6rEr41T9Smd7fS3erDOuQGHEZRw0uUobMySp76TVKgyEo1 Mu9g== 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:dmarc-filter:dkim-signature :dkim-signature; bh=w8aDRNwFS97oaEMMw0htQT1wpaGXARcApFthyoO4Su8=; b=wEced/pt+EKDmtGxXuCNu7hlghgvqPyUv4dx08F/adX0yAoIeCL6rOEtJn6qXbwRpr ovFaUYNRJdCHHTB8E3DMov86fg6iI3Us8wYJ/d3+8AN2jUfBFM7KfI8HW3hUfTJ5INXU zwLqzIKB4qtJwrHdKomJEFacd2fnYJpgI7lw2GpxdZQFjrhMeGUVcfUsmsBnxPlTysBT 7FCX0aAqiPHJp/qC1gNPWMmmkx9wOD7UpI5c4noRCW3bo5D3wUTqzR7ogm8OpI3q7h2R 7Jg66aBUSvDeCiOXBi/BtViXDmNQp2LBuH+yOwLn+4Eb/IuV0W+Wr408VBL9zDucsFev e8pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ayvsku85; dkim=pass header.i=@codeaurora.org header.s=default header.b=Bey6UonG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si1578048pls.83.2018.11.29.01.46.47; Thu, 29 Nov 2018 01:47:02 -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=@codeaurora.org header.s=default header.b=ayvsku85; dkim=pass header.i=@codeaurora.org header.s=default header.b=Bey6UonG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727643AbeK2UtU (ORCPT + 99 others); Thu, 29 Nov 2018 15:49:20 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:55164 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726617AbeK2UtU (ORCPT ); Thu, 29 Nov 2018 15:49:20 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 96693602FE; Thu, 29 Nov 2018 09:44:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1543484674; bh=2Z67Oez4a1sW8edCo4xL8GjcSbXbhT8kyUeOcCOSuPw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ayvsku85RluZUcRMAUGhnlOLRPSO/h4bPiduV49Q8r19oaOJWdQ9yJPUzsXjB+wKv DFCALuZRhWm0GqF59BVnhp5hZVRpxIUjdo/TxCq85bPO7rypOpYPBU6gUS1KZ6HSd3 0g5VCleut9iE6nMEdaQm4NkGMkI8sF0d9L1MwFk4= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A6E58602FE; Thu, 29 Nov 2018 09:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1543484673; bh=2Z67Oez4a1sW8edCo4xL8GjcSbXbhT8kyUeOcCOSuPw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Bey6UonGKEw46VBVLbDo+2AxiTy+xvxTvZinYB+6FB1YA7WQDC0qHV7OgWeksaTkQ 35qZDs2QzTV4IAFnXnMFKw8ZI+7pfNF6m6qpBxmIuxlEn6C3IxB5/+Qqt8mBy8vAGu BaYxvhOAwfmLa0yJqhcvZ35Vw6lMyNCagweD/6sE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A6E58602FE Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org Received: by mail-qt1-f181.google.com with SMTP id k12so1229201qtf.7; Thu, 29 Nov 2018 01:44:33 -0800 (PST) X-Gm-Message-State: AA+aEWbFHzlCQt1JFxunMuucU9fuNEXYGsgOMbJxQyNyP/BmXdvge6qn haIoMch45qZQTA9Ybi8begPW9lW05er62I39xTM= X-Received: by 2002:ac8:3e1a:: with SMTP id z26mr674044qtf.180.1543484673043; Thu, 29 Nov 2018 01:44:33 -0800 (PST) MIME-Version: 1.0 References: <20181126213710.3084-1-vivek.gautam@codeaurora.org> <20181128073940.GA13072@infradead.org> In-Reply-To: From: Vivek Gautam Date: Thu, 29 Nov 2018 15:14:21 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/1] drm: msm: Replace dma_map_sg with dma_sync_sg* To: Rob Clark Cc: hch@infradead.org, David Airlie , Tomasz Figa , open list , freedreno , dri-devel , linux-arm-msm , 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 Wed, Nov 28, 2018 at 6:09 PM Rob Clark wrote: > > On Wed, Nov 28, 2018 at 2:39 AM Christoph Hellwig wrote: > > > > > + /* > > > + * dma_sync_sg_*() flush the physical pages, so point > > > + * sg->dma_address to the physical ones for the right behavior. > > > + */ > > > + for_each_sg(msm_obj->sgt->sgl, s, msm_obj->sgt->nents, i) > > > + sg_dma_address(s) = sg_phys(s); > > > + > > > > I'm sorry, but this is completely bogus and not acceptable. > > > > The only place that is allowed to initialize sg_dma_address is > > dma_map_sg. If the default dma ops don't work for your setup we have > > major a problem and need to fix the dma api / iommu integration instead > > of hacking around it. > > I agree that the dma/iommu integration is very problematic for drm (in > particular, gpu drivers that use the iommu as an gpu mmu).. Really we > need a way that a driver can opt-out of this, and access the cpu cache > APIs directly, skipping the dma API entirely. But as it is, we've had > to hack around the dma API. I'm not really sure this hack is any > worse than abusing dma_(un)map_sg() for doing cache operations. > > I probably should have paid more attention and nak'd the dma/iommu > integration before it landed. But given that now we are stuck in this > situation, while I'm certainly interested if anyone has some ideas > about how to let drivers opt out of the dma/iommu integration and > bypass the dma API layer, I'm ok with replacing a hack with a less-bad > hack. May I take it as a positive nod to respin the next version? Regards Vivek > > BR, > -R -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation