From patchwork Mon Jul 13 09:14:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 6776571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4E806C05AC for ; Mon, 13 Jul 2015 09:17:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C41420678 for ; Mon, 13 Jul 2015 09:17:25 +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 A10D920614 for ; Mon, 13 Jul 2015 09:17:24 +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 1ZEZpo-00037F-Vf; Mon, 13 Jul 2015 09:15:36 +0000 Received: from mail-by2on0110.outbound.protection.outlook.com ([207.46.100.110] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZEZpm-0002wx-Kr for linux-arm-kernel@lists.infradead.org; Mon, 13 Jul 2015 09:15:35 +0000 Received: from BY1PR0201CA0037.namprd02.prod.outlook.com (10.160.191.175) by SN1PR0201MB1502.namprd02.prod.outlook.com (10.163.129.156) with Microsoft SMTP Server (TLS) id 15.1.213.14; Mon, 13 Jul 2015 09:15:12 +0000 Received: from BY2FFO11FD050.protection.gbl (2a01:111:f400:7c0c::111) by BY1PR0201CA0037.outlook.office365.com (2a01:111:e400:4814::47) with Microsoft SMTP Server (TLS) id 15.1.213.14 via Frontend Transport; Mon, 13 Jul 2015 09:15:12 +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; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp01.amd.com (165.204.84.221) by BY2FFO11FD050.mail.protection.outlook.com (10.1.15.187) with Microsoft SMTP Server id 15.1.190.9 via Frontend Transport; Mon, 13 Jul 2015 09:15:10 +0000 X-WSS-ID: 0NRF5P9-07-ACG-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (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 2A35ACAE7EF; Mon, 13 Jul 2015 05:15:08 -0400 (EDT) Received: from SATLEXDAG02.amd.com (10.181.40.5) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 13 Jul 2015 04:15:22 -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.195.1; Mon, 13 Jul 2015 05:15:06 -0400 From: Suravee Suthikulpanit To: , , , , Subject: [RFCv2 PATCH 4/8] acpi: gsi: Adding acpi_init_irq_alloc_info() hook Date: Mon, 13 Jul 2015 16:14:20 +0700 Message-ID: <1436778864-17645-5-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1436778864-17645-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1436778864-17645-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD050; 1:2i2iviPiRqHre4nXvNg+ERYd/6HArd6U5ziwxT6OyzVN4DaQLo0KpNHayNafRq7MXvDZoD3yLu38p5I2KmIkQTeswqgXVIRWUfV44WhOWSwaY9gIRSMpQYgG2Y67GqG1sniZo9t83rzriNrbo7P1cDIQUPzNwsBausY9ndMu162yvSk3M1Cw0xqmz7lH9qvQYvgvPsR54FQhCnT/Z1nWjAXvxOeJ/yHzW7qRons1a64hpmr3WoNdYBxTklomDUD6D6LZxG4xTDqMWLmRH068ElPf5febRdDs6tLuCc2xcC8OasIkAGj7oK9tqTYf1UWn X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(428002)(199003)(189002)(77156002)(2201001)(50986999)(62966003)(50466002)(76176999)(47776003)(229853001)(53416004)(105586002)(50226001)(48376002)(19580395003)(86362001)(5003940100001)(77096005)(92566002)(2950100001)(5003600100002)(36756003)(46102003)(87936001)(5001770100001)(189998001)(5001920100001)(101416001)(19580405001); DIR:OUT; SFP:1102; SCL:1; SRVR:SN1PR0201MB1502; H:atltwp01.amd.com; FPR:; SPF:None; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1502; 2:HTeAFYqzD26ZQ4Xr11OilsX3DLodYSVS+8/jpRXBcOTjOhG7C1zZhcFlIB1bhLXM; 3:2TUNAdmcmlKbbLqCv6T8U81UVcpkG7ypeotwssZas4BdlACGhYB5uMjDEcdqSQ5GqIwIZm/eQ+v2bQ99v1FlAdI5xof5XECB/KSvfGvEt+5PKSHfkCipS0rwPbifjacT5ZUjmJEgQ1TMxAeaOFnm/qZPXlB3E9BWfGbicAfB1TxdLBWb10l5Tn1y/dxItPn+xJLOltAARxWFIzYKBxEGaMK3BLRdnjdqTzc8qyXGN9t06GKqZIfK95erBLlCTXwV; 25:lPXJVcg0K+DXUcbufUA2Z6or8svDWCQnlGQGRpyLlcH6i57BOwX+rL/ZeDGMNn1KIAABxGok29+WlrufkhOc9zeEbNkWewC1KOzsXera0z9uv+5xX2bVbzNBNfJTuAO+GFosC1vlpaiCjp23iKXtmyRlWa6r9qsYTRORKYs1pl4EvxHjyi2ytHgzwCtPpjIG9ziucYxezdWRSKRWiJYEHL5yGsNDauPu/JwZ7erhe5Z5+QOG2q0ZD3rbu25Ob0elTKecxKJecAi2SGQynROV5Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0201MB1502; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1502; 20:TMAsHnBueWjJL9n7H71Uv8CDiKjiQSLHKxJBFID4VFqFSlFz4aiHDqkGHV/xSgn8bFboBlkd2r6Nu29l4JsW0A2MwIrW5OwaRApDCKwDzgaunIVKxmKCIII8o2jD2r/XQLDKAGEvbSZvJXm1atOS8NNUS0w9tqOmi95bfXlZAxWLQOvTE0qlynQDFp/XOJxMkt5Uj+j6sb7szMZEJ+s1HMh21rKMwTEQZX45Yb4tIKYQyK1niuZunoaUWjdHLpslxtO10J2019T5Qliav7QVTjRm8ekr4o3+yrZn6tYJV6UTsxXAc8leJFlQRLco0ZiTCzEFv+s3njMdUSxmsQneNVAnAPmUUcHAJLcpZ5i7U0EDZ5lOgd2oRSiJS0bDz/artxeZaUaVVKl8HIOydJZcQ33NAfqILSAVQzr8Wc0cSiOmLnXtmrQcCxDsXw3rjC7wi8sdXf9TY9eYjBW8fNkHCz69dpSdg3RjwwtRbY77j+R5ZCmPhsOC9do/2uXScE6l; 4:9T4jHdMylYkjKQGCdUYO9p0QDc9+m2xTspmkGxOOS0wL717hSV0y+PI61R01yhb2eYBoTPsu4VlwMMfkVsgAZc9Fdw3pYI+2m8gcz82YABA5Ogit7rpPGoFnUvxybHJPexu0NyN97rrDTk0WG23UPTm+Y+lXIdiTwCh3P/k7S99kU0lUj2JGoBIfzVjmHngjk0/LWuq4O/AilA+khIdHujgTRv9FBcI1ArHhrks6juH07SdAPgrHytw2XAPR9zXC7eTpL8JOY3DZ1Zy2RVhPCgs+QSU5HT0ut9nS6OQsHXE= SN1PR0201MB1502: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:SN1PR0201MB1502; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0201MB1502; X-Forefront-PRVS: 0636271852 X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1502; 23:YKviSp19uHJjmZCXL78AR1CIwYfFbopVeQtjRKVbg0mBoxy+wzlBw/t4qdX9UUyfOGSto5KmPwN+nmaOY6qdsk3Jj2UvgwDArWw+Sk9ul45BIFRQ+zzbjDyG4FPz0LVLzKtUq/NYtBN5nPvnFbXiFQjUY2Pq3oVJvaJQ3W+R8Zz8gMxmLegdOWO+ZqGMiB0lAxz3edGqTBGdmbIyfikULzZyh1JSSyPat7Fjwepefgi9IgrrIPE0Awvl8xCy58k+C68MnkCu0MceLAYMrQRvSRdsMUqD2R3kEYWG/nGmfddRRo80q3Wp1nstZCwhoKSbhwFaobB65vnktUcXPZOVQ8kWUoU/ggS9AZDqgC/Gg8FTf+Hx0iEhAAwo/15svWgAiMkN0F9/oXoRLHHan1BKE2lva9O8Al4zCHhyKYAwty++IFy85q2MHxyFUD8GtXONZd9nX63GOc+9hQH6qvEB1ErB0jKqKF2ZQV/l3+II0h1nDSUT9sPKRQjxTtlQ36IMlAkp06rqPRF/8O9VPaWwvjCc5sSxpX7j37fKPRWHf33DzWP0GP8oFbFG6IvHrep0Jtz90LRz0YdE0+X1/gMM5oPeLUBvviPXIvt95QcV8lyYHAdmhTmrL1MCG9FSnXC14Hqo7obMbd9+DeaFP661fYHCH1JUB6LDN5ayKdob67JC2WAwXyC5fqVCP0nkr+OM5C6uV5FpzsDNZFpyQYdrp2Dp6j1vbEgYGyTeYPLQGwjX+wFOebut+Xb8VlwOt4IcIFuHygV+N7/PYXkemdwOJxcXo+fZPQdVIkH5Qq0LyjuLTeDQPpgZ1A3eOnSGa3mNJpoIvtmyyt82NV7JmkINlWl7sqOl77v+FxLI2aVaUOnvArB0cNIDESPfJLcfF/bR X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1502; 5:3JUgr/ZbT72+RWFoQWYvvUpwg+iBQXRNzs170TOGRF0OqhC1TFnET9w0JzjNBemywtadkuekVDPjaL1Wegu3UT4MaQClKHut4dWFCSIgcM9B40u35Na5HgTxDmiLRHNq/q7c/awOIp4L3kK0O/bD5w==; 24:RrXxw8YuwjUu/qa6NA3fL2TseL75ynSwU5OFQB9l+AGhu923ttyc7+Z2kej+IihktB79pdkEvVgVfwUtzGJBrg7gM8ItuhCEHydJwAwH5EU=; 20:cWLD2v3bR6xsKdqI5PVnXLO1iqXv913yhoLkrsVIzPAeBW6sPVBeG1eoXnYXFIYH5Zx2HM2FrGVKxjSH7pAbyA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2015 09:15:10.8481 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96; Ip=[165.204.84.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0201MB1502 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150713_021534_725570_835F51F5 X-CRM114-Status: GOOD ( 13.81 ) 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: rjw@rjwysocki.net, al.stone@linaro.org, catalin.marinas@arm.com, sherry.hurwitz@amd.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, leo.duran@amd.com, Suravee Suthikulpanit , msalter@redhat.com, grant.likely@linaro.org, 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=-5.6 required=5.0 tests=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 adds acpi_init_irq_alloc_info(), which is declared as a weak symbol. This would allow arch-specific code to hook into acpi_register_gsi(). Signed-off-by: Suravee Suthikulpanit --- drivers/acpi/gsi.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c index 02c8408..01a14c5 100644 --- a/drivers/acpi/gsi.c +++ b/drivers/acpi/gsi.c @@ -62,6 +62,13 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) } EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); +int __weak +acpi_init_irq_alloc_info(struct irq_domain *domain, u32 gsi, + unsigned int irq_type, void **info) +{ + return 0; +} + /** * acpi_register_gsi() - Map a GSI to a linux IRQ number * @dev: device for which IRQ has to be mapped @@ -75,22 +82,41 @@ EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) { - int irq; + unsigned int irq; unsigned int irq_type = acpi_gsi_get_irq_type(trigger, polarity); + struct irq_data *d = NULL; + void *info = NULL; + int err; irq = irq_find_mapping(acpi_irq_domain, gsi); if (irq > 0) return irq; - irq = irq_domain_alloc_irqs(acpi_irq_domain, 1, dev_to_node(dev), - &gsi); + err = acpi_init_irq_alloc_info(acpi_irq_domain, gsi, irq_type, &info); + if (err) + return err; + + if (!info) + /* Default to pass gsi directly to allocate irq */ + info = &gsi; + + irq = irq_domain_alloc_irqs(acpi_irq_domain, 1, dev_to_node(dev), info); if (irq <= 0) return -EINVAL; + d = irq_domain_get_irq_data(acpi_irq_domain, irq); + if (!d) + return -EFAULT; + /* Set irq type if specified and different than the current one */ if (irq_type != IRQ_TYPE_NONE && - irq_type != irq_get_trigger_type(irq)) - irq_set_irq_type(irq, irq_type); + irq_type != irq_get_trigger_type(irq)) { + if (d) + d->chip->irq_set_type(d, irq_type); + else + irq_set_irq_type(irq, irq_type); + } + return irq; } EXPORT_SYMBOL_GPL(acpi_register_gsi);