From patchwork Wed Oct 14 23:25:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7399181 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 CEC569F443 for ; Wed, 14 Oct 2015 23:27:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F223A209D0 for ; Wed, 14 Oct 2015 23:27:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC236209D5 for ; Wed, 14 Oct 2015 23:27:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932420AbbJNX1a (ORCPT ); Wed, 14 Oct 2015 19:27:30 -0400 Received: from mail-by2on0053.outbound.protection.outlook.com ([207.46.100.53]:35115 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753990AbbJNXZv (ORCPT ); Wed, 14 Oct 2015 19:25:51 -0400 Received: from CY1PR12CA0043.namprd12.prod.outlook.com (10.163.230.11) by SN1PR12MB0718.namprd12.prod.outlook.com (10.163.209.20) with Microsoft SMTP Server (TLS) id 15.1.293.16; Wed, 14 Oct 2015 23:25:49 +0000 Received: from BY2NAM03FT034.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::205) by CY1PR12CA0043.outlook.office365.com (2a01:111:e400:c42b::11) with Microsoft SMTP Server (TLS) id 15.1.300.14 via Frontend Transport; Wed, 14 Oct 2015 23:25:48 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) 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 atltwp01.amd.com (165.204.84.221) by BY2NAM03FT034.mail.protection.outlook.com (10.152.84.211) with Microsoft SMTP Server id 15.1.300.4 via Frontend Transport; Wed, 14 Oct 2015 23:25:47 +0000 X-WSS-ID: 0NW8H2X-07-D1Y-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 2E1B4CAE61F; Wed, 14 Oct 2015 19:25:45 -0400 (EDT) Received: from SATLEXDAG02.amd.com (10.181.40.5) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 14 Oct 2015 18:25:48 -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.266.1; Wed, 14 Oct 2015 19:25:44 -0400 From: Suravee Suthikulpanit To: , , , CC: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , , , , , , , , Suravee Suthikulpanit Subject: [PATCH V2 1/6] pci: msi: Add support to query MSI domain for pci device Date: Wed, 14 Oct 2015 16:25:51 -0700 Message-ID: <1444865156-9870-2-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1444865156-9870-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1444865156-9870-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)(48376002)(64706001)(2201001)(46102003)(97736004)(2950100001)(47776003)(189998001)(53416004)(229853001)(86362001)(5001770100001)(50466002)(5007970100001)(5003600100002)(5008740100001)(5003940100001)(77096005)(19580395003)(36756003)(105586002)(87936001)(50986999)(50226001)(19580405001)(92566002)(101416001)(106466001)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0718; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0718; 2:EEa8PXFCU539tkxT8V3nXRAf0Rqxo5aWLPXDn2Ry5C5nc9yDWPjqRm/Qmqcc0Wdk14v/Av6qUw5MtgM6NyYDgOuZGOHFHTifunsF2m9+LdrhjFjFPe37oJ7qT7+TwRT76rMBqjRVUi9BRh8XOzpMeuhmgB+qJDG3az8ZJibwLdI=; 3:FhluOiH2gA+PXsekIcp2wQBo8/s4PATC/iEnQwbgTDMVaGejryzpBuOjRgJ82GKpo3TiaLsjBFZJsW0H6ZDnzhV55ga/K/khdFkItICIRUCimvfmu2jLxlTJePw9P5Gr8J46wOQb2zXLKHeibgsJ9NqwNkNqJtVhkJQiFjmme9QUgo9ucigRotY+E/GzWyBnhwxDaLI0lxQo7bC3LNN8pd74b5Y2GzfEW1p38/01ErbumCULwWMpf2wNA+A0qMEu; 25:0yhnCsA8Wrp3UVyxDKNJ+/1IfhJPrJ838C+5nGjfzHRIQ0sGUhnPd19LM8KBxI6FWw9vJXRTami7Qasn7ZNkNN/JGETkianOQQMuiGIsSzvvtcXw4ayE8A3718SXIsWUpH/ncdHfntX9IzwmTvsRITyypcQC3W4Jsu1Mxo+FcY7RgEgsPUmQmi0EVifJqZm1iOvrOoGpDB745A/OJVSIbKHox7ZS1yXY9lT1wPx/EmwJQfWeHTor3qKO3Kb2jFDshImlEya3Q4IGnP2M1OgDmw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0718; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0718; 20:YpGUD+BnBhfWJ2lOTK4f/bdvn1De3rDgWZNk8n1rEYHbDAMH07mbuRkH4S3D1Scc/n9cOLOS3w2VRuLfcLqmOrLcRo5jYwDpFOpN06+c5j7xFf0PP4a+w8BCRJooH461Ph1yDu+wU6meCnQ/9pX8dZynsTyjTc3kLtFn/f5qrbAFnIt7DKIKtAAMgdRuuJLwMrJ+g70LKlGPBrCP8u6SwiV4oxegopeDhBPuoRnf+YMMU3pOt+T4Zb9b65e0rTxb3+fytFTHjIiAKnryl0IgQOOHKQwAUIEJjZVqDC6TaD7wPOcV87vnWk+E0UhoPMCT+KT/sifOK/shKOAdzVPdm3vw5LEDSxZ7tz2LLKozbxqhGW7lFcvAQzSMLdILoVzi/GsJGUeCHKelgIT+BTa3yl67jw4WuPIQvACJsKTyTZYt04vI8JiQb15vVUjb27xugVkGBmp6RJiHVySNQpFRlx6wt0U/5MCGZL1Kpewxol6VJuLPGAur6XOTwnhmifEf; 4:kymeGe0chH8BwrZjzKJYQ4SmAzg1MZe0TPakND8ANzhakFDIhnGWtokdl7aVx3jDxjJwoVE63eeDPCLIL+s8mO8Gdi+a4DtjhR6B6aeq1WYVB6X9RLUhzzLjWmSEUqH5t7H8yw2pmWtYrxsc1mksmZA5KSFp2jizNI79Ym7aHwRkxJ188MOn/ENeoN2lEllxVtpEBsHYxowP8/jgLhcHoTvz41ggi7qYhJbjJ2UzADsy9jlnOHY82p2jtzqklCTzzsWnjUvp+svg5ZpVZU5eY6TAFMwpUQy4Yi+7NAxC4Q7l2VXQ632tj3VegmrdkRbmSRmNqXZj50/PIsUHBXXSO6SeSOH03S5e+LFBvs4QujY= 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); SRVR:SN1PR12MB0718; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0718; X-Forefront-PRVS: 0729050452 X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0718; 23:1lPVqtPTJ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z9ch39na7y7HISfiWT7w109jWAGIx3Mqz84F5bmbtumw1pK9nqTVLQwA4w==; 24:zu42scTyzggUECl2UoNh0eox32PUBVXXNrNeYd9n/NKSLZWUIPPFFcCTvLD4NxcAEIUwtcBzJgNlKGaIVM4G5vCFFmR+sG4CpobISGhbthw=; 20:5BXzQ/+nTQRBO5k8x9775XUnOx1vY3wDgpboAQdDvcT+VxAxf2SPPFNyg6l4/v1ubF4SNTDJYoFkB2MoT/QytRcM665B2rRlXEvbKkKUb2i19pAngEol+UIF9N0p4Xj1al38lpYF4vLMrp6Sm0jtDzabcjSBPdtxWXoZHNkQkU7HM1Mpt4VfzRJtyobyCaOdEvsSQCSyhR25XJvNba/CX49vG6NA7aM/TXAkX925mwxzBIF2meWeNhuqEs0HhPQR SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2015 23:25:47.3487 (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: SN1PR12MB0718 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, 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 */