From patchwork Tue Oct 13 20:46:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7388611 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 072E69F1B9 for ; Tue, 13 Oct 2015 20:48:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E736207C6 for ; Tue, 13 Oct 2015 20:48:56 +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 D2792207BE for ; Tue, 13 Oct 2015 20:48:54 +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 1Zm6TU-0003NX-Sc; Tue, 13 Oct 2015 20:47:08 +0000 Received: from mail-bn1on0077.outbound.protection.outlook.com ([157.56.110.77] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zm6T4-0003DS-M3 for linux-arm-kernel@lists.infradead.org; Tue, 13 Oct 2015 20:46:45 +0000 Received: from CY1PR1201CA0036.namprd12.prod.outlook.com (10.169.17.174) by DM3PR12MB0858.namprd12.prod.outlook.com (10.164.7.140) with Microsoft SMTP Server (TLS) id 15.1.293.16; Tue, 13 Oct 2015 20:46:20 +0000 Received: from DM3NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::200) by CY1PR1201CA0036.outlook.office365.com (2a01:111:e400:5b9a::46) with Microsoft SMTP Server (TLS) id 15.1.300.14 via Frontend Transport; Tue, 13 Oct 2015 20:46:20 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; arm.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 atltwp01.amd.com (165.204.84.221) by DM3NAM03FT011.mail.protection.outlook.com (10.152.82.88) with Microsoft SMTP Server id 15.1.300.4 via Frontend Transport; Tue, 13 Oct 2015 20:46:19 +0000 X-WSS-ID: 0NW6F16-07-6UG-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 atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 266F0CAE628; Tue, 13 Oct 2015 16:46:17 -0400 (EDT) Received: from SATLEXDAG03.amd.com (10.181.40.7) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 13 Oct 2015 15:46:19 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag03.amd.com (10.181.40.7) with Microsoft SMTP Server id 14.3.266.1; Tue, 13 Oct 2015 16:46:18 -0400 From: Suravee Suthikulpanit To: , , , Subject: [PATCH 3/4] gicv2m: Refactor to prepare for ACPI support Date: Tue, 13 Oct 2015 13:46:22 -0700 Message-ID: <1444769183-12374-4-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1444769183-12374-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1444769183-12374-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(101416001)(92566002)(64706001)(19580395003)(19580405001)(2950100001)(86362001)(189998001)(97736004)(53416004)(5001770100001)(11100500001)(50466002)(5003600100002)(87936001)(50986999)(50226001)(77096005)(105586002)(48376002)(5008740100001)(106466001)(46102003)(5007970100001)(2201001)(229853001)(5003940100001)(76176999)(47776003)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0858; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0858; 2:1Sd1bpP11lAEe8GBTvOgpoIHoghWtBfq4RwTwekFutWO3qZlQyYQ4vY+M2ULUjwzUsT+Z9le1M2EYQNRDIHMpnmeZenhMPBZZKb9RZnhG14DQqgtW1Y2F1vpuXgYCxjz2uzSdsgz64I77owOfOvmlSC+4AHjvMfylp/Lf7FAqdA=; 3:uOCXrEnCyn6S0ONJRnNeh6pDuWrRnQSdOOYQUtDDBQLN0ahDRO+GH3/J/kePTqrY3Iytu5/7JXN+eVVcYRdsm7UoRiNAJb1O6MxopbJ39GMFhLmiVSsaXL6x9jKLVpKAFtGFWMlyp/vd12IjKRMiZq2G57SGn9tFkle0rx23mnoFB638JDrNlwpM9P09wPLjauE72YOzIsHNjn30UfsowK2Xwc5kwRqjolzvMX3gm96Zjc1WtPNBMxG+0qzxF6a0; 25:4tY1sFaqPxCjdpNxUWooPCMcEjmwVlWmKny8TGke/5i437pR22UWnJfIDaqz19vfzzixGR6uKzeu9B7L3wv16v83r511M8qjxd3DjWYlKp1SD5PNdehIdwYMOLcMKliTQvacyYzPGoTRFFSEzb3wDGazU3CAZxK2KD651IfLumQ5v25GjLQyD8Ta5MvzuoHxDqSp2vs278YuBL9JcPyQoY1gWtf1BpCyuSY3skawo6ourcZKxGtgP1idvv5vBnjZKL2I4FGGa7PHXN++/Rd+Bw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM3PR12MB0858; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0858; 20:tUVTKvYqy3M9a4Thd/waSv6zp4ihRQ1YaoLPRhQXJlUGJBz/7FOoFj8QH+4pD2Uvig/Fn4iZ1cc7hhEOf3bTH3OZPKMRWiWGR+yJ5EsRjgZTbBOiaLsoOuyHOh5gBcPABn77YAPOZUgjr1IMB/oijEIU7eELg6lUoCRg7C9Hs05T0qNFiRFwlBDhgU/aGhqpFsO6swHq2x8aCqff9DwPTG8sWuj1bL/1oKH1kbwgU76EDs06DSXJT0Je0PdT7PoqtHVL3lTtPl6bxbBAMkLhyQE1PidHyD1zjHXF7S2aIFGANlyDT57IoXKScrrYFlZfItGs9NPex9lzLbQpq/PT3vSaf/9G7Id7OrxcB9/Lvo2DSrMqEgEC8QBpn0Yd+VmqUsFevWuvExX+VkxSu+/W6NM3CyLW/pLQe041FXLQnmRSgeKxudXem5de098krF26TyFYeIF5QvW9MEVNgVO8QOlraG82DTOgM1UPg3SGdR2Oha0GV9QFJE9Cft3N6MOk; 4:IdwMtDHcahM761HgoIdhIAaGuerLMqIqQeo+u1Lt1EFrjBuqmU8NNveoG0GANNyrQtF+8kXtiamb6hWRauN2SVdxx5veZ2Rt6Eyx61Ogr2+QxxRqNqGp6UMfoMp8Q0fqgbtv0Qt1W/UlY3EIbnZb1XK5dTBn0DI8BfPeRoaYZuEi+ivKH1UFzU7dBQc4VVGRZTpAbrqj4T/9lsOQxMklbFL3m5Xdh5GQEHdNu/ThV/I6nF2AcR/7jyEdWwVdcVE0+0MDYd8sWEjxYZjpQ9yErxLRuE2OKGwAVief10mDcztbR9HZVktGNGXDY0HkBRT4Gw2xnoWTiwb0Y7E4J8xO5INvw5p48N8iSLZgI0vHGxA= 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); SRVR:DM3PR12MB0858; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0858; X-Forefront-PRVS: 07283408BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR12MB0858; 23:bLv/EU84W9DUjZdgZzE4++HB5SB71uan3I6ddZ9xq?= =?us-ascii?Q?y86EznaookuRu0V1BmZboha8mM/V7/ScyHCLDmmSf/iO6WvX2VCW291qqbDv?= =?us-ascii?Q?pBrbxhyTBLeHRDq7eJLGWCjqzOZBGr6fGqc294UeidNh2NaCANAgPVjsZ0DI?= =?us-ascii?Q?wuNRY0pCBgZy3/QzblMUrEnGai870Y3lzboS31nzVuKIQ07zZ2sapYgKt+/z?= =?us-ascii?Q?ttGeiTmxOvu5FmfjYJdpJ0q0VP1ButFwfS/7FQ/UZNkNJDPnWRbDhG8vpa6c?= =?us-ascii?Q?mJk4Sv1nuIAiEdO6eeMriS9iignqKcw6Mg5N9KzbQYgUHBukhiFLJEMowE5i?= =?us-ascii?Q?6vTugETkT9igGpUaxSn0binawZC89mPnKW9KSnyYBhmdHpFfaM7aPzSUYtA4?= =?us-ascii?Q?AxD6YnXeuP38utabS5UfahRdNFzc6zRWc6aY0I4OjqK+wc63GDd6xG30maID?= =?us-ascii?Q?h14+kPA+AJYX8jcUJoSBoJJ+3ykqrXOADVRi6+MiYVAMucdcdbOq+85ExSUW?= =?us-ascii?Q?byfj1q3+cYO/t21is5CbWHFyHNXCTFhr3ZRCMpV4e2iZ7OGf9Fbp+2w6wI5a?= =?us-ascii?Q?v5F7Fs6IrV+jrJ9Ih+lybWq4gjGHKAQXpp0HDN26R66u+f8IAHuhJPPG4Xyo?= =?us-ascii?Q?1EpGM3v0Gae/pJb1RkEHIaj0Kjr80xMgSvYx3MUJB90j9lOHhlEqoefMo5VU?= =?us-ascii?Q?7UxGvoqh0rpVWOH58mAIRDe8WFVSLUxbFvD42qujUG5Q/ukQJfuK66jyQFl4?= =?us-ascii?Q?rq9rjDnj3B4mYr2SVJqBlWaoI0ETY/RdElmkikvFGII7xerROzLndf9qKYds?= =?us-ascii?Q?E/5r6DkIJA5/uRQ4RgeXoUL3PMRP+SULwfy4EwGd0RImw8cr7bhNEiZYeari?= =?us-ascii?Q?1IaZ8eXBCBzL/F7kFUQTP9PuL3XN7dKeJpRq4kFc6asvvEKiAd/6sER5qrRX?= =?us-ascii?Q?UFgj6NC+x+XTm43zrvVqAS9P3Uzos8/qyyPlddwjXDPcknEyPbMo4cSe126c?= =?us-ascii?Q?Co=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0858; 5:7NEEgSm/pMman4QGwP3idmztp/hUm5pkNifoiHv09afduv7y4FgtRPh1k/ON8AhaW8sL24jiMRg+VwDlQtovN6ZlyMVPoK2tiT4Mzl5nHuXD0GmdKI9xoLu6HffbNxhjFZD1qKkv3H7uPXyUZc+BrA==; 24:Khr65JDHQ/WRsBcta+gQZKK6HIDKfc8lizgSCKiqBu8R7oY0Qh8V8WIWsKuiCVMfWRnU1LgtrpxokmyfwKSLI7bsaM2fSTv3vdjdomEkdmw=; 20:h+0Dlo+eNdR62dihcYP1h4+OrCaH72WnHiC3a7J73LB0IncZZGCUQVCldlAGi4IXQXeHuIsVtReX7U5Qq8p9H5fgerSlqNnuQLo1VFhTrNH+vNwRrrkgG8DNtXvdf28YTRV83StEy32GemPa+/bKFkiXcruRLmF5t5RajBQuKD5LMfljEBAB478o6CnHWzkEqLY/w6Ep3YQn3B6ldTr9+rar1aJmrk8/VHzFH7w4LWhvrYNBOw7FtbB2fRHCU9eY SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2015 20:46:19.7891 (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.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0858 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151013_134643_088634_82C9B6A6 X-CRM114-Status: GOOD ( 13.52 ) 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 , 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, 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 refactors gicv2m_init_one() to prepare for ACPI support. It also replaces the irq_domain_add_tree() w/ irq_domain_create_tree() since we will need to pass the struct fwnode_handle, instead of struct device_node, when adding ACPI support later. Signed-off-by: Suravee Suthikulpanit --- drivers/irqchip/irq-gic-v2m.c | 51 ++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index bf9b3c0..97d1bf4 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -239,8 +239,10 @@ static struct msi_domain_info gicv2m_pmsi_domain_info = { .chip = &gicv2m_pmsi_irq_chip, }; -static int __init gicv2m_init_one(struct device_node *node, - struct irq_domain *parent) +static int __init gicv2m_init_one(struct irq_domain *parent, + u32 spi_start, u32 nr_spis, + struct resource *res, + struct fwnode_handle *fwnode) { int ret; struct v2m_data *v2m; @@ -252,23 +254,17 @@ static int __init gicv2m_init_one(struct device_node *node, return -ENOMEM; } - ret = of_address_to_resource(node, 0, &v2m->res); - if (ret) { - pr_err("Failed to allocate v2m resource.\n"); - goto err_free_v2m; - } - - v2m->base = ioremap(v2m->res.start, resource_size(&v2m->res)); + v2m->base = ioremap(res->start, resource_size(res)); if (!v2m->base) { pr_err("Failed to map GICv2m resource\n"); ret = -ENOMEM; goto err_free_v2m; } + memcpy(&v2m->res, res, sizeof(struct resource)); - 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); @@ -299,7 +295,7 @@ static int __init gicv2m_init_one(struct device_node *node, goto err_iounmap; } - inner_domain = irq_domain_add_tree(node, &gicv2m_domain_ops, v2m); + inner_domain = irq_domain_create_tree(fwnode, &gicv2m_domain_ops, v2m); if (!inner_domain) { pr_err("Failed to create GICv2m domain\n"); ret = -ENOMEM; @@ -308,10 +304,10 @@ static int __init gicv2m_init_one(struct device_node *node, inner_domain->bus_token = DOMAIN_BUS_NEXUS; inner_domain->parent = parent; - pci_domain = pci_msi_create_irq_domain(of_node_to_fwnode(node), + pci_domain = pci_msi_create_irq_domain(fwnode, &gicv2m_msi_domain_info, inner_domain); - plat_domain = platform_msi_create_irq_domain(of_node_to_fwnode(node), + plat_domain = platform_msi_create_irq_domain(fwnode, &gicv2m_pmsi_domain_info, inner_domain); if (!pci_domain || !plat_domain) { @@ -322,10 +318,9 @@ static int __init gicv2m_init_one(struct device_node *node, spin_lock_init(&v2m->msi_cnt_lock); - pr_info("Node %s: range[%#lx:%#lx], SPI[%d:%d]\n", node->name, - (unsigned long)v2m->res.start, (unsigned long)v2m->res.end, + pr_info("range[%#lx:%#lx], SPI[%d:%d]\n", + (unsigned long)res->start, (unsigned long)res->end, v2m->spi_start, (v2m->spi_start + v2m->nr_spis)); - return 0; err_free_domains: @@ -356,10 +351,26 @@ 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("Overriding V2M MSI_TYPER (base:%u, num:%u)\n", + spi_start, nr_spis); + + ret = gicv2m_init_one(parent, spi_start, nr_spis, &res, + &child->fwnode); if (ret) { of_node_put(node); break;