From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: [PATCH] genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() Date: Fri, 15 Mar 2019 13:07:59 -0700 Message-ID: <20190315200759.139479-1-swboyd@chromium.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: Sender: linux-kernel-owner@vger.kernel.org To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Lina Iyer , Marc Zyngier List-Id: linux-gpio@vger.kernel.org This function returns an error if a child interrupt controller calls irq_chip_set_wake_parent() but that parent interrupt controller has the IRQCHIP_SKIP_SET_WAKE flag. Let's return 0 for success instead because there isn't anything to do. There's also the possibility that a parent indicates that we should skip it, but the grandparent has an .irq_set_wake callback. Let's iterate through the parent chain as long as the IRQCHIP_SKIP_SET_WAKE flag isn't set so we can find the first parent that needs to handle the wake configuration. This fixes a problem on my Qualcomm sdm845 device where I'm trying to enable wake on an irq from the gpio controller that's a child of the qcom pdc interrupt controller. The qcom pdc interrupt controller has the IRQCHIP_SKIP_SET_WAKE flag set, and so does the grandparent (ARM GIC), causing this function to return a failure because the parent controller doesn't have the .irq_set_wake callback set. Cc: Lina Iyer Cc: Marc Zyngier Signed-off-by: Stephen Boyd --- kernel/irq/chip.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 3faef4a77f71..280d612ba71b 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1448,7 +1448,13 @@ 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; + for (data = data->parent_data; data; data = data->parent_data) + if (!(data->chip->flags & IRQCHIP_SKIP_SET_WAKE)) + break; + + if (!data) + return 0; + if (data->chip->irq_set_wake) return data->chip->irq_set_wake(data, on); -- Sent by a computer through tubes From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6DAFC43381 for ; Fri, 15 Mar 2019 20:08:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6CFC218A1 for ; Fri, 15 Mar 2019 20:08:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GPnrCHyv"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="cxnaaYgB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6CFC218A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jPYR2cyEwCJuTkyfW8DxJmSORsTSPAIeZ7KQyByLvd4=; b=GPnrCHyvXIR1F3 9tOsz/42ayFAH0kKo4tRCM4QzEqwFYNsq0QKKxtMNxKAIGd5X9VORnvBAYMWo8YoFB/R1NnjLxzGo nBm7394wvbnOqOnd4txIFhyos6MdTh9tPI0DA+Yh5HpIV7tZ3BWUnC+0H1201UQllQ/Yc6+SHqw4n Icopf3DNoamRhrvAVWiZKgx9mAyJZlEfgcZhkKekYewHFv+7WxNkUmbDAr+Mza+Ffob8UYWJ+SnB3 7HUr5s9hnOqqterrc1Ae/QYDB50JGM49Mf0bcS92TPtsHaqE861QV3id+BQHrpdFJpWmxlK00Q24/ irzi2A95Otv9XjJJq10Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4t7e-0007Zd-Bf; Fri, 15 Mar 2019 20:08:06 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4t7a-0007ZE-LW for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2019 20:08:04 +0000 Received: by mail-pf1-x444.google.com with SMTP id j5so7092047pfa.2 for ; Fri, 15 Mar 2019 13:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zJTJtCHTW4gN40l0qZRJ+gEBkunAEWcQrIjrIGSaUec=; b=cxnaaYgBBcKpejC5EFkzlUM5OuzOz5131423UVGdwAgD518MUgEA/on76nZbVOceFQ qNXxj534HxlKOQz90jV/fCWSzlyW2DoBY61YBvb8dhaHnmQSQbgasNkxkZmE+HmzDe5U NhUCujCDkUPF0TwHVXJ0MLDF6qNpxoBBJF1qY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zJTJtCHTW4gN40l0qZRJ+gEBkunAEWcQrIjrIGSaUec=; b=PQAnlsuGAYngVgq5dYNrXhfWbrntcZPKpf1JannSfb7WAkQDu455dmnMQmF3rpcMdz gQ8V9sDJH+S8AYFQ63TViYfAcGm0ix3xv/Zvy+hkgJxPtTeRfduuJT87UoZOnJpj3Wh+ sGXBKPIvHM0UAD2VEJhYtroadDg97ZaKvcsmq78t1/lnPTDpdMAp/29MC9qLP3rn8pgt wIsA/ywc6R3WKTmWCWuqthgmxi2Hwd9+a8Uj0XsJik2YXE+Ecp95cIHTgjDxBC2vfdqt xPC7dJSNd6wSmirN/lW2rFF3JZs7qvVxgZFNqQavMeNy3yz8L9Ohtj6AhyMlHFva6VJ2 S4Uw== X-Gm-Message-State: APjAAAWaLMUHzGAUqBBSbfDQt3Bi2Wbg4N1f4HU/Egug8jKKh9FiVNIa +k0WR/47YBvqtGhUr7iGu4boSg== X-Google-Smtp-Source: APXvYqx+uoTEcnILylmeJLMr0tqgnbguvI2GmOKclhq14KKCLYHWbEqAEqlg1sERc0negByM3xU8Vw== X-Received: by 2002:a63:2a82:: with SMTP id q124mr5139459pgq.402.1552680481392; Fri, 15 Mar 2019 13:08:01 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id f15sm3758376pfa.11.2019.03.15.13.08.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 13:08:00 -0700 (PDT) From: Stephen Boyd To: Thomas Gleixner Subject: [PATCH] genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() Date: Fri, 15 Mar 2019 13:07:59 -0700 Message-Id: <20190315200759.139479-1-swboyd@chromium.org> X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_130802_707882_B000E165 X-CRM114-Status: GOOD ( 12.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lina Iyer Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org This function returns an error if a child interrupt controller calls irq_chip_set_wake_parent() but that parent interrupt controller has the IRQCHIP_SKIP_SET_WAKE flag. Let's return 0 for success instead because there isn't anything to do. There's also the possibility that a parent indicates that we should skip it, but the grandparent has an .irq_set_wake callback. Let's iterate through the parent chain as long as the IRQCHIP_SKIP_SET_WAKE flag isn't set so we can find the first parent that needs to handle the wake configuration. This fixes a problem on my Qualcomm sdm845 device where I'm trying to enable wake on an irq from the gpio controller that's a child of the qcom pdc interrupt controller. The qcom pdc interrupt controller has the IRQCHIP_SKIP_SET_WAKE flag set, and so does the grandparent (ARM GIC), causing this function to return a failure because the parent controller doesn't have the .irq_set_wake callback set. Cc: Lina Iyer Cc: Marc Zyngier Signed-off-by: Stephen Boyd --- kernel/irq/chip.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 3faef4a77f71..280d612ba71b 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1448,7 +1448,13 @@ 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; + for (data = data->parent_data; data; data = data->parent_data) + if (!(data->chip->flags & IRQCHIP_SKIP_SET_WAKE)) + break; + + if (!data) + return 0; + if (data->chip->irq_set_wake) return data->chip->irq_set_wake(data, on); -- Sent by a computer through tubes _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel