From patchwork Wed Oct 21 18:47:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7459481 Return-Path: X-Original-To: patchwork-linux-arm@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 0B7579F37F for ; Wed, 21 Oct 2015 18:50:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 067E72089C for ; Wed, 21 Oct 2015 18:50:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D2EE20896 for ; Wed, 21 Oct 2015 18:50:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZoyRH-0003t7-Ip; Wed, 21 Oct 2015 18:48:43 +0000 Received: from mail-by2on0075.outbound.protection.outlook.com ([207.46.100.75] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZoyQm-0003in-O7 for linux-arm-kernel@lists.infradead.org; Wed, 21 Oct 2015 18:48:13 +0000 Received: from DM3PR12CA0010.namprd12.prod.outlook.com (10.164.12.148) by BY2PR12MB0711.namprd12.prod.outlook.com (10.163.113.21) with Microsoft SMTP Server (TLS) id 15.1.300.14; Wed, 21 Oct 2015 18:47:55 +0000 Received: from CO1NAM03FT007.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::201) by DM3PR12CA0010.outlook.office365.com (2a01:111:e400:599f::20) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Wed, 21 Oct 2015 18:47:55 +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 CO1NAM03FT007.mail.protection.outlook.com (10.152.80.117) with Microsoft SMTP Server id 15.1.306.8 via Frontend Transport; Wed, 21 Oct 2015 18:47:53 +0000 X-WSS-ID: 0NWL2VO-08-3RZ-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 2CEFDBD8902; Wed, 21 Oct 2015 14:47:48 -0400 (EDT) Received: from SATLEXDAG01.amd.com (10.181.40.3) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 21 Oct 2015 13:47:59 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server id 14.3.266.1; Wed, 21 Oct 2015 14:47:49 -0400 From: Suravee Suthikulpanit To: , , , Subject: [PATCH V3 5/6] gicv2m: Refactor to prepare for ACPI support Date: Wed, 21 Oct 2015 11:47:28 -0700 Message-ID: <1445453249-32557-6-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1445453249-32557-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1445453249-32557-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)(199003)(189002)(53416004)(2950100001)(46102003)(36756003)(19580395003)(50226001)(76176999)(87936001)(19580405001)(105586002)(5003600100002)(101416001)(106466001)(97736004)(50466002)(5007970100001)(77096005)(11100500001)(48376002)(64706001)(50986999)(189998001)(47776003)(86362001)(5001920100001)(2201001)(5001770100001)(229853001)(92566002)(5003940100001)(5008740100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0711; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0711; 2:aOOtEiR8m+vx9g4SxTFLLzraxNQqbFZSp5j8vjWNWqv64gazEIO8/gRNaAj64y8/q65LhXZM3LooRy/dcyr0PIHpNM7+famgflzbl4EJzNTlECmBUuIKSiGMalJmJCJYg2nOdzXpYvn5KWkGwBZ6BtYqwopNYjewelSVAshp9+o=; 3:e9MvVu13Z19S2u3cYRIcWpcLo4TBzTw+ibYGjgmipeIWQAZ5BLcVtlyfOVcSYL9/81g2cjJcPpFkTWG7iK4VBY1NDtvt9KRAqoDDfEzwxpJODiuUAb6+U1kgfhd4owVjOYVaaKBI43iU30Gngdd3eTj5K8yFpKMN/OhOTi75hcSAm/NNqE/pGKYMpauuLlB3jhCGThPRfuQryLgmWiQIEap66pTkrnT7vffVsPG/W7Z6HyU58RrWG+fElBRwnz2t; 25:wcKGqZn6fbwzoeB5IX1lqwzJMBavsJ/fe00RI2yQjxeefZEZ0pLfHAyE8Tb03Ks0/f6ZM/8xd8FWNPbCiungQTCFjs2cY0EzJrll1AvswHOTo2dQ+7feI+Kpfnu4rliOCEWIlX+JlGWSzn/uN7n7mgyVLdiCCMLGxs5OTSzpBdpCsa+D7VIRtuexnT2jg0r4O6bjhdaKUXqLgK1n9wqNOU45OkT228x3UeulJJ+R4LtU36ijyiK2JtefjXQCdV3AHD2AlnXWJoRDamt278BgjA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0711; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0711; 20:ZZJjjP/MAE4MxSCZfPHcS45SG8jZD2bxUDVqXeLhuqFEXdF6/PdUSFjyeJgRZUJsMPX9DGH4E/RtMHLVgiWbszloeiXMfNWlMHuQQzfC8Yi9dYchhJXJwzecIYzuxbTZOW3Z9BEVHuHMKlxX8TvJaInqjzE6f64vLjdgvEXyvbSw7qAXImJdR4ddfRy/HdQcATDEZTICsJYBuA2YWohC6cdhyTZpB2ZF2b9xn9/DF1y4vMTLIdout5l2Vs7c10gr/GqCgz7pukNz8DGhIYB7YTFry1y5/U/4r0xbxf5t29j7iTfYxWOdAW9f+GxeGJt/9P8FN5zLWBD8n7kFyuKqVl+jOkHGD2US+n4exGD9AISTJsw3HGrEc7yJYLpacoEAf3RDy2igxL09oHIlnoxh79y4axsYB8fAISmhr1z6ws3WXTgEy/QGJau2NxDDVkAie7XnQQrBMNWAZJvFdQt1Ib2s2YzMXDN50ki+e5fugm+D3fW5yHb9gIHpJ9seSL4b; 4:eSb/9eTA6HZ7ZP1ivwmb+Gtj2ikfZEa6BwyNfOPsrQqkhOSu7HMEsOHonjz9jGOqiAhrIZk0k8gt7wegM78QyDCU1zzC7Qe0mcPDbVfKY5w3V8Fe8PsJuNEcwPy7oDsexMgomsV68v/ElI3VaAGIJN8zCgPlZUL5S9adJuVYORrpKrxZhuNhu8v6x1C6w8Eyp0fFiPLo1tLiHqQx8rL0nmJJToeT+odpY6m55Bm5qDGrXSZ2/Q1wIcxnTivqFY3O9RFqezx2ckoZzraZiCWRnI9EoPbGiNMvngVTaD1QReb4COkv4AAxSBEuTe5a+fWNV7ZpsY6PS4thKUdSzRd6AZ2E5RHrtEAxjnldCDt7JaIgydyPz2huk/RMvrDJkXyp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(102115026); SRVR:BY2PR12MB0711; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0711; X-Forefront-PRVS: 073631BD3D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0711; 23:gSBekqDNio6AZ8QxDTF+TeVK31jPYVGQaRLRM0JQk?= =?us-ascii?Q?G3X85u9HpIOzxkCZggLtd15sDEs3fv2HP+HLVjPio+kZKajnNVUogQhRRyew?= =?us-ascii?Q?nIcNK5FZfa7joOvzOTvkm4oH1as6dpD4Jf8ZhXt8NEADI/4PjF/HSefBZii4?= =?us-ascii?Q?meiF1X1uNQS75u7igoF1Sg6mG0kynFumOrJFcrM4N76rbpRyXrUf4wLKjeyE?= =?us-ascii?Q?STmYf7uCMEUwmjiMPqxUWpUGGXKuSj7YH7x6NMrjsRFEiY+zU/kkxi3b3Ssq?= =?us-ascii?Q?efEvMY3VsAPNRnnpFWDpu2f/8y98a+Igyly03H9jgnodCuIMMebD6vULR+ZF?= =?us-ascii?Q?xvdzPhvLtgfm9kSlMfOhszZHGVAY02U9x52pnEV/7MJLKDs9+26Dt99GNcpy?= =?us-ascii?Q?BPQrI67lFDEZuCiArHHX6grJaL9L8AKuiUGZTWGrvVT1r9U9wu16JoR2VADt?= =?us-ascii?Q?d6OLe1tQuFoItUSctg9zu+/D94eyKfqawkaoikYrpqCCxtE4SJjvBwnmF7VK?= =?us-ascii?Q?oW/MMPcBJW5TqXyBr8ZXbxTGyPCR8ewsDn+tyKxZQZyLEfPhRYRJrlWmB9Kn?= =?us-ascii?Q?NHzYUCfiP2UEJjGnSIMkUgL7v9Tmy4xb61QlULROKHeHYXQ38PpD5vxhbQX4?= =?us-ascii?Q?dSL7JNZYdQHL47j2nJ3SdiFNd5p5T8uvPIsijFg4n9UO27BF94FHJ2TSBbqo?= =?us-ascii?Q?J4dFiFFLwn5uohH3kHAcv5Pv5gar9c1JB2HpVJOqUjGKlQso0FWMfutrVx+Q?= =?us-ascii?Q?5AmPMjC1OZCSSFiGvKV3iGkPKp5Cr+swdp4NT8huH/edYaBT52zD587y1hDx?= =?us-ascii?Q?qDEKFISMqx+DenQ6KZnqWRU9haEW35aLG2HO6Vv+4j7UxiVo07H3NHxOpXg0?= =?us-ascii?Q?5snZjphUIRGkke8QJmkLIM6Py2ACJGELp4vAWCckTHPXsdan8cmKFoaBGebq?= =?us-ascii?Q?6WftpqNmb+YlNQZJ+C1IfP2ADp6zp3P6wSEqpiVrGxvOs8+WF3ccDjbJ3kP6?= =?us-ascii?Q?nX9TrZUUfjLzebAGVT5NfCu?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0711; 5:IzA+gAPrE6XKF4zrYY/tqERb9UXAKyhog8ofW3coL3Ip71H2xYfEX+DcTpmOxYskz8W5ZikQH0hUC+QPeD1MsJJBgQ9rdR6iocLuWKQrgzGIEhPDNZsEsFRhqEORtqo/YiwqkGoY277ZdOp8YuzmJw==; 24:yor7jH0JF3HK/gokvXjK39AfcrcRif/8gX/HYmD/qJnmRjBGCRWMF9q2I9V6ts8dbG1o8CztitdCmF0CG6DwT2BkVCNWBEPP/ha2KmsOjCY=; 20:6IgXE83ehfy1kkp9DxiYE+L0i6wsXa6hOQFY+Bz2Up825Jn4Oul4+vcnZJwEPj6ro02JBwPZhL3M0BQ3J1FeOFz3qMViX2HBUYmsWixx4SIcUCkPsmTTS+5FWerA2/fSlEzTiGql8QtfPNyPgLKkihNg0rs9/kclptsDxUHUC3JJEjZ6KN9U/FNjEjjwY6iirWra6IlZo/bmQE6EoLWNyAwbFwcqmzwpj4K6OPKQui3xbfrEbPx/ugIMCJicwqpW SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2015 18:47:53.1519 (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: BY2PR12MB0711 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151021_114812_874653_3B7B8342 X-CRM114-Status: GOOD ( 14.55 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , graeme.gregory@linaro.org, Catalin Marinas , dhdang@apm.com, Will Deacon , linux-kernel@vger.kernel.org, tomasz.nowicki@linaro.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, Suravee Suthikulpanit , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, 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 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;