From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Hunter Subject: Re: [RFC PATCH 1/2] genirq: Add runtime resume/suspend support for IRQ chips Date: Tue, 17 Nov 2015 11:57:12 +0000 Message-ID: <564B1618.10806@nvidia.com> References: <1447166377-19707-1-git-send-email-jonathanh@nvidia.com> <1447166377-19707-2-git-send-email-jonathanh@nvidia.com> <7hio56dctz.fsf@deeprootsystems.com> <5645A6F6.6020202@nvidia.com> <5649A603.6020308@nvidia.com> <5649B135.8050800@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Geert Uytterhoeven Cc: Thomas Gleixner , Kevin Hilman , Jason Cooper , Marc Zyngier , Stephen Warren , Thierry Reding , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux PM list , "Rafael J. Wysocki" List-Id: linux-tegra@vger.kernel.org Hi Geert, On 16/11/15 10:48, Geert Uytterhoeven wrote: > On Mon, Nov 16, 2015 at 11:34 AM, Jon Hunter wrote: [snip] >>> Handling it automatically needs more bookkeeping than a simple reference >>> count. >> >> So what would you suggest? Adding a pm_runtime_register_irq() API that >> would register an IRQ with the device that you want RPM to handle? Not >> sure if there is a better/easier way to handle this. > > The irqchip needs to keep track how many times request_irq() has been > called, cfr. your suggestion above. > > On the other side, the system needs to keep track how many times request_irq() > has been called for each irqchip, so it can subtract those numbers from the > irqchip's counters during suspend of the device, and re-add them during resume. > So we need at least a "struct device *" parameter for request_irq(). > devm_request_irq() already has that, but not all drivers use that. Yes that would make sense. However, I am wondering if the syscore suspend/resume operators could be used here to do something like ... pm_runtime_disable(dev); if (!pm_runtime_status_suspended(dev)) chip->irq_runtime_suspend(data); > However, I think this should be looked at into the context of "[RFD] > Functional dependencies between devices". > https://lwn.net/Articles/662205/ > https://lkml.org/lkml/2015/10/27/388 > > There can be other dependencies than interrupts between devices. > All functions using dependencies need a "struct device *" parameter to > record information. Yes I like the sound of that. That would be ideal. However, I am guessing that that is a way off at the moment ... Cheers Jon From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752304AbbKQL5W (ORCPT ); Tue, 17 Nov 2015 06:57:22 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:17825 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751469AbbKQL5T (ORCPT ); Tue, 17 Nov 2015 06:57:19 -0500 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Tue, 17 Nov 2015 03:54:51 -0800 From: Jon Hunter Subject: Re: [RFC PATCH 1/2] genirq: Add runtime resume/suspend support for IRQ chips To: Geert Uytterhoeven References: <1447166377-19707-1-git-send-email-jonathanh@nvidia.com> <1447166377-19707-2-git-send-email-jonathanh@nvidia.com> <7hio56dctz.fsf@deeprootsystems.com> <5645A6F6.6020202@nvidia.com> <5649A603.6020308@nvidia.com> <5649B135.8050800@nvidia.com> CC: Thomas Gleixner , Kevin Hilman , Jason Cooper , Marc Zyngier , Stephen Warren , Thierry Reding , "linux-kernel@vger.kernel.org" , , Linux PM list , "Rafael J. Wysocki" Message-ID: <564B1618.10806@nvidia.com> Date: Tue, 17 Nov 2015 11:57:12 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.21.132.123] X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On 16/11/15 10:48, Geert Uytterhoeven wrote: > On Mon, Nov 16, 2015 at 11:34 AM, Jon Hunter wrote: [snip] >>> Handling it automatically needs more bookkeeping than a simple reference >>> count. >> >> So what would you suggest? Adding a pm_runtime_register_irq() API that >> would register an IRQ with the device that you want RPM to handle? Not >> sure if there is a better/easier way to handle this. > > The irqchip needs to keep track how many times request_irq() has been > called, cfr. your suggestion above. > > On the other side, the system needs to keep track how many times request_irq() > has been called for each irqchip, so it can subtract those numbers from the > irqchip's counters during suspend of the device, and re-add them during resume. > So we need at least a "struct device *" parameter for request_irq(). > devm_request_irq() already has that, but not all drivers use that. Yes that would make sense. However, I am wondering if the syscore suspend/resume operators could be used here to do something like ... pm_runtime_disable(dev); if (!pm_runtime_status_suspended(dev)) chip->irq_runtime_suspend(data); > However, I think this should be looked at into the context of "[RFD] > Functional dependencies between devices". > https://lwn.net/Articles/662205/ > https://lkml.org/lkml/2015/10/27/388 > > There can be other dependencies than interrupts between devices. > All functions using dependencies need a "struct device *" parameter to > record information. Yes I like the sound of that. That would be ideal. However, I am guessing that that is a way off at the moment ... Cheers Jon