Received: by 10.223.185.116 with SMTP id b49csp2078373wrg; Thu, 15 Feb 2018 06:16:35 -0800 (PST) X-Google-Smtp-Source: AH8x226geB+/23ERoPSVgisJVa0Z2mqQKYTVvD4m0Ox7gyF37n2IkT5sAtTzgUkiodELqNT0ehIo X-Received: by 2002:a17:902:5854:: with SMTP id f20-v6mr2701494plj.374.1518704195330; Thu, 15 Feb 2018 06:16:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518704195; cv=none; d=google.com; s=arc-20160816; b=SnPDsLqwCMXMuJLdiBVoqzkvIAa41y/34+f87dAkHFFXVttidr3Goy8TM06zp/t+q6 86fKfit8hMzYQd6LnDTY5S4P5ZtG/pRO/PTN8ziq0YKTVD5bcJYvgSk+EmSezAzWyehP qJLeAf0NGITHgZi0ISxtXqu0w99w5mV/SMprjydKUaQDWAEAn6ULk/F10LJ/LI8EaV7w 8Wa8AhKadyXSsGN0HjFKiSrt8lVrEUou4K9AA7NgULijvVFATIcnd6VBbBgffig7rer2 fWHV/LWfO0Pix/RjUsXjw8SaDN83FT/KwZxAI710esyhisO4QnhQ0IOL49EBdik5Tzrd 9uqg== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=FOmISjBC6Is5ZjZWghzdW9qvlburSkxvMszTs4qCx3M=; b=iBL0DapR3/Xg3zsmimt5/2ArCOyzrdI2O+jzx0Q2pIJAHO8z/4mA9kVYnr4YtQxiv8 VGx1LkbwfpfsdCE62oj72STVaPsdpKaM4BoPA+8Lv0Is3QXmQ/s6uL9utRV5WvpVWPWZ O+wUU6ZfGOPQ7n5E+gGqSt7iKkQvZ8Uf2QAqDNDHzx61DNVu25M2cpiVeCYaBajJ+2Yv TAwcaAJjVXASZe39lvCy1hng7nYr4ooPN6DuTJK7XIPqADOqydywIVUz7tyfE1MG3DEf 9wUvWVSY+4NFncUf4Chd5bxZHUmAyzNFEy39YjbHJn9bVOgD/dJjg5VDNUv+gTXJbNHj ZByA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MvtoIZiH; 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 g9-v6si2661317plm.454.2018.02.15.06.16.20; Thu, 15 Feb 2018 06:16:35 -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=MvtoIZiH; 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 S1033185AbeBOOOp (ORCPT + 99 others); Thu, 15 Feb 2018 09:14:45 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:39034 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032782AbeBOOOm (ORCPT ); Thu, 15 Feb 2018 09:14:42 -0500 Received: by mail-io0-f180.google.com with SMTP id b198so706424iof.6; Thu, 15 Feb 2018 06:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FOmISjBC6Is5ZjZWghzdW9qvlburSkxvMszTs4qCx3M=; b=MvtoIZiHhB+xud5Mex91ssab3sH0WqmFtySeicg2o7hW63DFFgosu7vbooHfwnlBPv mlAJ9gzeU34BRlDe3crBsnotVuU4ErSHZ+UBi+pZEpbgF630cHdw2Pko8N/zSFL5OjZ3 rZZEbzKjMifz+A61E828rC3VZOkjVZCLGoFxoQeYcZUrpUS3mUyqf1sko4oRLPr53Fqz qZko8U6TCL4HVO+xOGZK03fYKF/LUkww6pu0jxzOJs0dhDQsgpFtvn+BkG1imIkHc0lx s2T+Veai19H4lUu58bt/KSX2kkeXDgWmFZiJf85a1rzzpV76XTmALVRC59SmOrv+YInH ALDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FOmISjBC6Is5ZjZWghzdW9qvlburSkxvMszTs4qCx3M=; b=WxxaL9Z5MmoSa40P0lbsx5Fx/m4vVYAxayQiTM5xA6MxYEgXQFefL80SikjQZ2r5dN VtHI9blFNqPF4Qkwp5Vh3MDgKTyHBWxZcmc570M4gmG6uxEoZSoy8wLbu340IGeGWn3O PUwiBZhNbO3aHBV75LO3Cq6nsy8ZLfgDFaHmrN9TBt0zcOG7a0u2nw203CFxa1dEkBeF tdRaDT/8GMZkuf9+qBro60JBltX7jCyYwzIFwKJOZnRebQlva47wdOm+Y+zCo1hA82D6 p7t+3a6paqWYHS3fx99UUMyfiLTQQ24gTVyvsVtwRLD8rnQ0SDsmfSkwbAkStJFTQXbi uAHA== X-Gm-Message-State: APf1xPDKQ2wMCAaoOw+344WSfWZfSWfZ8SEtA9jEKlJBIwawNisnN8Q/ xo9G61E3rnF+lfZ2Hj4nIQ5AE0tW5xApy9xXFg0= X-Received: by 10.107.46.13 with SMTP id i13mr3860845ioo.161.1518704081139; Thu, 15 Feb 2018 06:14:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.92.211 with HTTP; Thu, 15 Feb 2018 06:14:40 -0800 (PST) In-Reply-To: References: <1517999482-17317-1-git-send-email-vivek.gautam@codeaurora.org> <1517999482-17317-7-git-send-email-vivek.gautam@codeaurora.org> <20180213164205.GA7599@jcrouse-lnx.qualcomm.com> <20180214154850.GA25422@jcrouse-lnx.qualcomm.com> From: Rob Clark Date: Thu, 15 Feb 2018 09:14:40 -0500 Message-ID: Subject: Re: [Freedreno] [PATCH v7 6/6] drm/msm: iommu: Replace runtime calls with runtime suppliers To: Tomasz Figa Cc: Vivek Gautam , Mark Rutland , devicetree@vger.kernel.org, Linux PM , David Airlie , Will Deacon , "Rafael J. Wysocki" , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , dri-devel , Linux Kernel Mailing List , Rob Herring , Greg KH , freedreno , Robin Murphy , Stephen Boyd , linux-arm-msm 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, Feb 14, 2018 at 11:09 PM, Tomasz Figa wrote: > On Thu, Feb 15, 2018 at 1:12 AM, Rob Clark wrote: >> On Wed, Feb 14, 2018 at 10:48 AM, Jordan Crouse wrote: >>> On Wed, Feb 14, 2018 at 12:31:29PM +0900, Tomasz Figa wrote: >>>> >>>> - When submitting commands to the GPU, the GPU driver will >>>> pm_runtime_get_sync() on the GPU device, which will automatically do >>>> the same on all the linked suppliers, which would also include the >>>> SMMU itself. The role of device links here is exactly that the GPU >>>> driver doesn't have to care which other devices need to be brought up. >>> >>> This is true. Assuming that the device link works correctly we would not need >>> to explicitly power the SMMU which makes my point entirely moot. >> >> Just to point out what motivated this patchset, the biggest problem is >> iommu_unmap() because that can happen when GPU is not powered on (or >> in the v4l2 case, because some other device dropped it's reference to >> the dma-buf allowing it to be free'd). Currently we pm get/put the >> GPU device around unmap, but it is kinda silly to boot up the GPU just >> to unmap a buffer. > > Note that in V4L2 both mapping and unmapping can happen completely > without involving the driver. So AFAICT the approach being implemented > by this patchset will not work, because there will be no one to power > up the IOMMU before the operation. Moreover, there are platforms for > which there is no reason to power up the IOMMU just for map/unmap, > because the hardware state is lost anyway and the only real work > needed is updating the page tables in memory. (I feel like this is > actually true for most of the platforms in the wild, but this is based > purely on the not so small number of platforms I worked with, haven't > bothered looking for more general evidence.) > At least as far as drm/msm/adreno, I'm not terribly concerned about other platforms that don't need to power up iommu. It's not really the same situation as a IP block that shows up in all different vendor's SoCs. But if you can convince Robin to go for get/put_sync() calls inside the iommu driver, I'm fine with that approach too. That is what I do in qcom_iommu already. But if not I'd like to at least solve this for some platforms if we can't solve for all. BR, -R >> >> (Semi-related, I would also like to batch map/unmap's, I just haven't >> gotten around to implementing it yet.. but that would be another case >> where a single get_supplier()/put_supplier() outside of the iommu >> would make sense instead of pm_get/put() inside the iommu driver's >> ->unmap().) >> >> If you really dislike the get/put_supplier() approach, then perhaps we >> need iommu_pm_get()/iommu_pm_put() operations that the iommu user >> could use to accomplish the same thing? > > I'm afraid this wouldn't work for V4L2 either. And I still haven't > been given any evidence that the approach I'm suggesting, which relies > only on existing pieces of infrastructure and which worked for both > Exynos and Rockchip, including V4L2, wouldn't work for SMMU and/or QC > SoCs. > > Best regards, > Tomasz