Commit Graph

475 Commits

Author SHA1 Message Date
Jian Jun Chen 655132fc8e dm: virtio: remove unused vbs_kernel_init
Tracked-On: #1364
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 15:39:57 +08:00
Yin Fengwei eb265809af DM: multiboot info address in DM for elf loader is wrong.
The () was missed during the patch refine. This patch add it.

Tracked-On: #1465
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 15:39:40 +08:00
Liang Yang 80e02c9708 DM USB: xHCI: Fix an potential array out of range issue.
When usb device numbers reach up to XHCI_MAX_SLOTS. The slot_allocated
array will get out of range. This patch is used to fix this issue.

Tracked-On: #1479
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 13:46:05 +08:00
Liang Yang 84c0c87842 DM USB: xHCI: Fix a potential NULL pointer issue.
After excap pointer is assigned, it should be checked whether it's
possible to get assignment for NULL pointer or not. This patch
fixes this issue.

Tracked-On: #1479
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-25 13:46:05 +08:00
Yin Fengwei 482a4dcc02 DM: correct the predefine DM option string.
That string was changed by accident and introduced the removed
items.

Tracked-On: #1465
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:44:09 +08:00
Zhi Jin ad1ef7ba1b samples: enable pstore via the sos kernel cmdline
Enable pstore via the sos kernel cmdline, as ABL doesn't
reserve memory and pass parameters for pstore.

Tracked-On: #1024
Signed-off-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2018-10-25 13:43:25 +08:00
Binbin Wu 96f8becca6 dm: bios: update vSBL to v1.0
New feature:
	Update vFastboot to v1.0
	Boot time optimization
	Support Crash mode, which uses vFastboot in vSBL as Crash mode target.
	Support Ramooops.

Tracked-On: #968, #1578, #1579, #1580
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2018-10-25 13:42:12 +08:00
Jason Chen CJ 19abb419c6 launch_uos.sh: make sure cpu offline by retry
if acrnd or acrn_guest service enabled, launch_uos.sh will be called
early time during system boot up, while a pci driver module may be
insmod and disable cpu hotplug in short time, which could make
cpu offline fail, we need check it to make sure cpu offline real happen
before hypercall to disable vcpu.

Tracked-On: https://github.com/projectacrn/acrn-hypervisor/issues/1584
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-10-25 13:37:43 +08:00
Minggui Cao 4228c81b3f DM: compare unsigned numbers to avoid overflow.
compare the two unsigned numbers to avoid delta calculation overflow.
It could happen during UOS warm root, which can trigger a "fake"
interrupt storm.

Tracked-On: #1476
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-25 13:30:47 +08:00
Jie Deng 7195537a6b dm: virtio-net: replace banned functions
sscanf and strcpy are banned according to the security requirements.
So replace them with their safe alternative.

Tracked-on: #1496
Signed-off-by: Jie Deng <jie.deng@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-24 18:16:37 +08:00
Jie Deng 7579678dd6 dm: add const declaration for dm_strto* APIs
These APIs are wrap of standard strto* APIs. The first parameters in
these APIs should be declared as "const" since they have never been
changed so that they can also be used when passing a variable declared
as const char *

Fixes: e1dab512c2 ("dm: add string convert API")
Tracked-on: #1496

Signed-off-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-24 18:16:37 +08:00
Huang, Yang bd97e5cbe2 dm: rpmb: Support RPMB mode config from launch.sh
physical RPMB is accessed if "phisycal_rpmb" is specified
in launch.sh.
Also it reserves some RPMB area with a fixed size(32KB) for
AttKB and future usage, which is RO for UOS.

Tracked-On: #1544
Signed-off-by: Huang, Yang <yang.huang@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-10-24 18:15:14 +08:00
Signed-off-by: Aviad Nissel 7ca1a7de7d dm: launch_uos.sh add virtio_mei mediator
Detect if SOS kernel mei drivers supports virtualization,
via driver hbm version 2.2
If yes use virtio_mei mediator for the mei device
otherwise fallback to passthrou mode.
Note that HBM version is not sufficient identification

Tracked-On: #1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 201e5cec0a dm: mei: enable virtio_mei compilation
Add virtio_mei to the Makefile

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler d4b9bd599d dm: mei: add module initialization
Register virtio device virtio-mei.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

Tracked-On: #1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler f6e6e8584e dm: mei: implement vmei_start/stop()
In vmei_start() the HBM host client is created,
it handles HBM protocol.
The HBM client is a management object and
is not exposed by the mei native driver.
The communication between TX and RX threads
is handed via internal pipe(2).
Second, we connect all fixed address clients as the mei
protocol doesn't provide connection mechanism for them,
they appear always connected.
Last, the hw_ready is set.

Define virtio_mei_ops, ass all the handlers are now available.

