Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1603987imm; Fri, 7 Sep 2018 03:10:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYM8czOn2/uChhnp1yw6sKxVLgw6OUpZivjvQVsonZnRrIGyx3QYflylled0N7D6fExhGJQ X-Received: by 2002:a63:5419:: with SMTP id i25-v6mr7386634pgb.345.1536315051039; Fri, 07 Sep 2018 03:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536315051; cv=none; d=google.com; s=arc-20160816; b=i/3dI6Hgah0M6dAceOqP7wT2WTZ9oVQ/DWJID+rLBq34EJMfbj7NOdCDbp79fb44JY 7Ya7k803iV/nNufSYWEdhx4bB4dOa8gqj+Rvl2u5MitfOhxwiypoKCtBf0UOB3bKIWOJ cL5w7mCuaXmoQ5GIJhwq40H2YebaIXhA5IU3fo8qMhqMw8f3t+P5p4p4pNNTCdADOQTL LzRFZqA2QqWkmrV+JmkiwgEWhPzPDrPkTNQbUWfOki5GQCMs5WNO00lekTwbs6B05q9V a/QMoJ2JKXdiRo1n0zwL5BHexPi4tgWhoG1zBuWZw7JMqJNmMWmmc1BfWn2f5Xl4FFV6 xQHA== 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; bh=wCTcRtKIKYnWBEwtSRALgT5bHp8nI4YE6AY85VqxoxM=; b=k3c0/YnM6ua85EI5DVjZNfYnVhFCGsJ85BSKcA/0Biw3zmYqzFzsMos874jDom49yM Fn1Mf6b/MrzebsSRIdNjRrp4GNeSQKcENJX6Er+wpcROwLd/L0fHoaAU/HgPx50v3n/M Cqa4ie74x/az+xgC+CwtpHu+kjCS/JpLeQH1tQ+fWgrzfGUVxoD3K5zWRs8xak8NS9gl JBfkKRLdxhCNG25ZUkNvwBGVZyH7Lty7wM9X8ScVlrk82T8bGicCt1AAevD0UE9hhFvt SBsXA7DsHgIhypK6d6saN/vJ1WnHb8ewx9x7Fr7Gx3k8/EOSelembAS9M86324sp5Amt DeTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="VZcJ/+h2"; 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 z9-v6si8193135pfg.46.2018.09.07.03.10.35; Fri, 07 Sep 2018 03:10:50 -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="VZcJ/+h2"; 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 S1728619AbeIGOca (ORCPT + 99 others); Fri, 7 Sep 2018 10:32:30 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:36865 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727686AbeIGOca (ORCPT ); Fri, 7 Sep 2018 10:32:30 -0400 Received: by mail-yw1-f66.google.com with SMTP id x83-v6so5184593ywd.4 for ; Fri, 07 Sep 2018 02:52:20 -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=wCTcRtKIKYnWBEwtSRALgT5bHp8nI4YE6AY85VqxoxM=; b=VZcJ/+h2Psh8AXDQ+nyiy7e2Ark7ARYv5uHFVwndput7eLhDaw5ZO4AXkKCae7dXGk gHnVBxJMO29ecVODFq9qpsfkCCwvO8snIUPc8kJ+xU42HCqI2Gpiy1q0fTeTur/6rcuO Z+NvG3RTDZCpZ/2O/oHEvrbRHIPwUosQKzZAw= 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=wCTcRtKIKYnWBEwtSRALgT5bHp8nI4YE6AY85VqxoxM=; b=PPHE7yEnhKDiB0ND2wBAlO7qw4DFVM4NePFgSq0p6aUv4reYD3Kll0hWR7xEVuBnFQ wM8pIHDvOw+zWcGIoIjtGMIiUX7tCoNMNd2IpZ3fCDyEqmwJUAiVr9dS2ZAjfB4Fn2IX bMMMcpQJjEk+rcgaESMY6iEecfC/AmxeagOtJH56L/0FvKrN6P9cwh+bSBiyZklprB7G 8/OBpTgd2sMfpezuvWUFNcnVCfAuCUY7IQktKPP3R5XroPb1NrRz9pqU687SW5cJAQla ZLQgJ9apy9o7g0KgiffNtV14vazDI/fomMYIFDGUVTYL1aujucuDMutur05Xg3I3+k4d fbyw== X-Gm-Message-State: APzg51DMV1SH6Qt2SK6ZnU9uq1cEQIex7oJjQlPzeXEFxcsWBFfjMoaG EJ+f1R/FvuY1SG95LEmM6OBHuqSZphICfw== X-Received: by 2002:a0d:ef01:: with SMTP id y1-v6mr3652489ywe.498.1536313940116; Fri, 07 Sep 2018 02:52:20 -0700 (PDT) Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com. [209.85.219.169]) by smtp.gmail.com with ESMTPSA id o63-v6sm2464161ywc.36.2018.09.07.02.52.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 02:52:19 -0700 (PDT) Received: by mail-yb1-f169.google.com with SMTP id t10-v6so5253012ybb.1 for ; Fri, 07 Sep 2018 02:52:18 -0700 (PDT) X-Received: by 2002:a25:acc6:: with SMTP id x6-v6mr485337ybd.293.1536313938375; Fri, 07 Sep 2018 02:52:18 -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: <3ccc3690-dc9d-56e7-e2d1-62e73a189bff@codeaurora.org> From: Tomasz Figa Date: Fri, 7 Sep 2018 18:52:07 +0900 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: Vivek Gautam Cc: "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Rob Herring , Robin Murphy , Will Deacon , devicetree@vger.kernel.org, Linux Kernel Mailing List , Alex Williamson , Mark Rutland , "Rafael J. Wysocki" , Rob Clark , Linux PM , freedreno , sboyd@kernel.org, jcrouse@codeaurora.org, Sricharan R , Marek Szyprowski , Archit Taneja , linux-arm-msm 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 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. Best regards, Tomasz