Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp549196oof; Tue, 25 Sep 2018 01:12:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV60SBNIW80Uti6pl+HpybsGv5dDO/FYj2HIDjxtFbFYe/cjfvBSJO6OmJrHpdGEcYsJEZ6NE X-Received: by 2002:a62:1d16:: with SMTP id d22-v6mr2385574pfd.159.1537863142397; Tue, 25 Sep 2018 01:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537863142; cv=none; d=google.com; s=arc-20160816; b=wF65b508MoDTA98OZFYuL3jm5X5MIkSU5E4H0Bmsyz3Np73T2esusKFdvL2rkq6oAU 3SbHg4PgXljZUscwTwxzd9L7s1MwsQjpqiW5Fks9BSCThsXU2ppTsIGx+93eGEdzmUKe rgEdLrsO+j0N+pfwmUS/PgdwaVohg+gejLOATiPBjhfGmuWYvL2oP2PrJc1LxZ0KqaoZ eSsQqWa8Kiw9aOFWGPhwZUQ4MSNKklYQ3t7hNkZe6DNB5UlQhKwCJa2u520iRM7YnVF6 wiPm8pl/6+50C1CA+5uMfmL5l8mz8uIEcm+FBImskgQK6P1HjeK3jN3SW7kXr62ees8A wBdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Zgk5CodURpobbnmEdCLxvm9fiVEYu2H5EtrgmpevAFI=; b=VtYTkYOt0uCVc3qQVjhp7HQvPXd6V32+rcxVvlzLkrSz+TrsCFLyN4GjgBB+lMX6iV 7cXIrH0KhLA9u9w28HWPPcpKLqr9RVWyu+fM2MJbZSfNrfLDzOaYIlznNyQBQgb/LezJ 8h5xZFsDwGtVbk+Cy1Ja73LxzKdDLFLCigVhYj7rs+r1WkE7rhOr/O6riamzN+8gEhQ0 tCoSawDPL7UUq5xpBuZj7brff3E0YKrjZg6ail0gIbrqdl1smKYi4Gyr+oRLHeisVwuX oR2Yl+dZAwemPrtdaOzWoYyi4hR309jf+ajtimtesw7T5dK3rgQmrVil+UCqvEFTiwgl pNow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dk61sQdp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si1660564pfj.245.2018.09.25.01.11.36; Tue, 25 Sep 2018 01:12:22 -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=@linaro.org header.s=google header.b=Dk61sQdp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727610AbeIYORk (ORCPT + 99 others); Tue, 25 Sep 2018 10:17:40 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:33220 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727119AbeIYORk (ORCPT ); Tue, 25 Sep 2018 10:17:40 -0400 Received: by mail-it1-f194.google.com with SMTP id j198-v6so6617230ita.0 for ; Tue, 25 Sep 2018 01:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Zgk5CodURpobbnmEdCLxvm9fiVEYu2H5EtrgmpevAFI=; b=Dk61sQdpAY785zQ9TV+v3SRQ5jCP7PRR2Nzbsy+XXmcbuaPbKR+ucTQiaAux3HbX7B lmq4nWz0DMILJFcyCSAkiStG82QOjLTziXlDypbtk28gcnXbewnvZpiEhcb22G6Zd2TI nP5KrIiZFSs8G8q5s0MGBipXXQg8AyAqVFWiI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zgk5CodURpobbnmEdCLxvm9fiVEYu2H5EtrgmpevAFI=; b=Y+dWRxS6u4zGC/smNoD24NK8Ic0OeiGudc6XadWKT3/nKi8KkJvSCyE64DTA+uGNu7 wiUS/QLIVplKSmMtZWDU8tQkcJQBcLnF2+9k4jiJ3ywLTDoH/8Y2orvj/icj9bNy+vGA 0e9iHhklQH872z+wMWOj5Of3a2d8iz2snkHvASG8fgggKKO6RtRSnfnp2mMCh3LePDOq 2LeKGu1/ecoPg4Wgf5zTebT5puosIuuuSoIZONOl7btyVgTEqer8nT+UQo1AfrYNwtFr 9wgUIpztFC3qtDJueJZq1eLikKAZJk6ea+0dP9GC5tBxm/x6KbyQ2re7TdUk4ZJtANyK btSg== X-Gm-Message-State: ABuFfoj5ix609IcRwd3bznBse9AwJTsH40U3pG1744spmSDcuOOBqcAX 6ev+4S044OoVnJgd/7geRSUuubuD/360LyonGa7gnw== X-Received: by 2002:a24:83c1:: with SMTP id d184-v6mr1827021ite.16.1537863078725; Tue, 25 Sep 2018 01:11:18 -0700 (PDT) MIME-Version: 1.0 References: <20180921102546.12745-1-thierry.reding@gmail.com> <20180921102546.12745-7-thierry.reding@gmail.com> In-Reply-To: <20180921102546.12745-7-thierry.reding@gmail.com> From: Linus Walleij Date: Tue, 25 Sep 2018 10:11:06 +0200 Message-ID: Subject: Re: [PATCH 6/9] gpio: Add support for hierarchical IRQ domains To: "thierry.reding@gmail.com" , Marc Zyngier Cc: Thomas Gleixner , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-tegra@vger.kernel.org, "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thierry! Thanks for the patch! I am a bit ignorant about irqdomains so I will probably need an ACK from some irq maintainer before I can apply this. On Fri, Sep 21, 2018 at 12:25 PM Thierry Reding wrote: > From: Thierry Reding > > Hierarchical IRQ domains can be used to stack different IRQ controllers > on top of each other. One specific use-case where this can be useful is > if a power management controller has top-level controls for wakeup > interrupts. In such cases, the power management controller can be a > parent to other interrupt controllers and program additional registers > when an IRQ has its wake capability enabled or disabled. > > Signed-off-by: Thierry Reding While I think it is really important that we start supporting hierarchical irqdomains in the gpiolib core, I want a more complete approach, so that drivers that need hierarchical handling of irqdomains can get the same support from gpiolib as they get for simple domains. > @@ -1918,7 +1918,9 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip, > type = IRQ_TYPE_NONE; > } > > - gpiochip->to_irq = gpiochip_to_irq; > + if (!gpiochip->to_irq) > + gpiochip->to_irq = gpiochip_to_irq; So here you let the drivers override the .to_irq() function and that I think gets confusing as we are asking gpiolib to handle our irqchip. > - gpiochip->irq.domain = irq_domain_add_simple(np, gpiochip->ngpio, > - gpiochip->irq.first, > - ops, gpiochip); > + if (gpiochip->irq.parent_domain) > + gpiochip->irq.domain = irq_domain_add_hierarchy(gpiochip->irq.parent_domain, > + 0, gpiochip->ngpio, > + np, ops, gpiochip); > + else > + gpiochip->irq.domain = irq_domain_add_simple(np, gpiochip->ngpio, > + gpiochip->irq.first, > + ops, gpiochip); So this part is great: if we pass in a parent domain the core helps us create the hierarchy. But the stuff in .to_irq() should also be handled in the gpiolib core: the irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, &spec) for example. That way you should not need any external .to_irq() function. I can't see if you need to pull more stuff into the core to accomplish that, but I think in essence the core gpiolib needs to be more helpful with hierarchies. Yours, Linus Walleij