Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1824831imm; Fri, 7 Sep 2018 06:47:33 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbmo4tVNbpBGCDE55mOwRvSJZ4B0cOLrByN2pV1sAJ/8LQeRZQT0bSmVW/PzVsn8UkfUwua X-Received: by 2002:a17:902:6b05:: with SMTP id o5-v6mr8074544plk.338.1536328053615; Fri, 07 Sep 2018 06:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536328053; cv=none; d=google.com; s=arc-20160816; b=njDEaNAJ21eUj69OSW++ZXOpl+XyNom5bEgnJe4I4lB7MiFv9LE5t7BIbOSk6d++Yt u16DZxMmFw1n3dCW8NetR6QLxzwJITJZl/exgmwTCIldZcAyPD55s+hT1NU4uHEELPep Lb9o1ZIWU9kpWy/WPHm+kq+X1fFOjhhIFaC/MXMNOfZ03nwDHVC1Rus08uDW4CvKWAW6 h2boP1CtTvLFXPPAqiwQvmLt+XDhldBdSec92zYol7Io7j8ZPjzf17lpfZEiuL477RPu VLpNpr7pXZHfaEi7w6HOLucouPokNcF4j1y5YJzUepHA6HpBJ1wTEjKbsCuMYIbwMeoj g0wg== 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; bh=Red/iv2C1rJt/DTscvuD3odKWxtV4Wa1zzLWKoC9Hz8=; b=jnRK2b7x69zbF9fehcS+hQgNi+2l0iDSWz0NW1N1iz3N1iBiW6AdwqJ8DTgFqjcws9 oPfHNjxItArz4Cy892Ulq5l2QV/7J3oBHn8APk+Jw2iO9TwAAJ4e209h/EmACYFt5Jqz m2L9jquGgiG83zNFkH0xt3oAWriTVNp4Q17f2N3QkSm+xxa5ZizCVex7bJXLYnpt1Be9 njqaCbWEgdnDSufdQX3TIuaTsQh7X2QKpWve6PFhWVwY8U3zZAIkRQtXXvv81tAftM0I T3BcmJ2cFk2V+DjX3u7eAuc0wETQg7Sd2521IZe+YAGMOmmT4IVwqrEguyQn2Do8IPDf mRWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=I1t++FzR; dkim=pass header.i=@codeaurora.org header.s=default header.b=iv7+yLSj; 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 184-v6si6169916pgi.614.2018.09.07.06.47.17; Fri, 07 Sep 2018 06:47:33 -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=I1t++FzR; dkim=pass header.i=@codeaurora.org header.s=default header.b=iv7+yLSj; 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 S1728460AbeIGPCm (ORCPT + 99 others); Fri, 7 Sep 2018 11:02:42 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35818 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727651AbeIGPCm (ORCPT ); Fri, 7 Sep 2018 11:02:42 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D96F86085F; Fri, 7 Sep 2018 10:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536315744; bh=QasiAzmxXre/E6Fwdx+gr7PwnYd8+a16b7uv7i3BwN4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I1t++FzRFB3FcnbS4GUNMs9qG3I1LCZevlTmq3jE2xatom1Ec0zs4IYETCb5IbJCT DvweAyItF7b7rM48PVMhgcd7qw1iZo6BhFpb0hivhjcb2RsAiHBacb4qtmPo71GbGS kRr85MjBcpYIV8dIHWrBm7F6S4Lef/rsoKgSHzhA= 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-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 A577A608BF; Fri, 7 Sep 2018 10:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536315740; bh=QasiAzmxXre/E6Fwdx+gr7PwnYd8+a16b7uv7i3BwN4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iv7+yLSjMtg9X9XonkVWmjJhOnL8Lh7AexTieZB7Zhgfu4UzFNdviAKSktgc3J110 G0P/T53RlsSRdjmAMZXIyGRDjp4D1Ey4uM9Oc8Jro10WPSllHTpFqeD/nUtyuEVGfJ t+p9/Z7nJufrEpTDGTH0TqLOngJ3NLhNWFIwUhKY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A577A608BF 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-qk1-f178.google.com with SMTP id g197-v6so9359812qke.5; Fri, 07 Sep 2018 03:22:20 -0700 (PDT) X-Gm-Message-State: APzg51DzIJbHIZEqZQa5HUPZHCAGxO1mTAwvuexCQ22WMDhY9/0AWHS8 zk9h+U/uXgiKUFaBDWblFy0XOcBRwqZIRs8HQmY= X-Received: by 2002:a37:9904:: with SMTP id b4-v6mr5340996qke.102.1536315739645; Fri, 07 Sep 2018 03:22:19 -0700 (PDT) MIME-Version: 1.0 References: <20180830144541.17740-1-vivek.gautam@codeaurora.org> <20180830144541.17740-3-vivek.gautam@codeaurora.org> <3ccc3690-dc9d-56e7-e2d1-62e73a189bff@codeaurora.org> In-Reply-To: From: Vivek Gautam Date: Fri, 7 Sep 2018 15:52:06 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v16 2/5] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device To: Tomasz Figa , Robin Murphy Cc: Mark Rutland , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , alex.williamson@redhat.com, Linux PM , sboyd@kernel.org, "Rafael J. Wysocki" , Will Deacon , open list , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , "robh+dt" , linux-arm-msm , freedreno 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 Fri, Sep 7, 2018 at 3:22 PM Tomasz Figa wrote: > > On Fri, Sep 7, 2018 at 6:38 PM Vivek Gautam wrote: > > > > Hi Tomasz, > > > > > > On 9/7/2018 2:46 PM, Tomasz Figa wrote: > > > Hi Vivek, > > > > > > On Thu, Aug 30, 2018 at 11:46 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. > > >> Global locks are also initialized before enabling runtime pm as the > > >> runtime_resume() calls device_reset() which does tlb_sync_global() > > >> that ultimately requires locks to be initialized. > > >> > > >> Signed-off-by: Sricharan R > > >> [vivek: Cleanup pm runtime calls] > > >> Signed-off-by: Vivek Gautam > > >> Reviewed-by: Tomasz Figa > > >> Tested-by: Srinivas Kandagatla > > >> --- > > >> drivers/iommu/arm-smmu.c | 89 +++++++++++++++++++++++++++++++++++++++++++----- > > >> 1 file changed, 81 insertions(+), 8 deletions(-) > > > [snip] > > >> @@ -2215,10 +2281,17 @@ static int arm_smmu_device_remove(struct platform_device *pdev) > > >> if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS)) > > >> dev_err(&pdev->dev, "removing device with active domains!\n"); > > >> > > >> + arm_smmu_rpm_get(smmu); > > >> /* Turn the thing off */ > > >> writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0); > > >> + arm_smmu_rpm_put(smmu); > > >> + > > >> + if (pm_runtime_enabled(smmu->dev)) > > >> + pm_runtime_force_suspend(smmu->dev); > > >> + else > > >> + clk_bulk_disable(smmu->num_clks, smmu->clks); > > >> > > >> - clk_bulk_disable_unprepare(smmu->num_clks, smmu->clks); > > >> + clk_bulk_unprepare(smmu->num_clks, smmu->clks); > > > Aren't we missing pm_runtime_disable() here? We'll have the enable > > > count unbalanced if the driver is removed and probed again. > > > > pm_runtime_force_suspend() does a pm_runtime_disable() also if i am not > > wrong. > > And, as mentioned in a previous thread [1], we were seeing a warning > > which we avoided > > by keeping force_suspend(). > > > > [1] https://lkml.org/lkml/2018/7/8/124 > > I see, thanks. I didn't realize that pm_runtime_force_suspend() > already disables runtime PM indeed. Sorry for the noise. Hi Tomasz, No problem. Thanks for looking back at it. Hi Robin, If you are fine with this series, then can you please consider giving Reviewed-by, so that we are certain that this series will go in the next merge window. Thanks Best regards Vivek -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation