Received: by 10.223.185.116 with SMTP id b49csp5270812wrg; Wed, 7 Mar 2018 09:01:16 -0800 (PST) X-Google-Smtp-Source: AG47ELtJLN6lszEhKCaxugzkQMwEhWgHbZGKw0Ry0eGo1DaXDZdAsWyRgtIGXCxfCycMCYoyteTB X-Received: by 2002:a17:902:b58e:: with SMTP id a14-v6mr20356984pls.76.1520442076120; Wed, 07 Mar 2018 09:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520442076; cv=none; d=google.com; s=arc-20160816; b=IUmZjxvUKKXsKchKOBGDVqXnnZ0oZwq8fPq59iWsy5C6dfC6F8QToEeGJdzC7wtAOg tdlU0nZ+gTLTcvhm+dUf/svDk3rC/1A0LrU7tqQuCAFeCZjSZK+sME1a54uobLgpoGX7 QTiqUXn4XiZ5dnNY8JsBhbiWwYlJiW/ZA7IgjqpEGLriho8clhG2HGGWHa6XGwBjX5iu SQ5S9CFK3L2Pqy6uRmvIK5w8yY0WWbfI2WfkX1WStDVqLk3nd0Dk9gWLXOKjNWBOtx79 fPHaIKpjv6/5+DmilBXIKtxh3bjTJS42geC86lUHQvV0v05w884Lu8jwhj8aE7zfC8wy B2AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=mmekN6mLj3Q375TPWTcQi5yLsfF+g0huLTwnzwqzwUs=; b=BuuAWhkFypwvVUFmhmVb1c3lldigPcqqWWLR6ZypkKyQMhJnPOnEj3EeTzNXzgtvIz fN9mgo3NOC/cLTosgOxjOQ78aO0rTzSRZoOnCwOKgvXpcBG3G1zmkxG3i9iOPCQhrL/R NuVhrojO+ODzCwuuBBLA+pcxv3YSDS0kVqLBBG2+6pErm66/HV5lolgrO67Wr/keqsBj bqQ9NCL0r4ownoAUuJ46qQ3Xftel0Z+faknYND0Xj89DZgsINa65OSMkCzg6MKaiRDjv 2aUGGR1kCEdM4L2obgsTgzDNWcPCKqzTW8sltHiqNaeod8QMvI9S0q+1P/HgemWtLvK+ Hm8w== ARC-Authentication-Results: i=1; mx.google.com; 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 p10si11601530pgn.756.2018.03.07.09.00.53; Wed, 07 Mar 2018 09:01:16 -0800 (PST) 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; 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 S934022AbeCGQ6n (ORCPT + 99 others); Wed, 7 Mar 2018 11:58:43 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54230 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933487AbeCGQ6i (ORCPT ); Wed, 7 Mar 2018 11:58:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DF8181529; Wed, 7 Mar 2018 08:58:37 -0800 (PST) Received: from [10.1.210.88] (e110467-lin.cambridge.arm.com [10.1.210.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 13F6C3F53D; Wed, 7 Mar 2018 08:58:34 -0800 (PST) Subject: Re: [PATCH v8 3/5] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device To: Tomasz Figa Cc: Vivek Gautam , Joerg Roedel , Rob Herring , Mark Rutland , "Rafael J. Wysocki" , Will Deacon , Rob Clark , "open list:IOMMU DRIVERS" , devicetree@vger.kernel.org, Linux Kernel Mailing List , jcrouse@codeaurora.org, Stephen Boyd , Sricharan R , Marek Szyprowski , Archit Taneja , linux-arm-msm References: <20180302101050.6191-1-vivek.gautam@codeaurora.org> <20180302101050.6191-4-vivek.gautam@codeaurora.org> From: Robin Murphy Message-ID: <30a2fa5e-3d8e-acb6-ab31-bec652f1be99@arm.com> Date: Wed, 7 Mar 2018 16:58:33 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/03/18 13:52, Tomasz Figa wrote: > On Wed, Mar 7, 2018 at 9:38 PM, Robin Murphy wrote: >> On 02/03/18 10:10, 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 >>> --- >>> drivers/iommu/arm-smmu.c | 96 >>> ++++++++++++++++++++++++++++++++++++++++++++---- >>> 1 file changed, 88 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c >>> index c8b16f53f597..3d6a1875431f 100644 >>> --- a/drivers/iommu/arm-smmu.c >>> +++ b/drivers/iommu/arm-smmu.c >>> @@ -209,6 +209,8 @@ struct arm_smmu_device { >>> struct clk_bulk_data *clks; >>> int num_clks; >>> + bool rpm_supported; >>> + >> >> >> Can we not automatically infer this from whether clocks and/or power domains >> are specified or not, then just use pm_runtime_enabled() as the fast-path >> check as Tomasz originally proposed? > > I wouldn't tie this to presence of clocks, since as a next step we > would want to actually control the clocks separately. (As far as I > understand, on QCom SoCs we might want to have runtime PM active for > the translation to work, but clocks gated whenever access to SMMU > registers is not needed.) Moreover, you might still have some super > high scale thousand-core systems that require clocks to be > prepare-enabled, but runtime PM would be undesirable for the reasons > we discussed before. > >> >> I worry that relying on statically-defined matchdata is just going to blow >> up the driver and DT binding into a maintenance nightmare; I really don't >> want to start needing separate definitions for e.g. "arm,juno-etr-mmu-401" >> and "arm,juno-hdlcd-mmu-401" just because one otherwise-identical instance >> within the SoC is in a separate controllable power domain while the others >> aren't. > > I don't see a reason why both couldn't just have RPM supported > regardless of whether there is a real power domain. It would > effectively be just a no-op for those that don't have one. Because you're then effectively defining "compatible" values for the sake of attaching software policy to them, rather than actually describing different hardware implementations. The fact that RPM can't do anything meaningful unless relevant clock/power aspects *are* described, however, means that we shouldn't need additional information redundant with that. Much like the fact that we don't *already* have an "arm,juno-hdlcd-mmu-401" compatible to account for those being integrated such that IDR0.CTTW has the wrong value, since the presence or not of the "dma-coherent" property already describes the truth in that regard. > IMHO the > only reason to avoid having the RPM enabled is the scalability issue > we discussed before. Yes, but that's kind of my point; in reality high throughput/minimal latency and aggressive power management are more or less mutually exclusive. Mobile SoCs with fine-grained clock trees and power domains won't have multiple 40GBe/NVMf/whatever links running flat out in parallel; conversely networking/infrastructure/server SoCs aren't designed around saving every last microamp of leakage current - even in the (fairly unlikely) case of the interconnect clocks being software-gateable at all I would be very surprised if that were ever exposed directly to Linux (FWIW I believe ACPI essentially *requires* clocks to be abstracted behind firmware). Realistically then, explicit clocks are only expected on systems which care about power management. We can always revisit that assumption if anything crazy where it isn't the case ever becomes non-theoretical, but for now it's one I'm entirely comfortable with. If on the other hand it turns out that we can rely on just a power domain being present wherever we want RPM, making clocks moot, then all the better. Robin.