Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp396284yba; Fri, 5 Apr 2019 08:47:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9yr+fuJI4H1o244LACOv4ptOb8M1WGE9ZZeGL1yhL4Ebkl/IPvdYusv23esbHscq6RHkM X-Received: by 2002:a62:6490:: with SMTP id y138mr13284521pfb.230.1554479249932; Fri, 05 Apr 2019 08:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554479249; cv=none; d=google.com; s=arc-20160816; b=PJkBYdPOJsJdy8lMWUiAcJH8DlX/OY3JTU0WGXiOhPsd+asLAXLmm0THsXhVsVPdPx wR6Ckn85KEuGsUBeMrdDXTXFpQZ79wdVaxurNJajqvqdYyxSjAqMQaDc6pzi/aZ6Y32G 1S8/ybYblNttzuxwY1qJ/Bt7OPr5v7APs7C1HFxXXVmZGaf/cjnIe+wnLgSGvFrakdRG 3aef0+42EqjpLhta+2RS0Hfn0Hbk6m5B8yiV+L7A5F8tE6rw0hGGOFL04Q36Ld0VH9G+ UlgZhNWQEmpXm8ELZ8PrL3J5bYu0Y3WSrf3vSJW79A+laTv5WaSY1w4D6JMtlZLuvJFT hkNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=6v21jqd8+qgd80gtQnD+7baNi7cd0/ZMMcNSAJgqGxg=; b=xbMYGkbKkrJ1awu7E1FJ+6b2NHKoQyxJ/xpnKl+Xg3Yk8Kh0bo8RSzsuS80Zj7tLk7 1otXID1yDcrvRqxcfSW4GDUgVhPWbVUt9CyQTpt02avWeRSYETRs/cVNYJN/kbuT4LKB mw8uZ1rz7EDtOdEh65hhNF4oiOQKsl8P5LIYWfsRF4ONqip7i7tUN1gGBoAxUIjunSeJ LkJYF0wbJWHhAY6/Fj8IMtDCiDsaErTs9LKwSx8k+7FhfGtHui6ewOMpNhGwOfonU4jj B4NLjxIjm7mzHzJGw2bT3/iW05rUpawb8iQkmlWoU9mdKmD2D63JqTENetMVbuTmai/i EoMw== 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 s34si19321694pgl.97.2019.04.05.08.47.14; Fri, 05 Apr 2019 08:47:29 -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 S1731316AbfDEPqa (ORCPT + 99 others); Fri, 5 Apr 2019 11:46:30 -0400 Received: from terminus.zytor.com ([198.137.202.136]:41185 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726643AbfDEPq3 (ORCPT ); Fri, 5 Apr 2019 11:46:29 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x35FkGRF2814777 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 5 Apr 2019 08:46:16 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x35FkG2e2814774; Fri, 5 Apr 2019 08:46:16 -0700 Date: Fri, 5 Apr 2019 08:46:16 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Stephen Boyd Message-ID: Cc: tglx@linutronix.de, swboyd@chromium.org, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, ilina@codeaurora.org, marc.zyngier@arm.com Reply-To: tglx@linutronix.de, mingo@kernel.org, swboyd@chromium.org, linux-kernel@vger.kernel.org, hpa@zytor.com, marc.zyngier@arm.com, ilina@codeaurora.org In-Reply-To: <20190325181026.247796-1-swboyd@chromium.org> References: <20190325181026.247796-1-swboyd@chromium.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/urgent] genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() Git-Commit-ID: 325aa19598e410672175ed50982f902d4e3f31c5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_03_06 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 325aa19598e410672175ed50982f902d4e3f31c5 Gitweb: https://git.kernel.org/tip/325aa19598e410672175ed50982f902d4e3f31c5 Author: Stephen Boyd AuthorDate: Mon, 25 Mar 2019 11:10:26 -0700 Committer: Thomas Gleixner CommitDate: Fri, 5 Apr 2019 17:41:41 +0200 genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() If a child irqchip calls irq_chip_set_wake_parent() but its parent irqchip has the IRQCHIP_SKIP_SET_WAKE flag set an error is returned. This is inconsistent behaviour vs. set_irq_wake_real() which returns 0 when the irqchip has the IRQCHIP_SKIP_SET_WAKE flag set. It doesn't attempt to walk the chain of parents and set irq wake on any chips that don't have the flag set either. If the intent is to call the .irq_set_wake() callback of the parent irqchip, then we expect irqchip implementations to omit the IRQCHIP_SKIP_SET_WAKE flag and implement an .irq_set_wake() function that calls irq_chip_set_wake_parent(). The problem has been observed on a Qualcomm sdm845 device where set wake fails on any GPIO interrupts after applying work in progress wakeup irq patches to the GPIO driver. The chain of chips looks like this: QCOM GPIO -> QCOM PDC (SKIP) -> ARM GIC (SKIP) The GPIO controllers parent is the QCOM PDC irqchip which in turn has ARM GIC as parent. The QCOM PDC irqchip has the IRQCHIP_SKIP_SET_WAKE flag set, and so does the grandparent ARM GIC. The GPIO driver doesn't know if the parent needs to set wake or not, so it unconditionally calls irq_chip_set_wake_parent() causing this function to return a failure because the parent irqchip (PDC) doesn't have the .irq_set_wake() callback set. Returning 0 instead makes everything work and irqs from the GPIO controller can be configured for wakeup. Make it consistent by returning 0 (success) from irq_chip_set_wake_parent() when a parent chip has IRQCHIP_SKIP_SET_WAKE set. [ tglx: Massaged changelog ] Fixes: 08b55e2a9208e ("genirq: Add irqchip_set_wake_parent") Signed-off-by: Stephen Boyd Signed-off-by: Thomas Gleixner Acked-by: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org Cc: linux-gpio@vger.kernel.org Cc: Lina Iyer Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20190325181026.247796-1-swboyd@chromium.org --- kernel/irq/chip.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 3faef4a77f71..51128bea3846 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1449,6 +1449,10 @@ int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, void *vcpu_info) int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on) { data = data->parent_data; + + if (data->chip->flags & IRQCHIP_SKIP_SET_WAKE) + return 0; + if (data->chip->irq_set_wake) return data->chip->irq_set_wake(data, on);