Received: by 10.223.185.116 with SMTP id b49csp2634941wrg; Mon, 5 Mar 2018 06:22:01 -0800 (PST) X-Google-Smtp-Source: AG47ELus8y4KMoL/Z/PHwEM+YI3sQGHpJK6Nb3CxKklMOT65eJ/5BRAEQ5aodBfSFU5jMLbMrlOc X-Received: by 10.98.59.11 with SMTP id i11mr15592714pfa.57.1520259721038; Mon, 05 Mar 2018 06:22:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520259721; cv=none; d=google.com; s=arc-20160816; b=crL9IUMAPz+sqm+y0GK8BYjpbBVbZVZHp2Ubg+8WMpPGKnGJgVxRO6EO5m3iPxyw83 SevUkanOc9p/cEHw5f3Yk7FgUU9l6YTP+ENrbEtxqa9H8pPV2peE1J3mXNGVwvBdCxqu GtVLMJIDi0pextWNyTJX8sdZ0skpcHKYE6UNB2rbm5WdqjI0TVVt3BauNgRIvi5p11BS 22NMd46ETPB4jjvizfTjR2BD2aUXOkmUMdiCuk8UvTGDJ3UG9DsISyCqp5Ym85bWkglT ywq2X+yJdZBMQxf9d3vFN30EiK+1+xFtUC5ZPpFgj0FQqlw/5/u56PwC7bK4Q8L0Y7nC Ad+A== 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=0hzwwXrV5CMdxIH407UUEOxt9b61bHo5Zv9SaILhSUg=; b=xGLfPPqSwVroZWVL8XeS4f2vpp/a67GzgMdB4WhoyWzP1WThjUAeg1YhAMV5ekljwC Y2fQlDtTbWdA5P3b2T+VsbQCs2O8cYuBhYsqT0wIU2/OGkThrsmbyDrtni/nbJWHaxr7 dZ9K80azVF6SXi8DAosPzdaatxilrAKYf1+Deh3a//uYpmLR6dt2uXI5k8C0ynUyXz8Y wsQSpiCrzGFnbSJnmiC68HETjOb8Y7QjeT/bUVecqq328rkTwveI2oYIssjDXr3Uhqrj jlyUKUZ2MxL/Ncyt5o90iQcTqiUrcMehzfQf2JavKEDdua2NcrXykGatHZGxheLb+uZG I8/Q== 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 n15-v6si4159393pll.587.2018.03.05.06.21.46; Mon, 05 Mar 2018 06:22:01 -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 S1752131AbeCEONY (ORCPT + 99 others); Mon, 5 Mar 2018 09:13:24 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50382 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751777AbeCEONU (ORCPT ); Mon, 5 Mar 2018 09:13:20 -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 4D7B31529; Mon, 5 Mar 2018 06:13:20 -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 56F7F3F53D; Mon, 5 Mar 2018 06:13:18 -0800 (PST) Subject: Re: [RESEND PATCH v6 13/14] iommu/rockchip: Add runtime PM support To: Tomasz Figa , Jeffy Chen Cc: Linux Kernel Mailing List , Ricky Liang , simon xue , Heiko Stuebner , "open list:ARM/Rockchip SoC..." , "open list:IOMMU DRIVERS" , Joerg Roedel , "list@263.net:IOMMU DRIVERS" , Joerg Roedel , linux-arm-kernel@lists.infradead.org References: <20180301101837.27969-1-jeffy.chen@rock-chips.com> <20180301101837.27969-14-jeffy.chen@rock-chips.com> From: Robin Murphy Message-ID: <0cd81b39-ffe9-eda3-1358-13afeb2ec25b@arm.com> Date: Mon, 5 Mar 2018 14:13:16 +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 05/03/18 13:49, Tomasz Figa wrote: [...] >> @@ -518,7 +520,12 @@ static irqreturn_t rk_iommu_irq(int irq, void *dev_id) >> u32 int_status; >> dma_addr_t iova; >> irqreturn_t ret = IRQ_NONE; >> - int i; >> + int i, err, need_runtime_put; > > nit: need_runtime_put could be a bool. > >> + >> + err = pm_runtime_get_if_in_use(iommu->dev); >> + if (err <= 0 && err != -EINVAL) >> + return ret; >> + need_runtime_put = err > 0; > > Generally something must be really wrong if we end up with err == 0 > here, because the IOMMU must be powered on to signal an interrupt. The > only case this could happen would be if the IRQ signal was shared with > some device from another power domain. Is it possible on Rockchip > SoCs? If not, perhaps we should have a WARN_ON() here for such case. In general, there's almost certainly some time window between the interrupt level being latched at the GIC and the IRQ actually being taken by its target CPU, in which potentially the power could be removed and/or the clocks gated - especially if there are higher-priority IRQs pending at the same time and the racing PM call is on some other CPU. Sure, it's probably unlikely, but I wouldn't necessarily consider it completely erroneous. Robin.