From patchwork Wed Oct 14 23:25:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7399151 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5EF149F1B9 for ; Wed, 14 Oct 2015 23:27:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DB02209D6 for ; Wed, 14 Oct 2015 23:27:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DB0B209D4 for ; Wed, 14 Oct 2015 23:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754752AbbJNX0S (ORCPT ); Wed, 14 Oct 2015 19:26:18 -0400 Received: from mail-bl2on0054.outbound.protection.outlook.com ([65.55.169.54]:22248 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753772AbbJNX0P (ORCPT ); Wed, 14 Oct 2015 19:26:15 -0400 Received: from CY1PR12CA0013.namprd12.prod.outlook.com (10.160.137.23) by SN1PR12MB0719.namprd12.prod.outlook.com (10.163.209.21) with Microsoft SMTP Server (TLS) id 15.1.293.16; Wed, 14 Oct 2015 23:26:12 +0000 Received: from BY2NAM03FT016.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::205) by CY1PR12CA0013.outlook.office365.com (2a01:111:e400:4c1f::23) with Microsoft SMTP Server (TLS) id 15.1.300.14 via Frontend Transport; Wed, 14 Oct 2015 23:26:12 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; apm.com; dkim=none (message not signed) header.d=none; apm.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by BY2NAM03FT016.mail.protection.outlook.com (10.152.84.215) with Microsoft SMTP Server id 15.1.300.4 via Frontend Transport; Wed, 14 Oct 2015 23:26:11 +0000 X-WSS-ID: 0NW8H3G-08-IVN-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2ED86BD88D4; Wed, 14 Oct 2015 19:26:04 -0400 (EDT) Received: from SATLEXDAG02.amd.com (10.181.40.5) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 14 Oct 2015 18:26:11 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by SATLEXDAG02.amd.com (10.181.40.5) with Microsoft SMTP Server id 14.3.266.1; Wed, 14 Oct 2015 19:26:06 -0400 From: Suravee Suthikulpanit To: , , , CC: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , , , , , , , , Suravee Suthikulpanit Subject: [PATCH V2 5/6] gicv2m: Refactor to prepare for ACPI support Date: Wed, 14 Oct 2015 16:25:55 -0700 Message-ID: <1444865156-9870-6-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1444865156-9870-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1444865156-9870-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(189002)(199003)(48376002)(2201001)(97736004)(229853001)(5003600100002)(76176999)(50986999)(50466002)(19580395003)(53416004)(36756003)(5003940100001)(105586002)(101416001)(19580405001)(5001770100001)(5008740100001)(2950100001)(92566002)(86362001)(11100500001)(87936001)(189998001)(106466001)(47776003)(46102003)(64706001)(5007970100001)(50226001)(77096005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0719; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0719; 2:RLxqAFKOnvj4CDGFg/VnKZoCCspOs1g5C1zGgr3GyH8zXpS/5//vLr/HnSZ5JVHiQxs1d9pIh3I5pylM+SGNrT0p5kpwEKYskVBlpT8yzGMcdscBZp1dN1ZM4T50dKkJepfKAgwK6S3m3XPYBvDcxo37qmholYv618P0XqioBWQ=; 3:Vfx0kSLlO2yguDbREA1R3Uvx0Xoslf8NRtTsYzlWCaUEm8t+zJpgkM1hEIc0kWnjSsOjyKdEW0isAeC67xSu/k7WH7mQh0OWR/tY3NNNA1idzZNqoEvl9xTbcwC1m7/qR1FET9pgbDurJE9wxDZ2/ECZ/8SgOlGq0+NV6xw6U9H5gXZjc7fj0DiPP8kLxm56t7jYk7WhLmmZ1j03CkfXusRUlGuUCudFp/6ZgrS1cjjEQIHcDc98ctb/xjjYwd62; 25:PBzOFN6AbLhQQzXXMALR0GseaUC1LaBTlAXriS5tfRqFXdNrmrncnreAHH62ZJ+jMkcHwGw0LH2sa+yOzOYBlU7FIUiQn38XYupp/69cDOZcy2k7BbkPz5Q+dzAzZwzY4yareb/KLbIqG1pMgP7efp4AigPOmkmWEjWeQrEe5ShSltsZWDcH8zTsahtOgVFrGJfofj+TwT+DHfYKBilAT8k/eXouy06TLI3wawp6dS2tPXSCAKB4FJh/uEnzhx0X588lG552tBL8rHZkJ9E1VA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0719; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0719; 20:zN2EXg44QrD9BkV0YgjHUgyDvKXzsIrjvdr6onxuWns+fJfPT9RiVRoeceps1n4XSPosHytEjCgAypmIngK/XO7r8bSJgHqcaPr+iFzqh521BV3JJyzj8h7gjkXX7J/Jv/Yebb+HHakcCjYrseZqb1tsirEv3rZVEratsjR0/xAmW0Nhyc6U45vKAmFlXrhPa9+dY/WVG34a2xvma4A94rJ7ottsHfVOgmXdCPZEqhPz3s3YFNCjSFAy10YMb4UlJStz7pBhZjESft7JSfdJ3M4S2ZDu2lCmFVVLhspyBlJAmt/Sq+cFGiW2bdXuY+AosVI93Bia1sh8/siao0fKmuNWn2RHIArVtAuOt61sTpq8W/I8aaS36ymbZaN+FG0lyJLtCWkYYMgROL86DZI7s3JJbhMrs/TeJRrIrZqvEXCl20s/vtvGBHaxWHJR7ZC7qp8Ap5eqI3syBzT5zY9Qj1fX8n4ktV/H66ELsp1ap25lJ7gi1V/dXkGWLhsLUoFH; 4:iApNxijMMIkdJx4cmj5qYdjQeSL+Ty/30V1r2j0M7vIbMc5AEwKtDs4fYY0IEbxZxGiuRA8U3n1TFEMcm5G5RRi012/DJk2V+C6iqzwLq58F4PiN9jUpOqS3HdRyRPjk7XRO+wZuO7ENYzSnaj8XjUWIlUTyS9q3nmCpSEv1EjXpb+unIXqR2NvevbP9TLRQ8Ho6yQZfiXotgDZG9iRy0YrE7DGYLptBgakWMvRnAF5b+Wk1stQu9j56RXA+mAusA7dUc19hcKA9M1NfzQlroV+aps7hOXgvWL8bJQ8Q1dFLIbgDEwww5irSxyIl+jDopetneAVa3s0x51kDzKEz0zgRh4ylMVftVKpmZ8NibiY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001); SRVR:SN1PR12MB0719; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0719; X-Forefront-PRVS: 0729050452 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0719;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wSr?= =?us-ascii?Q?j9qGWuMEKa7C2js7YcP3u4qg4mDXbLklKBZz2Pc0UfF2Aw4F8KSiRoGeoQ9E?= =?us-ascii?Q?BxhGB9ot9kbYd2Lrnow1CptsZWOObkJWseJ2Z05oh9nQxRUG+xepdhthp3Fl?= =?us-ascii?Q?R4=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0719; 5:BIGckxOr1WyAfX5R/ZGHkDnCACFDsW8I/vZQ4OsRCx97+U4IdiJdV75TFBfmRtOLnLAHu+btjQb6fkame0TRh5cs+rihJsd36HW2LB//67hoFfHkBf2LCA7YapiRHqIw7oq0ncUfu5QKCqHBW9LqRQ==; 24:cXvv5JnupgVSv4G5uDP16ALhadVdeSqESqaf+feXlO4QlNcWAuMq4HBtlKy4/iB3g1SvWONb58ZuQbcJWNHparjNiNSqBQkSrRhZOcUsI7g=; 20:IjgOsecJtu5cCfS+cem/+8AsoUGQM90O0YtSja93+JJ2BfKoQ+4EjtLunEBW7OY66LRXIvakZOwHJ4dAj3XtJxijJkwBGIswg8HnMQ5iBes/I5KNqKKF98R2rheTTZC3x68sjzZYIURsA4mBOV7w6u02gfHB0Ta/I4i/zniXPAQTJC0iiOqEge5YOcHml3KKcaKCJwqN6qs/vNHXjfNIIHtGUIPZKAI55S9UCpzDnoBBSjJ1/tb2vYT7Tc0vftPZ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2015 23:26:11.0415 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0719 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replaces the struct device_node in v2m_data with struct fwnode_handle since this structure is common between DT and ACPI. It also refactors gicv2m_init_one() to prepare for ACPI support. There should be no functional changes. Signed-off-by: Suravee Suthikulpanit --- drivers/irqchip/irq-gic-v2m.c | 57 +++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index 87f8d10..7e60f7e 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -55,7 +55,7 @@ static DEFINE_SPINLOCK(v2m_lock); struct v2m_data { struct list_head entry; - struct device_node *node; + struct fwnode_handle *fwnode; struct resource res; /* GICv2m resource */ void __iomem *base; /* GICv2m virt address */ u32 spi_start; /* The SPI number that MSIs start */ @@ -254,7 +254,7 @@ static void gicv2m_teardown(void) list_del(&v2m->entry); kfree(v2m->bm); iounmap(v2m->base); - of_node_put(v2m->node); + of_node_put(to_of_node(v2m->fwnode)); kfree(v2m); } } @@ -268,7 +268,7 @@ static int gicv2m_allocate_domains(struct irq_domain *parent) if (!v2m) return 0; - inner_domain = irq_domain_create_tree(of_node_to_fwnode(v2m->node), + inner_domain = irq_domain_create_tree(v2m->fwnode, &gicv2m_domain_ops, v2m); if (!inner_domain) { pr_err("Failed to create GICv2m domain\n"); @@ -277,10 +277,10 @@ static int gicv2m_allocate_domains(struct irq_domain *parent) inner_domain->bus_token = DOMAIN_BUS_NEXUS; inner_domain->parent = parent; - pci_domain = pci_msi_create_irq_domain(of_node_to_fwnode(v2m->node), + pci_domain = pci_msi_create_irq_domain(v2m->fwnode, &gicv2m_msi_domain_info, inner_domain); - plat_domain = platform_msi_create_irq_domain(of_node_to_fwnode(v2m->node), + plat_domain = platform_msi_create_irq_domain(v2m->fwnode, &gicv2m_pmsi_domain_info, inner_domain); if (!pci_domain || !plat_domain) { @@ -296,11 +296,13 @@ static int gicv2m_allocate_domains(struct irq_domain *parent) return 0; } -static int __init gicv2m_init_one(struct device_node *node, - struct irq_domain *parent) +static int __init gicv2m_init_one(struct fwnode_handle *fwnode, + u32 spi_start, u32 nr_spis, + struct resource *res) { int ret; struct v2m_data *v2m; + const char *name = NULL; v2m = kzalloc(sizeof(struct v2m_data), GFP_KERNEL); if (!v2m) { @@ -309,13 +311,9 @@ static int __init gicv2m_init_one(struct device_node *node, } INIT_LIST_HEAD(&v2m->entry); - v2m->node = node; + v2m->fwnode = fwnode; - ret = of_address_to_resource(node, 0, &v2m->res); - if (ret) { - pr_err("Failed to allocate v2m resource.\n"); - goto err_free_v2m; - } + memcpy(&v2m->res, res, sizeof(struct resource)); v2m->base = ioremap(v2m->res.start, resource_size(&v2m->res)); if (!v2m->base) { @@ -324,10 +322,9 @@ static int __init gicv2m_init_one(struct device_node *node, goto err_free_v2m; } - if (!of_property_read_u32(node, "arm,msi-base-spi", &v2m->spi_start) && - !of_property_read_u32(node, "arm,msi-num-spis", &v2m->nr_spis)) { - pr_info("Overriding V2M MSI_TYPER (base:%u, num:%u)\n", - v2m->spi_start, v2m->nr_spis); + if (spi_start && nr_spis) { + v2m->spi_start = spi_start; + v2m->nr_spis = nr_spis; } else { u32 typer = readl_relaxed(v2m->base + V2M_MSI_TYPER); @@ -359,10 +356,13 @@ static int __init gicv2m_init_one(struct device_node *node, } list_add_tail(&v2m->entry, &v2m_nodes); - pr_info("Node %s: range[%#lx:%#lx], SPI[%d:%d]\n", node->name, - (unsigned long)v2m->res.start, (unsigned long)v2m->res.end, - v2m->spi_start, (v2m->spi_start + v2m->nr_spis)); + if (to_of_node(fwnode)) + name = to_of_node(fwnode)->name; + + pr_info("Frame %s: range[%#lx:%#lx], SPI[%d:%d]\n", name, + (unsigned long)res->start, (unsigned long)res->end, + v2m->spi_start, (v2m->spi_start + v2m->nr_spis)); return 0; err_iounmap: @@ -384,10 +384,25 @@ int __init gicv2m_of_init(struct device_node *node, struct irq_domain *parent) for (child = of_find_matching_node(node, gicv2m_device_id); child; child = of_find_matching_node(child, gicv2m_device_id)) { + u32 spi_start = 0, nr_spis = 0; + struct resource res; + if (!of_find_property(child, "msi-controller", NULL)) continue; - ret = gicv2m_init_one(child, parent); + ret = of_address_to_resource(child, 0, &res); + if (ret) { + pr_err("Failed to allocate v2m resource.\n"); + break; + } + + if (!of_property_read_u32(child, "arm,msi-base-spi", + &spi_start) && + !of_property_read_u32(child, "arm,msi-num-spis", &nr_spis)) + pr_info("DT overriding V2M MSI_TYPER (base:%u, num:%u)\n", + spi_start, nr_spis); + + ret = gicv2m_init_one(&child->fwnode, spi_start, nr_spis, &res); if (ret) { of_node_put(node); break;