Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp427802imm; Thu, 30 Aug 2018 02:23:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbLbrg9g5hDU+7uk9fL4LzigQ0o5y9eOgH2I/AzuVJiqt+fiY3Lk5vxQB3+gdGAEg5GL7Kj X-Received: by 2002:a62:e11:: with SMTP id w17-v6mr9755483pfi.242.1535621027746; Thu, 30 Aug 2018 02:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535621027; cv=none; d=google.com; s=arc-20160816; b=XsrZHHNMk1JMO7ELkviiqG5x7n5D+Ew+t6p8WJ2wf2OQ9eupGscG/c9e6/xMQkXbqF wpD4NS/tWa8AzPJ45CeKmj8AzfHfD6LpCXp4dLUMtwOkhZEyucvaFBzvqe93foFqFNPf efgfH8sWVVvfvWpQ54hfQjrFJKBeE8blsDSJuyxY8q0VqSiz7J1KcwV/n8YJuSQu71cs xvzH4Mev6JXOepEqs9YgRya6qp8KGAMCqG1brQemnCUxHmis+5krmqAcZsIEab+BO4LG 2+JrWwJrdcqQesOrdWmkAYbQb6/80UTZsSQ7Gc6cVPExnfWIiezThpDvKN5CNNh0fygR QGmA== 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=nulT9FFtrm0aG4WvURxYF3Fpm4VlL6NaBJmZhVtszgE=; b=pQheHD2pN2qjlgdXeBevxicsb3QVV2xaCHmKklII71i1Gj6hIfyILTQqpLjaSZBcnx mJKavp1FNRHDxke//Vg1/ED5YMg9I7c/eKNX8HOkP1Is7V8X5h3Uhx2/2CiwUuLF5Xts A99fVu/zQDzgyVqYoHN9rLeZhdE7mO6bnfUbbwekMdAu5FIUXa/hq+U0qC8FrvDF7dvg 4FYGzPRGhR885R1YEDsD7JjBUjxPEnQ6Gcb/GqNbcm8O7yQr0Fh8upS8Oq/FpKUp1wyk JqaZRN+7R/ndtIXiO2IIdC7vw/3cFoJt0DY1j23DJUgsxZj2o+eUQXbH0Ia2QOw7PRIE l7Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mcsTDsdm; dkim=pass header.i=@codeaurora.org header.s=default header.b=YdhOjbp6; 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 185-v6si6028611pgj.511.2018.08.30.02.23.32; Thu, 30 Aug 2018 02:23:47 -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=mcsTDsdm; dkim=pass header.i=@codeaurora.org header.s=default header.b=YdhOjbp6; 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 S1728262AbeH3NX3 (ORCPT + 99 others); Thu, 30 Aug 2018 09:23:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33524 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728048AbeH3NX3 (ORCPT ); Thu, 30 Aug 2018 09:23:29 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9B1E56053D; Thu, 30 Aug 2018 09:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535620936; bh=Kf3w/av/yLP3d0By/0vVXzz86NBMVrFNM8h9fShqe2s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mcsTDsdmlRx6Vtcy49yOpcMvHuK/YfVckRU6l7LlZexHCx2yBErsz+HbzYx0eh2Qo 0tf+4FoylOUnt1N20sUbs44ZjCnwvu8ffyD8Ew7XeREne4ptjO0elDInSl2+VGf+qM bD3bVcbscCx935B5vOMngZbNTBH7cQVYCEbNcoOY= 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-f174.google.com (mail-qt0-f174.google.com [209.85.216.174]) (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 328B5606FA; Thu, 30 Aug 2018 09:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535620935; bh=Kf3w/av/yLP3d0By/0vVXzz86NBMVrFNM8h9fShqe2s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YdhOjbp6fK8q70lzV1Ltbkp2ITKz6c74+An5iAgCdaZ8jAtOuoyVxcwNXGBByBLM7 1zxQ1BEJ6O9239x0amk+YUz+7/j3BkZxBLkPYAm7WW7gZXjDIlv+rVoAF9R8qd8zye ddAswSPHTQdV/yNIcxDZMdiu8hzMiuRvn36rEVKw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 328B5606FA 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-f174.google.com with SMTP id j7-v6so9005162qtp.2; Thu, 30 Aug 2018 02:22:15 -0700 (PDT) X-Gm-Message-State: APzg51BHbMDP4oUHT6B8YLuhCrVn2SeQV5DWhywH0oKDWPONY65vGrgj wHdc4/fh35sOdWSBAB7LNGVorPl5BgRvbbvLE8c= X-Received: by 2002:a0c:ada8:: with SMTP id w37-v6mr10497810qvc.107.1535620934270; Thu, 30 Aug 2018 02:22:14 -0700 (PDT) MIME-Version: 1.0 References: <20180827105551.16346-1-vivek.gautam@codeaurora.org> <20180827105551.16346-3-vivek.gautam@codeaurora.org> In-Reply-To: <20180827105551.16346-3-vivek.gautam@codeaurora.org> From: Vivek Gautam Date: Thu, 30 Aug 2018 14:52:01 +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: Joerg Roedel , "robh+dt" , Robin Murphy , Will Deacon , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , freedreno Cc: Mark Rutland , Linux PM , sboyd@kernel.org, "Rafael J. Wysocki" , alex.williamson@redhat.com, linux-arm-msm , Andy Gross 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 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. > + if (err < 0) > + return err; > + > + /* Enable clocks explicitly if runtime PM is disabled */ > + if (!pm_runtime_enabled(dev)) { > + err = clk_bulk_enable(smmu->num_clks, smmu->clks); > + if (err) > + return err; > + } > + > err = arm_smmu_device_cfg_probe(smmu); > if (err) > return err; [snip] Best regards Vivek -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation