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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 87B34C04AB6 for ; Fri, 31 May 2019 08:46:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62CA4265F9 for ; Fri, 31 May 2019 08:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726240AbfEaIqA (ORCPT ); Fri, 31 May 2019 04:46:00 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:62478 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbfEaIqA (ORCPT ); Fri, 31 May 2019 04:46:00 -0400 Received: from 79.184.255.225.ipv4.supernova.orange.pl (79.184.255.225) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.213) id f191c577164177af; Fri, 31 May 2019 10:45:58 +0200 From: "Rafael J. Wysocki" To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org, Masahisa Kojima , Linus Walleij , Marc Zyngier , Graeme Gregory , Lorenzo Pieralisi , Mika Westerberg , Len Brown Subject: Re: [PATCH v4 1/4] acpi/irq: implement helper to create hierachical domains Date: Fri, 31 May 2019 10:45:57 +0200 Message-ID: <1909675.6iIoxqmsXk@kreacher> In-Reply-To: <20190528133647.3362-2-ard.biesheuvel@linaro.org> References: <20190528133647.3362-1-ard.biesheuvel@linaro.org> <20190528133647.3362-2-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Tuesday, May 28, 2019 3:36:44 PM CEST Ard Biesheuvel wrote: > ACPI permits arbitrary producer->consumer interrupt links to be > described in AML, which means a topology such as the following > is perfectly legal: > > Device (EXIU) { > Name (_HID, "SCX0008") > Name (_UID, Zero) > Name (_CRS, ResourceTemplate () { > ... > }) > } > > Device (GPIO) { > Name (_HID, "SCX0007") > Name (_UID, Zero) > Name (_CRS, ResourceTemplate () { > Memory32Fixed (ReadWrite, SYNQUACER_GPIO_BASE, SYNQUACER_GPIO_SIZE) > Interrupt (ResourceConsumer, Edge, ActiveHigh, ExclusiveAndWake, 0, "\\_SB.EXIU") { > 7, > } > }) > ... > } > > The EXIU in this example is the external interrupt unit as can be found > on Socionext SynQuacer based platforms, which converts a block of 32 SPIs > from arbitrary polarity/trigger into level-high, with a separate set > of config/mask/unmask/clear controls. > > The existing DT based driver in drivers/irqchip/irq-sni-exiu.c models > this as a hierarchical domain stacked on top of the GIC's irqdomain. > Since the GIC is modeled as a DT node as well, obtaining a reference > to this irqdomain is easily done by going through the parent link. > > On ACPI systems, however, the GIC is not modeled as an object in the > namespace, and so device objects cannot refer to it directly. So in > order to obtain the irqdomain reference when driving the EXIU in ACPI > mode, we need a helper that implicitly grabs the default domain as the > parent of the hierarchy for interrupts allocated out of the global GSI > pool. > > Reviewed-by: Mika Westerberg > Reviewed-by: Lorenzo Pieralisi > Signed-off-by: Ard Biesheuvel Acked-by: Rafael J. Wysocki if that matters. > --- > drivers/acpi/irq.c | 26 ++++++++++++++++++++ > include/linux/acpi.h | 7 ++++++ > 2 files changed, 33 insertions(+) > > diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c > index c3b2222e2129..ce6b25a3b7a7 100644 > --- a/drivers/acpi/irq.c > +++ b/drivers/acpi/irq.c > @@ -295,3 +295,29 @@ void __init acpi_set_irq_model(enum acpi_irq_model_id model, > acpi_irq_model = model; > acpi_gsi_domain_id = fwnode; > } > + > +/** > + * acpi_irq_create_hierarchy - Create a hierarchical IRQ domain with the default > + * GSI domain as its parent. > + * @flags: Irq domain flags associated with the domain > + * @size: Size of the domain. > + * @fwnode: Optional fwnode of the interrupt controller > + * @ops: Pointer to the interrupt domain callbacks > + * @host_data: Controller private data pointer > + */ > +struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, > + unsigned int size, > + struct fwnode_handle *fwnode, > + const struct irq_domain_ops *ops, > + void *host_data) > +{ > + struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, > + DOMAIN_BUS_ANY); > + > + if (!d) > + return NULL; > + > + return irq_domain_create_hierarchy(d, flags, size, fwnode, ops, > + host_data); > +} > +EXPORT_SYMBOL_GPL(acpi_irq_create_hierarchy); > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 98440df7fe42..70de4bc30cea 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -23,6 +23,7 @@ > > #include > #include /* for struct resource */ > +#include > #include > #include > #include > @@ -327,6 +328,12 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); > void acpi_set_irq_model(enum acpi_irq_model_id model, > struct fwnode_handle *fwnode); > > +struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, > + unsigned int size, > + struct fwnode_handle *fwnode, > + const struct irq_domain_ops *ops, > + void *host_data); > + > #ifdef CONFIG_X86_IO_APIC > extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); > #else > From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH v4 1/4] acpi/irq: implement helper to create hierachical domains Date: Fri, 31 May 2019 10:45:57 +0200 Message-ID: <1909675.6iIoxqmsXk@kreacher> References: <20190528133647.3362-1-ard.biesheuvel@linaro.org> <20190528133647.3362-2-ard.biesheuvel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190528133647.3362-2-ard.biesheuvel@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Ard Biesheuvel Cc: Lorenzo Pieralisi , Graeme Gregory , linux-gpio@vger.kernel.org, Marc Zyngier , Linus Walleij , linux-acpi@vger.kernel.org, Masahisa Kojima , Mika Westerberg , linux-arm-kernel@lists.infradead.org, Len Brown List-Id: linux-gpio@vger.kernel.org On Tuesday, May 28, 2019 3:36:44 PM CEST Ard Biesheuvel wrote: > ACPI permits arbitrary producer->consumer interrupt links to be > described in AML, which means a topology such as the following > is perfectly legal: > > Device (EXIU) { > Name (_HID, "SCX0008") > Name (_UID, Zero) > Name (_CRS, ResourceTemplate () { > ... > }) > } > > Device (GPIO) { > Name (_HID, "SCX0007") > Name (_UID, Zero) > Name (_CRS, ResourceTemplate () { > Memory32Fixed (ReadWrite, SYNQUACER_GPIO_BASE, SYNQUACER_GPIO_SIZE) > Interrupt (ResourceConsumer, Edge, ActiveHigh, ExclusiveAndWake, 0, "\\_SB.EXIU") { > 7, > } > }) > ... > } > > The EXIU in this example is the external interrupt unit as can be found > on Socionext SynQuacer based platforms, which converts a block of 32 SPIs > from arbitrary polarity/trigger into level-high, with a separate set > of config/mask/unmask/clear controls. > > The existing DT based driver in drivers/irqchip/irq-sni-exiu.c models > this as a hierarchical domain stacked on top of the GIC's irqdomain. > Since the GIC is modeled as a DT node as well, obtaining a reference > to this irqdomain is easily done by going through the parent link. > > On ACPI systems, however, the GIC is not modeled as an object in the > namespace, and so device objects cannot refer to it directly. So in > order to obtain the irqdomain reference when driving the EXIU in ACPI > mode, we need a helper that implicitly grabs the default domain as the > parent of the hierarchy for interrupts allocated out of the global GSI > pool. > > Reviewed-by: Mika Westerberg > Reviewed-by: Lorenzo Pieralisi > Signed-off-by: Ard Biesheuvel Acked-by: Rafael J. Wysocki if that matters. > --- > drivers/acpi/irq.c | 26 ++++++++++++++++++++ > include/linux/acpi.h | 7 ++++++ > 2 files changed, 33 insertions(+) > > diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c > index c3b2222e2129..ce6b25a3b7a7 100644 > --- a/drivers/acpi/irq.c > +++ b/drivers/acpi/irq.c > @@ -295,3 +295,29 @@ void __init acpi_set_irq_model(enum acpi_irq_model_id model, > acpi_irq_model = model; > acpi_gsi_domain_id = fwnode; > } > + > +/** > + * acpi_irq_create_hierarchy - Create a hierarchical IRQ domain with the default > + * GSI domain as its parent. > + * @flags: Irq domain flags associated with the domain > + * @size: Size of the domain. > + * @fwnode: Optional fwnode of the interrupt controller > + * @ops: Pointer to the interrupt domain callbacks > + * @host_data: Controller private data pointer > + */ > +struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, > + unsigned int size, > + struct fwnode_handle *fwnode, > + const struct irq_domain_ops *ops, > + void *host_data) > +{ > + struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, > + DOMAIN_BUS_ANY); > + > + if (!d) > + return NULL; > + > + return irq_domain_create_hierarchy(d, flags, size, fwnode, ops, > + host_data); > +} > +EXPORT_SYMBOL_GPL(acpi_irq_create_hierarchy); > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 98440df7fe42..70de4bc30cea 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -23,6 +23,7 @@ > > #include > #include /* for struct resource */ > +#include > #include > #include > #include > @@ -327,6 +328,12 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); > void acpi_set_irq_model(enum acpi_irq_model_id model, > struct fwnode_handle *fwnode); > > +struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, > + unsigned int size, > + struct fwnode_handle *fwnode, > + const struct irq_domain_ops *ops, > + void *host_data); > + > #ifdef CONFIG_X86_IO_APIC > extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); > #else > 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=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=unavailable 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 113DEC04AB6 for ; Fri, 31 May 2019 08:46:23 +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 DB5D6265F9 for ; Fri, 31 May 2019 08:46:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="n1xSRJJ4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB5D6265F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net 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:References:In-Reply-To: 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: List-Owner; bh=kfJSqB0QkwZVI32D5UAqHtIlsyYEg2Eiph6NgOiqmDQ=; b=n1xSRJJ46vqbWy eNMsaG9tz1bQYs2VXv4QknJjkKtecq10XpgR7/2g5Kurpyvvf2TATWmGcNF8xwcEL0lfowWwSwqJ5 99LNnGLLPjeWdF3OBvnFdeMwZQNUlN5Kijwz/Hwt7sfLQ/TZgKXTRxRQQ5H460DIsdOimSZWZ9C9h 73EVs86meSNnQZJvrgKmoDuvftOxiJL7K1GLAJjHJyOd+FGiRvU+TM/jtrZW0RcWpka0uoN3DKdNi KKjATIfuGUxWELC9sicNe2QKiJ/mkf2ADsmh83diRLh9jYn1ym+vBLskAgOVwWRE3oRyWYqMnC6eY iabDl0EioRxgLT5tIuog==; 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 1hWdB1-0007GV-Bl; Fri, 31 May 2019 08:46:15 +0000 Received: from cloudserver094114.home.pl ([79.96.170.134]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWdAx-0007Fe-On for linux-arm-kernel@lists.infradead.org; Fri, 31 May 2019 08:46:13 +0000 Received: from 79.184.255.225.ipv4.supernova.orange.pl (79.184.255.225) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.213) id f191c577164177af; Fri, 31 May 2019 10:45:58 +0200 From: "Rafael J. Wysocki" To: Ard Biesheuvel Subject: Re: [PATCH v4 1/4] acpi/irq: implement helper to create hierachical domains Date: Fri, 31 May 2019 10:45:57 +0200 Message-ID: <1909675.6iIoxqmsXk@kreacher> In-Reply-To: <20190528133647.3362-2-ard.biesheuvel@linaro.org> References: <20190528133647.3362-1-ard.biesheuvel@linaro.org> <20190528133647.3362-2-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190531_014611_970821_245F3C25 X-CRM114-Status: GOOD ( 19.02 ) 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: Lorenzo Pieralisi , Graeme Gregory , linux-gpio@vger.kernel.org, Marc Zyngier , Linus Walleij , linux-acpi@vger.kernel.org, Masahisa Kojima , Mika Westerberg , linux-arm-kernel@lists.infradead.org, Len Brown 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 On Tuesday, May 28, 2019 3:36:44 PM CEST Ard Biesheuvel wrote: > ACPI permits arbitrary producer->consumer interrupt links to be > described in AML, which means a topology such as the following > is perfectly legal: > > Device (EXIU) { > Name (_HID, "SCX0008") > Name (_UID, Zero) > Name (_CRS, ResourceTemplate () { > ... > }) > } > > Device (GPIO) { > Name (_HID, "SCX0007") > Name (_UID, Zero) > Name (_CRS, ResourceTemplate () { > Memory32Fixed (ReadWrite, SYNQUACER_GPIO_BASE, SYNQUACER_GPIO_SIZE) > Interrupt (ResourceConsumer, Edge, ActiveHigh, ExclusiveAndWake, 0, "\\_SB.EXIU") { > 7, > } > }) > ... > } > > The EXIU in this example is the external interrupt unit as can be found > on Socionext SynQuacer based platforms, which converts a block of 32 SPIs > from arbitrary polarity/trigger into level-high, with a separate set > of config/mask/unmask/clear controls. > > The existing DT based driver in drivers/irqchip/irq-sni-exiu.c models > this as a hierarchical domain stacked on top of the GIC's irqdomain. > Since the GIC is modeled as a DT node as well, obtaining a reference > to this irqdomain is easily done by going through the parent link. > > On ACPI systems, however, the GIC is not modeled as an object in the > namespace, and so device objects cannot refer to it directly. So in > order to obtain the irqdomain reference when driving the EXIU in ACPI > mode, we need a helper that implicitly grabs the default domain as the > parent of the hierarchy for interrupts allocated out of the global GSI > pool. > > Reviewed-by: Mika Westerberg > Reviewed-by: Lorenzo Pieralisi > Signed-off-by: Ard Biesheuvel Acked-by: Rafael J. Wysocki if that matters. > --- > drivers/acpi/irq.c | 26 ++++++++++++++++++++ > include/linux/acpi.h | 7 ++++++ > 2 files changed, 33 insertions(+) > > diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c > index c3b2222e2129..ce6b25a3b7a7 100644 > --- a/drivers/acpi/irq.c > +++ b/drivers/acpi/irq.c > @@ -295,3 +295,29 @@ void __init acpi_set_irq_model(enum acpi_irq_model_id model, > acpi_irq_model = model; > acpi_gsi_domain_id = fwnode; > } > + > +/** > + * acpi_irq_create_hierarchy - Create a hierarchical IRQ domain with the default > + * GSI domain as its parent. > + * @flags: Irq domain flags associated with the domain > + * @size: Size of the domain. > + * @fwnode: Optional fwnode of the interrupt controller > + * @ops: Pointer to the interrupt domain callbacks > + * @host_data: Controller private data pointer > + */ > +struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, > + unsigned int size, > + struct fwnode_handle *fwnode, > + const struct irq_domain_ops *ops, > + void *host_data) > +{ > + struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, > + DOMAIN_BUS_ANY); > + > + if (!d) > + return NULL; > + > + return irq_domain_create_hierarchy(d, flags, size, fwnode, ops, > + host_data); > +} > +EXPORT_SYMBOL_GPL(acpi_irq_create_hierarchy); > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 98440df7fe42..70de4bc30cea 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -23,6 +23,7 @@ > > #include > #include /* for struct resource */ > +#include > #include > #include > #include > @@ -327,6 +328,12 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); > void acpi_set_irq_model(enum acpi_irq_model_id model, > struct fwnode_handle *fwnode); > > +struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, > + unsigned int size, > + struct fwnode_handle *fwnode, > + const struct irq_domain_ops *ops, > + void *host_data); > + > #ifdef CONFIG_X86_IO_APIC > extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); > #else > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel