Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2522957yba; Mon, 15 Apr 2019 13:31:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9VX3CWQ+uvDWwvv2saVJmCvAvnQ8knhpMICxCjh1Cesk21K9qMS/RzfTIQ+Nl+zzlax0Q X-Received: by 2002:aa7:884b:: with SMTP id k11mr77842988pfo.49.1555360286339; Mon, 15 Apr 2019 13:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555360286; cv=none; d=google.com; s=arc-20160816; b=ii7zM+XDEffohZgXXI7w3mahzJqvc4UwlGFauBzy3q3qd7Yf8mRywR0Q24ehUK1uyR j0Qt+te6wVWct526jI1DbwRdqu/2furpO3RsxalBO50syrZKeWk9W2/mFGzmd9WPXehg Hk+p4Tcau8FdgicPtH0j+UjPmjNSAFsEHzfkR7WO8cpWtilwOcXpxVYn4UiaVqJWn5zP 2JHnDDud6Q5480JtmTGtBQtV/exG0trX4W/Xc95/zb/LkeiUB8mJPs+XZghsADz7TYYc 6zQwTL9/GzegrihMPvxsskQA6WBvYc0t/WY7SDKAksVvUzscUnkafgzq8gCqaFiG5sPb 8vIQ== 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:dkim-signature; bh=iAilGUi1qcbFRDCkhdhVCDkCpGEucIwNV8bSgptQKfY=; b=BenVY3akekBW5/U/X/SSa1B1Cz1dX12tE07bAR50ZV/9GOegOwAUWQRHut+BZ5XsZ6 lhmtol206Ue3WAMPtfu/3ZLeqKYHVN+Z42FHKwej5cZFCDHlW9B++00nqcXrVPk9R2cK GHSrPEZ0JQa89DLI7v5BCW4WbsVioLqJ71xuGEGjwkLup2DiQ8gOOM5fwlSvfR+EgRD7 KsOu2CxlYfPwAmsTaSxHtNqyQ3Uw7zH8Hqo+Ua/QDc13S/bAnLaH6B9Tay4XwzgweV6q Guij5VAKS7kv8A5t58DfgNt9VnIt+ahY6hfxf32vvevV++ePf5H6RhYpGhGJKNmTHMeT 6c+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="usZ/tFmN"; 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 u70si35558837pgu.119.2019.04.15.13.31.09; Mon, 15 Apr 2019 13:31:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b="usZ/tFmN"; 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 S1730323AbfDOTHw (ORCPT + 99 others); Mon, 15 Apr 2019 15:07:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:42920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728200AbfDOTHt (ORCPT ); Mon, 15 Apr 2019 15:07:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F828218DA; Mon, 15 Apr 2019 19:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355268; bh=aRZ3aRMylXpBl/ZENBGU29JNC1NzKlwAAFnBA9GtQeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=usZ/tFmNLQnl4YL7Q3Suoapz9Wwvlk2K63tLBllIiAaV494WVPh711wMauM8cGu5x rD2JUdrqHhhXOspGdTHtm6MOHCjZFRPPvfPtSKJaLnQYrvW+awr6+SRW8EiufkMv11 tmvoi0vlrdvMNLeyl48QrwkU0KgH80nvKQjiNV+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , Thomas Gleixner , Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Lina Iyer Subject: [PATCH 4.19 073/101] genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() Date: Mon, 15 Apr 2019 20:59:11 +0200 Message-Id: <20190415183744.324123019@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Stephen Boyd commit 325aa19598e410672175ed50982f902d4e3f31c5 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- kernel/irq/chip.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1384,6 +1384,10 @@ int irq_chip_set_vcpu_affinity_parent(st 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);