Tracked-On: #1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 6a1f824229 dm: mei: implement rx flow.
Rx is triggered from epoll event (mevent), a host client
is retrieved from associated event data. P proper mei message header is
attached to the packet and sent to the virtio FE device.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 50ecd93b24 dm: mei: implement tx flow
TX from virtio driver is handled firt via
virio tx notify handler vmei_notify_tx(),
placed into host clinet tx circular buffer.
TX thread will then write the data to the device.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 483a893e57 dm: mei: implement HBM protocol handler
Implement the FW part of the HBM protocol.
Currently the support version is 2.0.
The HBM protocol handles client management, such
initialization handshake, connection, power management,
and the flow control.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 98c6b7a692 dm: mei: add native io handlers
Add read write and connect handler,
that perform io peration on SOS /dev/meiX
device.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 3abbf10e55 dm: mei: add me clients enumeration
ME client enumeration is received from sysfs attributes
of the native device.

V3: Use bounded functions.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 7cbb3872a2 dm: mei: add virtio cfgread/cfgwrite handlers.
mei mediator perform reset handshake via
the cfgread/write handlers and provide access
to fw status registers.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Signed-off-by: Aviad Nissel f462601b0a dm: mei: add reset handlers
There are multiple types of resets that need to be handled
by the mei device.
The reset may be initiated from both sides host or fw.
The host requests reset on probe and remove,
power state transaction, and errors,
while ME FW may request reset upon error.
If the native device undergo reset the host application
has to be notified.

Tracked-On: #1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler a632ac3dae dm: mei: add client management infrastructure
1. virtio_mei structure represents an instance of mei device.
2. vmei_me_client represents an ME application in the MEI FW.
3. vmei_host_client represent a host application talking to the
ME application, ME application can support multiple connections.
4. Add debug helpers

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 445f419304 dm: mei: add virtio configuration
The virtio has two virtio queues, TX and RX.
TX have two segment buffers one for header and one for data.
The virtio_mei declares host buffer of size 128 slots, each
slot is a 4 bytes value.
For synchronization hw_ready and host_reset configuration flags
are used that emulates mei reset flow.
And last fw status registers must be also readable via virtio
mei device.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 0dc7adfbac dm: mei: add sysfs read functions
mei requires reading of u8, u32 and uuid
sysfs files.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler b8d53d17d5 dm: mei: add reference counter functions
mei handles objects on the list, hence reference counting
infrastructure is required for easier multithreading.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 6a96878e0b dm: types: add container_of macro
Add standard container_of macro to access
the parent struct pointer.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Alexander Usyskin 4e057c32d2 dm: mei: add guid handling functions
libuuid sports only uuid (big endian encoding),
though mei requires guids (little endian encoding).
The base types are based on <linux/uuid.h> header.

Tracked-On: #1536
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler d141aebdcd dm: mei: add mei hbm protocol definitions header.
HBM is a control channel protocol between mei device
driver and mei fw.

Add new ioctl IOCTL_MEI_CONNECT_CLIENT_VTAG

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
Tomas Winkler 0cc50b1d43 dm: remove virtio_heci
Remove virtio_heci to be replaced with virtio_mei

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-23 11:40:15 +08:00
yuhong.tao@intel.com 2973db7839 DM: VMcfg: generated example header
devicemodel/vmcfg/example.h is a example, it is generated at build
time.

Tracked-On: #1528
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-10-22 16:57:23 +08:00
yuhong.tao@intel.com c86da0034e DM: VMcfg: support --dump options
run 'acrn-dm --dump <index>' to show build-in parameters

Tracked-On: #1528
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-10-22 16:57:23 +08:00
yuhong.tao@intel.com 67d7292081 DM: VMcfg: support --vmcfg options
Enable --vmcfg options for acrn-dm, if --vmcfg <index> is specified,
build-in VM configuration will be used, and override any other
optional parameters.
run 'acrn-dm --vmcfg list' to show all build-in VM configurations.
run 'acrnpdm --vmcfg <index>' to launch UOS with selected config.

Tracked-On: #1528
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-10-22 16:57:23 +08:00
yuhong.tao@intel.com 321021ebaf DM: VMcfg: mrb-env-setup.sh
Script that setup envriment on MRB platform, for UOS with build-in
configuration
For example, you need to run  mrb-env-setup.sh once, to
prepare images, networks and pci-stubs, etc,.

Tracked-On: #1528
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-10-22 16:57:23 +08:00
yuhong.tao@intel.com d2ed9955fd DM: VMcfg: support VM1 on MRB
Add build-in vm1 configuration for MRB platform, this is also an
example about how to add new VM configurations

Tracked-On: #1528
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-10-22 16:57:23 +08:00
yuhong.tao@intel.com ae5b32dcb3 DM: VMcfg: build-in vm configurations
use *args_buildin[] to hold build-in VM configurations

Tracked-On: #1528
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-10-22 16:57:23 +08:00
yuhong.tao@intel.com 646cc8c4b2 DM: VMcfg: Kconfig & Makefile for VM Configuration
VMcfg use Kconfig mechanism to generate a header file
devicemodel/include/vmcfg_config.h, which contains many macro symbols
for conditionally compiling. This feature is disabled by default, to
enable it, You can switch to devicemodel/vmcfg/ and run 'make' with
these options:

