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: "Suthikulpanit, Suravee" X-Patchwork-Id: 54978 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 4685F20490 for ; Wed, 14 Oct 2015 23:27:22 +0000 (UTC) Received: by wicid10 with SMTP id id10sf1682753wic.2 for ; Wed, 14 Oct 2015 16:27:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=ALY6E2kdjfVoBokVa3OY6HfbxsXLCReRuh9RaJoCfYI=; b=ZcPwwQuiCTr36XrOhKLZloutYE0xwdrSy9F8CRMOGzAHlTZJ3GAC5nAny5z9mi8JDY P31LoBcFN4rGuc/vwCV182ET3ochHjMqwRfndkhq/f/2wfoZ/2pPMnFp+xEzdBwTxalg mZ4NmP5GfBTNpnXsC8vBtfc/rOF/7WH6rglibyukVp3fLcWLKLOM1K5D4YFY7HGG0ifm zL3UP6Yj30SRVvyqQzjWhbkVU637YAf5X+f5OQ5uTs4uo4bmte04Ize0E6sc4zS7kf0S vK3S0qX9MwxmlaCK3FwUqYJ5whV3iil9fnYVHtzhLfb8xaeeaDKeFkgp3G4831p/C/rB N3cw== X-Gm-Message-State: ALoCoQkyZouygplMuAkLAZEuN0gY2MX4c0QzirM1A7rCVSICO7jSQINfOGGidfEPdjj2ufyDTHv5 X-Received: by 10.112.132.10 with SMTP id oq10mr1362646lbb.1.1444865241554; Wed, 14 Oct 2015 16:27:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.38.206 with SMTP id m197ls85682lfm.55.gmail; Wed, 14 Oct 2015 16:27:21 -0700 (PDT) X-Received: by 10.25.19.216 with SMTP id 85mr1962283lft.68.1444865241420; Wed, 14 Oct 2015 16:27:21 -0700 (PDT) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id ta8si7167371lbb.115.2015.10.14.16.27.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 16:27:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lffy185 with SMTP id y185so19867263lff.2 for ; Wed, 14 Oct 2015 16:27:21 -0700 (PDT) X-Received: by 10.25.205.198 with SMTP id d189mr1914638lfg.72.1444865241279; Wed, 14 Oct 2015 16:27:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp280276lbq; Wed, 14 Oct 2015 16:27:20 -0700 (PDT) X-Received: by 10.66.147.74 with SMTP id ti10mr6499865pab.88.1444865240202; Wed, 14 Oct 2015 16:27:20 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id z7si5724447par.27.2015.10.14.16.27.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 16:27:20 -0700 (PDT) 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; 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 1ZmVR5-0005xo-Kt; Wed, 14 Oct 2015 23:26:19 +0000 Received: from mail-by2on0097.outbound.protection.outlook.com ([207.46.100.97] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmVQw-0005pS-OW for linux-arm-kernel@lists.infradead.org; Wed, 14 Oct 2015 23:26:11 +0000 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 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: , , , 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/GzWyBnhwxDaLI0lxQo7bC3LNN8pd74b5Y2GzfEW1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A5KSFp2jizNI79Ym7aHwRkxJ188MOn/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:1lPVqtPTJ3OSFI3otpIamYKYWcuJ//O80vs951h4LRemNTdWzFtd+Yl4yEuGZzODR8LUa5TC6hirXZcP1dubHEZNQ5qWIVKdc06ZIhFnXhcqCtzQRTGDQdck4ESgNBKui2PKvV65eLk17fjaorC3AvbsDpuhOqsd1mWDFnpD44G2JLNQFUhw9C9jGl6e86lYswmpvI7RYUGoh5mot/6h4Rlk/EvOQ2QdsgCVXznR9Dq+G5gU+gNUZ3VOKZtsCDja5kcHzcczFCj7+C8mDz1zp+vZ5fqu3pgehMY4qrUxUTY1Zo6E8AW0gteoakwT1Pt+l7svy2rQz9aB5pz83oyTXEgYG2wRBLCVBST53CzSmcpnwalNO2b1agwXtopNmjnZvXfnr0UEWZq5kOKNDFEqF+J2X9mdVul5nwCjCuizqdEQlSyAWbmxau4MgySnJt6o9ezc4bihIWKs0xhGOvFWSF0I2itK4/DZzT84rW3hIaibvAz+oO83H3lohboNCmklEzrBLUwcQS6Oc9OysrAPr5luG9kO0nK90yNQVBK+oYzsXCWrUBKzvYz9iUc1MWU+kk2O0B4a3pZPvOEZcWKukeltNV03ARNHuxzKcxXRpyubhjagLCCDsF6N2EqHFk0HVQ0UawkuQkQEj6r2Mi+CHgZxpKiWkrJbXV5YoY0e0WaEZwAlx0NiRkC4Xnh0wDchGYYkUkLc6FyLPPn++Q8A5m4C77tj2dNfnvWxnjIZD6AKXRW8QBYi7YSNe4GgyXgS9KDugOc6V0tRpSyESu55Wz303iiCxfL3wS9RDzF/OwFWGmFemhwkIINC25qrdBo7vZrl8Ubo6iusNl8KMjThkLYSnfj3cXMKM7TYsV0uQVuuPGE7++WlPAsoSmuCnfrK0KIAz+ANtOpQ5tC8lWqggOwJd4omWmyfRDXwCnpmQNCZqDdbj0pWkWI5WOxpDr3j X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0718; 5:fw/Nke+SISsaOU+KoxgUteyLJ8cDbKCARlxgMST2em46YX/3g1aAuJoXWM90QC7eD0J1/2IqAfZn7eG2eTe2q7Al8ktaz9ch39na7y7HISfiWT7w109jWAGIx3Mqz84F5bmbtumw1pK9nqTVLQwA4w==; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151014_162610_885593_75C812A9 X-CRM114-Status: GOOD ( 13.50 ) 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_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [207.46.100.97 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [207.46.100.97 listed in wl.mailspike.net] -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-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: suravee.suthikulpanit@amd.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 */