From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 5927C20BD for ; Wed, 9 Aug 2017 11:07:55 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2017 02:07:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,346,1498546800"; d="scan'208";a="888135856" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 09 Aug 2017 02:07:54 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 9 Aug 2017 02:07:54 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 9 Aug 2017 02:07:53 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.236]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.25]) with mapi id 14.03.0319.002; Wed, 9 Aug 2017 17:07:52 +0800 From: "Liu, Yong" To: Jianbo Liu , "dts@dpdk.org" , "herbert.guan@arm.com" Thread-Topic: [dts] [PATCH] framework: add config option for vfio noiommu mode Thread-Index: AQHTENlh5Vt4tVMevUmSVr0IeU99KqJ7u44w Date: Wed, 9 Aug 2017 09:07:51 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62E4E23C@SHSMSX103.ccr.corp.intel.com> References: <1502260322-23906-1-git-send-email-jianbo.liu@linaro.org> In-Reply-To: <1502260322-23906-1-git-send-email-jianbo.liu@linaro.org> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH] framework: add config option for vfio noiommu mode X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 09:07:56 -0000 Hi Jianbo, I am curious about your environment, what kind of environment you're using = and required for NOIMMU mode? Thanks, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Jianbo Liu > Sent: Wednesday, August 09, 2017 2:32 PM > To: dts@dpdk.org; herbert.guan@arm.com > Cc: Jianbo Liu > Subject: [dts] [PATCH] framework: add config option for vfio noiommu mode >=20 > Signed-off-by: Jianbo Liu > --- > framework/dts.py | 9 +++++++++ > framework/project_dpdk.py | 30 +++++++++++++++++++++++++++++- > framework/settings.py | 1 + > tools/setup.py | 2 +- > 4 files changed, 40 insertions(+), 2 deletions(-) >=20 > diff --git a/framework/dts.py b/framework/dts.py > index c821fc1..931bf38 100644 > --- a/framework/dts.py > +++ b/framework/dts.py > @@ -81,6 +81,14 @@ def dts_parse_param(config, section): > parameters =3D config.get(section, 'parameters').split(':') > drivername =3D config.get(section, 'drivername').split('=3D')[-1] >=20 > + driver =3D drivername.split(':') > + if len(driver) =3D=3D 2: > + drivername =3D driver[0] > + drivermode =3D driver[1] > + settings.save_global_setting(settings.HOST_DRIVER_MODE_SETTING, > drivermode) > + else: > + drivername =3D driver[0] > + > settings.save_global_setting(settings.HOST_DRIVER_SETTING, drivernam= e) >=20 > paramDict =3D dict() > @@ -373,6 +381,7 @@ def dts_run_target(duts, tester, targets, test_suites= ): > for dutobj in duts: > dutobj.stop_ports() > dutobj.restore_interfaces() > + dutobj.restore_modules() >=20 >=20 > def dts_run_suite(duts, tester, test_suites, target): > diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py > index b9a6d4a..402ac8d 100644 > --- a/framework/project_dpdk.py > +++ b/framework/project_dpdk.py > @@ -33,7 +33,7 @@ import os > import re >=20 > from settings import NICS, load_global_setting, accepted_nic > -from settings import DPDK_RXMODE_SETTING, HOST_DRIVER_SETTING > +from settings import DPDK_RXMODE_SETTING, HOST_DRIVER_SETTING, > HOST_DRIVER_MODE_SETTING > from ssh_connection import SSHConnection > from crb import Crb > from dut import Dut > @@ -104,6 +104,11 @@ class DPDKdut(Dut): > self.send_expect("modprobe vfio-pci", "#", 70) > out =3D self.send_expect("lsmod | grep vfio_iommu_type1", "#= ") > assert ("vfio_iommu_type1" in out), "Failed to setup vfio- > pci" > + > + drivermode =3D load_global_setting(HOST_DRIVER_MODE_SETTING) > + if drivermode =3D=3D "noiommu": > + self.send_expect("echo 1 > > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode", "#", 70) > + > else: > self.send_expect("modprobe uio", "#", 70) > out =3D self.send_expect("lsmod | grep igb_uio", "#") > @@ -130,6 +135,29 @@ class DPDKdut(Dut): > out =3D self.send_expect("kldstat", "#") > assert ("nic_uio" in out), "Failed to insmod nic_uio" >=20 > + def restore_modules(self): > + """ > + Restore DPDK kernel module on DUT. > + """ > + restore_modules =3D getattr(self, 'restore_modules_%s' % > self.get_os_type()) > + restore_modules() > + > + def restore_modules_linux(self): > + """ > + Restore DPDK Linux kernel module on DUT. > + """ > + drivername =3D load_global_setting(HOST_DRIVER_SETTING) > + if drivername =3D=3D "vfio-pci": > + drivermode =3D load_global_setting(HOST_DRIVER_MODE_SETTING) > + if drivermode =3D=3D "noiommu": > + self.send_expect("echo 0 > > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode", "#", 70) > + > + def restore_modules_freebsd(self): > + """ > + Restore DPDK Freebsd kernel module on DUT. > + """ > + pass > + > def set_rxtx_mode(self): > """ > Set default RX/TX PMD function, > diff --git a/framework/settings.py b/framework/settings.py > index d306de2..e5b7746 100644 > --- a/framework/settings.py > +++ b/framework/settings.py > @@ -204,6 +204,7 @@ DTS_ENV_PAT =3D r"DTS_*" > PERF_SETTING =3D "DTS_PERF_ONLY" > FUNC_SETTING =3D "DTS_FUNC_ONLY" > HOST_DRIVER_SETTING =3D "DTS_HOST_DRIVER" > +HOST_DRIVER_MODE_SETTING =3D "DTS_HOST_DRIVER_MODE" > HOST_NIC_SETTING =3D "DTS_HOST_NIC" > DEBUG_SETTING =3D "DTS_DEBUG_ENABLE" > DEBUG_CASE_SETTING =3D "DTS_DEBUGCASE_ENABLE" > diff --git a/tools/setup.py b/tools/setup.py > index 9fcd70e..c6c72bc 100755 > --- a/tools/setup.py > +++ b/tools/setup.py > @@ -280,7 +280,7 @@ def config_execution(): > driver_option =3D {'prompt': 'Choose one of them', > 'type': 'choice', > 'help': 'Choose one of dpdk support driver', > - 'options': ['igb_uio', 'vfio-pci'], > + 'options': ['igb_uio', 'vfio-pci', 'vfio- > pci:noiommu'], > 'default': '0'} > opt =3D Option(**driver_option) > driver_name =3D opt.parse_input() > -- > 1.9.1