Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp394896imm; Wed, 11 Jul 2018 04:31:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdF2muiA4QyIq66RAzfwh9Ryio9vKGH/HLSVMNcZ2MvzgHeGfop76+ajlm1Wy0+quaLw7UP X-Received: by 2002:a17:902:d716:: with SMTP id w22-v6mr28257735ply.98.1531308683035; Wed, 11 Jul 2018 04:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308683; cv=none; d=google.com; s=arc-20160816; b=R3KiJJct1wOFM/O+gjg2UXbBBz+QrPoG5o80giTgTi83tLpjnBfHrbTwd1Pkj3XRex KOB+SRmme2X4gKPUITueRcvowxuQNUjrFde9gcyxm9lRAP8h1np5163FwUCYRswhTY7l ItjeSRa/CkXCbPO7RemZGqoK536l31H10vt05kSKgjVWFhhphbNI4HYNytA1TVTCDLGw jaPq6sBh6NTYGB8pCC2yuG7FV2Uxq3b07zeBFoi4fuponeizRBqv9Zz6fCuN3cu41Hx1 tVxzY6i2f/uXQZ8psXUKtjBvKyVPQjZ7Pq6Qa774hvb1oi5QRv/IDAyWeH/15W+HTZ8B ax9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=FBxT8LkyA1r+Cj2WygDf2YRlY3mJmK2mbPrqwlhdWSY=; b=NYCghTyGvWvymFq46RhJ7H/Z9Wz4rG0e7HoUgAtILHOiTKrO/ML4exKRFYE3bx9o+F h410R50aHonoI8Y71HMJtKShsq3g+QxIRAR7mLZI6/M5yU8GWPuE8lv3N5Mt0l7tejJO Lm9fa+Guc1MShZVoYCvBttcXzge3dmecUk97AuneMyw9lCfhcuArqhyXFg9Aaqu7DPmh cuE5+cLk+TgZFU/V/w1LqozqaKX9ARR53gccaalau44w8d2M4XfIPR0CSbFznbsFVa5X uGvLDo6XiQa7fs8DK+TEuYtnLXMtA6zZ4A2m7HP/2brzvdYGoqN/mhT/mXo5ytdbgXSI skMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=bPNLzztD; dkim=pass header.i=@codeaurora.org header.s=default header.b=hpTKTLu1; 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 15-v6si13620008pgu.205.2018.07.11.04.31.07; Wed, 11 Jul 2018 04:31:22 -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=bPNLzztD; dkim=pass header.i=@codeaurora.org header.s=default header.b=hpTKTLu1; 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 S1733142AbeGKLeU (ORCPT + 99 others); Wed, 11 Jul 2018 07:34:20 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57916 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733118AbeGKLeT (ORCPT ); Wed, 11 Jul 2018 07:34:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F2E0E60B7A; Wed, 11 Jul 2018 11:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531308625; bh=j8/TrVMkZ7n8Rj7zySqVAR6Uato/8p+hSyte8EpAYhI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bPNLzztDQutdoOXM+K3RGiTVm7rjWE+1CETqj0MkFOGyLMMloev3g7VzJupww4c5E 6cYdLceZy2yiVHFW1zs3e3RdQHm7yBOFzyMwkSxW200ylRpZN9GZnHCu07vDzy5eJj 9s7tk6VQNArpmLnFTcK3kNwxEXizseaFSJVRw45Y= 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 [10.79.40.147] (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (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 0753460274; Wed, 11 Jul 2018 11:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531308623; bh=j8/TrVMkZ7n8Rj7zySqVAR6Uato/8p+hSyte8EpAYhI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=hpTKTLu12QwTBG7R4gOfOPvJX9bZb8XtwxH2XWOtuaW+r3wYpKBAVIXt5Dj0B7h14 XplBS8Un4zC3gfQdzC18wJdTz/8684a394gLJH1U4thE6dAye0qXUhXrOLZObVLa9f UdeZhddI3aRhoTC2sqYzCT0CnGpvfvcOb6Ke6BF4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0753460274 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 Subject: Re: [PATCH v12 2/4] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device To: "Rafael J. Wysocki" , Tomasz Figa Cc: "Rafael J. Wysocki" , "list@263.net:IOMMU DRIVERS" , Joerg Roedel , joro@8bytes.org, Rob Herring , Mark Rutland , Robin Murphy , Will Deacon , "list@263.net:IOMMU DRIVERS" , Joerg Roedel , iommu@lists.linux-foundation.org, "devicetree@vger.kernel.org" , Linux Kernel Mailing List , Alex Williamson , Rob Clark , Linux PM , freedreno , Stephen Boyd , Sricharan R , Marek Szyprowski , Archit Taneja , linux-arm-msm , jcrouse@codeaurora.org References: <20180708173413.1965-1-vivek.gautam@codeaurora.org> <20180708173413.1965-3-vivek.gautam@codeaurora.org> <1694664.FhRBrgajmF@aspire.rjw.lan> From: Vivek Gautam Message-ID: <1bc641d5-a5d0-e459-57cf-07b6b7e055f4@codeaurora.org> Date: Wed, 11 Jul 2018 17:00:14 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/11/2018 4:29 PM, Rafael J. Wysocki wrote: > On Wed, Jul 11, 2018 at 12:05 PM, Tomasz Figa wrote: >> Hi Rafael, >> >> Thanks for review. >> >> On Wed, Jul 11, 2018 at 6:53 PM Rafael J. Wysocki wrote: >>> On Sunday, July 8, 2018 7:34:11 PM CEST 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 >>>> --- >>>> >>>> - Change since v11 >>>> * Replaced pm_runtime_disable() with pm_runtime_force_suspend() >>>> to avoid warning about " Unpreparing enabled clock". >>>> Full warning text mentioned in cover patch. >>>> >>>> drivers/iommu/arm-smmu.c | 92 +++++++++++++++++++++++++++++++++++++++++++----- >>>> 1 file changed, 84 insertions(+), 8 deletions(-) >>>> >>>> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c >>>> index a01d0dde21dd..09265e206e2d 100644 >>>> --- a/drivers/iommu/arm-smmu.c >>>> +++ b/drivers/iommu/arm-smmu.c >>>> @@ -268,6 +268,20 @@ static struct arm_smmu_option_prop arm_smmu_options[] = { >>>> { 0, NULL}, >>>> }; >>>> >>>> +static inline int arm_smmu_rpm_get(struct arm_smmu_device *smmu) >>>> +{ >>>> + if (pm_runtime_enabled(smmu->dev)) >>> Why do you need the pm_runtime_enabled() checks here and below? >>> >>> pm_runtime_get_sync() and pm_runtime_put() should work just fine if >>> runtime PM is not enabled. >> Because pm_runtime_get_sync() acquires a spin lock, even if only for >> the short time of checking if runtime PM is enabled and SMMU driver >> maintainers didn't want any spin locks in certain IOMMU API code paths >> on hardware implementations that don't need runtime PM, while we still >> need to be able to control runtime PM there on hardware >> implementations that need so. > OK, so it is an optimization. It would be good to put a comment in > there to that effect. Yea, actually there's a comment placed in arm_smmu_device_probe()  where the runtime PM is conditionally enabled. I can add comments for these wrappers too if you would like. Thanks & Regards Vivek