Received: by 10.223.185.116 with SMTP id b49csp3364602wrg; Tue, 13 Feb 2018 01:12:12 -0800 (PST) X-Google-Smtp-Source: AH8x224e2FsxMejB6Tkj5SpqjZMakY3acaDvs+YWF7Q0/PM15tcG3jfY+h+S+RmX/C9Am6T56SXD X-Received: by 10.98.46.70 with SMTP id u67mr587423pfu.16.1518513132786; Tue, 13 Feb 2018 01:12:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518513132; cv=none; d=google.com; s=arc-20160816; b=InxxYaRt/4SMi6nWVDBuQj1kACsEfDaoDBcSbBUnrdFqmrEvqhFaODorQFGnBoKTG8 iZo6ChkD3dz41DhxDKxecbfI3tzg3yr0lPMI1tfdjLiGcDK02k6kEGDKOWlOKGYtSy6K c33q/aFilQI1sQEyLvh5vHst9CvnhBgWnyptH1cgOsoLz9xFa5waJufDqoTB9L1Awg/f 1H50t8ERhqvz+G/H2j8d1vqQh132cm59UPbYJeOuXS6yS4dIenbwYjtzRC/muT7jfqxY 7lRPqsci+QIrMPZtVUyjUZSbE7+FmBHBgcn0zRiyT8JAzS/FPeWP/i9snxWXg4Q/gsWR SfLg== 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=zgDOrQ0vdnEEpzJQTdiI/AsXJqEeC0L6DTsretGGndQ=; b=fZiwzqAvE4eTJiv0gNmC47QJcWbgMaRX6e21hPluMut0IGmIAeWqGIPBqliKICiRpG FXYbbUWmZiGaTbASaiJRTrm40y3OhG708yos59ky5DoysDps8cExJCCOeEKr8pH9ihQT H1oDLpspdZnwxpSR0FPVIXDsvy03mPxLtrgywcp21psYWkreEzg9bRBe6N8zJI0CzbZW kSiE1K+c1ActsiOggLpKbC3xfMXi08Rujh8l1gtNMsAzwGBMwEYx9ePlmZJT1FBwLNbg GMNQm+SNd7kU0RTDbT9y4suy3DZKsaSO/nLRU33jxuywVrai39dMr/yM/ZQKO5Nos60h GJwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=M07evCr4; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si1849413plb.280.2018.02.13.01.11.58; Tue, 13 Feb 2018 01:12:12 -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=@chromium.org header.s=google header.b=M07evCr4; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934120AbeBMJLK (ORCPT + 99 others); Tue, 13 Feb 2018 04:11:10 -0500 Received: from mail-ua0-f196.google.com ([209.85.217.196]:39109 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933810AbeBMJLD (ORCPT ); Tue, 13 Feb 2018 04:11:03 -0500 Received: by mail-ua0-f196.google.com with SMTP id r4so11168068uak.6 for ; Tue, 13 Feb 2018 01:11:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zgDOrQ0vdnEEpzJQTdiI/AsXJqEeC0L6DTsretGGndQ=; b=M07evCr4zO5Smak3i0TVt0AB5TNGF7+ESfl1fxyofFCNEzHohjmuNj9kWBHCpgn4mh sZGI+hs1wXOr/5ZiePDo83H2LbHplzMOm4210LJ7wwLs4rwGomE96YuuktlBl8+HuPPh 0LOQPF3JKXScs+b3tHtJswNqUBzv5ONBi58jY= 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=zgDOrQ0vdnEEpzJQTdiI/AsXJqEeC0L6DTsretGGndQ=; b=fNHADU3bi/FrOdyD/Rq+k1+By9eNoxolS5HmkDdk5YdZME+FIg4fRjnErw2BL5czYX TrndJ+UO+BYTpnpmvTW+pUpjiY2vOIwedSiSR6xnrpZ96Pkaf91lPf4YbOVjG0K4ozB5 I8bo/4mxVw+l/ithlDELv9eLmZLN9XiGNu0Ymy8VRvBpzDK0u6RUessQiPa9nO8noX1O uYgVeSK3BfmsxvivzTQGo4lx5L+QjoqWcHK0x+IQpoNJ806TA6D2Tbyj+hAyqqEpv/A8 fhnGhmRkXJjzgi2qN5IZIQqry7BtJt1Uyh28bePojJRRdeQZEepSrORZt+feFLiyualr c+JA== X-Gm-Message-State: APf1xPBj5MQUSeYCzhOUO4N5ouqfTZCFR9IYYtD+TEMiHOBMsbX9CJ2S 5Q/hYBK9kK6+Qr1+hBrju6Xnz5XqrG0= X-Received: by 10.176.29.8 with SMTP id j8mr481244uak.64.1518513061808; Tue, 13 Feb 2018 01:11:01 -0800 (PST) Received: from mail-vk0-f41.google.com (mail-vk0-f41.google.com. [209.85.213.41]) by smtp.gmail.com with ESMTPSA id d15sm4427791uag.3.2018.02.13.01.11.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 01:11:00 -0800 (PST) Received: by mail-vk0-f41.google.com with SMTP id x203so10416045vkx.10 for ; Tue, 13 Feb 2018 01:11:00 -0800 (PST) X-Received: by 10.31.139.138 with SMTP id n132mr460592vkd.133.1518513059495; Tue, 13 Feb 2018 01:10:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.0.68 with HTTP; Tue, 13 Feb 2018 01:10:38 -0800 (PST) In-Reply-To: <1517999482-17317-7-git-send-email-vivek.gautam@codeaurora.org> References: <1517999482-17317-1-git-send-email-vivek.gautam@codeaurora.org> <1517999482-17317-7-git-send-email-vivek.gautam@codeaurora.org> From: Tomasz Figa Date: Tue, 13 Feb 2018 18:10:38 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 6/6] drm/msm: iommu: Replace runtime calls with runtime suppliers To: Vivek Gautam Cc: "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Rob Herring , Mark Rutland , "Rafael J. Wysocki" , Robin Murphy , Will Deacon , Rob Clark , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel , freedreno@lists.freedesktop.org, David Airlie , Greg KH , sboyd@codeaurora.org, linux-arm-msm@vger.kernel.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 Vivek, Thanks for the patch. Please see my comments inline. On Wed, Feb 7, 2018 at 7:31 PM, Vivek Gautam wrote: > While handling the concerned iommu, there should not be a > need to power control the drm devices from iommu interface. > If these drm devices need to be powered around this time, > the respective drivers should take care of this. > > Replace the pm_runtime_get/put_sync() with > pm_runtime_get/put_suppliers() calls, to power-up > the connected iommu through the device link interface. > In case the device link is not setup these get/put_suppliers() > calls will be a no-op, and the iommu driver should take care of > powering on its devices accordingly. > > Signed-off-by: Vivek Gautam > --- > drivers/gpu/drm/msm/msm_iommu.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c > index b23d33622f37..1ab629bbee69 100644 > --- a/drivers/gpu/drm/msm/msm_iommu.c > +++ b/drivers/gpu/drm/msm/msm_iommu.c > @@ -40,9 +40,9 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char * const *names, > struct msm_iommu *iommu = to_msm_iommu(mmu); > int ret; > > - pm_runtime_get_sync(mmu->dev); > + pm_runtime_get_suppliers(mmu->dev); > ret = iommu_attach_device(iommu->domain, mmu->dev); > - pm_runtime_put_sync(mmu->dev); > + pm_runtime_put_suppliers(mmu->dev); For me, it looks like a wrong place to handle runtime PM of IOMMU here. iommu_attach_device() calls into IOMMU driver's attach_device() callback and that's where necessary runtime PM gets should happen, if any. In other words, driver A (MSM DRM driver) shouldn't be dealing with power state of device controlled by driver B (ARM SMMU). This is also important for the reasons I stated in my comments to "[PATCH v7 1/6] base: power: runtime: Export pm_runtime_get/put_suppliers". Quoting for everyone's convenience: >> There are however cases in which the consumer wants to power-on >> the supplier, but not itself. >> E.g., A Graphics or multimedia driver wants to power-on the SMMU >> to unmap a buffer and finish the TLB operations without powering >> on itself. > >This sounds strange to me. If the SMMU is powered down, wouldn't the >TLB lose its contents as well (and so no flushing needed)? > >Other than that, what kind of hardware operations would be needed >besides just updating the page tables from the CPU? > In other words, the SMMU driver can deal with hardware state based on return value of pm_runtime_get_sync() or pm_runtime_get_if_in_use() and decide whether some operations are necessary or not, e.g. - a state restore is necessary if the domain was powered off, but we are bringing the master on, - a flush may not be required when (un)mapping with the domain powered off, - etc. Best regards, Tomasz