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 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 E7D96C04E84 for ; Tue, 28 May 2019 13:12:53 +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 BCDB7208CB for ; Tue, 28 May 2019 13:12:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oJBbd080"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UDHPDd6e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCDB7208CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U1GohRWEnCAYPdMTWmmMRO4iB/KbStIDTXusRoHoDXg=; b=oJBbd080tzfqVV 57ZWs6soqRQiiIsy9iBSmX66nrh/5CTPStVjS1HRzMGsqlH9TuRPxPpJukTK6/0P1KGTdxl1RmUqe ejeWF0cFoVTEiYiSbM2SOCVhglzpmpSsOEMjEHFMlIlBnd7lnqsbmBX6q8fBC3EtZw/wfBSXmLQWC N9HQiApSGeYOxiUOU7orBFMLrotyi0lVD7VckysHl+X3HAN7ZPVqVRe82+pPgLKYI/mov35uPzn93 fojbs2ooKlCasAkbgrS2IkD/0b0hcQLS4Z77MK+z8p7PU9SxsdD26znBXSnCWLM8oF/m3bv9lElsn /hhhbA/FRnpyiCTC2DDQ==; 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 1hVbuN-0006Kk-7X; Tue, 28 May 2019 13:12:51 +0000 Received: from mail-it1-x141.google.com ([2607:f8b0:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVbuK-0006KP-09 for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2019 13:12:49 +0000 Received: by mail-it1-x141.google.com with SMTP id 9so3773272itf.4 for ; Tue, 28 May 2019 06:12:47 -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=ch6XsF4UkVDwbCtK10AE8N7qp77v0YkcnUzTiE/e8Wo=; b=UDHPDd6eadbAHYaP04Cm1XVM2x1yZoC0tAY4rfUmppJ96IeB9CdtarAqp26BGa1wNm EIIaAqWORDZNx/Eon9VS6GbvD4pOEXFnggl0fe1H9zbqLNEQvdv44lP7kwOqgjoBVqEN g9k5/ha0yYhZdGCRp08+rNai+C+qISbz64aHwjZtFR+X+UbF2XArTc+0mJuVUr4rUMfg suuEWe8fn6oKmbciozq2nCYcHcnMDIUTFH/1fkFuJ4b/DNY/ZoRVuxlWrAJMVpS2Cv18 1jCYgODJS/naqPgxQwREU6vqcws1Yfh78Hn6Qabwx1GpKYPF7Xm7HzK4f57BRLIyaGpQ sPnA== 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=ch6XsF4UkVDwbCtK10AE8N7qp77v0YkcnUzTiE/e8Wo=; b=pYFefSOQeMFq+bHjIWZnOMrAQmS1STOcoTjuTa0AMBsap0GmB41WiY1hjNCr4WAJI6 2SM0LxAPGLKYYK3VdRtb2vnVzP3Lq7ozXwozrwtNHhDqIi0fblQ8bgLSXxpRFB2DaMo+ dyIXepOjg1vZvn4d/SKa0Hr9S3UOVK+BzKt0frmmI4HUmeSC9XVP/AC3Qa/voZuYNiRc VZ3Ky4LylN4yDnsnAw0PXAQCSxqlPrpTxrKsKgX+cpviaKvR2k1afXZOv6HAviWrgFZR vx2mimsEubBt8JL+PpYR88w1q08AcoZHVDZf0278s/QxHcRW9rU8BSv95ueA+s5IJJzD oHwg== X-Gm-Message-State: APjAAAV1iL13skfosFYt23ilkuHDmz90leV0zdEMrD33tx8yJlcC0JlG KkO8tojyOxPVN9XC19XwOiOp4YUVw8jORqMPeqzmzA== X-Google-Smtp-Source: APXvYqxLB1pPADB1FNuibHAgC0X75X9+avjoPthNYmISUQ4GARPimb8jbgaZz2VKax2H1f0/5DqrH9zrGOFDmB0KMxQ= X-Received: by 2002:a24:910b:: with SMTP id i11mr3270618ite.76.1559049166968; Tue, 28 May 2019 06:12:46 -0700 (PDT) MIME-Version: 1.0 References: <20190527112720.2266-1-ard.biesheuvel@linaro.org> <20190527112720.2266-2-ard.biesheuvel@linaro.org> <20190528130247.GA25151@redmoon> In-Reply-To: <20190528130247.GA25151@redmoon> From: Ard Biesheuvel Date: Tue, 28 May 2019 15:12:34 +0200 Message-ID: Subject: Re: [PATCH v3 1/4] acpi/irq: implement helper to create hierachical domains To: Lorenzo Pieralisi X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190528_061248_048677_FAED72AF X-CRM114-Status: GOOD ( 26.05 ) 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: Graeme Gregory , "open list:GPIO SUBSYSTEM" , Marc Zyngier , Linus Walleij , "Rafael J. Wysocki" , ACPI Devel Maling List , Masahisa Kojima , Mika Westerberg , linux-arm-kernel , 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 Tue, 28 May 2019 at 15:02, Lorenzo Pieralisi wrote: > > On Mon, May 27, 2019 at 01:27:17PM +0200, 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 for > > unqualified interrupts as the parent of the hierarchy. > > Nit: I do not think they are "unqualified". > > ACPI 6.3, table 6-237, Extended Interrupt Descriptor Definition: > > "Resource Source: (Optional) If present, the device that uses this > descriptor consumes its resources from the resources produces by the > named device object. If not present, the device consumes its resources > out of a global pool." > > Where the global pool I _assume_ is the GSI domain, so it is the default > expected behaviour (for once :)) > By 'unqualified', I meant lacking an explicit description of the producer of the resource. But I can change the wording if you prefer. > > Signed-off-by: Ard Biesheuvel > > --- > > drivers/acpi/irq.c | 20 ++++++++++++++++++++ > > include/linux/acpi.h | 7 +++++++ > > 2 files changed, 27 insertions(+) > > > > diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c > > index c3b2222e2129..39824a6bbcd5 100644 > > --- a/drivers/acpi/irq.c > > +++ b/drivers/acpi/irq.c > > @@ -295,3 +295,23 @@ 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. > > Yes please comment parameters even if it is just a wrapper around > the IRQ domain API. > > > +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); > > +} > > 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 > > Reviewed-by: Lorenzo Pieralisi Thanks, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel