Received: by 10.223.185.116 with SMTP id b49csp3645939wrg; Tue, 13 Feb 2018 05:39:05 -0800 (PST) X-Google-Smtp-Source: AH8x227AxmD8TABcW9Qc2vsDTLGXd/v/iXDTRLlAW5rvzQUvc+Ue5ac/luS+8us9n2VF1v6ydiKp X-Received: by 10.101.73.12 with SMTP id p12mr1063236pgs.442.1518529145272; Tue, 13 Feb 2018 05:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518529145; cv=none; d=google.com; s=arc-20160816; b=tOP9nys/8jl57wX4eDlJsz1Mz97f3aarW0PlCSF/muA9unU/6BsPBDkCBt49jzJ8xN IgBAfP2isWdc5qEBD9OaeuHayPrlDqugbWlqQQPPxxMR206VlhUowMt8LWWXyOTDZeEZ rMaCbpkLobsg5NtzZT//yyE2pjKhJy8ulHa6ECKc9tBQk2ezfvdd1tVDiOfkL/xPBExY sJuc12z7RTghCZi5evNoPIyyEUhxVlqFLW3xJd7vShZbshrMJEJJvqAuRv+TotkB4VTt Jf5DeSiCVVHM8wNN0SoV9yxmNoJ1EYtphzG3rUkEN40ULTqOq9Zrs2si+Ug3b0fsDPmS cVpQ== 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=833oXPNEmIsSVMHQE0CCUoiZ779UX0dXuR5ReiR4wwk=; b=oMKK5H/fHaq1jDvp6xh1tPvDJwC9OmVVSba773K0zZAWyU2txLXR3I4ehxI8V2qnYd NSRQAM0mJliYNk5mtZq5IPGA9UuGNfX9K5Rn9KgNo3eHnbEZDZK1u6E6UzREMq5xLqKZ Pdd62ktqoMKhtnkE8NMnr5zmn4SyBWeYbefy4VrblMaR/z0GbdTruvwhgP1qfYEgzixR r48RJ3X8CunsTbSYdnqKwphv8yq1N5hTr9SADy62taPbuE+fNyJhPRpLZWqTEX4KfUUs 1xn5r+94HsF7gMKyEofTiff37fpTKLXilShJZsVJ6maA5zyTJizWUtpT65qB+oUQ2h5e YEWw== 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 j61-v6si7442758plb.108.2018.02.13.05.38.50; Tue, 13 Feb 2018 05:39:05 -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 S965047AbeBMNhr (ORCPT + 99 others); Tue, 13 Feb 2018 08:37:47 -0500 Received: from foss.arm.com ([217.140.101.70]:57676 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964846AbeBMNho (ORCPT ); Tue, 13 Feb 2018 08:37:44 -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 5013D1529; Tue, 13 Feb 2018 05:37:43 -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 39CD23F487; Tue, 13 Feb 2018 05:37:40 -0800 (PST) Subject: Re: [PATCH v7 1/6] base: power: runtime: Export pm_runtime_get/put_suppliers To: Tomasz Figa Cc: Vivek Gautam , "list@263.net:IOMMU DRIVERS" , Joerg Roedel , Rob Herring , Mark Rutland , "Rafael J. Wysocki" , Will Deacon , Rob Clark , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel , freedreno@lists.freedesktop.org, David Airlie , Greg KH , sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org References: <1517999482-17317-1-git-send-email-vivek.gautam@codeaurora.org> <1517999482-17317-2-git-send-email-vivek.gautam@codeaurora.org> <65d707c0-76cc-d59e-ff18-1fdd89306900@arm.com> From: Robin Murphy Message-ID: Date: Tue, 13 Feb 2018 13:37:38 +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 13/02/18 12:54, Tomasz Figa wrote: > On Tue, Feb 13, 2018 at 9:00 PM, Robin Murphy wrote: >> On 13/02/18 07:44, Tomasz Figa wrote: >>> >>> Hi Vivek, >>> >>> On Wed, Feb 7, 2018 at 7:31 PM, Vivek Gautam >>> wrote: >>>> >>>> The device link allows the pm framework to tie the supplier and >>>> consumer. So, whenever the consumer is powered-on the supplier >>>> is powered-on first. >>>> >>>> There are however cases in which the consumer wants to power-on >>>> the supplier, but not itself. >>>> E.g., A Graphics or multimedia driver wants to power-on the SMMU >>>> to unmap a buffer and finish the TLB operations without powering >>>> on itself. >>> >>> >>> This sounds strange to me. If the SMMU is powered down, wouldn't the >>> TLB lose its contents as well (and so no flushing needed)? >> >> >> Depends on implementation details - if runtime PM is actually implemented >> via external clock gating (in the absence of fine-grained power domains), >> then "suspended" TLBs might both retain state and not receive invalidation >> requests, which is really the worst case. > > Agreed. That's why in "[PATCH v7 3/6] iommu/arm-smmu: Invoke > pm_runtime during probe, add/remove device" I actually suggested > managing clocks separately from runtime PM. At least until runtime PM > framework arrives at a state, where multiple power states can be > managed, i.e. full power state, clock-gated state, domain-off state. > (I think I might have seen some ongoing work on this on LWN though...) > >> >>> Other than that, what kind of hardware operations would be needed >>> besides just updating the page tables from the CPU? >> >> >> Domain attach/detach also require updating SMMU hardware state (and possibly >> TLB maintenance), but don't logically require the master device itself to be >> active at the time. > > Wouldn't this hardware state need to be reinitialized anyway after > respective power domain power cycles? (In other words, hardware would > only need programming if it's powered on at the moment.) Yes, if the entire SMMU was fully powered down because all masters were inactive, then all that should need to be done is to update the software shadow state in the expectation that arm_smmu_reset() would re-sync it upon TCU powerup. If at least some part of the internal logic remains active, though, then you may or may not need to fiddle with zero or more clocks and/or power domains (depending on microarchitecture and integration) in order to be sure that everything from the programming slave interface through to wherever that state is kept works correctly so that it can be changed. The main motivation here is that the Qualcomm SMMU microarchitecture apparently allows the programming interface to be shut down separately from the TCU core (context banks, page table walker, etc.), and they get an appreciable power saving from doing so. This is different from, say, the Arm Ltd. implementations, where the entire TCU is a single clock/power domain internally (although you could maybe still gate the external APB interface clock). As the previous discussions have shown, this is really, really hard to do properly in a generic manner. Robin.