{"id":810986,"url":"http://patchwork.ozlabs.org/api/patches/810986/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/1504784522-26841-6-git-send-email-yamada.masahiro@socionext.com/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504784522-26841-6-git-send-email-yamada.masahiro@socionext.com>","list_archive_url":null,"date":"2017-09-07T11:42:01","name":"[v4,5/6] irqdomain: add IRQ_DOMAIN_FLAG_NO_CREATE flag","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c0baf99744b85da77f71359812a5cc5ea5e9e1e7","submitter":{"id":65882,"url":"http://patchwork.ozlabs.org/api/people/65882/?format=json","name":"Masahiro Yamada","email":"yamada.masahiro@socionext.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/1504784522-26841-6-git-send-email-yamada.masahiro@socionext.com/mbox/","series":[{"id":1983,"url":"http://patchwork.ozlabs.org/api/series/1983/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=1983","date":"2017-09-07T11:41:57","name":"irqdomain, gpio: expand irq_domain_push_irq() for DT use and use it for GPIO","version":4,"mbox":"http://patchwork.ozlabs.org/series/1983/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810986/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810986/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-gpio-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-gpio-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=nifty.com header.i=@nifty.com\n\theader.b=\"v+mfaEEj\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnzDS2ZwMz9t2W\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 21:46:00 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755114AbdIGLp3 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 7 Sep 2017 07:45:29 -0400","from conuserg-09.nifty.com ([210.131.2.76]:17251 \"EHLO\n\tconuserg-09.nifty.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1755223AbdIGLn7 (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Thu, 7 Sep 2017 07:43:59 -0400","from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp\n\t[153.142.97.92]) (authenticated)\n\tby conuserg-09.nifty.com with ESMTP id v87BgcP3021413;\n\tThu, 7 Sep 2017 20:42:45 +0900"],"DKIM-Filter":"OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v87BgcP3021413","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com;\n\ts=dec2015msa; t=1504784566;\n\tbh=X/I1RnU3Gpzzhqg3pT6YB/0pqxY8xpqZMXsz/E2FYa4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=v+mfaEEjEDASsoAlytN+uZbu7QfE3gxL7g6ZMN8YCQN5qbiQ/l9HTLL51oQAdXLMT\n\tb/aPPOxpSFMGrFUAXVc4I6lLT+sKvrzLrtKDVoe2qZ6B4QBa9Y/xodLq7yQ1CWgW9v\n\tHuQciynbixVNGknv8KEKl4IWEFYX6LbzffiZNco/GZqurQBjk/CD7H6/ft/YoH8Oy8\n\tNdg9RLjzPXmjNAUb8yOX/8QQnrxiGY5hX5mtey3vFQfR8y7Qmkm5AaslQZ+TU1tjCW\n\t/dOJVS0TjS3Z84hJIwu327cqF2vNHZhVP3GSoCaQNBpSL+aCM+jpuO3KOCTa9TLZZi\n\tR8pM5/2iTLWDQ==","X-Nifty-SrcIP":"[153.142.97.92]","From":"Masahiro Yamada <yamada.masahiro@socionext.com>","To":"Marc Zyngier <marc.zyngier@arm.com>,\n\tThomas Gleixner <tglx@linutronix.de>,\n\tLinus Walleij <linus.walleij@linaro.org>,\n\tlinux-gpio@vger.kernel.org, Rob Herring <robh+dt@kernel.org>","Cc":"Jassi Brar <jaswinder.singh@linaro.org>,\n\tdevicetree@vger.kernel.org, Jason Cooper <jason@lakedaemon.net>,\n\tMasami Hiramatsu <mhiramat@kernel.org>,\n\tDavid Daney <david.daney@cavium.com>,\n\tMasahiro Yamada <yamada.masahiro@socionext.com>,\n\tlinux-kernel@vger.kernel.org","Subject":"[PATCH v4 5/6] irqdomain: add IRQ_DOMAIN_FLAG_NO_CREATE flag","Date":"Thu,  7 Sep 2017 20:42:01 +0900","Message-Id":"<1504784522-26841-6-git-send-email-yamada.masahiro@socionext.com>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1504784522-26841-1-git-send-email-yamada.masahiro@socionext.com>","References":"<1504784522-26841-1-git-send-email-yamada.masahiro@socionext.com>","Sender":"linux-gpio-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-gpio.vger.kernel.org>","X-Mailing-List":"linux-gpio@vger.kernel.org"},"content":"When an irqchip driver uses irq_domain_push_irq(), all irqs should be\nstatically created by the irqchip.\n\nIf a device tries to allocate an irq on-the-fly, irq_domain_alloc_irqs()\nis called.  It allocates struct irq_data and invokes .alloc() hook\npassing fwspec as its argument.  This is probably not what the irqchip\nexpects (unless .alloc can call it recursively).\n\nThis issue could happen when a device tries to get irq after\nirq_domain_create_hierarchy(), but before irq_domain_push_irq().\n\nTo avoid the race, add IRQ_DOMAIN_FLAG_NO_CREATE flag.  This flag\nprevents devices from creating irqs.  Devices are only allowed to get\nalready existing irqs.\n\nSigned-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>\n---\n\nChanges in v4:\n  - Newly added\n\n\n include/linux/irqdomain.h | 3 +++\n kernel/irq/irqdomain.c    | 3 +++\n 2 files changed, 6 insertions(+)","diff":"diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h\nindex 7609807..525de32 100644\n--- a/include/linux/irqdomain.h\n+++ b/include/linux/irqdomain.h\n@@ -195,6 +195,9 @@ enum {\n \t/* Irq domain name was allocated in __irq_domain_add() */\n \tIRQ_DOMAIN_NAME_ALLOCATED\t= (1 << 6),\n \n+\t/* Do not allow irq consumers to create irq */\n+\tIRQ_DOMAIN_FLAG_NO_CREATE\t= (1 << 7),\n+\n \t/*\n \t * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved\n \t * for implementation specific purposes and ignored by the\ndiff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c\nindex b317a64..ecf107ab 100644\n--- a/kernel/irq/irqdomain.c\n+++ b/kernel/irq/irqdomain.c\n@@ -806,6 +806,9 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)\n \t\treturn 0;\n \t}\n \n+\tif (domain->flags & IRQ_DOMAIN_FLAG_NO_CREATE)\n+\t\treturn -EPROBE_DEFER;\n+\n \tif (irq_domain_is_hierarchy(domain)) {\n \t\tvirq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, fwspec);\n \t\tif (virq <= 0)\n","prefixes":["v4","5/6"]}