Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3131imm; Thu, 30 Aug 2018 07:03:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZNsGPnL4gEYHfPcml+jhIO9zyB4gU8uJBHGS65FFPheA2A1EuEmjyGA6yV43hL3iDc4vfc X-Received: by 2002:a62:3545:: with SMTP id c66-v6mr10587889pfa.63.1535637797276; Thu, 30 Aug 2018 07:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535637797; cv=none; d=google.com; s=arc-20160816; b=xr2h+bGp0jzzOubocyEYDHT27MC0OzUQEj5Im/mv2g1MlWHOoTz4dor21wvSyUAZ0c 5xTH1uuSYpyFZlZwO6Rp0Vtt6aEw3m8a/DOPEGqJab/usaO7CJjnFf2X0mhIgVtEK8cO RRWGIkbgreH82mUSPcuQgSn1v4D63VYnBF0R77HKiyJRmAyi6eFSil4L3x30HHmtevGZ 14oakfQqwyKZOhxjE69vx4oxLeltUQdq4XQ8EUYX9nH1W4A9z5doOVf1Rju8IyM3vlDF GgU3ceDXgeFnpieF7SW7UESFlP1bBTCTFOqKW/IBSTkrVtidXB6Ilc5dHBUUNY4PnjaS yj2g== 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:arc-authentication-results; bh=xCTCGsHS+fzBYv6e9G8J9s3q/VXOVn1H9n4I3RaDQ1c=; b=yxasWtds7yz+QuvpanpNiPjiCGPzEOLt9/oE7kPiKAc/pq+cP8saXhBwJV3cs/equ7 NoNJ2JQ3l/66ZwWSCyXV+itFIrdUcDT95c7IBQ5HtFMxl8NEiVuHI4Lu02TCivokaLnh No+XZ00osmhSpB6oDxe/sAWPuY6BPDYFZW9p9iqIxEnw9JHc2M7E12MzQnELnmD4ga90 A0PInOzuGdygdiqmRbIe4J8cbG5yXmPj12Rd4LdmAn4RQRh1RLfLptMzx++O6CqsGD7P OD0fa/IV7+nyN674Sj1Tegc6UXqAjueCcU741GbZ0a1A5nNBPmKdQ2pBNoOZtvIy3JxU gImw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=j7gL4WOK; dkim=pass header.i=@codeaurora.org header.s=default header.b=drmaEKp1; 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 u26-v6si6095781pge.590.2018.08.30.07.03.01; Thu, 30 Aug 2018 07:03:17 -0700 (PDT) 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=j7gL4WOK; dkim=pass header.i=@codeaurora.org header.s=default header.b=drmaEKp1; 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 S1729165AbeH3SC0 (ORCPT + 99 others); Thu, 30 Aug 2018 14:02:26 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50896 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbeH3SC0 (ORCPT ); Thu, 30 Aug 2018 14:02:26 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 02FA260912; Thu, 30 Aug 2018 14:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535637609; bh=xlnDAfHcLt8P6yv5162XbShaDXF2IfadAZMQKVnM8jw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=j7gL4WOKyuzpY89wKdKtYbaEHyAfQt5BY1aChMJa6dSw94FQWmRedJGa5DIIMyvvO dRz4yXGTKYf+ViEeIYOPaMtDGItEFsOJyi7lvnAD5bW8TtC0MupXSk1iMi6YGf/Z1k Ork9hGxgDnVW5kiSHSzoazVEDFYBZKGd4kv7QSAw= 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.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail-qt0-f179.google.com (mail-qt0-f179.google.com [209.85.216.179]) (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 4437060A98; Thu, 30 Aug 2018 14:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535637600; bh=xlnDAfHcLt8P6yv5162XbShaDXF2IfadAZMQKVnM8jw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=drmaEKp13ZaJrAVmZWSLja7tAZX2XTGQmM20lwu2dqcIso1I4gkCT8HxcyUrtsfL/ LviJuIlxoaREVvBuBRjoTpTzAcbBRIY+sjflhy7PWFo5hY1KiTkxbNJVCyKZ1ictNF yeJ+UnZ9BFsgxNl4TUODhENBMqwX1+1bQh0EDSnI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4437060A98 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-qt0-f179.google.com with SMTP id k38-v6so9882848qtk.11; Thu, 30 Aug 2018 07:00:00 -0700 (PDT) X-Gm-Message-State: APzg51DCXBlUUYzJIVU6fgDPsKcJxgFE/qLSiBwYPeJDhpz+ALd1vTTs dK/eKR73sC8bE6dymxnzYE7mYXgYCWy/1p2GLUo= X-Received: by 2002:ac8:435e:: with SMTP id a30-v6mr11796351qtn.261.1535637599087; Thu, 30 Aug 2018 06:59:59 -0700 (PDT) MIME-Version: 1.0 References: <20180827105551.16346-1-vivek.gautam@codeaurora.org> <20180827105551.16346-3-vivek.gautam@codeaurora.org> In-Reply-To: From: Vivek Gautam Date: Thu, 30 Aug 2018 19:29:46 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Patch v15 2/5] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device To: Tomasz Figa Cc: Mark Rutland , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , alex.williamson@redhat.com, Linux PM , sboyd@kernel.org, freedreno , Will Deacon , open list , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , "robh+dt" , "Rafael J. Wysocki" , linux-arm-msm , Andy Gross , Robin Murphy 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, Aug 30, 2018 at 3:04 PM Tomasz Figa wrote: > > On Thu, Aug 30, 2018 at 6:22 PM Vivek Gautam > wrote: > > > > On Mon, Aug 27, 2018 at 4:27 PM Vivek Gautam > > wrote: > > > > > > From: Sricharan R > > > > > > The smmu device probe/remove and add/remove master device callbacks > > > gets called when the smmu is not linked to its master, that is without > > > the context of the master device. So calling runtime apis in those places > > > separately. > > > > > > Signed-off-by: Sricharan R > > > [vivek: Cleanup pm runtime calls] > > > Signed-off-by: Vivek Gautam > > > Reviewed-by: Tomasz Figa > > > Tested-by: Srinivas Kandagatla > > > --- > > > > > > Changes since v14: > > > - none. > > > > > > drivers/iommu/arm-smmu.c | 101 +++++++++++++++++++++++++++++++++++++++++++---- > > > 1 file changed, 93 insertions(+), 8 deletions(-) > > > > > > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > > > index a81224bc6637..23b4a60149b6 100644 > > > --- a/drivers/iommu/arm-smmu.c > > > +++ b/drivers/iommu/arm-smmu.c > > > > [snip] > > > > > @@ -2131,6 +2188,26 @@ static int arm_smmu_device_probe(struct platform_device *pdev) > > > if (err) > > > return err; > > > > > > + /* > > > + * We want to avoid touching dev->power.lock in fastpaths unless > > > + * it's really going to do something useful - pm_runtime_enabled() > > > + * can serve as an ideal proxy for that decision. So, conditionally > > > + * enable pm_runtime. > > > + */ > > > + if (dev->pm_domain) > > > + pm_runtime_enable(dev); > > > + > > > + err = arm_smmu_rpm_get(smmu); > > > > We shouldn't be doing a runtime_get() yet, as this eventually calls > > arm_smmu_device_reset(). > > arm_smmu_device_reset() should be called only after arm_smmu_device_cfg_probe(). > > So, I plan to replace the pm_runtime_get/put() calls in probe() with > > simple clk_bulk_enable() > > to let the driver initialize smmu, and at the end of the probe we can > > disable the clocks and > > enable runtime pm over the device to let it take care of the device further-on. > > > > We can avoid the explicit clock disable by just calling > pm_runtime_set_active() before pm_runtime_enable(), assuming that what > probe does is symmetrical with the suspend callback, which would be > called after the latter. Sure, that sounds reasonable. Will use pm_runtime_set_active() instead of explicitly disabling the clocks.Thanks. Best regards Vivek > > Best regards, > Tomasz > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation