From patchwork Tue Nov 19 05:17:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 3200071 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 97485C045B for ; Tue, 19 Nov 2013 05:25:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EDBDA2034D for ; Tue, 19 Nov 2013 05:25:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09FF920347 for ; Tue, 19 Nov 2013 05:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751923Ab3KSFYF (ORCPT ); Tue, 19 Nov 2013 00:24:05 -0500 Received: from co1ehsobe003.messaging.microsoft.com ([216.32.180.186]:29030 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751822Ab3KSFXx (ORCPT ); Tue, 19 Nov 2013 00:23:53 -0500 Received: from mail154-co1-R.bigfish.com (10.243.78.239) by CO1EHSOBE033.bigfish.com (10.243.66.98) with Microsoft SMTP Server id 14.1.225.22; Tue, 19 Nov 2013 05:23:51 +0000 Received: from mail154-co1 (localhost [127.0.0.1]) by mail154-co1-R.bigfish.com (Postfix) with ESMTP id 84818740BFB; Tue, 19 Nov 2013 05:23:51 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 8 X-BigFish: VS8(zzzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h1d1ah1d2ah1fc6h1082kz70kd2iz1de098h8275bh1de097hz2dh2a8h839he5bhf0ah107ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1e23h1fe8h1ff5h2218h2216h20cfi1155h) Received: from mail154-co1 (localhost.localdomain [127.0.0.1]) by mail154-co1 (MessageSwitch) id 1384838629688096_17884; Tue, 19 Nov 2013 05:23:49 +0000 (UTC) Received: from CO1EHSMHS022.bigfish.com (unknown [10.243.78.252]) by mail154-co1.bigfish.com (Postfix) with ESMTP id 994F6100041; Tue, 19 Nov 2013 05:23:49 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS022.bigfish.com (10.243.66.32) with Microsoft SMTP Server (TLS) id 14.16.227.3; Tue, 19 Nov 2013 05:23:49 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.3.158.2; Tue, 19 Nov 2013 05:23:48 +0000 Received: from freescale.com ([10.232.15.72]) by az84smr01.freescale.net (8.14.3/8.14.0) with SMTP id rAJ5Ngng006163; Mon, 18 Nov 2013 22:23:43 -0700 Received: by freescale.com (sSMTP sendmail emulation); Tue, 19 Nov 2013 10:47:53 +0530 From: Bharat Bhushan To: , , , , , , , , , CC: Bharat Bhushan , Bharat Bhushan Subject: [PATCH 5/9 v2] pci/msi: interface to set an iova for a msi region Date: Tue, 19 Nov 2013 10:47:09 +0530 Message-ID: <1384838233-24847-6-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1384838233-24847-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1384838233-24847-1-git-send-email-Bharat.Bhushan@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-FOPE-CONNECTOR: Id%0$Dn%FREESCALE.MAIL.ONMICROSOFT.COM$RO%1$TLS%0$FQDN%$TlsDn% Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, UNRESOLVED_TEMPLATE 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 defines an interface by which a msi page can be mapped to a specific iova page. This is a requirement in aperture type of IOMMUs (like Freescale PAMU), where we map msi iova page just after guest memory iova address. Signed-off-by: Bharat Bhushan --- v2 - new patch drivers/pci/msi.c | 13 +++++++++++++ include/linux/pci.h | 8 ++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 2643a29..040609f 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -77,6 +77,19 @@ int __weak arch_msi_get_region(int region_num, struct msi_region *region) return 0; } +int __weak arch_msi_set_iova(struct pci_dev *pdev, int region_num, + dma_addr_t iova, bool set) +{ + return 0; +} + +int msi_set_iova(struct pci_dev *pdev, int region_num, + dma_addr_t iova, bool set) +{ + return arch_msi_set_iova(pdev, region_num, iova, set); +} +EXPORT_SYMBOL(msi_set_iova); + int msi_get_region_count(void) { return arch_msi_get_region_count(); diff --git a/include/linux/pci.h b/include/linux/pci.h index c587034..c6d3e58 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1195,6 +1195,12 @@ static inline int msi_get_region(int region_num, struct msi_region *region) { return 0; } + +static inline int msi_set_iova(struct pci_dev *pdev, int region_num, + dma_addr_t iova, bool set) +{ + return 0; +} #else int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); @@ -1209,6 +1215,8 @@ void pci_restore_msi_state(struct pci_dev *dev); int pci_msi_enabled(void); int msi_get_region_count(void); int msi_get_region(int region_num, struct msi_region *region); +int msi_set_iova(struct pci_dev *pdev, int region_num, + dma_addr_t iova, bool set); #endif #ifdef CONFIG_PCIEPORTBUS