From patchwork Tue Oct 13 20:46: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: 7388591 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 7DCF89F1B9 for ; Tue, 13 Oct 2015 20:48:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95D2C207C6 for ; Tue, 13 Oct 2015 20:48:49 +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 A8670207BE for ; Tue, 13 Oct 2015 20:48:48 +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 1Zm6TC-0003HB-Mk; Tue, 13 Oct 2015 20:46:50 +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 1Zm6T4-0003DQ-0v for linux-arm-kernel@lists.infradead.org; Tue, 13 Oct 2015 20:46:43 +0000 Received: from CY1PR12CA0010.namprd12.prod.outlook.com (10.160.137.20) by BY2PR12MB0709.namprd12.prod.outlook.com (10.163.113.19) with Microsoft SMTP Server (TLS) id 15.1.293.16; Tue, 13 Oct 2015 20:46:18 +0000 Received: from DM3NAM03FT008.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::206) by CY1PR12CA0010.outlook.office365.com (2a01:111:e400:4c1f::20) with Microsoft SMTP Server (TLS) id 15.1.293.16 via Frontend Transport; Tue, 13 Oct 2015 20:46:19 +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 DM3NAM03FT008.mail.protection.outlook.com (10.152.82.122) with Microsoft SMTP Server id 15.1.300.4 via Frontend Transport; Tue, 13 Oct 2015 20:46:17 +0000 X-WSS-ID: 0NW6F14-07-6UE-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 2E9E3CAE628; Tue, 13 Oct 2015 16:46:15 -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:16 -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:15 -0400 From: Suravee Suthikulpanit To: , , , Subject: [PATCH 1/4] pci: msi: Add support to query MSI domain for pci device Date: Tue, 13 Oct 2015 13:46:20 -0700 Message-ID: <1444769183-12374-2-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)(105586002)(106466001)(50466002)(97736004)(77096005)(2201001)(189998001)(48376002)(101416001)(87936001)(5003940100001)(50986999)(19580405001)(5008740100001)(86362001)(50226001)(76176999)(5007970100001)(46102003)(19580395003)(36756003)(5001770100001)(64706001)(229853001)(2950100001)(92566002)(5003600100002)(47776003)(53416004); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0709; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0709; 2:EkyVIjeC7JJeo38prdwGzI8i8OndwIG/+BHWUjH9xVrmtdtr4Chyj1kCZkwi/dbEKw7twb5SJBP8UcXA+x5yWDYItKoK67ga+3pLWMJ6vrjnFpEGYI2EoRe+GPc9NMfywYjIcDjS6t/e5+5b4ig0RujmbcLfIElEC1xoWlFOsLw=; 3:xWT1HsDtzUbIzmLG6DtRzP+Wg57ugVzVfZrP2G1Wd6olSHv4D/LIN0n4QDL2NhxdEqfBIyqtu75I2zmXyUVZpNct7gXB6RM4JblZ3JIpRRi3D3i7tZHuw5N/Z4gaqdatvm6yxtCQYh8YnARFdSS++2aWkSsv4rFpdqfX+DjWLhdc1PYnPBcvraP8LnAt+3d2DiA3u1ndiPQ6CQROBVynn3Pe55Yk/G5d7v5ggaUHSNlQCFtZyqYK10NwjwlGy/xu; 25:+3LKD7T/+xE/q/yMDAtuawk37boshTJjUXCg2XVFdIpZtzgTaOg1si4Wnw0LJbSAConsAjk1eepQYzdsmy/4mzbrq6kSWnA3I7th5RM2R3i1l4X1WvGX6O88mzDFIbnCvxKQCcdZZxnUll9IoOWL2peMSvOjRVzOmEm9d1gZlKaLAGBKCKYoWeTAQ7iKjXgbMp3IwGTwgt2SRYeME9RBP0mMN7C5KDo4nzPswX2AF4bQyvU3Q54nYVPp/lgzwmwLrpyCo8o/QTWG8umRX0pyug== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0709; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0709; 20:Sr8iYFIowbCsA2BqnhNmTWj4YIsdyUfHm24HDr/e3X4Fj8no9u8v0s3p10HCKxlVvByqFDQbjndYG65DqXfPU+Obm5b4mZEs6/rDov7ZL4EBQY5MyfANlsBID3Rtu25sCd27ny6bzKS1NYQxQ6WhE8kBWikNweJYAXabVILK7s/ruCyTVkvyPnHUFc3syQ6Le0BV9F0j7KB6WGeF+lYCoNPYVpIW3/RpTXK6gt6/4axtOg5UaxJdRedu0ryK+aKjZaCHiFfpYrPqWKi76CaVLoTgMNZ0bYbawHzlkLoUQmbF2pW8A1+OpHxtyCAqk+P8BTh1jKZ6lGcAVQsoLTJ93yeMfQTem2FzlkE1A+7QUZBd6fNP1yIqhHHum4lesdjOA2wPSr51NdVl71f0tL4f0m3QQCbXBu1aUyn3ndDXFE4uuIr+jWKVPYJOmRHxvRaOga9vYjSAoiSPd1tJgcuG0lqZ6VsQOpZ66Hf+M5DldjPudZE1HQ9JxEcoonBRpqn0; 4:ZOvt2EQ/5HnI+rXBdEVYSALAaMBwEULNjBCBoKiAQp3nPogxcPYl2oa9J2MiTvW44XYuVRF3gVyc489H5qflYI/BvVaRtxF0likYAOrHptViwXT1GZv0aSPcRWv/DFaqNSkMUQB113kbmGOTmP/BfK67NmDgExFwm7FAqiyTqYvuVErh1NCiJYyvKSX4Q00eWH3xpKmWR5kPpHY0k60CXxdkh+/O8AvoOuggKPjnnW7iaOBVxNNok04wH3n0l5RXA0cKZX2Lwszr0j4ZCh5RwvCxL0/U+b2QYSsIb0JPIXCXh1a3Y8FSXss3XkDJlDyYLNGDo1oxOKMEAbnf38gGIovofYimCFQlx9hSOzdKW8k= 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)(5005006)(8121501046)(3002001); SRVR:BY2PR12MB0709; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0709; X-Forefront-PR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qxwgc0nDSTj1ylGmDZ8U+9Jl5IBlTrBjLpbspxShMQ4tCKkKozt3+xuJMlbE2Yc17atbuwyRXVy1zWHD26H3FYFy/hhQLVPdUHVhwfyLl8Uu51w==; 24:JUTmlqPqt68jWE9M/4yK4ulZT24cDNM8T6cDhopXqj4JmBmq8RQpMQmwtv3OPcGAh7kqVNlRwxGl5SbuLr4q2T//5d/dCntHLbUl/RIRurA=; 20:HMIjuyG6zpjAHSbsnoBxHLGMLmdVoluiR+xX7ojXWmjPrGA499q89Ahxioh1BQLSkgw4Cvg0TbyWbtrnvfLIow2wwh6eK7VkztgifDqb/bvmhE4/WM0qw6DYjJOQELm8GIfW1arc31uqC0EkljFNfUmt93vsedDz8FIZKQc7etmgpYbk8w+WyvobNW+Xn1rz4khVnNOZbmf/Rsf3X/bEZM2KKeD6jmLvjSsd9aqMEVZCiEXhCdDdd4lD5zZ+eUgf SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2015 20:46:17.7516 (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: BY2PR12MB0709 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151013_134642_791794_B4883DCA X-CRM114-Status: GOOD ( 12.87 ) 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=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 introduces an interface for irqchip to register a callback, to provide a way to determine appropriate MSI domain for a pci device. Signed-off-by: Suravee Suthikulpanit --- drivers/pci/msi.c | 30 ++++++++++++++++++++++++++++++ include/linux/msi.h | 7 +++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index ddd59fe..2c87843 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1327,4 +1327,34 @@ struct irq_domain *pci_msi_create_default_irq_domain(struct fwnode_handle *fwnod return domain; } + +static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev); + +/** + * pci_msi_register_fwnode_provider - Register callback to retrieve fwnode + * @fn: The interrupt domain to retrieve + * + * This should be called by irqchip driver, which is the parent of + * the MSI domain to provide callback interface to query fwnode. + */ +void +pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *)) +{ + pci_msi_get_fwnode_cb = fn; +} + +/** + * pci_msi_get_fwnode - Query fwnode for MSI controller of the @dev + * @dev: The device that we try to query MSI domain token for + * + * This is used to query MSI domain token when setting up MSI domain + * for a device. Returns fwnode_handle * if token found / NULL if not found + */ +struct fwnode_handle *pci_msi_get_fwnode(struct device *dev) +{ + if (pci_msi_get_fwnode_cb) + return pci_msi_get_fwnode_cb(dev); + + return NULL; +} #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */ diff --git a/include/linux/msi.h b/include/linux/msi.h index 32a24b9..ceaebf6 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -3,6 +3,7 @@ #include #include +#include struct msi_msg { u32 address_lo; /* low 32 bits of msi message address */ @@ -294,6 +295,12 @@ irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev, struct msi_desc *desc); int pci_msi_domain_check_cap(struct irq_domain *domain, struct msi_domain_info *info, struct device *dev); + +void +pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *)); + +struct fwnode_handle *pci_msi_get_fwnode(struct device *dev); + #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */ #endif /* LINUX_MSI_H */