Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp896981imu; Wed, 28 Nov 2018 01:04:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/UwWQoGLr4Xt5dMo0w4JnW8K7DW4oPbRMbbMuLDs4ZA3J3ssu80yuGnWX+iD5XaAi80/mVK X-Received: by 2002:a17:902:4281:: with SMTP id h1-v6mr36066372pld.114.1543395877971; Wed, 28 Nov 2018 01:04:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543395877; cv=none; d=google.com; s=arc-20160816; b=FsL4rrVm3NIlwaKY2563YL6a6+BZ7itq0bjdGrcBn3JcboVfXazKXnCtAZ+Cg7ca6F ISF9S1ZmwfiIlRXTC9YbiV5fn2WGmnUgYA+Noy62OvmBSWIR+771Zosus40YUI74yf26 YWUTGa+6ObOayU5U1KOWjIZk+e3rFsgbHV63TJz9mjcpyfQ8y4pHG6SwT4LyyMGMoKz4 sFhdPrXWDlXfq3TcOApKi5KOmMJX+rILztxkrkACl1azHcUvhFYB+DOH2dPIR2HhisLK miRaXkZvytz328r0J2VPkddfeJ2d+vlv/rZ5RPk5riFt7WkpdRBiuQ5M24EBfqGmQXS9 jYtA== 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=0RsslZeE5EB8vS/BOXuFYom2Zh8ORMFe/KOfF+cLLiY=; b=CTVn1hedBciuW54NM/nFe2TdwS7yyx9z+r9djqatFR5z2D0XzwbffFqg7ParraZf2H roWhNEHOc16N8Tk12hfYAdME7EdYIL0DcVF82JAkD1QTe686SR0PxfZ6orCbl4drAVeW r3JCVK7VPzmb3iqqiRdOgxgEItcu+Jje4mVIY1Ewj8nO1Fp7SQpP5B+4WHvcpmAts2pG dfyZYPXl0JpvSWXBOdB1CAqRM/A1xtthwjgQQoVs08uyxfXey1azcj5GHFRIn0IzeYwl aMnBxOKH7HF+pqdTuIWJL5zyo48dQAwuNabV62qePkuaBDAVaJNa8cWZW9OOIn48m7eJ y/SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ITLkKK0o; dkim=pass header.i=@codeaurora.org header.s=default header.b=Su2us9EP; 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 y29si6258408pgk.376.2018.11.28.01.04.22; Wed, 28 Nov 2018 01:04:37 -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=ITLkKK0o; dkim=pass header.i=@codeaurora.org header.s=default header.b=Su2us9EP; 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 S1728030AbeK1UDo (ORCPT + 99 others); Wed, 28 Nov 2018 15:03:44 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:40650 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727736AbeK1UDn (ORCPT ); Wed, 28 Nov 2018 15:03:43 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D4FD560C61; Wed, 28 Nov 2018 09:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1543395769; bh=VYoCnpZS0pG7F3nwYm6u0/ssqCRXzYD+NX4/SExvkN0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ITLkKK0oBmjuK7UJ2t++3WJ3x41gZ9sgRZ9vGQ1wG75bmZqlc7+K0mT7OTfgdE/88 HOfTPn3J9363uYcWQGF1fNsA/vaNZk5wLjR+ykL6Ia1xq+Jsh9JOwVXez7k4m7TQfd pW9RZ7MrJDKcQhdKAc+p3hIiK00NFvusBgt/4Sqw= 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-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (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 9564760B62; Wed, 28 Nov 2018 09:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1543395767; bh=VYoCnpZS0pG7F3nwYm6u0/ssqCRXzYD+NX4/SExvkN0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Su2us9EP5u+ChhPO0Qmb6GH30Qw1A2sIBy860t7oLpfA7advqhxfWth6xjFW4QLqG bAUTXJg9D6aVtwD9kBsLsZjmZkb76cVnq5qC8bBFxhNTQg1T4CcK9Aq/8mgihMyGmd 3viKOvsDgI0QVfDGN0QVT0fw2aeDbC4HTMWPAmdg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9564760B62 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-f176.google.com with SMTP id v11so24989857qtc.2; Wed, 28 Nov 2018 01:02:47 -0800 (PST) X-Gm-Message-State: AA+aEWYDitEH2vxeXIZUOAnx76q+klWB+1/gusrlOCnleqIJ+YAPyfs/ g2AfJBBUePJkX1tr1pfn8pqrOK+zhzxduQIAzcI= X-Received: by 2002:a0c:f9c3:: with SMTP id j3mr293036qvo.107.1543395766444; Wed, 28 Nov 2018 01:02:46 -0800 (PST) MIME-Version: 1.0 References: <20181126213710.3084-1-vivek.gautam@codeaurora.org> <20181128073940.GA13072@infradead.org> In-Reply-To: <20181128073940.GA13072@infradead.org> From: Vivek Gautam Date: Wed, 28 Nov 2018 14:32:34 +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: hch@infradead.org Cc: David Airlie , Rob Clark , Tomasz Figa , open list , freedreno , dri-devel , linux-arm-msm , Jordan Crouse , seanpaul@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 Hi Christoph , On Wed, Nov 28, 2018 at 1:10 PM 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. Thanks for reviewing this change. From what I understand the things in drm, we don't use the default iommu-dma domain for drm devices. Rather we allocate a new iommu domain, and therefore we can't use the default dma ops. Hence we need separate dma_sync_sg*() to flush/invalidate the cache. For this we need to initialize the sg's addresses. Please correct me if my understanding is incomplete. Best regards Vivek -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation