From patchwork Wed Dec 9 19:24:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 58180 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp31696lbb; Wed, 9 Dec 2015 11:25:52 -0800 (PST) X-Received: by 10.66.218.225 with SMTP id pj1mr10179985pac.40.1449689152205; Wed, 09 Dec 2015 11:25:52 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lj14si14447844pab.100.2015.12.09.11.25.51; Wed, 09 Dec 2015 11:25:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753832AbbLITZv (ORCPT + 6 others); Wed, 9 Dec 2015 14:25:51 -0500 Received: from mail-bn1on0082.outbound.protection.outlook.com ([157.56.110.82]:8736 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753830AbbLITZB (ORCPT ); Wed, 9 Dec 2015 14:25:01 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from ssuthiku-fedora-lt.amd.com (165.204.77.1) by BLUPR12MB0433.namprd12.prod.outlook.com (10.162.92.139) with Microsoft SMTP Server (TLS) id 15.1.355.16; Wed, 9 Dec 2015 19:24:55 +0000 From: Suravee Suthikulpanit To: , , , CC: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , , , , , , , , Suravee Suthikulpanit Subject: [PATCH v6 3/4] gicv2m: Refactor to prepare for ACPI support Date: Wed, 9 Dec 2015 11:24:33 -0800 Message-ID: <1449689074-30609-4-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1449689074-30609-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1449689074-30609-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY1PR20CA0108.namprd20.prod.outlook.com (25.164.213.162) To BLUPR12MB0433.namprd12.prod.outlook.com (25.162.92.139) X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 2:xNjtJ4+QhTpFLQ0p6f3a6l321PvHb08iEpIyRwUvSxcRvh2NS9utVECTRhAx2IpwKv+SH0kVX3hGSvUFuNuyIVOK5SN+SOXfEZSURUw8fhJbEUidtZ7G1myGbPI7bUd+mYD3bcQh23992YmREzIXEA==; 3:EoB9Zy6phledrJbT7G6MwyztaDKWCPaMeZurq7WccMFCDXLPlZQi/pMDU8yawFVws2ZmCaIs8Tjli0hg9aiu5h/x3AHKQ3nJwgIsHIXAXMzkUsIc32cCDMZAC/HEjUnv; 25:bK7LQ/WKj1tcYtZj4v5zbxwwo9p052VgTdFv6AN+SJ3QjrsHTz2D+IkNjcSPu9Nz3qCZrU6z3OiTcvonbq+2WAiDBuSRN4A6lIN7yJjV51byc5P9MUgA0x/WT48Jm1V6f8mWI024d6nyuVxd1poPYS2dLpNumiCpvb3vxwvEdKuQgNFWsgAVTreTlYqhvtDYbPK5sdVa14s2LAcnUMaQqN6fAkhYE/Dpcmh8U5fZ87xEwHNm62w+Fq8LYJZMtZZ6x84bf0ou1JZQJaXbrN2GBg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0433; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 20:QwL8iGapSfcPubnfBiaHwmuQgFMNF7jQKSXl7RNNFxEUDKq7BsdsvBHEmQcLd61n9XbLrGd6JeihqsB5XOI00L9MWgR9kENvTStRPp+WR+Tb/GCjSN009d0c5D0Ya8DlyTb4u34qDYC5rC8on8mbLLMiuo7QwhLa5LilzzRG8DjFDMYZUJgJO1UwIiwc4CNmPT3Kqreupy9ee6ctJ70b+RHk/HaWjxvvsL6xAiBU9G/2LyZb38NzPnbl0EtDnVjkelkTurnMoOT4BNYJ91e+9+4muj+ssaM058ZCcepJ+Q1Gz45cqyyZZ7uXnInqa3pu+OArA7B47ArbHrsn2mwxk93/RkJ81/eZVgFEAYjDj8CcMIA0MpR4KD883b/WU/pkDIIZqfhVno+2zBsqpbU8feeOfWm9DeqG+/tr/vwvXoaY6paMfAUUybf3D20qP2vmrjUj6goTdiRx01e0NczQh7picN5tfGv7JqveW6hv0hdoYKWPRTS1Vn92q+A6bkVU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046); SRVR:BLUPR12MB0433; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0433; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 4:5xqK4oni3rqsEf3CMlHmciXp3/mUD4SjUKVe3sg0HNmSUJiqLoa2lz7jNYju5/6Pilau8VE4q+wQeLsniEO1IdL7hvG/bPk08Ov8DV+HE91xGRnSaKnLoctxQA3AAIOlowdbIYv4jBUXuNKZ4R06nXwj1k/EyW2sFk+B5WrGzL1XuU6FAzS1NzlD2TKcaTVJmMEfEexHU2TUiiGy4TdpS/c0Y6SeFgkDkQ3+YygGyzzy0yfhwIj0BBJ1LNk42t6Oyfeq6JtcTHLFnp1Md+VtNNLDub3mu39isk6VnjtNOzK3C3BHbzViaVHxSDf+GnKaurnCclQqSL9qlPodK8rsex7W07CGmhNuUDisCnTHXqQdlhHYXBczT20vrEuT5P6mQkkrSvPrNSm4ZdFZBzlHmpheujOAgHeRgSVqn73mLqaua+U4ZNaMBIm8JHl9SDBsR0vBzmfVhQ5VJ63rxJskdg== X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(5001770100001)(50226001)(122386002)(229853001)(36756003)(42186005)(106356001)(105586002)(5004730100002)(86362001)(5003940100001)(2201001)(66066001)(47776003)(53416004)(92566002)(76176999)(97736004)(586003)(189998001)(101416001)(5008740100001)(1096002)(50986999)(50466002)(40100003)(3846002)(2950100001)(77096005)(6116002)(48376002)(87976001)(19580395003)(19580405001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0433; H:ssuthiku-fedora-lt.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR12MB0433; 23:cOXkvoo2qcfEZTob5U7LtGhRaCpuNHda0vJUgPggE?= =?us-ascii?Q?/3NuaDWLn4btXRXeTAF3g4xRpt/GN1/+hewW6+tweOD+1WWA5H9e+yH6cDJq?= =?us-ascii?Q?lZFd/6ImBx2W0+poPsGBYmngV+ZYxCTa3hU2zfs9QHRPgD1ei5BS37n1zgZu?= =?us-ascii?Q?JSbTVmmquin5EyrUne9BA+tPzTqRESgVcLzLKftxqj8CvyIPkmWAea4cbTd5?= =?us-ascii?Q?WGgc5u4EP+QpJJCw9olrSTV2YZCLjf+qf9dyZevfMXT3cekct3Tyv0RtSYdA?= =?us-ascii?Q?hhHC4rL8U9KizE5SEd4vf8HVXqz3rohU1gSBu5GYs6sRZYd8mi1h84skLRbc?= =?us-ascii?Q?aBBnbetnVCp0u+LQx0yJEpsqj/0jFf1G3bCxNKCSoaGqkipv81FvA1RmsutQ?= =?us-ascii?Q?z5V8jKvaP1bNTBXzEXCukYapEeIt9rv40ROffFP8fkuPaSgzsJ+olb1bciRa?= =?us-ascii?Q?Np7OgYMV95Awk3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ddDLj1plosYxNv56cyjvcLVwCbwv3OET9IOal3RP9j40YP46RyfGeTGQGT36WBBUGS1uRxRMytPhBlinXQGNNM/55AqdedMvpTAfiVGF0JBF7dhcFvkou0zdxGOIuAInry8uRyWyaZ083Fc1bmPYtwe/s5o17 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2015 19:24:55.5319 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0433 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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. The only functional change is removing the node name from pr_info. Reviewed-by: Marc Zyngier Signed-off-by: Suravee Suthikulpanit --- drivers/irqchip/irq-gic-v2m.c | 53 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 21 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index 87f8d10..779c390 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,8 +296,9 @@ 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; @@ -309,13 +310,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 +321,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 +355,10 @@ 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)); + 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_iounmap: @@ -384,10 +380,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;