From patchwork Wed Oct 11 06:42:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 115503 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp407049qgn; Tue, 10 Oct 2017 23:42:59 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBFhsCVw2a8ed7tKLg4KR0Uqb40cJnTddeXfns/AJWsc9kXCqdnSp6FbfX7a85DhVar07pY X-Received: by 10.28.100.4 with SMTP id y4mr12118971wmb.46.1507704179665; Tue, 10 Oct 2017 23:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507704179; cv=none; d=google.com; s=arc-20160816; b=vaAJwuUMSwz0AfOUQCjlH1MiIOUmynycWaDcxbapYfHESlGVfFtyQFuQgazBNFOozq +GPTQRNYa5Uulx5ANq3mKo+BbrJS1tWgGxWS/ZwaAT0PopoHyRUVrA2tlmt6HPujuU0N g9qkfZjB9h1Dsvb5r5Z5vG37sv7HMWC7dt1FLCTNkM6ao7Pvv4xEiQQeyUgTUV7rkXxC IaA3WeotwUEpYDPEiKl8TpbTVYKozD0j7g10lU0skhRu2NrKoimA8rwOGB0QhYhfAqCc gjC35IyeLNjBaQq7eNuKx1DFd7Q8q49kp6bqOIanjwtwEfE6t9me7Fsj55byR5xDAZoE bK8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=GXAMPOk3Kb8lAipGtXd/hsMxUB/t5QQU5S6UbxcIKh8=; b=XVNOBDOrrR5Tqg6B42oL3NvjCbDkiMbjKaUjideT9qknKhCuzTRmK73pCInrhXUBGv CUunSdvoMiFvu35RLYtxggdMgtVzyQHy069ad+0/mFIWpyeqb6/Uegtp/eF5BCGxNQc1 OpegOjFhBgq97xqsRBGJA0mN/KItySi2vN68uIhJIkJPEB14mIjInSdVpihyQsUrFdZS ShWG3YCIWXXzZJrT+vzbjnRYhAx2rtSGwZ5FL48myhHguci0r6u+Nx9BenDugbrI3SgS +7CfWCaInvnDbPcAh8i72YRIsVWM8GwCKG4Zq2ddwtjnIhI93+gved2peYurdt8N8TBt 1IbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id g47si12107913wrg.136.2017.10.10.23.42.59; Tue, 10 Oct 2017 23:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 575D91B1BF; Wed, 11 Oct 2017 08:42:59 +0200 (CEST) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0052.outbound.protection.outlook.com [104.47.40.52]) by dpdk.org (Postfix) with ESMTP id 1011B1B1BE for ; Wed, 11 Oct 2017 08:42:57 +0200 (CEST) Received: from BN6PR03CA0024.namprd03.prod.outlook.com (10.168.230.162) by DM5PR03MB2700.namprd03.prod.outlook.com (10.168.197.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Wed, 11 Oct 2017 06:42:56 +0000 Received: from BN1AFFO11FD019.protection.gbl (2a01:111:f400:7c10::137) by BN6PR03CA0024.outlook.office365.com (2603:10b6:404:23::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Frontend Transport; Wed, 11 Oct 2017 06:42:56 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD019.mail.protection.outlook.com (10.58.52.79) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Wed, 11 Oct 2017 06:42:55 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v9B6gqfH031131; Tue, 10 Oct 2017 23:42:53 -0700 From: Hemant Agrawal To: , CC: Date: Wed, 11 Oct 2017 12:12:18 +0530 Message-ID: <1507704138-17237-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507375221-16271-1-git-send-email-hemant.agrawal@nxp.com> References: <1507375221-16271-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131521777762393067; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(376002)(346002)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(53936002)(106466001)(47776003)(105606002)(16586007)(97736004)(110136005)(5003940100001)(76176999)(356003)(68736007)(50986999)(85426001)(81156014)(48376002)(8936002)(33646002)(8676002)(305945005)(50466002)(50226002)(104016004)(81166006)(4326008)(2906002)(6666003)(189998001)(69596002)(498600001)(86362001)(77096006)(575784001)(316002)(2950100002)(5660300001)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2700; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD019; 1:ZK4i0oRFof2c9ptIDMO2OudC4Qgtl8lV68fiB+d9s7RyHTHOZTe28vg6o7VabHfdtoEs/DTVqhfCOcXmUbb5BCIQsuffvZOJs6NBCbLXnSqubfywBwFx9c+3IauEnUOa MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 40682635-d2a4-4d86-50e3-08d510734e25 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:DM5PR03MB2700; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2700; 3:rm7kQ2bfNHkpV4OSRFoonOts6fkPz33p8+h/XVu45COV6OC7BFNDQ9clN7vdqVJZMHF9U0Kki3XIpc0f6xD1z6nV9zCBer8aE5GIKX5TT7mhV4AZoWiZX9KmjcJSf7upjHdkVeOwIKhEVb4EIc7LrQQ0RI92SsamJi2sLpcmWz9x4WdQFqh2r3y/ciGpvLdOPLCL5YPhYI8jWGqgSMIlZ7WKdjCUYbKvZ/dTEpptB+sX5ZldmTXFORIvhd9a0u84QYVHqn2PW9sHEIRlG2Up4zbcf5EJuWaOy2Z9PtDd24INPRqyORizKqwQ8EaiWO1fCjYlKs1vSQqEawRCkJbfTlR4KrtbdOfxdTn4w9cGYco=; 25:OFDk40Ir9IYAs4MwpJOMHJx/7SEOL1thw8Y1xyijOygWo7+hM3cfF1wCoAqyQrTVESEsWVG0liBTezpq7zgVIr2I2npJI1Ry3Wb01OQ7scR787s3J+LiTIQh9pXVhKsFHnpNRPfbAPBzGmnQDi3eZeR2E1TW3Bqe3pux4XJfd8aFdkXtD3ZLpMf20sUpzRI2ilFPbfin/iLi84RcBdteb3p6G80/sdLjJvbGZqFPYMGjkjV7ru44U/j+A3K+4r/so+MGal6mezRh5y5VYpEFbPMGbguQO+R+zrXsyClHy1ddon0vf7ioaNoZa2yikUstyicBN4SkMOvuWSyAi62Img== X-MS-TrafficTypeDiagnostic: DM5PR03MB2700: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2700; 31:97/niI1TSZSuJRSEWHplH8YX5b1uZ6ZSHOhecovUBv6AiIISx+o6+6RcOylKcjad2gqXBiG0MqjauK62S9yTw8gw+zhufJ9VnZrAUwc4/XhPPijPNVecVyJ2UbfuiAIxAuKBRxZMoW1QZFxKxPsfSf30QIK9Sn6EfrO/YxbMSXnttBRGoUUHJYh6cHmhHW4Dko901aG/Nf8NSrTiBv8SVgMWuVh7wlKozPt51Hxl/A8=; 4:/PPsf3hptvJa3qLL9zYbQGAVGejObnYnNNBsTyC7IytE7b49fXDSlFSfLYzptbURbNn+NQ0MZ+mynJla5CYp8pKjF2vIzkVYdffoie8oY2uE9eq2gG0Ozh3AXpVGxWkDbnUg933PAgCb3oFeRdrGIb4K8sDK86ZVHfe8yzHzx7qqMq6b8ZYFXTTxA6NT9TGp1iKuKINcQhauo5RpEev1ZbdjR7Y5QkXiM1bleMg6z6y3UTZxcvhe/vuRL7s1T2p+kg26KykD4DzOpLvzu+dRRr0ggWJX0gkEdnO89fE7IuE= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123563025)(20161123556025)(20161123561025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR03MB2700; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR03MB2700; X-Forefront-PRVS: 0457F11EAF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2700; 23:hZPb6g3kQdg3NdD1nfwwh/v40ZLscGQRl6xIr9Ipf?= 8VKhwTWFcI14wsjy/rcLKHT+CJ4wIFRB4u+bMAc9liLAYTdPkSkMQNcgfvC8IAbMUgfkU0zvksjn9I+GR2ey8JMro5rNIPDDpYIl8BudtAlaU8bEZquOHttxVRVdChUA5cjCLDUTw04hTUJlIceJzuBc7EhRL3ZlyJbuFNM65oOVPpSutusY2Eg4xxDBdcwS6GbLS1MUGPIc+T6kuB5XemRaIk6nqIK3ML3EaKOzVuG9AaWUV1zDpLByAvGd9sp4hLprVutTmKYOyQlSP67pSH74cyllEe8Zjp22LSrFvFzeEvShnAyAZX2XyAwXcQuHsdmycFX0nf9Qo6d2SOI6QE5KWJw+87B7P3++eyYbNSYOZacaecq0n7b3s1vkh327OItVh/oXdmL3ZF4/aQusSI5x3cgUVift/0Xan0jtTt+XB7V4pOpcXAxn9WkiG8A7FCP9D3BELYh9JRfDFYUYLbR/c1IPcb9jR/4D3SVcGus0SiRY+XywZnrAFkUJFcYwnIX6pu4AvEB/z9XX1VPQR13vsjbbS/9gnWxr4YpYb2LIdTPJX+LvknyAWVAGnVzKvFTcSEKvack7Pw5QLWaLUsgKizDjcSZx+iKGzk7/wtmKhS65rdAan0cfG3RGuCHfIFJS9zL8sSrmjhYqYHMpZzDXF8xG4u2lA0Iker/LZfomrOpxNlP5a/z7LLlUC8OYwNF/ygTlOJoDC3vEKVajrUe6VGrO8W7MYklrimn7DVZCuIetx8xorVn3WNaQX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I0coqZ8M0MhUfJClYdRYLhISi3NIGNnznZfbgEkSJxbL4ai0ThYhRPPbfBZoY73CVpdgI9WSSaX7whW90gENDov07I5mi2bHW8LgQ+burX8s3BFCPl6SibKl5TbpkaoNLYD0ACkAvVLMYbmHmcNPGitdK5tJuVDjbzsebwopiZrxosRI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2017 06:42:55.8961 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2700 Subject: [dpdk-dev] [PATCH v3] eal: enable vfio independent of PCI bus X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" VFIO may be used by buses other than PCI. This patch enables the VFIO on the basis of vfio root presence. Since vfio_enable should be called only once, pci_vfio_enable is also removed. A debug print is added in case vfio_pci module is not present. Signed-off-by: Hemant Agrawal --- v3: changed the vfio enable for vfio root instead of pci v2: enabled VFIO, independent of no-pci flag as suggested by Thomas removed fslmc specific vfio enable lib/librte_eal/linuxapp/eal/eal.c | 8 ++++++-- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 6 ------ lib/librte_eal/linuxapp/eal/eal_vfio.c | 2 +- lib/librte_eal/linuxapp/eal/eal_vfio.h | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) -- 2.7.4 Acked-by: Anatoly Burakov diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index ec37c52..e0aceba 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -710,9 +710,13 @@ static int rte_eal_vfio_setup(void) { int vfio_enabled = 0; + if (vfio_enable("vfio")) + return -1; + vfio_enabled = vfio_is_enabled("vfio"); + if (!internal_config.no_pci) { - pci_vfio_enable(); - vfio_enabled |= pci_vfio_is_enabled(); + if (!pci_vfio_is_enabled()) + RTE_LOG(DEBUG, EAL, "vfio pci modules not loaded\n"); } if (vfio_enabled) { diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index aa9d96e..fc84705 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -661,12 +661,6 @@ pci_vfio_ioport_unmap(struct rte_pci_ioport *p) } int -pci_vfio_enable(void) -{ - return vfio_enable("vfio_pci"); -} - -int pci_vfio_is_enabled(void) { return vfio_is_enabled("vfio_pci"); diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index b32cd09..ebb71f0 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -489,7 +489,7 @@ vfio_enable(const char *modname) /* inform the user that we are probing for VFIO */ RTE_LOG(INFO, EAL, "Probing VFIO support...\n"); - /* check if vfio-pci module is loaded */ + /* check if vfio module is loaded */ vfio_available = rte_eal_check_module(modname); /* return error directly */ diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h index 26ea8e1..4bab363 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -207,7 +207,6 @@ int vfio_release_device(const char *sysfs_base, const char *dev_addr, int fd); int vfio_enable(const char *modname); int vfio_is_enabled(const char *modname); -int pci_vfio_enable(void); int pci_vfio_is_enabled(void); int vfio_mp_sync_setup(void);