'make menuconfig'
run 'make menuconfig' at ./devicemodel/vmcfg/, and configure manually.
When you finished, save your changes to ./devicemode/vmcfg/.config

'make oldconfig'
Overwrite ./devicemodel/vmcfg/.config with your config file, then run
'make oldconfig' at ./devicemodel/vmcfg

'make *_defconfig'
E.g, there is ./devicemodel/vmcfg/config/mrb_defconfig, you can run
'make mrb_defconfig' at ./devicemodel/vmcfg/

Tracked-On: #1528
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-10-22 16:57:23 +08:00
Xiaoguang Wu 6a9a46ac47 DM USB: xHCI: workaround for Stop Endpoint Command handling
This patch is one workaround to resolve a crash issue for certain brand
touch screen (eGalaxTouch EXC7200-7368v1.01). The formal fix should
follow the xHCI spec to stop xfer and generate transfer completed event
trb prior to Stop Endpoint Command complete event trb. It should be a
big change and for short term, do nothing for the stop endpoint command
which is no other side effect be observed so far.

Tracked-On: #1413
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Xiaoguang Wu ecf0585bf2 DM USB: xHCI: fix incorrect device searching logic
The function pci_xhci_get_native_port_index_by_path didn't
compare the bus number during the process of native USB
device searching. This patch is used to fix it.

Tracked-On: #1434
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Xiaoguang Wu 6b2a18a866 DM USB: add support for multi-layers hubs
This patch is used to support emulation of multiple layers of hubs
under Flat Mode.

Tracked-On: #1434
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Liang Yang f533a07af1 DM USB: xHCI: support multiple hubs in single layer
This patch is used to enable multiple hubs in single layer under
Flat Mode.

Tracked-On: #1434
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Xiaoguang Wu 6886d3cdf8 DM USB: xHCI: change port mapping logic for multiple hub support
To support the multiple hubs and multiple layers of hub, the
port_map_tbl should be replaced by native_ports to record all
native devices' state, including assignment state, emulation
state etc.

Tracked-On: #1434
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Xiaoguang Wu 540ce05f27 DM USB: introduce function usb_get_native_devinfo
There are many places in USB emulation implementation to get
native USB device infomation, and the related codes are long
and repeated many times. This patch introduces function
usb_get_native_devinfo to remove redundent codes for the
purpose mentioned above.

Tracked-On: #1434
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Liang Yang e8f7b6fa74 DM USB: introduce struct usb_devpath and releted functions
This patch introduce struct usb_devpath to indentify uniquely an USB
device, which is basic element for multiple hub support.

Tracked-On: #1434
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Liang Yang 14bc961f03 DM USB: xHCI: remove old hub support code.
Previous design use bus and port(root hub port) for the identification
to the native USB device. It cannot work properly under the multi-hub
situation due to external USB hub is introduced.

This patch removes old hub implementation code, and subsequent patches
will be add support for mutiple hubs.

Tracked-On: #1434
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:39:50 +08:00
Shuo Liu 268a9f1453 [REVERTME] dm: script: disable xHCI runtime PM to WA USB role switch hang issue
When do USB role switch between host and device mode, we hit hang issue.
It might be caused by accessing suspended xHCI during that. This issue
need to be root caused later in xHCI driver.

This is a workaround solution, which will be reverted when got a fix.

Tracked-On: #1516
Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
2018-10-19 22:34:40 +08:00
Huang, Yang ffcf62982d dm: rpmb: DM customized changes for RPMB mux kernel module
As RPMB mux kernel module is going to be created,
there are two corresponding changes required for DM:
1. The name has been changed to /dev/rpmbmux.
2. DM does NOT check MAC of RPMB result returned by kernel
   module because DM doesn't own the real key.

Tracked-On: #1508
Signed-off-by: Huang, Yang <yang.huang@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-10-19 22:31:28 +08:00
Victor Sun de10df2693 DM: add MSI and INTR support for i6300esb watchdog
Per i6300esb spec, when WDT_INT_TYPE(bit 0 and 1 of WDT config register)
are set to 00, IRQ feature should be supported.

The WDT_INT_ACTIVE bit is set when the first stage of the 35-bit
down-counter reaches zero. An interrupt will be generated if WDT_INT_TYPE
is configured to do so (See WDT Configuration Register). This is a sticky
bit and is only cleared by writing a 1.

SMI feature(WDT_INT_TYPE are set to 0x10) is not supported.

Tracked-On: #1498
Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-10-18 09:30:01 +08:00
Conghui Chen 21458bddff dm: storage: banned functions replace
1. replace sscanf with string API.
2. replace sprintf with snprintf
3. replace strlen with strnlen

Tracked-on: #1496
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-10-17 16:22:00 +08:00