From patchwork Sat Apr 20 10:09:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 10910153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57AD314DB for ; Sat, 20 Apr 2019 10:31:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4664628D51 for ; Sat, 20 Apr 2019 10:31:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 391B428D67; Sat, 20 Apr 2019 10:31:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B908628D51 for ; Sat, 20 Apr 2019 10:31:14 +0000 (UTC) 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=ZzpjucIiiyRkgpvcKegvfO0/uJIKtpwyE8Y6098ab/I=; b=h5Revh9Vu8V5cb WsAvUaS35Qiaklu/wYaC6SG80xUwNHLncMOrkQgiZjJ7VQXt6u/O/qwY4C7k89A1mpcwFb/Z/wFVd FhWUcl3jX8vtnRW43U681mf1nDIP1se5aLiYbOkmM5i3pqgnCFzHLWL6O1ZTxcGtf1mM22/P3DKCG VDq0OgFhwbnWasilCa1mNVpz1WH63iDvSnkl+st44+mVED9sIYds5A3v/ZRlkDGJ4958LCbJ7/i07 kA5nAIt51cJWMAa4E9PEKf0EBAcPMcaDjdPvaa7KuHdhVQA6261Hh8UdcUmuwzIZYgNH7Z3JSg0PM RoM4SPg77lZiyar7yVRw==; 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 1hHnH5-0002yQ-29; Sat, 20 Apr 2019 10:31:11 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hHnGt-0002lZ-O6 for linux-arm-kernel@bombadil.infradead.org; Sat, 20 Apr 2019 10:30:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fwMtKmHI0LHaI4B1vd4OY0LZJNxjgh5qJQeE541Muvs=; b=zfbCct72NjddjgaMEmQyGSGNPw XVHtHsjf/0muHntJjgu3KbLS3HlHYi05A2LMRlTClkJWD7p7HLDWy/UNhOu6nCptCOvaowL2+3/0I KHjmCRB/NcX8w0tJQ6oOlmxKuo6srBJO/fCS3tGrLVRjIsYeP+f4AZJF103J/Xdv+1co/cIFKyfO4 9gVONgZ2wzNtOWeVwBPZcxiIyzewMSxDLXr5b0mMVg+R1uriWNKL4R6xMAMmitSavzxMGDGUHDIKF iXU6bkNuASEWKDWM0ZE9JRoSurlV+ucfToElGYldHdEfVp6spDuJ7yEHuhNpCHpUH6Gl9OJmhJE6i jsG4VYUQ==; Received: from fllv0016.ext.ti.com ([198.47.19.142]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hHmyH-0005sJ-OD for linux-arm-kernel@lists.infradead.org; Sat, 20 Apr 2019 10:11:46 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3KABL8e081031; Sat, 20 Apr 2019 05:11:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1555755081; bh=fwMtKmHI0LHaI4B1vd4OY0LZJNxjgh5qJQeE541Muvs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dpkeC95P7Hw6dJpY+q/b1ONrGi4GZ0dyciymRt5gazeATIkGoS1mF6mfgsh+4WcYb TnIuY7IO1HIbeelBuXiCALkiBb3lDLNAT4r7PNeUcVpy7pnNL82qnbGug37QZWexNW 9sJ2F/5+fSu6WVmxBtdnCYCVHUb262vh6U02ntas= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3KABLnL098500 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 20 Apr 2019 05:11:21 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Sat, 20 Apr 2019 05:11:21 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Sat, 20 Apr 2019 05:11:21 -0500 Received: from uda0131933.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3KAAHa4070234; Sat, 20 Apr 2019 05:11:17 -0500 From: Lokesh Vutla To: Marc Zyngier , Santosh Shilimkar , Rob Herring , Nishanth Menon , , Subject: [PATCH v7 13/14] irqchip: ti-sci-inta: Add msi domain support Date: Sat, 20 Apr 2019 15:39:49 +0530 Message-ID: <20190420100950.7997-14-lokeshvutla@ti.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190420100950.7997-1-lokeshvutla@ti.com> References: <20190420100950.7997-1-lokeshvutla@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190420_061145_896138_714CFC49 X-CRM114-Status: GOOD ( 17.47 ) 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: Peter Ujfalusi , Grygorii Strashko , Device Tree Mailing List , Tony Lindgren , linus.walleij@linaro.org, Sekhar Nori , linux-kernel@vger.kernel.org, Tero Kristo , Lokesh Vutla , Linux ARM Mailing List Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a msi domain that is child to the INTA domain. Clients uses the INTA msi bus layer to allocate irqs in this msi domain. Signed-off-by: Lokesh Vutla --- Changes since v6: - Updated to get device id from platform device. drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-ti-sci-inta.c | 40 ++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 7c84a71bcd88..1fab40487d63 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -441,6 +441,7 @@ config TI_SCI_INTA_IRQCHIP depends on TI_SCI_PROTOCOL select IRQ_DOMAIN select IRQ_DOMAIN_HIERARCHY + select TI_SCI_INTA_MSI_DOMAIN help This enables the irqchip driver support for K3 Interrupt aggregator over TI System Control Interface available on some new TI's SoCs. diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c index 71e5b45ab4ce..53a356795ebf 100644 --- a/drivers/irqchip/irq-ti-sci-inta.c +++ b/drivers/irqchip/irq-ti-sci-inta.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -28,6 +29,9 @@ #define HWIRQ_TO_DEVID(hwirq) (((hwirq) >> (TI_SCI_DEV_ID_SHIFT)) & \ (TI_SCI_DEV_ID_MASK)) #define HWIRQ_TO_IRQID(hwirq) ((hwirq) & (TI_SCI_IRQ_ID_MASK)) +#define TO_HWIRQ(dev, index) ((((dev) & TI_SCI_DEV_ID_MASK) << \ + TI_SCI_DEV_ID_SHIFT) | \ + ((index) & TI_SCI_IRQ_ID_MASK)) #define MAX_EVENTS_PER_VINT 64 #define VINT_ENABLE_SET_OFFSET 0x0 @@ -496,9 +500,34 @@ static const struct irq_domain_ops ti_sci_inta_irq_domain_ops = { .alloc = ti_sci_inta_irq_domain_alloc, }; +static struct irq_chip ti_sci_inta_msi_irq_chip = { + .name = "MSI-INTA", + .flags = IRQCHIP_SUPPORTS_LEVEL_MSI, +}; + +static void ti_sci_inta_msi_set_desc(msi_alloc_info_t *arg, + struct msi_desc *desc) +{ + struct platform_device *pdev = to_platform_device(desc->dev); + + arg->desc = desc; + arg->hwirq = TO_HWIRQ(pdev->id, desc->inta.dev_index); +} + +static struct msi_domain_ops ti_sci_inta_msi_ops = { + .set_desc = ti_sci_inta_msi_set_desc, +}; + +static struct msi_domain_info ti_sci_inta_msi_domain_info = { + .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | + MSI_FLAG_LEVEL_CAPABLE), + .ops = &ti_sci_inta_msi_ops, + .chip = &ti_sci_inta_msi_irq_chip, +}; + static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) { - struct irq_domain *parent_domain, *domain; + struct irq_domain *parent_domain, *domain, *msi_domain; struct device_node *parent_node, *node; struct ti_sci_inta_irq_domain *inta; struct device *dev = &pdev->dev; @@ -563,6 +592,15 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) return -ENOMEM; } + msi_domain = ti_sci_inta_msi_create_irq_domain(of_node_to_fwnode(node), + &ti_sci_inta_msi_domain_info, + domain); + if (!msi_domain) { + irq_domain_remove(domain); + dev_err(dev, "Failed to allocate msi domain\n"); + return -ENOMEM; + } + INIT_LIST_HEAD(&inta->vint_list); mutex_init(&inta->vint_mutex);