Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp434309imm; Thu, 30 Aug 2018 02:35:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY26s3XYc7fijsG70pDtaRkvrqSS4hTPEvUxDtTj1ghPLajQpzK8+H5xYzD2RdC+dWzhYu6 X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr9670245pfa.238.1535621748190; Thu, 30 Aug 2018 02:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535621748; cv=none; d=google.com; s=arc-20160816; b=d5tDkLK5A+e7AJsXOVPZvgziMiRYPdj2ZxjvDo6DWGaNNtwllAr6G0zIZToycGkb17 7B7Z2KGsSThtdVLMUnCwzACbXaMikRfV9Ga02SOSmhXSrfj7H9dVwEuPe6azaFQpPA8o DJDzZlRaPLcVCuD4/PtwKqAH6rxOV1zjhGePoIX8rNRAeZq7+QKY9arGiyW6dHMGe4bl +8N8T7h1aB4En+mxS5z3ZBbTA+tKvKArdzcIg0yvnMHmVsf+x6/EDM3dZjVXoNd2f0yx wzSjxwYoU6ZfoQmo5JmqJbJZ9PEiOfWPzmTzpLI/UX9JjMsQ8Utilja3ozQv+MfdGXDy SyJA== 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:dkim-signature :arc-authentication-results; bh=+YKs89KCBRjOhJ6kZ6HhzrYkouwY3ACEQLGR4lhrPH0=; b=vxqgYMl/TxP4l4E2JJrZg0TEOCY9IpakqpMNt00BJUlYO0XNIjFh7+ZWZIdTvhFi7N 9YRw8vH/OUIS5HxCWj3hf2XbZB02c4KRs8Hm1SOkRAsgR4QvQf/afDXUjsJzyIxY4HtG sYakPr3/uN/3oHhXHM+gZ+vjY8MKABFnd8Ej74/Y3NxoaugA0PhjxF6zAMhiiO3FWtwL nRfWqvCUyiwmWvVliAus0XjwRAp/JV40w7rl3anTrqT90ybpayGgaDslgtlpuUa3HrWt voGAm4EC1JKXe+0IfHbwE5L86vDaOn0j4ZYYJPivHm5DljydGuH4C/wEczlp8iyil98N jwPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RZyf3DBX; 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 d1-v6si5873980pgj.353.2018.08.30.02.35.33; Thu, 30 Aug 2018 02:35:48 -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=@chromium.org header.s=google header.b=RZyf3DBX; 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 S1728200AbeH3NfX (ORCPT + 99 others); Thu, 30 Aug 2018 09:35:23 -0400 Received: from mail-yb0-f195.google.com ([209.85.213.195]:40029 "EHLO mail-yb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728165AbeH3NfW (ORCPT ); Thu, 30 Aug 2018 09:35:22 -0400 Received: by mail-yb0-f195.google.com with SMTP id f4-v6so3145023ybp.7 for ; Thu, 30 Aug 2018 02:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+YKs89KCBRjOhJ6kZ6HhzrYkouwY3ACEQLGR4lhrPH0=; b=RZyf3DBXUkWZ3PXUp248I616x8kSPYutIZvWNl+TI6RomijMnEYFs3kXYDWDrHR2yP 6MKPWSquH+r6BM1C19OgidNc7ipLDwsiW+0hlShRoV27jF5bzPdikfUK9YEKWEgp2SuQ tchjJ2bBl1CQ1q2lP1E19Q+oRCQVLkx5pZ1/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+YKs89KCBRjOhJ6kZ6HhzrYkouwY3ACEQLGR4lhrPH0=; b=ZWCApbZneUnXjuGxs7QIGYF7rdR7/rvjckbIDKwI8GlxQURSNlVVLzdGKw9fSAJELm CZ+0bf3Gx1NNZuQwYk+TlRmoKSenf2WvVNx4JwuamrjifRMSBDKdt7EUxIlKfnThRYuJ Fmgq66MTnosFTQw8+orIizzKlVNuZYX1OCTRFof5+FcnFBR7BM3oYda7tY1GKPveqolP t8otRZ2CnUO5YJbSuH1Xn+sJMipKu35kx5cJcdGbCGLeXa13gXh9qWDRdeQPqlEC21ij ccXVrkgWVutxEvEBbVfFumIF7fjck7gTF4jvlYYsTb7f8SUjND96YHwDoW2Cc6THE+cS hd7Q== X-Gm-Message-State: APzg51BD5HhXX3p/u2vcDJ5E4/fhqfm1BMyp2jcDGUTLQiUmhhBjsUQl Lnxuoh5ofP83r3z+TU2gCDqS5J7Yery/Bg== X-Received: by 2002:a25:3002:: with SMTP id w2-v6mr5425167ybw.25.1535621647045; Thu, 30 Aug 2018 02:34:07 -0700 (PDT) Received: from mail-yb0-f174.google.com (mail-yb0-f174.google.com. [209.85.213.174]) by smtp.gmail.com with ESMTPSA id l127-v6sm2871241ywc.5.2018.08.30.02.34.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 02:34:05 -0700 (PDT) Received: by mail-yb0-f174.google.com with SMTP id t10-v6so3154501ybb.1 for ; Thu, 30 Aug 2018 02:34:04 -0700 (PDT) X-Received: by 2002:a25:b3ce:: with SMTP id x14-v6mr5135165ybf.508.1535621644146; Thu, 30 Aug 2018 02:34:04 -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: Tomasz Figa Date: Thu, 30 Aug 2018 18:33:53 +0900 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: Vivek Gautam Cc: "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Rob Herring , Robin Murphy , Will Deacon , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , devicetree@vger.kernel.org, Linux Kernel Mailing List , freedreno , Mark Rutland , Linux PM , sboyd@kernel.org, linux-arm-msm , "Rafael J. Wysocki" , Alex Williamson , 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 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. Best regards, Tomasz