From patchwork Thu Dec 10 16:55:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 58230 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp616553lbb; Thu, 10 Dec 2015 08:58:36 -0800 (PST) X-Received: by 10.66.150.198 with SMTP id uk6mr17983053pab.70.1449766716103; Thu, 10 Dec 2015 08:58:36 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id hx10si1230083pac.1.2015.12.10.08.58.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Dec 2015 08:58:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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 1a74Wy-0004BO-2w; Thu, 10 Dec 2015 16:57:24 +0000 Received: from mail-bn1bon0072.outbound.protection.outlook.com ([157.56.111.72] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a74Vx-00033C-Qk for linux-arm-kernel@lists.infradead.org; Thu, 10 Dec 2015 16:56:27 +0000 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; Thu, 10 Dec 2015 16:55:56 +0000 From: Suravee Suthikulpanit To: , , , , Subject: [PATCH v7 3/4] gicv2m: Refactor to prepare for ACPI support Date: Thu, 10 Dec 2015 08:55:29 -0800 Message-ID: <1449766530-16935-4-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1449766530-16935-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1449766530-16935-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY1PR14CA0031.namprd14.prod.outlook.com (25.163.13.169) To BLUPR12MB0433.namprd12.prod.outlook.com (25.162.92.139) X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 2:DOtmwUvmgrvqov3mw5C1+rBfXzphrOQ8dZpzecr9enmPXpOKHYg9Vvs2k5mhQwvqVZ2CHksPoG3vdIe6h+OH/NBGkzPfAZPkW/4fWT3Sk1Ce5kDlnvpbbY8Vv/BK2nNucRu4FvBmtff5q5rqRSH3rw==; 3:uIp5mb4RJP6YuRdfJGZ6FOVBxg6G20e90sMG9ufKgAsKdIcr32y13bia+EcNLO9pZMsK3jEHol4tw0EtcLLZmdmOF87OgR1HfSbniXQE9x6XE6SFYsmaE6bLAfzbsWY6; 25:dUuowni5HoNkVF1T6CCwwj/h0hFeMyo+a65aeuyJuCPOBDNianv9jq+22JEKjAUdOo/yrnV5RTNGzgJU1wibl5DdVrnuYxnI/2iApY6ZNOsuVHBmgPDRHyxuPnZ1qvT2JkZj34i2WrrLsDsGgXD5n2CqiskqVD44xLuNhV+LMBxjSnYCC6hRsH2a8FPiRfkbMp5b+QUB3kXAwrfX3/Qecj5rkFSWcxCiaPi4jDxoc4Np/aIOaavNos3srCNk8P34kXnmUpsEaSsYtKqcMmAuhA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0433; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 20:ggG10eYnK8Iu6XkmvnoGymGvMXT29UqQ8cwOO8utGVD78kRDjuR2ppa/fl0xWzDkNjgldmjgDoe8Y3msweKyR24Gtzvyatmzsu8oRvRH6tkXikjy1S2kQxrkAHKS4CzRQuihBy4nSj4Yrr2JgZL+x2KuO4LCiz/FnVy0B2AEg+ugcVxciaTRaEfsB0Pym1NEwSVnrn/GHfXHovDleK2clcIRED4yD/Ghga60M3n8IwdIxsT/aDGO5WVOHV/Cxt3iBKB9+bC0NWbOiCX30TlB/yVsJRiaxJBniNyckjFWAEhD8T6C9IeFJsTOSui2Cca6ZePpsBJS7jgbOtpyCLDwH8a7Q8YKi678oEMg6jHHcGJJj+3DWuyRH4tCsHlmXuWUybQpojX/dT8RCIOebhDPfXNrWy+SiVVjp3bIVmRGKNvSDA7BU90325NmGQHZgWOZ770tP61sZpnqwh7xsTk4RcYi0JRvEPPVjCbkS+V9BHTxu7OBGoZtJHkPNTNxub+O 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)(520078)(8121501046)(5005006)(10201501046)(3002001); SRVR:BLUPR12MB0433; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0433; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 4:jkXLWURY+eR6JLMkAnN5TZXMchG1GFdUmLmf04v5/pYodbOwpvXoAaB4pEjmypjbhkMUhiAc5Z7Dh4DqODCfDeTTrNHMwgiTDincqdAfIwDrWejlhne6gPRxjrc5xVRT2JQEHYgVJZ5/ZHMQ7ax8R8QCTYR+RhwjEOK1gApvY32X+s3XpQMAj59ywyBOM7RzvclUSFNKjhFhJonEbRDTd4SC1gm55v8/3x7+QZTboCnQk+B/D6MD8oPNAajF+G6Ei+5vDvJC3OgpzwEk8YBgAiWGU8ztjzE/ccQRwAUwL4lPUdCDmatd6uB36VPaoYBY5D/ItIf+26oEXbR741x86lfjlbK4tw7ErHfNZc6vVp7gG5fqgiHp5pRyO7jfZVmshaTAdJ7PKcsiNXzu2+AM06mJxbi9rEiWiHuT5VUptLM02r+nzPRrT5yaOToCKwPipRSwyIztW/NjWWmxB5WKsg== X-Forefront-PRVS: 078693968A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(97736004)(50226001)(122386002)(5001770100001)(42186005)(229853001)(36756003)(106356001)(47776003)(2201001)(66066001)(5004730100002)(105586002)(53416004)(86362001)(5003940100001)(189998001)(5008740100001)(76176999)(586003)(101416001)(50986999)(50466002)(40100003)(3846002)(1096002)(2950100001)(77096005)(48376002)(6116002)(87976001)(19580395003)(19580405001)(92566002); 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:pD+Fhv7n9FSX6hFftw8mOWNKf4RTZSRZvsGFSV7Ms?= =?us-ascii?Q?svnONL8jREFJW8h5HphO9lvN3EapHsAuIMSBprYbOtTMpi5ZYcp/mHQ9CgYr?= =?us-ascii?Q?7wCJZ36xK99uSX7wHTiOngllhwAXZjgWqhvmA6btfLXOOSFF9o0HQ6mhrmqA?= =?us-ascii?Q?P7Rqoc4jijjA9e9ETRhPgwKh9iSI+F4hiofE1YRNqE9b0BowAQ8KKh3mXC7C?= =?us-ascii?Q?yIpgWcGaEugew9nX4uUsXGmJXoJWhjBqzmfSeY62u6SNlr4+3fxesPEreI9t?= =?us-ascii?Q?FHQU0e7YiRsy8yYpDQPSZL7DWGB6sZouY5KK6PaB5FgUkT2Xw+UrJ/QjlQ8a?= =?us-ascii?Q?JpvkzPJAplsJPr7646gOy6+cfpnlvnoWgl4gK+t9MXRCsFRg0N0G50lshV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NXi47hF5GLugmBb/sPwoCJQU6l7zsgIk2i4fxXmE4JfKSalwvugUFJwqujoByLTrTVPrBJev7lZJp0xLt5DCWKNRwbeQ500MoJuksHAt4OeWGgfdg9ruduvNmJTSSP9ZluLyp0ZwaVCjPaLYbpi8y51HXakhwAZ7hOqL2hbxowCDBbtZdgsFqwbGrt5RISxXcOUVjy7JjOyDtXGR/tQ+UcPlUrXLFT/Hy6EAOE0Ie78HrLz3l X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2015 16:55:56.0313 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151210_085622_358984_A7DAC8C0 X-CRM114-Status: GOOD ( 10.98 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [157.56.111.72 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [157.56.111.72 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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;