Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp725469imm; Thu, 13 Sep 2018 06:53:19 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYldvkaaEKGnpAyU+96t+12HQClt657xXSc6Y4G6aAc+JljGzkn1tbcbW1zFQjGIytp1c2V X-Received: by 2002:a62:174a:: with SMTP id 71-v6mr7701088pfx.217.1536846799621; Thu, 13 Sep 2018 06:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846799; cv=none; d=google.com; s=arc-20160816; b=FfsYIyaMeSeKMvaBlhbHOeo41j9+bn3GwBRsR7wBUXoy5Y6/Fof56vxFoOUi6nUsCE WdfImmgqN90jVTn4Og0u1o5UaOeNcxMystUW3X7zkCcyfZSPKUnqOZkoXYO4i5YciPSu QXWCAPr9ixnX4cW6hc3jt1Uej2ovumDnkfgBTRUT+r3m0ke0vlDPiTMMVPkUSdjfN4HR UKXjFJnM2bdqPR9dl8TJexH73er8FMczgwKnTwFCZBbutlQxpSkyqnSLFIUgTxDdDVfg 9jFJ6i8qgLPGwXNy4FrGg2h/kY2v9CUZTPRTd5VxS4h42jb9FznFT+5HgfI3AIPXjNuW JKZg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=b4JbGAAoVHnX5+1CKLIJK1jgRy3+O0Ffq2mRVtmzGh0=; b=sDgvbbqxpM6sDR2vYLha4opSOrYDUHbG5ptQ8qwTNDr60mKf+cXjuczaGkf2O8jUwW O5WU6R6lyEW6sZiX4oEzk5bz7ujRBge+niNMa9fOdk52LzlHvnfIcjJMs2g4vSyPsFyj 5wlncELIzzaRAG8/eNEKzy90Sasg3Hr98/00laPG2kO04wSkRSW6OEZ3k+NQptb+6yTt V88uFmaGAdQ6nL0DKIeNGtXrVPERvmSU33pqLt4Aj/Uj66sTUkI9DAdxFfmQD5gon/eP zBz6zTA9ArCZaaH3QGBOEYpvqgd0Tc0hHgCxYuF58tO3cFmM5w7CtwoEfSlt1MocsT90 v/BA== 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 j125-v6si4023748pfc.243.2018.09.13.06.53.04; Thu, 13 Sep 2018 06:53:19 -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; 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 S1731046AbeIMTCb (ORCPT + 99 others); Thu, 13 Sep 2018 15:02:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33592 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730051AbeIMTCa (ORCPT ); Thu, 13 Sep 2018 15:02:30 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3A07FD19; Thu, 13 Sep 2018 13:52:55 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Marc Zyngier , Olof Johansson , Sasha Levin Subject: [PATCH 4.18 046/197] iommu/rockchip: Move irq request past pm_runtime_enable Date: Thu, 13 Sep 2018 15:29:55 +0200 Message-Id: <20180913131843.388158321@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier [ Upstream commit 1aa55ca9b14af6cfd987ce4fdaf548f7067a5d07 ] Enabling the interrupt early, before power has been applied to the device, can result in an interrupt being delivered too early if: - the IOMMU shares an interrupt with a VOP - the VOP has a pending interrupt (after a kexec, for example) In these conditions, we end-up taking the interrupt without the IOMMU being ready to handle the interrupt (not powered on). Moving the interrupt request past the pm_runtime_enable() call makes sure we can at least access the IOMMU registers. Note that this is only a partial fix, and that the VOP interrupt will still be screaming until the VOP driver kicks in, which advocates for a more synchronized interrupt enabling/disabling approach. Fixes: 0f181d3cf7d98 ("iommu/rockchip: Add runtime PM support") Reviewed-by: Heiko Stuebner Signed-off-by: Marc Zyngier Signed-off-by: Olof Johansson Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/rockchip-iommu.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1161,17 +1161,6 @@ static int rk_iommu_probe(struct platfor if (iommu->num_mmu == 0) return PTR_ERR(iommu->bases[0]); - i = 0; - while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) { - if (irq < 0) - return irq; - - err = devm_request_irq(iommu->dev, irq, rk_iommu_irq, - IRQF_SHARED, dev_name(dev), iommu); - if (err) - return err; - } - iommu->reset_disabled = device_property_read_bool(dev, "rockchip,disable-mmu-reset"); @@ -1228,6 +1217,19 @@ static int rk_iommu_probe(struct platfor pm_runtime_enable(dev); + i = 0; + while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) { + if (irq < 0) + return irq; + + err = devm_request_irq(iommu->dev, irq, rk_iommu_irq, + IRQF_SHARED, dev_name(dev), iommu); + if (err) { + pm_runtime_disable(dev); + goto err_remove_sysfs; + } + } + return 0; err_remove_sysfs: iommu_device_sysfs_remove(&iommu->iommu);