From patchwork Wed Oct 21 18:47:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7459351 Return-Path: X-Original-To: patchwork-linux-acpi@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 662219F1C3 for ; Wed, 21 Oct 2015 18:47:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C90720875 for ; Wed, 21 Oct 2015 18:47:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E7EC20880 for ; Wed, 21 Oct 2015 18:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbbJUSrx (ORCPT ); Wed, 21 Oct 2015 14:47:53 -0400 Received: from mail-bl2on0083.outbound.protection.outlook.com ([65.55.169.83]:1361 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750910AbbJUSrv (ORCPT ); Wed, 21 Oct 2015 14:47:51 -0400 Received: from BN1PR12CA0008.namprd12.prod.outlook.com (10.160.77.18) by BY2PR12MB0711.namprd12.prod.outlook.com (10.163.113.21) with Microsoft SMTP Server (TLS) id 15.1.300.14; Wed, 21 Oct 2015 18:47:48 +0000 Received: from CO1NAM03FT013.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by BN1PR12CA0008.outlook.office365.com (2a01:111:e400:49::18) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Wed, 21 Oct 2015 18:47:48 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; apm.com; dkim=none (message not signed) header.d=none; apm.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 atltwp02.amd.com (165.204.84.222) by CO1NAM03FT013.mail.protection.outlook.com (10.152.80.120) with Microsoft SMTP Server id 15.1.306.8 via Frontend Transport; Wed, 21 Oct 2015 18:47:46 +0000 X-WSS-ID: 0NWL2VI-08-3RW-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 atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2BA2DBD8902; Wed, 21 Oct 2015 14:47:42 -0400 (EDT) Received: from SATLEXDAG01.amd.com (10.181.40.3) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 21 Oct 2015 13:47:52 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server id 14.3.266.1; Wed, 21 Oct 2015 14:47:44 -0400 From: Suravee Suthikulpanit To: , , , CC: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , , , , , , , , Suravee Suthikulpanit Subject: [PATCH V3 1/6] pci: msi: Add support to query MSI domain for pci device Date: Wed, 21 Oct 2015 11:47:24 -0700 Message-ID: <1445453249-32557-2-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1445453249-32557-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1445453249-32557-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(53416004)(2950100001)(46102003)(36756003)(19580395003)(50226001)(76176999)(87936001)(19580405001)(105586002)(5003600100002)(101416001)(106466001)(97736004)(50466002)(5007970100001)(77096005)(11100500001)(48376002)(64706001)(50986999)(189998001)(47776003)(86362001)(5001920100001)(2201001)(5001770100001)(229853001)(92566002)(5003940100001)(5008740100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0711; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0711; 2:i6qa9gyXFM5D+yNdS7mrrjmtm2ifY2AbT7gKpBjECVxvSw1hDSdOuJrjVHtqeYQjxNIpJyW252wThUV0xBW9YQrhF4kQS7svsO1gZfZm7oXmUeT81IGUDJk561B+xdLyXDlaCEO/J+vB3B1XrNL1PQdVpuDQINeYIeXSALWr/EQ=; 3:fp/f+7xAsCBXPUBCLWmI4lBdJoqQNH54Q0kl64jcHFfcrfZsAlMDFjhNPmuybDyWtYUF7T8tL2V8pwI/uP9mN19CXJ+sz0UQE3w/TAFUn9pn7jMmBSeZev6kSCxDu4jdCepgGGOfXkBVGdmzqZVj2l3j5KqgynDeH8aePA0rPv0iO/4eb2kpq9HFpX8xesD2kPTwpBO8ldRA9g+5F5WrssK3Ncuaz1037Cv1Mt5A33eP85Cyitsuw7qeeh5F353o; 25:+KJW5F5DCaaoVPVh76mePNMiFDmpUamSTxUSbToth+OtVIEfg5kiVq8384q2KWdcqqcrYq8No0YERiDbiDlJVP2m+tgT64qXZTWG2aal75z0t9rvHGM3a0ZgKCEG8ZejTsOHYfKe1a4/C+TGx9L3x0OZxd4Mzc7Ldg7jOmvRc3sWRfI/Oykxphm25rTNtS2I7L8OhNfXx4Ny7RqCWP1F3cd5SGlzrvFhQg3ZjQNcfgoaZpsQI5BT3G7GEvkCPfwBRgEeaoCdT1iQmotGl90N/A== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0711; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0711; 20:SVLossgSXyeUn3uSk2gFbL00n0TnCbn/+4tAYvLqMEundXMeE0S3fZfcOAGbMi9J3aA7F2NyUJcLMrD6Seana5QHH4sBTTJ+PNpZYY0Db4HQ+bPSdc+X3bQmwrp/fsEOLxAWeC4GyzgpwyqASDXegDmrczmINC7vfwxHMvyowquGmhIsYeHgzqHfWfYeHL/6odu4Rmv6Cozw1qCjY7a3esv9PJs+I6D9yK4BRc6ltCWzUI/0LUI0tqWVvYerws/xB2VlUVCBay0y0QwAg6Min5nXqKnDC1FkI2wO9pUGFU09BqWeS1t2Puf9qoZcVozz3cPuXJaphdPFaU3/WCsG4Zpc1Cc8gQnkK0W389vnnT2sJ5dohY3x4ANhn0JZJbGK/5kJKvNZqqIFKkqQD10VDuhUU0Qxm1ubtNkXojvoehmWPjKYc7DVRHSvjXIT8cT111JZLshdEdNrsioB2Yp6EqQ2ayPdnxtbDV3+k3NRcVpiQW//eIApe8YyqTNszsPl; 4:dm34A3DH1UuXM/f8j5Cdz9lTT4yKs2HUcUzAoB3jlRX8bPJnVGCVrEgeEVldY+4B3c25AnorSJNkl7byYDMZnhaQ9EAv1+/Mmb592wCLTPcM4IIlapSriuC0V4eeRaxkc2QbHdnPIylkT5rkgn/3alWJ9CrgBkBLF9sEiI4YWLrZf+prizs+vDJZKKV+V8eaOuZKIU6C39V3/UtLaAlp/lpYXact3u2JAEZldJJuY2sXfZ7GRAEgDUvk4LgPSDPD38ggiybxpZ1Q+eEiI412Kr6xSK2SVuA9qXIdgX5LcSM9gSHNb70/cCmpG54bI4ZJiaXaabz0KkJmN0PHUHEnTlrJBvrMhI3G4Oy2MONr114e7Q1NKDzNnemzTuTpG+4N 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)(102115026); SRVR:BY2PR12MB0711; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0711; X-Forefront-PRVS: 073631BD3D X-Microsoft-Exchange-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1LYyGEV+YEKeyMc7K0+1luf45luJvsl83A5cX5HX?= =?us-ascii?Q?iIkkNq32c22SuJmhSzOfF+wQtG1zJjMrtVSSdmeHXZLuzfZ1nNEOJLL8OYWg?= =?us-ascii?Q?jLIy146yPX43y+jymF/z+fiKNvDmluPZSvHGO4gf05mwtjqPTBLt27XDCXDm?= =?us-ascii?Q?n/TJWe3553ANMu7RH5QJLmk?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0711; 5:M5twojCcqylNPf2SkJ1m7kTiRfuekesRDBhXciPH5sDzkKa3JtZJvXT7s8h9a0GuEaY+23YmbO3aZSRYCyCl5R7CQv4wMGSlwbHoEQ12o/7l7ccWvbTZnQZesO71Q+Jtv1u6Saf3QAe6IdkUSiIJAQ==; 24:DmuujPM566iYzopxkNpsfpXsAsgpLVxGIHLmBZHlTWP/GAWmSo0UOU8zCEQ70qfPQIF2HxUH3EoQPcy4JQD5Yu0YWismFmnlXj9zy6xOk34=; 20:1lUx6NxFWVW9/2b3S+epJx8yIbJ+0XYpvDJqd+oEGgBj2bDkGmawwLt0Pjt5ra7ucNOyPrIoo1JYyPyCajKF9VWAJeZnhSq2E8FLd24JSAP0hSbjvt6kUPpyBoqm57M6Mg8PvVzYUrzh5aAX3LJ942Le5yv3KZWcrzHyDybmLLeqL/Ku1FcRKtlmQ7VwKB8pQ8ibbu0zflFWIPaHOgF+njQ7ckMG/hDTXq1JB+YU8vdVI9SgGzXKeyLMY/X1UlI3 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2015 18:47:46.3405 (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.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0711 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 */