From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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: , X-List-Received-Date: Mon, 23 Oct 2017 06:33:16 -0000 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 th= e basis of vfio root presence. Since vfio_enable should be called only once, pci_vfio_enable is also remov= ed. 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/ea= l/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 =3D 0; =20 + if (vfio_enable("vfio")) + return -1; + vfio_enabled =3D vfio_is_enabled("vfio"); + if (!internal_config.no_pci) { - pci_vfio_enable(); - vfio_enabled |=3D pci_vfio_is_enabled(); + if (!pci_vfio_is_enabled()) + RTE_LOG(DEBUG, EAL, "vfio pci modules not loaded\n"); } =20 if (vfio_enabled) { diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/li= nuxapp/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) } =20 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/linuxa= pp/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"); =20 - /* check if vfio-pci module is loaded */ + /* check if vfio module is loaded */ vfio_available =3D rte_eal_check_module(modname); =20 /* return error directly */ diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxa= pp/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 c= har *dev_addr, int fd); int vfio_enable(const char *modname); int vfio_is= _enabled(const char *modname); =20 -int pci_vfio_enable(void); int pci_vfio_is_enabled(void); =20 int vfio_mp_sync_setup(void); -- 2.7.4