Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp879959yba; Wed, 24 Apr 2019 11:05:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjeqovsmRMoqsl90Q8F6NI1Ed5BCfvlweIn48qdYoqa4YsGBuAAALc64KXhHVSrw2KcCpp X-Received: by 2002:a17:902:e793:: with SMTP id cp19mr28060904plb.65.1556129146104; Wed, 24 Apr 2019 11:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556129146; cv=none; d=google.com; s=arc-20160816; b=keAO0Pv+Q2Z2kWm248gEYVZDKo7jn0SexB4kgZg9QTZ6sv+KcnDNq0B/6EsDcgcFKe WENvXnNv/0AlBJnVMydMq4H9jDgC75Ej4JHLmttXzsUvipeX/Sod4wnsv3gASz2GogBT 6xGVfZb/Qy+1UgGhEcWTr35jzap0CsXvU4GReP+2+FDN9BE08EB2TpRFme+rFYBLVsLE 5iJP4hJvUdObsb76kvRUpXTqF+VBfNBm17MwJ9jkRTVni+4f68/GaM5VwIFPzkmMFsdo JL2hhIBTX7NiQXEE/F5UyRV700lz5LvfCBM0ibVdXbrOMM8nZ1bbxzMjGDsoCoUXQfpL 6V/w== 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=qqMbiSyMbKbzv1UGfKtggS8ItPCpSAcDTyjlhWgngp4=; b=RkDNGkq59gxZqnBdSNOwN+uGkYpi7w/LdbWWBeC6924l5Vn4Ni9++m3rGq+NFJ0MRX xeFM9LlggxIb6w8Iig+ylxh6tAds56sM30cJLfhCNNUv6YZCDGNd3o/ksZIL3tkUAiv/ E/x4ce2hBRni6iQhrombtBhWDgSz4EjLbe1UW+gNHpvWur/6cznFCyR9dn/pyILoBwwG DSdJ8l47jiF5yAxtymKv2PVMnVUctRj376368XKr4XetgPMhVrOFu+cQa30dixCOiqst xSyXal/oCJmn7iqLWI0R6+F+xdQEhewdk9C6sYkHy/O+Wel5RKPSAtK7gAbBhNhlHw6h B4pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="v1HGGji/"; 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 p22si18357345pgi.449.2019.04.24.11.05.30; Wed, 24 Apr 2019 11:05:46 -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="v1HGGji/"; 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 S2389552AbfDXSDz (ORCPT + 99 others); Wed, 24 Apr 2019 14:03:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731186AbfDXRTl (ORCPT ); Wed, 24 Apr 2019 13:19:41 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (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 9047021905; Wed, 24 Apr 2019 17:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556126380; bh=HJmkoGsfEJtz4NOiF3IYf4wBdwNYC3Njq2u556qpVuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v1HGGji/ol3B6kZhynrQWizNzje+dJ6/yC/1NdQqr9fN7wFUEORCqV4w2pD6miGR3 Ui4glppRjZARUdDiRBIvbihbiYgkcAEMXPFjt+x1CuvtLyCNovcbNobyLd1Qhyj+OT tlfNY8MI1kOQtfNEAKXyl+mJEvtfd51gsFI4NI3k= 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.4 091/168] genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() Date: Wed, 24 Apr 2019 19:08:55 +0200 Message-Id: <20190424170929.132107872@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170923.452349382@linuxfoundation.org> References: <20190424170923.452349382@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 @@ -1056,6 +1056,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);