From patchwork Mon Apr 2 08:36:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132655 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp2330794ljb; Mon, 2 Apr 2018 01:38:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx487sGa0o3XSWdQrX7PLVQxosBbIG2BRMKzifnz07QBcjaRdM1YlkFtsNvaANOv7AkH7b+vM X-Received: by 10.28.40.194 with SMTP id o185mr170108wmo.111.1522658295436; Mon, 02 Apr 2018 01:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522658295; cv=none; d=google.com; s=arc-20160816; b=rLpM8MK/cIFjFVo1itDz2QViYFIctLXLkRqgkdlBtWEAKcfrilr9h/IG4mubFg0XSt CKbZl0amcZI+EKRXA4svusV+ek3OE5r6Qnw7c9CcZttBBiAiZ9k/sK1PC0xeK4C1/7xK uGIZ4hMoywuZM/iOrXi55GZgGNFGjlyXN2+mO0UbjBUcUxvQdglWAkR18kYX5hoSa3BN Le4knZTJmn8wXAKeSM8uRhePLzCwf0lNQEMV5V4mcmc53MV4LLGtKQe6olaVDe4RTfYY RVpYCDN0E4GORjVcDaUjaFLbLxelop/GslxZasEYr/2gqwhiVzO9U5W+XbcICGHqwnw3 Qtww== 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:dkim-signature:arc-authentication-results; bh=DpuxwRGqAmb6PRmsVVki9K9pbmm9gjQw85X41E8Mr7A=; b=L35gYyosypRKHfDe0Wz/CHIILOnznqcrD2Hnd6vtCDk5oWaxXwU8AYOXszU/C29MIH Je//rh0SorFS6w+sjhO2Cm3bQHuT9mLXcQArMn9WjeS+h31M7dWfIhC3rdlzj0dK+NJW fiX9LaLgEK3vj3SuOZcg3tu5rjQjH8Rsl45RCNS2YEBei5czUoYp9LaIN9Z7V+e9W4de VzCokLw/EFhbASlg7/vvbPr19nFi8DN2ewv67/kqqHVj/BURjrTRc4A0X5Ml0OEz8PtA buU/z7fSDtYtKHsx6kAAx1vb8cIEuQGuvWtgBhU2rxMnlSNNnUM5WwqhuC/XgUddELUO NN8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=KBuJmCLx; 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 130si56123wmv.88.2018.04.02.01.38.14; Mon, 02 Apr 2018 01:38:15 -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; dkim=fail header.i=@nxp.com header.s=selector1 header.b=KBuJmCLx; 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 CEB77A497; Mon, 2 Apr 2018 10:38:13 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00053.outbound.protection.outlook.com [40.107.0.53]) by dpdk.org (Postfix) with ESMTP id CABE87FC9 for ; Mon, 2 Apr 2018 10:38:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DpuxwRGqAmb6PRmsVVki9K9pbmm9gjQw85X41E8Mr7A=; b=KBuJmCLxKsJ8f3HGWvXUCHpBIBGnV/BNYCjWP1unB7Lng14DX3TqoJUZkHaWIAtDulswT3bHWDNkeeRdRXj/uIw8/lV2KWT1mOzubOQsZCFO9l0WYXNk43r84PA6cnToQ5DCiK1DKFk2MMPl/ceW9WoYQHB3L2VrVFnsLPwr5+Y= Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by DB4PR04MB0768.eurprd04.prod.outlook.com (2a01:111:e400:984d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Mon, 2 Apr 2018 08:38:07 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Mon, 2 Apr 2018 14:06:13 +0530 Message-Id: <1522658173-13955-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521014434-3399-1-git-send-email-hemant.agrawal@nxp.com> References: <1521014434-3399-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BMXPR01CA0045.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::31) To DB4PR04MB0768.eurprd04.prod.outlook.com (2a01:111:e400:984d::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac028e44-3fde-4f59-aaba-08d598751044 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB4PR04MB0768; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0768; 3:UUnvdUUKjHotNzwwAiKjSGF1Ob8kpfYJ/Z2NI/hTfw5p2dS36GqhSZFLnscHgIRJvDG/6F87PNBOeBzYyEDY3cdQiVPxV9LdrSvxwLLLPHWlHP727BbkafTr9ExHt6ViOUOSZyte/TiPpVFC8d0ayNrDflXFlcpDV4ZnDNvlpA+sPMknSv4IcHSMnb+6ZI6PMTziqQ1sCzz5Of/DERbAwcPy1MnWrvw1V92x/eA2EhNH+qcpyA+JaRfuTeQenCGJ; 25:uWlzrj8ReZ07U5SswSgXrMXkEjsPuF0Nt02CV2rL2m5cFeztGDu+zdsFfbCrYY35pvqoqW1nb4NZoOWGLAn1Mg8G2aH9NO1SIACU4NKw/60L8npNYg2QbDSxcCjSoa2Crep9K5Ylnf9JAgajCbHbS3TLPVRIEgv+iSkv01fN7I2i/1Yc+oNdWUdW++Uz7LsWKPdYhod6AUhaWCx9r5lCOzSGSxRLsXFFRQf//fQEddmrw/3sEk7Bsw6mD04qoazNhBs/7gyuKlON9wzkczR25Wq0lE/5L7+VstlxZOEIthdLMCt0t/Fw677oVYsyocr6AvGO2ybU1qYzm6UFsj6LiQ==; 31:WtQa7WS4CTYJAhDTNUaKF0bIL41648vv3s5TzilplcAYEfbV6N1jHIKyH21NGpx70x4EGT8xxrGfPPkPbqnDkI/MVQ9Oezwc6x3Hl0xug5Gp1GvsOXNi65c9G0M3c0DZ6U/1Fy5pAbZpCvAn55qgHAbUtG35KWmhFs4N/ehAXCdVmOzDqJkKhw64FTuZoOXA7tfZteFkLhhXEx8R1m4Gq+lSRenA9uSV1AcRQYcNGWQ= X-MS-TrafficTypeDiagnostic: DB4PR04MB0768: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0768; 20:rGMaWlBZ5XhT6mycBO6a3XfyoCGCLGecrUJxdaKBW0o4uiWNBgsfoWSJiMBUGou0H1rKskX11t10oMJYOsGjkpRyjOQEW/MrF2guGPGlfkn39Mool3ray19seo79OwEnP6Tce3l5FaYqoXlFiVi+tlR6XQUGMavuekO/qB8TSjjAbU6yO6d17qFyYW/70QVQZizJ7PQurmCj+JctRA2H5/mh2d396E6LgwGYbozd2ULxm/5KWDliiEkaJwXeyACbon5KUU3zFYUUwhAs0h26NWzBEkIw6DoW2tjNAcY5SOxODLbNmLTet/CP/rBYOSmeN0EpGZD5Kau+IHhenzOpobNb9FV/9JCtrkgUMGqxfbm7+p99Hqn3lZw9s+AgH25MlhD8vJgfFZsa4u43s+fc8r8FQloJSwn7GDVFYN8UZcJXn4Tq1vNOT4zNg+Qgx9/atTqIm9262mpZXIpOuxfSEWYU/uy9P7JcMgGMN0zfzqaPOCP3wWk6cRCIa0Z64M23; 4:sSOqAE5NyfDR5RleCim+A8tjAkcg9q5guxosTgbmb+1xMTh1SDX8vb3rj6eDPIlloN3JYh5ogm7vK8mZpXlmBrFND1ixLm27fDW3sxKvsmHqFVFx//08ooFWefDPfnMon9SIl83sr+jsUQTMJGK2z3Vur+484OolA6/bVvHqm2fUvEGWRNlVt5QQLigSoJzWUD+eiPCR2qf0PIKwCR8Ty1EYwxNlYX7MmWT/SNE3/PgoVBIyVZHNHAz9q9zraarudz0mAjFX8fsp7J5l2gWxAh+ngdZ9LCi1YCWWK/BEtKDwzb0ud7EJX9/yKreUZEC2HYrALl7G0sPPdQuuUJdDj1pWbG9mYL+cgOCYmkprjtlbMQMC8rNLpIhJbHTStrgw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DB4PR04MB0768; BCL:0; PCL:0; RULEID:; SRVR:DB4PR04MB0768; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(366004)(39380400002)(396003)(189003)(199004)(86362001)(6916009)(186003)(6666003)(6512007)(53936002)(68736007)(8936002)(16526019)(55236004)(6486002)(66066001)(316002)(6506007)(26005)(36756003)(47776003)(2361001)(2351001)(478600001)(2906002)(386003)(16586007)(305945005)(97736004)(52116002)(50226002)(7736002)(106356001)(59450400001)(76176011)(51416003)(81156014)(81166006)(956004)(446003)(105586002)(476003)(11346002)(4326008)(5660300001)(486005)(8676002)(2616005)(486005)(48376002)(3846002)(5009440100003)(25786009)(50466002)(6116002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR04MB0768; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR04MB0768; 23:xlDblcKSkCey5lc73+6d4ujIUnTQa4ZqheD1ERLca?= uBkf9FcdBkN8H/yK87rX+2UipR6+NYJkTh8K+rfHWxJEdttCT6LHphJma7oMSERdknZWSSkKVdhdlbtm6d7LCuMPAp/VlBEqbVds3rEhx/LneFKo5yP3cCEGz0+2trg1SJS0YJBImIzis0jVItwqL5mNKeWcwmXlT6d3gPiXqJZupQwqjQnI7rco/z5F3DjyUH0IL1oO1e46uylM35SVdYo27wWCuB92z9WMeJ71QVxRcGrFHwg+2RAwkuZ55mJb0VqvVeAThawTNu1oLPPA1O/ReNTaB280BCme6+8oSt/t+06Lr3yjQVB+6Kacu7IlgeMehfNV/5lkXHG8XLVCy6cLFkfYlw5dFny9ebNeS2ydzcZZySEf2PTmbcOhusj9V6jDJLkVw+Y2xNfo/9f2z5fr6n776paIgUqR9FiDvZgIv0TShSMhZhZjbWfpn1MUzDm/m/X9t7zR1zbieHCYSwFcdLAl7+xb+DNj8ZgHkQ1KvyXpcvL5IiiiyH5dQHCw8INv9WVhZX8SkBmTPvyoKyZUToaSFZFbzHM1BDwE31Diw8RPNLsNVRK/hYwm5SdkrWG7qnLEafPOue6JX1koiDi8NzSJUI9R8Xm6Yflhi+JBO61ZC8RPpamYuipjwZrEOZpV5R+mdYNO1Bq2v0vRJ+Al9UIN8x5z2MPaWLiP5k2tM7T/iWYmP37lW1p4OZNnmT51w+ixxSNTkuFejvjExleEUp1jozae/H7KscNmZbnIeZqF3uYuptkKY4fV2UMeBYwL8meKS3b1Nj6m9alQ3aON1HqWcT6UtDsveVZCcw+/0os2F9ZHymW58DJNkCizPg2iPzo1iSJyj9tiUvLlkysZOHIp0ttYuge1S4+9hs0x6vq/q0EaVVW4/aM60McHojIoI38RCZGBCMQMzRyTeRianLIumzY1ryhULunGgasupIJ/2TEpaK9o8qpSicrLlEySL2yogGQLuVGooUWrfPq4lCOPwaZW72ziiT225ZL00uRGCnyiK1DvFiaM8guDwvBHJeN9A60ZqNi3cLxYu4fLOovpHRpPuzNMdss9jeM/T8+zhSRzepv03AvzsZsxJU4GydgTEkYQxfKESean4n1U2NNmnFs2Kx8/C4Mc6LwyJW6kt9JFtc0g5XLZnHTp9IkY23gvEVpmvk6T4WNvEWNashL3EZL71ck+6Ha1GEK/7c0FIcFUqabfKv/UbiTsQFpt3smg+o2uj/OqRe0E7CKmkLv+lrnqVlYQMKMrXvgf9tWbKwERyvYRS1OJqNVvVYIyvz5LbLBzUSQU5nRFPxg X-Microsoft-Antispam-Message-Info: AKOOQc/x2npsQoIwwQCO2EbNDJ6q5wURFKqhDvIeidqbbtrLG5QU6ihUY/ezqeo/CNlYy3Az5GkNuodVcRco9l0YbFB1Zb+pXJj76pPfGdLDTfj/V2qOKyszSHArMIK0TCNHu3pBvEH9x8CQufGD2BjzteCaoekGPxVgyw129zcyyFcKMWd8GvWPX36ycBRc X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0768; 6:zcARInrqXHqdagh/fUEiGBiz36LgnllMumSvdhzi8461P5VgwtgKhhjtQ36U1zO+t2PqwTlUf2NPNEhyW9I2+EB094tdTo+1tDeXNLRpgK1yzMVsTO3F5VkRs8diPRKJ0RPKvKGR0wDmK/o8ra38v4BuOpFZaXVHEbjWau0DJR3nxojawDjzfoRITWJuP+MuQunNkUA87vKEylH+0clIlgVw6Pe8DrrmhIeA5fHf07cgm387ipdVUMB0Ti8I+EJ43drSDMhWx/3IUS6zLgeQUfrh4E1I4/YaNLoCT1i/DSimSKxAEDi9YkrJWJkQnO5tLwzj/fyT0vSNpOZ8DRdB3MSAzULa1dT6Jpycw8cyGs7sFNVKHEpTLateI+MCm3ezh13Yw7MVbS8tm9dc2qBciVmq/52LMozYjHctRboXSfQ8JfJV0NkT+hCReCPvb1KoKvP/4IdEci9BctsQ6hC+vQ==; 5:xAUcxkPWLs+cO67tl5zAZkxGk+lCZpG++ZzrqpH2KUqchQIESqgOoI/DVqLLs9QZQS9v1hubiiM3uzl2k/ZHv1XgHnEIqQDYfmqRxPIsG4jQVXIWogok/ptmZ7ZlahYqrK39VsRxipZZx6kg4fEIMC99G8wd6wQ33kuzHmj+5Sw=; 24:9RD7hjSwObihwYbn0fkhDMquNvdHk3frQ8KpAdrZhmvMdeyqq1x1ep+gF+OgmlNNlq4YGJ/6TsOzQtTJ85ArjleZQKi+2+YuV1BVZcMmALA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0768; 7:dNEQmxE36Lq5oGTd0oF1M16JDZFzWkVJQKc3953vFeC4hjssnyx+WybpkxsvLW63uIn4Lj76dlOq2IcwyYVEiAAugs/4TSCzavdIPn2F0eD0CVDk9YWVuAtK9bu7SzGuwpakO66eJyrdci/KGGd4upb/Ze5eWPiM7glUKNCq7nxIMK2Z//2XP0G+G2lxTPLpSZG/iWXjmBX/ysTCwv5Fl8MiIHuZ8ijiSCyYVq24y4F1wVnTHLyXDatQS2ykU4j+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 08:38:07.8388 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac028e44-3fde-4f59-aaba-08d598751044 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR04MB0768 Subject: [dpdk-dev] [PATCH v2] eal/vfio: export internal vfio functions 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" This patch moves some of the internal vfio functions from eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix. This patch also change the FSLMC bus usages from the internal VFIO functions to external ones with "rte_" prefix Signed-off-by: Hemant Agrawal Acked-by: Anatoly Burakov --- v2: handle Thomas's comment fix API documentation drivers/bus/fslmc/Makefile | 1 - drivers/bus/fslmc/fslmc_vfio.c | 6 +-- drivers/bus/fslmc/fslmc_vfio.h | 2 - drivers/bus/fslmc/meson.build | 1 - lib/librte_eal/bsdapp/eal/eal.c | 20 +++++++ lib/librte_eal/common/include/rte_vfio.h | 74 +++++++++++++++++++++++++- lib/librte_eal/linuxapp/eal/eal_vfio.c | 18 +++---- lib/librte_eal/linuxapp/eal/eal_vfio.h | 21 -------- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 4 +- lib/librte_eal/rte_eal_version.map | 3 ++ 10 files changed, 110 insertions(+), 40 deletions(-) -- 2.7.4 diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index 952b4c0..04814db 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -21,7 +21,6 @@ endif CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include -CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index e840ad6..4e1187e 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -94,7 +94,7 @@ fslmc_get_container_group(int *groupid) } /* get group number */ - ret = vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container, groupid); + ret = rte_vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container, groupid); if (ret <= 0) { FSLMC_VFIO_LOG(ERR, "Unable to find %s IOMMU group", g_container); @@ -128,7 +128,7 @@ vfio_connect_container(void) } /* Opens main vfio file descriptor which represents the "container" */ - fd = vfio_get_container_fd(); + fd = rte_vfio_get_container_fd(); if (fd < 0) { FSLMC_VFIO_LOG(ERR, "Failed to open VFIO container"); return -errno; @@ -627,7 +627,7 @@ fslmc_vfio_setup_group(void) } /* Get the actual group fd */ - ret = vfio_get_group_fd(groupid); + ret = rte_vfio_get_group_fd(groupid); if (ret < 0) return ret; vfio_group.fd = ret; diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h index e8fb344..9e2c4fe 100644 --- a/drivers/bus/fslmc/fslmc_vfio.h +++ b/drivers/bus/fslmc/fslmc_vfio.h @@ -10,8 +10,6 @@ #include -#include "eal_vfio.h" - #define DPAA2_MC_DPNI_DEVID 7 #define DPAA2_MC_DPSECI_DEVID 3 #define DPAA2_MC_DPCON_DEVID 5 diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build index e94340e..78f9d92 100644 --- a/drivers/bus/fslmc/meson.build +++ b/drivers/bus/fslmc/meson.build @@ -22,6 +22,5 @@ sources = files('fslmc_bus.c', allow_experimental_apis = true -includes += include_directories('../../../lib/librte_eal/linuxapp/eal') includes += include_directories('mc', 'qbman/include', 'portal') cflags += ['-D_GNU_SOURCE'] diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 4eafcb5..29cac28 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -781,3 +781,23 @@ int rte_vfio_clear_group(__rte_unused int vfio_group_fd) { return 0; } + +int __rte_experimental +rte_vfio_get_group_no(__rte_unused const char *sysfs_base, + __rte_unused const char *dev_addr, + __rte_unused int *iommu_group_no) +{ + return -1; +} + +int __rte_experimental +rte_vfio_get_container_fd(void) +{ + return -1; +} + +int __rte_experimental +rte_vfio_get_group_fd(__rte_unused int iommu_group_no) +{ + return -1; +} diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h index 249095e..cfcc3d3 100644 --- a/lib/librte_eal/common/include/rte_vfio.h +++ b/lib/librte_eal/common/include/rte_vfio.h @@ -32,6 +32,13 @@ extern "C" { #endif +/* NOIOMMU is defined from kernel version 4.5 onwards */ +#ifdef VFIO_NOIOMMU_IOMMU +#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU +#else +#define RTE_VFIO_NOIOMMU 8 +#endif + /** * Setup vfio_cfg for the device identified by its address. * It discovers the configured I/O MMU groups or sets a new one for the device. @@ -123,10 +130,75 @@ int rte_vfio_is_enabled(const char *modname); */ int rte_vfio_noiommu_is_enabled(void); -/* remove group fd from internal VFIO group fd array */ +/** + * Remove group fd from internal VFIO group fd array/ + * + * This function is only relevant to linux and will return + * an error on BSD. + * + * @param vfio_group_fd + * VFIO Grouup FD. + * + * @return + * 0 on success. + * <0 on failure. + */ int rte_vfio_clear_group(int vfio_group_fd); +/** + * Parse IOMMU group number for a device + * + * This function is only relevant to linux and will return + * an error on BSD. + * + * @param sysfs_base + * sysfs path prefix. + * + * @param dev_addr + * device location. + * + * @param iommu_group_no + * iommu group number + * + * @return + * >0 on success + * 0 for non-existent group or VFIO + * <0 for errors + */ +int __rte_experimental +rte_vfio_get_group_no(const char *sysfs_base, + const char *dev_addr, int *iommu_group_no); + +/** + * Open VFIO container fd or get an existing one + * + * This function is only relevant to linux and will return + * an error on BSD. + * + * @return + * > 0 container fd + * < 0 for errors + */ +int __rte_experimental +rte_vfio_get_container_fd(void); + +/** + * Open VFIO group fd or get an existing one + * + * This function is only relevant to linux and will return + * an error on BSD. + * + * @param iommu_group_no + * iommu group number + * + * @return + * > 0 group fd + * < 0 for errors + */ +int __rte_experimental +rte_vfio_get_group_fd(int iommu_group_no); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index e44ae4d..3dc2c18 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -36,7 +36,7 @@ static const struct vfio_iommu_type iommu_types[] = { }; int -vfio_get_group_fd(int iommu_group_no) +rte_vfio_get_group_fd(int iommu_group_no) { int i; int vfio_group_fd; @@ -266,7 +266,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, int ret; /* get group number */ - ret = vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no); + ret = rte_vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no); if (ret == 0) { RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n", dev_addr); @@ -278,7 +278,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, return -1; /* get the actual group fd */ - vfio_group_fd = vfio_get_group_fd(iommu_group_no); + vfio_group_fd = rte_vfio_get_group_fd(iommu_group_no); if (vfio_group_fd < 0) return -1; @@ -398,7 +398,7 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr, int ret; /* get group number */ - ret = vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no); + ret = rte_vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no); if (ret <= 0) { RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver\n", dev_addr); @@ -407,9 +407,9 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr, } /* get the actual group fd */ - vfio_group_fd = vfio_get_group_fd(iommu_group_no); + vfio_group_fd = rte_vfio_get_group_fd(iommu_group_no); if (vfio_group_fd <= 0) { - RTE_LOG(INFO, EAL, "vfio_get_group_fd failed for %s\n", + RTE_LOG(INFO, EAL, "rte_vfio_get_group_fd failed for %s\n", dev_addr); return -1; } @@ -480,7 +480,7 @@ rte_vfio_enable(const char *modname) return 0; } - vfio_cfg.vfio_container_fd = vfio_get_container_fd(); + vfio_cfg.vfio_container_fd = rte_vfio_get_container_fd(); /* check if we have VFIO driver enabled */ if (vfio_cfg.vfio_container_fd != -1) { @@ -558,7 +558,7 @@ vfio_has_supported_extensions(int vfio_container_fd) } int -vfio_get_container_fd(void) +rte_vfio_get_container_fd(void) { int ret, vfio_container_fd; @@ -622,7 +622,7 @@ vfio_get_container_fd(void) } int -vfio_get_group_no(const char *sysfs_base, +rte_vfio_get_group_no(const char *sysfs_base, const char *dev_addr, int *iommu_group_no) { char linkname[PATH_MAX]; diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h index 8059577..c72b76c 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -79,12 +79,6 @@ struct vfio_iommu_spapr_tce_info { #define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) -#define RTE_VFIO_NOIOMMU 8 -#else -#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU -#endif - #define VFIO_MAX_GROUPS RTE_MAX_VFIO_GROUPS /* @@ -133,21 +127,6 @@ vfio_set_iommu_type(int vfio_container_fd); int vfio_has_supported_extensions(int vfio_container_fd); -/* open container fd or get an existing one */ -int -vfio_get_container_fd(void); - -/* parse IOMMU group number for a device - * returns 1 on success, -1 for errors, 0 for non-existent group - */ -int -vfio_get_group_no(const char *sysfs_base, - const char *dev_addr, int *iommu_group_no); - -/* open group fd or get an existing one */ -int -vfio_get_group_fd(int iommu_group_no); - int vfio_mp_sync_setup(void); #define SOCKET_REQ_CONTAINER 0x100 diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c index 7cc3c15..e19b571 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c @@ -267,7 +267,7 @@ vfio_mp_sync_thread(void __rte_unused * arg) switch (ret) { case SOCKET_REQ_CONTAINER: - fd = vfio_get_container_fd(); + fd = rte_vfio_get_container_fd(); if (fd < 0) vfio_mp_sync_send_request(conn_sock, SOCKET_ERR); else @@ -283,7 +283,7 @@ vfio_mp_sync_thread(void __rte_unused * arg) continue; } - fd = vfio_get_group_fd(vfio_data); + fd = rte_vfio_get_group_fd(vfio_data); if (fd < 0) vfio_mp_sync_send_request(conn_sock, SOCKET_ERR); diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index f331f54..23723d7 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -255,5 +255,8 @@ EXPERIMENTAL { rte_service_set_runstate_mapped_check; rte_service_set_stats_enable; rte_service_start_with_defaults; + rte_vfio_get_group_no; + rte_vfio_get_container_fd; + rte_vfio_get_group_fd; } DPDK_18.02;