From patchwork Mon Oct 23 06:33:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 116640 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4301296qgn; Sun, 22 Oct 2017 23:33:18 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RWVeUaVyBdxKyK16xRnXU0JupQFYR+FYAb4+9UGGi2rzr8xvogwetKHPdn4hs7yeqFnkwC X-Received: by 10.28.111.19 with SMTP id k19mr3982613wmc.84.1508740398756; Sun, 22 Oct 2017 23:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508740398; cv=none; d=google.com; s=arc-20160816; b=olik8U/l57pgbS+IfIP3aXSb8rJ1lwzSgb7H9lCkTp2yT52I4RC7PpMKXjWG4Slpns lIjsy48znv5BJGdwEyFBRR9YKVz4Hw14OpKXdP39oO/fY65MrDaguiar+1/LHZJJyCen fqtkgJScKVt49BShcPsnu6QJH2dLRoIFBR85WuLonnOYMZXQZ/s7X7SPuXYgT8HLsO3Q 4Z2JbFPeYyYxDY8WcMFLRNWeFXsf44GWDcysa6j9CT8BZ0kR3FjXzmR63Y9UuuGYTjsh 80DujL4iV3LS8kYPCfj/4t6J8ufUo772VVdx7U68nbtO8AxRFLuzFkRmVDKSNZirDGnB R4Eg== 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:mime-version :content-transfer-encoding:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:cc:to:from :dkim-signature:arc-authentication-results; bh=4f0oEMe1Do0+h1zMmqvwaYoLTH2NI0Z5RucWCK+iuA0=; b=RUnCtgcg/4dR14hgRsEaDkVMg00c8yZWF4bUNVPwdmo4KG+z2yqZye4tbJjUiyEVY+ TGVCJwp3JCIlPnfkDmlm85ErXOu5x8/K5JD9nw76T0Px1J7OKIiQiTXnmUkY44o12vVt E0SHUZbr4kOeLS9u4XbDwqUCKaMEoEjUTCT1DEXegDTOChWIUiS3aMraXC9bC+PTQ5qT Jwhz3NLUlAhGEfWo+MSDsoD+qpHpALYkjv68DsL9se3b5nN7uA7mXuGi7f5mA9EQLyH4 gp4Tg07zF+9jUUZuj8RtXIGevBoVcUDMdmHqLudjxeggR2zpzBf9tg32KoWtDDw5aXPJ ulnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=RRY13h9Y; 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 h19si4761292wrc.83.2017.10.22.23.33.18; Sun, 22 Oct 2017 23:33:18 -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=RRY13h9Y; 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 921D31B398; Mon, 23 Oct 2017 08:33:17 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0072.outbound.protection.outlook.com [104.47.0.72]) by dpdk.org (Postfix) with ESMTP id 0A1A81B397 for ; Mon, 23 Oct 2017 08:33:16 +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=4f0oEMe1Do0+h1zMmqvwaYoLTH2NI0Z5RucWCK+iuA0=; b=RRY13h9Y3V6IR06eSqRuuH1PM9//iYoNXejZgSh8Eq7z5N/q45TBz0QppJ+soTRU25ZHAvp4Jl24seFD/Z3x6u7nFcOmwHTswwIAyKIoQmSlab1W8jBr5nCZypznic7XsAq3lXdc5XGDbMH3WGMKHMgF12c/7h0UUxi162tDtJQ= Received: from AM2PR04MB0753.eurprd04.prod.outlook.com (10.160.56.141) by AM2PR04MB0753.eurprd04.prod.outlook.com (10.160.56.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 23 Oct 2017 06:33:14 +0000 Received: from AM2PR04MB0753.eurprd04.prod.outlook.com ([fe80::ac7b:f458:e37:269a]) by AM2PR04MB0753.eurprd04.prod.outlook.com ([fe80::ac7b:f458:e37:269a%14]) with mapi id 15.20.0077.023; Mon, 23 Oct 2017 06:33:14 +0000 From: Hemant Agrawal To: "anatoly.burakov@intel.com" CC: "dev@dpdk.org" , Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v3] eal: enable vfio independent of PCI bus Thread-Index: AQHTQlwvDZOqQam9F06PPKoM7wjtGKLxDDyg Date: Mon, 23 Oct 2017 06:33:14 +0000 Message-ID: References: <1507375221-16271-1-git-send-email-hemant.agrawal@nxp.com> <1507704138-17237-1-git-send-email-hemant.agrawal@nxp.com> In-Reply-To: <1507704138-17237-1-git-send-email-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM2PR04MB0753; 6:cFvvWOX5Psh1InjWxPaU7ZvwdAt7B9k//f00HUVK9VNYFvagx0zNJL3FLMxjGhU6FyxvGhCw2JHetrsOd7uRONH4PkRSQdokgXrFgqffMVyy7nByPDWZQI7CYYhtpLVsJDaWaRnacy5m4jxTIie4ZbAJDqQbsoyzI6R4RrcyPAawTEOl9YlIV42KABoOUSSXfcCqEC11FEO3YfbiEzy5bOEoXRp7gCVg4eiUDxgpjy9v9GK3OzqhIL7wLMPJtB11rB6lUPHBzRVEQNqI0/c7deGJ4iSRLONiub+vUjrHmT1w0/tKXR4c2LLr31A0YQjX+7x3x8g19VsPKWGE6SDUuQ==; 5:Jl2WEFDymez5vTkwLV2WQt+xKaNH0axLz8MtsyUpMmRZPB9c98WIikm//enYja9fKAArFr/hQtumcWp4wN+2TSKs04JIau3Io3mddINNJqGQNkFsliQ5G0SQnoUx44tW+Z4wAI7IubnssFCI/xid5A==; 24:EOq+1unFUHQbNC9uVTzwnd9060qYHJx8FgmbC/T0RwCbrWXRxdDvQ/usgPOKR1hAl1B5bK7sEGlF4cIVz4cWQZ+NkORsQ9P9Vh+6JKmWYRM=; 7:PEeuPA3nIeq1jWoj6pHcx/zKt4nx0h8FwWsxUmZjcii5WZxfwXJnG55Eke8QKft+JL+a01ntHmc08kXjidHa3Cxv2YNFHqRKewh6Tzbg+ierzVLHVMtpBSsATzb4/BwPMLyFKtBoGeYCh/uzlIp2pg8GATxeCE+O/81NlMtEVnMEAQsBsW6HIwALeVd1QMQLpf+5T8R3+EWaNko5mBLi3AKPp6QcR8QIFtjClPXpdMQ= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 43ef62c9-8ea6-4956-0aee-08d519dff08a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627075)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:AM2PR04MB0753; x-ms-traffictypediagnostic: AM2PR04MB0753: x-exchange-antispam-report-test: UriScan:(185117386973197)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(3231020)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM2PR04MB0753; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM2PR04MB0753; x-forefront-prvs: 046985391D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(376002)(346002)(13464003)(189002)(199003)(229853002)(189998001)(2501003)(2900100001)(25786009)(99286003)(2473003)(6506006)(55016002)(6916009)(14454004)(2950100002)(53546010)(3660700001)(9686003)(478600001)(5640700003)(5660300001)(3280700002)(33656002)(106356001)(81166006)(2906002)(316002)(105586002)(6436002)(102836003)(3846002)(66066001)(6116002)(76176999)(54356999)(101416001)(50986999)(5250100002)(8676002)(81156014)(7696004)(86362001)(4326008)(8936002)(97736004)(2351001)(7736002)(575784001)(53936002)(305945005)(68736007)(74316002)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0753; H:AM2PR04MB0753.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Oct 2017 06:33:14.5523 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0753 Subject: [dpdk-dev] FW: [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" Hi Anatoly, Will you please review the following patch? Regards, Hemant -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal Sent: Wednesday, October 11, 2017 12:12 PM To: thomas@monjalon.net; anatoly.burakov@intel.com Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v3] eal: enable vfio independent of PCI bus 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(-) 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); -- 2.7.4