Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp412729oof; Mon, 24 Sep 2018 22:56:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV61hy6G64apJjIySaxdFEYGaN9DZWV4mJjkd/0lY+Lyj4hA+n7Kuma8zMAxvHUEcuO6X2+te X-Received: by 2002:a17:902:543:: with SMTP id 61-v6mr1929783plf.126.1537855002417; Mon, 24 Sep 2018 22:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537855002; cv=none; d=google.com; s=arc-20160816; b=Xw+4JiOvanMnpWeZ7NJ/sivXtUeWgQJox4YnFdrBMaeysvHCvIpQVuoBqr7Q9WVX// i9gOJnvPAQ7qp56zL3Mg3KcB2JReqZ+BRHRcKmmx9fVDLirBeQ+gBGZaP/tl5W1h8uR7 uAsgMam2VWeO4DUejZZt9HAQ0G8yDb2LoZviUblIaGzYSTtO79yqM5pSpGV3ZuEz5R8k KOzpkz94l9bWyxChqlzqBEpHfCAYbzI73sWOxL+ydxVODvUUrzuMXOvF1584aRvycexY 3exrfAwEBotcUBXMd6TthHDjVyg2EUfnKVAzVW4WOwKKxo5TzPUDhxFWuZl+ixNg/4vW lx/w== 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=5HQM8ZGxUSlYxX7hdyycNTvziEiYOHy1OaIf0wgT3hQ=; b=GiE82O9f/DNS6MBHn7CRG4ZXo4V00Ul7y4II6WLy8l7MlGbwacCdsDTbiVb1zWxQ2s vP+La6JiVVyJ/WovX/yefAj37v6dZphUEsw+8+PE4kvKHtKuoiGbmHs7jiaUutA+U1/h o0WEd3Wonaha9RocbXMmt+psUZj4Icnyx/jIcMDoNl9kzh4R2KN7bOWNqthlwUb21ytC PbtyiBZP0KkMLhnOou0AaVCgId7AeEJIv87Fl5vZVnLcC1rJRVd+flyIDwZotTq9l+Rg IE1apOC81A9boPKpHj+BKxobiZ9/AFP1FP0hVrL2MOCbA6ir9oIrLpiFJl2zfqaniJN5 uPmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=akpFbhXr; dkim=pass header.i=@codeaurora.org header.s=default header.b=RPQI6RlO; 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 g6-v6si1330921pgq.240.2018.09.24.22.56.26; Mon, 24 Sep 2018 22:56:42 -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=akpFbhXr; dkim=pass header.i=@codeaurora.org header.s=default header.b=RPQI6RlO; 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 S1726927AbeIYMCN (ORCPT + 99 others); Tue, 25 Sep 2018 08:02:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57638 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbeIYMCM (ORCPT ); Tue, 25 Sep 2018 08:02:12 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 536ED607DC; Tue, 25 Sep 2018 05:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537854979; bh=VBJtdc5abMID1376NKVyjQlHwtIh4KAr4awMZ/0z/+I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=akpFbhXrcKwLyveIqgTOy1NoYAC+PeJO4VZ4+mNKcuN524SgRWoUpD0ej1f376bgF Nv8GE4FxuhfAFgP3rh30UxEuV2YPStPH6rym5IWyOuPNbcG4M5BqGnYO2MMyT/Peoy G6yORPvleEGIDN9DFLb7VyqSYMaFOCy9zau1o5/s= 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-f179.google.com (mail-qk1-f179.google.com [209.85.222.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 CCBDF607DC; Tue, 25 Sep 2018 05:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537854978; bh=VBJtdc5abMID1376NKVyjQlHwtIh4KAr4awMZ/0z/+I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RPQI6RlOi3WtUIkQpZ0h/Z0ZtvD2qPM0E9JfViRliCbdzAwmU87yeoUOvQtYOHjcl 0cYQWa3xMCfCGQ18wf98dfU42rW9KP/0+n/rILrmhbfdYsPO0Qsqq9th49OT4zBvoe SgBse0GDHpXBpb7cJX9QzmuKQJf1oSU9JjtofU7g= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CCBDF607DC 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-f179.google.com with SMTP id b19-v6so12809637qkc.6; Mon, 24 Sep 2018 22:56:17 -0700 (PDT) X-Gm-Message-State: ABuFfoixEvF2zwFz8/c8BGBUTO5sVHjib+lROKhP+ar4Y8GayrHAUZFA zDSeCcsNlc12ciM71N29AQ3DLSeStdPzMlj8oEA= X-Received: by 2002:a37:c44c:: with SMTP id h12-v6mr1486652qkm.279.1537854977014; Mon, 24 Sep 2018 22:56:17 -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: Tue, 25 Sep 2018 11:26:04 +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: Robin Murphy , Will Deacon Cc: Mark Rutland , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , alex.williamson@redhat.com, Linux PM , sboyd@kernel.org, "Rafael J. Wysocki" , open list , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , "robh+dt" , linux-arm-msm , freedreno , Tomasz Figa 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 Robin, Will, On Tue, Sep 18, 2018 at 8:41 AM Vivek Gautam wrote: > > Hi Robin, > > On Fri, Sep 7, 2018 at 3:52 PM Vivek Gautam wrote: > > > > 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 > > Gentle ping. > You ack will be very helpful in letting Will pull this series for 4.20. > Thanks. I would really appreciate if you could provide your ack for this series. Or if there are any concerns, I am willing to address them. 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 -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation