Commit Graph

931 Commits

Author SHA1 Message Date
Yuan Liu f1b71d983a dm: expand default WaaG memory to 4G
This patch is used to expand WaaG memory from 2G to 4G in launch script.

Tracked-On: #3576
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-08-14 16:10:03 +08:00
Junming Liu 4dfd5d6ae6 dm:gvt:keep LaaG aperture size consistent with the host
Keep LaaG aperture size consistent with the host bios setting,
if we statically set LaaG aperture 256MB,
it may not have memory space for LaaG aperture.
We get host aperture size from cfg port 0x62.

Tracked-On: #3537
Signed-off-by: Junming Liu <junming.liu@intel.com>
Reviewed-by: Xinyun Liu <xinyun.liu@intel.com>
2019-08-09 10:29:42 +08:00
Yifan Luo 50e0a932a2 dm: virtio-i2c: fix native_adapter memory leak
If failed to create native_adapter, free allocated native_adapter memory before return.

Tracked-On: #3543
Signed-off-by: Yifan Luo <luoyifan@cmss.chinamobile.com>
2019-08-08 10:36:46 +08:00
Xiaoguang Wu e188e1f245 DM USB: xHCI: fix an error in PORTSC emulation
When DM receives the Disable Slot command, according to xHCI spec,
the PP bit in PORTSC register should not be cleared.

Tracked-On: #3486
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-08-01 09:28:01 +08:00
Xiaoguang Wu 55a5876eba DM USB: xHCI: workaround for USB SSD which supports UAS protocol
The USB mediator doesn't support USB Attached SCSI (UAS) protocol
due to no proper implementation for USB Stream. This patch will
use USB Bulk transfer to workaround until formal implentation for
UAS is ready.

Tracked-On: #3486
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-08-01 09:28:01 +08:00
Xiaoguang Wu 0e2cfd2dee DM USB: add native info in control transfer logging code
Add native bus and port information in the control transfer logging code.

Tracked-On: #3486
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-08-01 09:28:01 +08:00
Peter Fang 87cafaea33 OVMF release v1.2
- Add support for VRING_USED_F_NO_NOTIFY in virtio devices
- Revert "Initialize EmuVariable NV storage memory with varstore from
  ROM"
- Add AcrnEmuVariableFvbRuntimeDxe to support NV storage
- Enable ahci driver.

Secure boot is supported from this release onwards.

Tracked-On: #3506
Signed-off-by: Peter Fang <peter.fang@intel.com>
2019-08-01 09:24:52 +08:00
Tianhua Sun 107c406baa dm: array bound checking to avoid buffer overflow
The array index of "epid" may be out of bounds if
"epid >= XHCI_MAX_ENDPOINTS", so bound check is
necessary before it is used.

Tracked-On: #3434
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
2019-07-30 16:36:13 +08:00
Tianhua Sun 493ddefd47 dm: fix pointer not checked for null before use
this patch fix null pointer access issues.

Tracked-On: #3434
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
2019-07-30 16:36:13 +08:00
yuhong.tao@intel.com 653aa859b1 DM: monitor support force stop
When someone send DM message DM_STOP, with a non-zero data.acrnd_stop.force
value, DM set suspend mode to VM_SUSPEND_POWEROFF directly, that will
cause DM quit main loop. That can force stop VM

Tracked-On: #3484
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2019-07-30 13:27:16 +08:00
Gao Junhao c175141c77 dm: bugfix for remote launch guest issue
when stdio is set as a virtio-console, guest run in backend, the open
file descriptor is not referring to a terminal.

Tracked-On: #3473
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
2019-07-29 09:53:35 +08:00
Conghui Chen 3945bc4c40 dm: array bound and NULL pointer issue fix
Remove the possible NULL pointer access code for virtio-console.c
Add '\0' to end of native_patch[], to avoid the potential issue when
using %s to print the array for virtio-i2c.c

Tracked-On: #3467
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yonghua Huang <Yonghua.huang@intel.com>
2019-07-26 08:55:11 +08:00
Gao Junhao ff299d5c50 dm: support VMs communication with virtio-console
Add feature that client uos can still connect to server uos after
rebooting.

Tracked-On: #3459
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-07-24 16:26:36 +08:00
Yang, Yu-chu 16a7d2522c DM: ovmf NV storage writeback support
To support modification of OVMF NV storage, add an option "w" for
--ovmf to write the changed OVMF NV data section back to the OVMF image
from guest memory before deinit operations. This will enable persistent
EFI variables. Only option "w" is supported, dm will exit if passing
invalid option. It expects OVMF NV storage writeback with option "w"
when power off or reboot the UOS, poweroff, cold and warm reboot in EFI
shell and when dm recieves SIGINT and SIGHUP.

Tracked-On: #3413
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Reviewed-by:Eddie Dong <eddie.dong@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-07-22 11:18:47 +08:00
Peter Fang c787aaa328 dm: allow High BIOS to be modifiable by the guest
In order to support OVMF NV storage writeback, the High BIOS region in
the guest will behave as RAM and can be modified by OVMF itself. Give
the guest write permission to this page.

Tracked-On: #3413
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-07-22 11:18:47 +08:00
Conghui Chen c1b4121e3b dm: virtio-i2c: minor fix
Change the condition of checking native adapter number.
Change sprintf to snprintf.

Tracked-On: #3437
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-19 09:12:34 +08:00
Tianhua Sun 796ac55016 hv: fix symbols not stripped from release binaries
In release environment, binary files must be stripped in
order to remove debugging code sections and symbol information
that aid attackers in the process of disassembly and reverse
engineering.
Use '-s' linking option to remove symbol table and relocation
information from release binaries.

Tracked-On: #3427
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-18 15:03:00 +08:00
Xiaoguang Wu 7a3ea2ad89 DM USB: xHCI: fix corner case of short packet logic
The old logic identify the short packet complete status (CS) by
comparing the transfered bytes (TB) and the expected transfered
bytes (ETB), it is right only when no error happend. If error
appears, the TB may be less than the ETB, but DM should report
error CS instead of short packet CS.

Tracked-On: #3401
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-07-12 17:04:44 +08:00
Xiaoguang Wu 32d186ba68 DM USB: xHCI: add the resume state for PLS bits
Add resume state for the Port Link Status (PLS) bits.

Tracked-On: #3401
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-07-12 17:04:44 +08:00
Xiaoguang Wu c3d4cc36e1 DM USB: xHCI: refine the logic of Stop Endpoint cmd
When the Stop Endpoint command is trapped, should not clear all
the data structure. Instead, only reset the ring buffer.

The reason is the xHCI may continue queue TRB without doing whole
initializing process again.

Tracked-On: #3401
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-07-12 17:04:44 +08:00
Xiaoguang Wu 5686898291 DM USB: xHCI: change log for convenience of debugging
Not change code logic, just modify some logging code.

Tracked-On: #3401
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-07-12 17:04:44 +08:00
Tianhua Sun e749ced4a0 dm: remove unsafe apis in dm log
sprintf/vsnprintf are not safe, so use snprintf
instead of sprintf, use vasprintf instead of vsnprintf.

Tracked-On: #3394
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Minggui Cao <minggui.cao@intel.com>
2019-07-12 09:41:15 +08:00
Tianhua Sun d8b752c4ee dm: fix variable argument list read without ending with va_end
va_end() was not getting called under certain condition
after the va_start() function call taking the va_list.

Tracked-On: #3396
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-12 09:41:15 +08:00
Tianhua Sun b96a3555bc dm: fix some possible memory leak
free memory allocated by strdup()

Tracked-On: #3395
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-12 09:41:15 +08:00
Conghui Chen b592404f48 script: set virtio-console BE to stdio for LaaG
Set virtio-console BE to stdio for LaaG. Remove 'com1' but still keep
'console=ttyS0' in Laag kernel cmdline.
'console=ttyS0' means LaaG will use ttyS0 (0x3F8) as a console port, and
during bringup, it will access port ttyS0. When the same port is added
to hypervisor configuration file as a console port, the output will be
captured by hypervisor console, and can switch by "vm_console <vm_id>".

Tracked-On: #3370
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-07-10 09:45:29 +08:00
Vijay Dhanraj 59800214b1 DM: Increase hugetlbfs MAX_PATH_LEN from 128 to 256
Current hugetlbfs code has a limitation on file path length.
The path string comprises of mount path + vm name.
Something like /run/hugepage/acrn/huge_lv1/vm1.
To this UUID (32 bytes) is added and the total path length
should be less than 128.

This works fine but in cases where the VM name is large as
in case kata, this check fails. Kata passes a sandbox-id
as VM name and so path + 32 for UUID easily exceed 128 bytes.
“/run/hugepage/acrn/huge_lv1/
sandbox-6d455fa48788eae82dee42410fc3d38849c2a5196f930b3d6944805aed8d24c7"

To address this, increase the size of MAX_PATH_LEN from
128 to 256 bytes.

Tracked-On: #3379
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-10 09:32:10 +08:00
Conghui Chen e720dda5b0 DM: virtio-i2c: add dsdt info
Add dsdt information for i2c adapter and i2c slave devices. Currently,
only support 'cam1', 'cam2' and 'hdac' for MRB board. To add other
specific i2c device, please extend acpi_node_table[].

Usage:
	virtio-i2c,<bus>[:<slave_addr>[@<node>]][:<slave_addr>[@<node>]]
	        [,<bus>[:<slave_addr>[@<node>]][:<slave_addr>][@<node>]]

e.g.
	virtio-i2c,0:70@cam1:2F

	This will add slave devices 0x70, 0x74 to virtio i2c adapter.
	And for 0x70, it has '@cam1', so, will also add acpi info for
	it. For 0x74, it has no '@<node>', will not add any acpi info
	for it.

Note, there is slave address in acpi node info, please use '@<node>'
according to real hardware.

Tracked-On: #3357
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2019-07-05 10:20:21 +08:00
Conghui Chen b6f9ed39fc DM: virtio-i2c: add msg process logic
Create a new thread for virtio-i2c to process i2c msg from FE. After
receive the msg, BE will dispatch it to corresponding native adapter,
after the process done, it will kick the FE.

Tracked-On: #3357
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2019-07-05 10:20:21 +08:00
Conghui Chen 859af9e03d DM: virtio-i2c: add backend interface
Add backend interface for virtio-i2c, it will parse the parameters,
maintain the info for native i2c device, remap the slave address and
dispatch the requirement from FE. When there is only one native adapter,
will not remap the slave address.

Usage for virtio-i2c:

virtio-i2c,<bus>[:<slave_addr>][:<slave_addr>]
	[,<bus>[:<slave_addr>][:<slave_addr>]]

e.g.
1.  virtio-i2c,4:1C
    SOS:
        mount /dev/i2c-4, slave addr is 0x1C.
    Guest OS:
        /dev/i2c-x
           |- 0x1C

2. virtio-i2c,4:1C:2F,6:70
    SOS:
        /dev/i2c-4, slave addr 0x1C and 0x2F
        /dev/i2c-6, slave addr 0x70
    Guest OS:
        /dev/i2c-x
           |- 0x1C
           |- 0x2F
           |- 0x70

Tracked-On: #3357
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2019-07-05 10:20:21 +08:00
Conghui Chen a450add672 DM: virtio-i2c: add support for virtio i2c adapter
Add virtio i2c adapter BE driver.

Tracked-On: #3357
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2019-07-05 10:20:21 +08:00
Yonghua Huang 2751f137fd dm: remove Execute attribute of usb_pmapper.c
code cleanup

Tracked-On: #861
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-05 09:51:54 +08:00
Gao Junhao e837116691 dm: clean up assert in virtio_rnd.c
clean up assert in virtio_rnd.c

Tracked-On: #3252
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-05 09:39:42 +08:00
Yonghua Huang 842da0ac1e dm: cleanup assert in core.c
- check input by condition check, instead of assert.
 - remove redundant header file including for some files.

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
2019-07-05 09:36:02 +08:00
Peter Fang cb8bbf7bea dm: clean up the use of errx
errx() does not require an additional exit().

Tracked-On: #3252
Signed-off-by: Peter Fang <peter.fang@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yin, Fengwei <fengwei.yin@intel.com>
2019-07-03 13:19:43 +08:00
Peter Fang 82f7720ae7 dm: vhpet: clean up asserts
Remove the use of assert() in vHPET.

Tracked-On: #3252
Signed-off-by: Peter Fang <peter.fang@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yin, Fengwei <fengwei.yin@intel.com>
2019-07-03 13:19:43 +08:00
Peter Fang aac8275098 dm: vpit: clean up asserts
Remove the use of assert() in vPIT.

Tracked-On: #3252
Signed-off-by: Peter Fang <peter.fang@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yin, Fengwei <fengwei.yin@intel.com>
2019-07-03 13:19:43 +08:00
Yan, Like 81f9837e8a Revert "dm: add "noapic" to rt-linux kernel parameters"
This reverts commit c42b41fe2b.
Kernel will stay in xapic mode with this boot arg, lapic won't be passthru, so revert.

Tracked-On: #3227
Signed-off-by: Yan, Like <like.yan@intel.com>
2019-07-03 13:18:50 +08:00
Liu Xinyun 5a9a7bcd31 dm: gvt: clean up assert
handle the error if failed to create GVT device.

- remove assert
- clean up the allocated resource

V2: refine code and clean up the allocated resource

Tracked-On: #3349

Signed-off-by: Liu Xinyun <xinyun.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-03 09:40:15 +08:00
Liu Xinyun bd3f2044eb dm: hyper_dmabuf: clean up assert
validate fd before use it

Tracked-On: #3349

Signed-off-by: Liu Xinyun <xinyun.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-03 09:40:15 +08:00
Liu Xinyun 5650183471 dm: gc: clean up assert
remove unused head file

Tracked-On: #3349

Signed-off-by: Liu Xinyun <xinyun.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-03 09:40:15 +08:00
Yan, Like c42b41fe2b dm: add "noapic" to rt-linux kernel parameters
This commit adds "noapic" boot option to rt-linux, to skip IOAPIC probe.

Tracked-On: #3227
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-28 09:36:41 +08:00
Conghui Chen 8badd0b486 DM: virtio-console: bug fix for parsing options
Bug fix for parsing options, as the vritio-console support multiple
virtio serial ports, and the parameters is split by ',':

virtio-console,[@]stdio|tty|pty|file:portname[=portpath]\
   [,[@]stdio|tty|pty|file:portname[=portpath]]

But the previous patch "refine console options parse code" not
cover this case, can only parse one port config. Fix it in this patch.

Tracked-On: #3337
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2019-06-27 16:42:09 +08:00
Binbin Wu ad6f54b99a dm: sample: remove deprecated sos_bootargs files
SOS bootargs is specified in vm_configurations.h in different scenarios.
The files in devicemodel/samples/<board>/sos_bootargs_*.txt are not used anymore.
Remove these deprecated files to avoid confusion.

Tracked-On: #3214
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-06-27 15:29:21 +08:00
Xiaoguang Wu 31e23cd09c DM USB: clean up the assert usage
Remove assert in USB mediator code.

Tracked-On: #3252
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-26 22:50:38 +08:00
Long Liu 7176e813ed ACRN: dm: Modify the runC.json for NUC.
The path modify the configuration for the runC container. There have
three changes for the configuration.
1、args [ "sh" ]: this is an example parameter and when the VM is started,
the parameter will be replaced by the launch_UOS script.
2、The linux capabilities will guarantee the Acrn-dm have enough capabilities
to run in container. For more infomation about the capalility you can refer
http://man7.org/linux/man-pages/man7/capabilities.7.htm
3、Move the rootfs to the parent directory, so all the container can share
the same rootfs.

Tracked-On: projectacrn#2020
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-06-26 15:22:33 +08:00
yingbinx fbf16d7327 DM: virtio_rpmb: clean up assert
clean up assert from virtio rpmb module.

Tracked-On: #3252
Signed-off-by: dengwei <wei.a.deng@intel.com>
Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2019-06-24 18:51:44 +08:00
Jian Jun Chen 56469f3edc dm: refine assert usage
Remove unnecessary assert and add error handling when required.

Tracked-On: #3252
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-24 11:57:05 +08:00
Gao Junhao 93b4cf57fa dm: clean up assert in virtio.c
clean up assert in virtio.c

Tracked-On: #3302
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-22 21:42:32 +08:00
Gao Junhao c265bd5552 dm: clean up assert in virtio_audio.c
clean up assert from virtio_audio

Tracked-On: #3301
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-22 21:42:14 +08:00
Gao Junhao 14a93f7475 dm: clean up assert in virtio_input.c
clean up assert in virtio_input.c

Tracked-On: #3303
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-22 21:41:57 +08:00
Yan, Like 0a6baaf4d3 dm: samples: use stdio as vxworks console by default
Current launch script leaves stdio to OVMF console and, vxworks console to pty, so users
need to use additional tool like minicom to connect to pty device to use vxWorks.

To be more convinient, this commit changes the vxWorks to use the stdio by default, and OVMF
is not availabe by default.

Tracked-On: #3069
Signed-off-by: Yan, Like <like.yan@intel.com>
2019-06-22 21:41:40 +08:00
Yuan Liu 5cbda22d29 dm: virtio_gpio: clean up assert
This patch is to clean up assert from virtio-gpio

Tracked-On: #3252
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 22:25:11 +08:00
Yuan Liu 1e23c4dc41 dm: ioc: clean up assert
This patch is to clean up assert from ioc

Tracked-On: #3252
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 22:25:11 +08:00
Shuo A Liu db7e7f1c44 dm: platform: clean up assert() for some platform devices
Tracked-On: #3252
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-06-20 11:21:51 +08:00
Shuo A Liu 1b7995387d dm: pcidev: clean up assert() for some pci devices
Tracked-On: #3252
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-06-20 11:21:51 +08:00
Shuo A Liu 2b3dedfb9b dm: pci: clean up assert() in pci core
Tracked-On: #3252
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-06-20 11:21:51 +08:00
Conghui Chen d0e0871283 dm: virtio-block: clean up assert
This patch is to clean up assert from virtio-block

Tracked-On: #3252
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:56:29 +08:00
Conghui Chen 3ef385d6c4 dm: ahci: clean up assert
This patch is to clean up assert from achi.

Tracked-On: #3252
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:56:29 +08:00
Conghui Chen 4145b8af6e dm: block: clean up assert
This patch is to clean up assert for block interface.
'magic' is removed from block structure, as the user should make sure
the block device is created and not closed when access to it.

Tracked-On: #3252
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:56:29 +08:00
Yonghua Huang 13228d910f dm: refine 'assert' usage in irq.c and wdt_i6300esb.c
cleanup 'assert' usage to avoid possible software vulnerabilities

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:55:44 +08:00
Yonghua Huang e6eef9b672 dm: refine 'assert' usage in pm.c and acpi.c
'assert' usage cleanup to avoid possible software vulnerabilities

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:55:44 +08:00
Yonghua Huang 885d503a60 dm: refine 'assert' in hugetlb.c and mem.c
cleanup 'assert' usage to avoid possible software vulnerabilities.

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:55:44 +08:00
Yonghua Huang 65d7d83b1c refine 'assert' usage in vmmapi.c and main.c
cleanup 'assert' to avoid possible software vulnerabilities

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:55:44 +08:00
Yonghua Huang dedf9befa6 dm: refine 'assert' in inout.c and post.c
- 'assert' cleanup to avoid possible software vulnerabilities.

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:55:44 +08:00
Yonghua Huang a2332b159a dm: refine 'assert' usage in timer.c and rtc.c
- 'assert' cleanup
 - fix memory leakage in vrtc_init()

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:55:44 +08:00
Yonghua Huang ec626482d2 dm: cleanup 'assert' for guest software loading module
cleanup 'assert' to avoid possible vulnerabilities.

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-20 08:55:44 +08:00
Jie Deng cdc5f120f1 dm: virtio-net: clean up assert
This patch is to clean up assert from virtio-net.
Tracked-On: #3252

Signed-off-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-19 08:40:13 +08:00
Tianhua Sun b0015963f5 dm: fix some potential memory leaks
This patch is to fix some potential memory leak issues

1, free mrp if the mmio_rb_lookup() function return 0;
2, free memory allocated by strdup in some error case handling.

Tracked-On: #3277
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-19 08:39:55 +08:00
Tianhua Sun 0620980fab dm: use strnlen to replace strlen
Replace strlen function with strnlen function in DM

Tracked-On: #3276
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-19 08:39:55 +08:00
Tianhua Sun 1e1244c36b dm: use strncpy to replace strcpy
Use strncpy instead of strcpy to avoid buf overflow.
Fix strncpy null-terminated issues.

Tracked-On: #3245
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-19 08:39:55 +08:00
Binbin Wu 0ea788b48e dm: passthru: remove the use of assert()
Remove the use of assert() in passthrough driver.

Tracked-On: #3252
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2019-06-19 08:39:20 +08:00
Gao Junhao efccdd22a0 dm: add virtio-rnd device to command line
When FE virtio devices work in polling mode, sshd.service can't start
normally and blocks at generating random bytes. When reading from
the random source, getrandom() blocks caused by no random bytes.

Tracked-On: #3268
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
2019-06-18 09:56:33 +08:00
Long Liu 48877362c6 ACRN: DM: Add new options for NUC launch_uos script.
The patch adds new argument for launch_uos script for NUC.
In the patch add "-C" parameter for launch_uos script. When launch
the script with the parameter the ACRN-dm will be launched in the
runC container. For more information about this please refer to
ACRN-dm QoS document.

Tracked-On: #2020
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Binbin Wu binbin.wu@intel.com
Reviewed-by: Geoffroy Van Cutsem geoffroy.vancutsem@intel.com
2019-06-17 19:23:44 +08:00
Kaige Fu 22f24c229b DM: Samples: Enable VxWorks as hard-rt VM
This patch adds --lapic_pt option to launch VxWorks as hard-rt VM.

Tracked-On: #3069
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2019-06-14 15:47:26 +08:00
Qi Yadong 8426db9309 DM: vrpmb: replace assert() with return false
Replace assert() with explicit parameter checking and error handling.

Tracked-On: #3252
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2019-06-14 09:25:20 +08:00
Yuan Liu 66943be353 dm: enable audio passthrough device.
Enable audio device by default on WaaG

Tracked-On: #3257
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-14 09:24:56 +08:00
Minggui Cao ed7f64d748 DM: add deinit API for loggers
when DM exit, it is better to call deinit_loggers
to do some cleanup work.

Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-06-13 13:06:51 +08:00
Minggui Cao d05349d767 DM: use pr_dbg in vrtc instead of printf
also add "\n" in the end of each log.

Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-06-13 13:06:51 +08:00
Minggui Cao 5ab098eae2 DM: add disk-logger configure in launch script
add disk-logger setting in nuc/up2 launch script files.

Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-06-13 13:06:51 +08:00
Minggui Cao c04949d993 DM: add disk-logger to write log into file system
disk-logger used to save persistent log as file in disk.
log path: /var/log/acrn-dm/

each log file size is 2MB; default 8 log files; the log
files' suffix will be increased; when file count more than 8,
the last one added, the first one is removed, like form 1-8 to
2-9 to 3-10 ...

Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-06-13 13:06:51 +08:00
Minggui Cao 6fa41eee98 DM: add static for local variables
variables defined by struct logger_ops just used
in local file, so add static to them.

Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-06-13 13:06:51 +08:00
Xiaoguang Wu 5a9627ced8 DM USB: xHCI: refine the emulation of Stop Endpoint Command
Old implementation does nothing when Stop Endpoint cmd is received,
it is not right. The new implementation will cancel all the libusb
requests in processing.

Tracked-On: #3054
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-13 10:30:38 +08:00
Xiaoguang Wu 1be719c630 DM USB: clean-up: change name of function usb_dev_comp_req
Change it to usb_dev_comp_cb, which is more accurate for what
it does. This patch doesn't change original program logic.

Tracked-On: #3054
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-13 10:30:38 +08:00
Xiaoguang Wu 7dbde27615 DM USB: xHCI: use new isoch transfer implementation
The old implementation processes isoch TRB one by one, this method
can't support scenario which needs high performance, such as real
time USB camera video.

New implementions will compose all the isoch TRBs for one Door Bell
Ring, and give them to libusb as a single request. The test result
shows that this method could greatly improve the porfermance.

Tracked-On: #3054
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-13 10:30:38 +08:00
Xiaoguang Wu b57f6f9243 DM USB: clean-up: give shorter names to libusb_xfer and req
The names for the two variables are too long, change to shorter
name. This patch doesn't change any logic, just clean up.

Tracked-On: #3054
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-13 10:30:38 +08:00
Xiaoguang Wu adaed5c0e3 DM USB: xHCI: add 'chained' field in struct usb_data_xfer_block
The chained field could help to describe the relationship of USB
data blocks.

Tracked-On: #3054
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-13 10:30:38 +08:00
Xiaoguang Wu f2e35ab701 DM USB: save MaxPacketSize value in endpoint descriptor
Save the MaxPacketSize value for every endpoint of virtual
USB device.

Tracked-On: #3054
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-13 10:30:38 +08:00
Yan, Like 771f15cd6b dm: don't present ioapic and pic to RT VM
Per ACRN RT VM design, there is no virtual IOAPIC and virtual PIC emulated for RT VM.
This commit removes the entries of IOAPIC, PIC, PPRT and APRT in ACPI table for RT VM.

Tracked-On: #3227
Signed-off-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-06-12 14:29:50 +08:00
bing.li 509af78490 dm: Solve the problem of repeat mount hugetblfs
If you run two acrn-dm processes at the same time,
hugetblfs will be mounted twice, which will cause a memory leak.
The specific solution is :different virtual machines mount hugetblfs
into different directories.

Tracked-On:#2854
Signed-off-by: bing.li <bingx.li@intel.com>
Reviewed-by: Minggui Cao<minggui.cao@intel.com>
Acked-by: Yin Fengwei<fengwei.yin@intel.com>
2019-06-11 15:03:47 +08:00
Conghui Chen 765669ee35 dm: support VMs communication with virtio-console
Adding the feature of communication between VMs using virtio-console
based on appointed socket file. Not appointing the socket type will set
the socket type to be server in default.

Example:
Server: adding "-s 5,virtio-console,socket:console=/path/console.sock:server"
Client: adding "-s 6,virtio-console,socket:console=/path/console.sock:client"

Tracked-On: #3232
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-06 12:40:47 +08:00
Conghui Chen c0bffc2f58 dm: virtio: refine console options parse code
Refine the virtio-console options parse code, so that no need to pass
all the variables as parameters to the backend adding function.

Tracked-On: #3232
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-06 12:40:47 +08:00
Peter Fang ce6e663f6c OVMF release v1.1
- Cleanup unused and unsupported function of AcrnRtc
- Remove SMBIOS support
- Add ResetSystemLib for ACRN
- Disable BhyveFwCtlLib
- Disable COM2
- Avoid connecting all system drivers
- Speed up Ps2KeyboardDxe
- Created new Rtc driver and optimized RtcInit and RtcGetTime
- Initialize EmuVariable NV storage memory with varstore from ROM
- Switch to BasePciLibPciExpress
- Avoid exhaustive PCI bus scanning during PCI host bridge
  initialization
- Add support for ACRN platform initialization
- Add ACRN's Host Bridge Device ID

Tracked-On: #3226
Signed-off-by: Peter Fang <peter.fang@intel.com>
2019-06-06 12:11:59 +08:00
Vijay Dhanraj a4e28213c2 DM: handle SIGPIPE signal
Ignore SIGPIPE signal and handle the error directly when write()
function fails. this will help us to catch the write failure
rather than crashing the UOS.

PS: Observed that when acrnctl stop command was issued from
kata-runtime, UOS was crashing with SIGPIPE signal.

Tracked-On: #3190
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-03 09:17:01 +08:00
Vijay Dhanraj 19366458f8 DM: handle virtio-console writes when no socket backend is connected
When virtio-console is used as console port with socket backend,
guest kernel tries to hook it up with hvc console and sets it up.
It doesn't check if a client is connected and can result in ENOTCONN
with virtio-console backend being reset. This will prevent client
connection at a later point. To avoid this, ignore ENOTCONN error.

PS: For Kata, the runtime first launches VM and then proxy which acts
as a client connects to this socket. If this error is not handled,
proxy will never be able to connect as the backend itself will be reset.

Tracked-On: #3189
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-03 09:17:01 +08:00
Tw 857e6c0415 dm: passthrough: allow not page-aligned sized bar to be mapped
Some physical bar sizes are not page aligned, in order to support them,
we map a bigger region which is page aligned.

Tracked-On: #3181
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-06-03 09:14:32 +08:00
Jian Jun Chen b98096ea06 dm: pci: fix the MMIO regions overlap when getting bar size
PCI spec says that the procedure of sizing a BAR is as follows:
1) disable the decode via command register
2) save the original value of BAR register
3) write all-1 to the BAR register
4) read BAR register back, calculate the size
5) restore the original value to BAR register
6) re-enable the decode via command register

Some driver does not disable the decode of BAR register via the
command register before sizing a BAR. This will lead to a overlay
of the BAR addresses when trying to register the intermediate
BAR address via register_bar. A stateful variable sizing is used
to keep track of such kind of BAR address changes and workaroud
this violation.

Currently this issue is only found when audio device is passed
through to Windows 10 guest. When it is fixed in the Windows
audio driver, this patch should be reverted.

v1 -> v2:
- change the commit message to add the procedure of BAR sizing from
  PCI spec

Tracked-On: #2962
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-06-03 09:14:15 +08:00
Gao Junhao 286dd180a7 dm: virtio: bugfix for polling mode
In vxworks, virtio-console FE driver only initiate 2 virtqueues, but BE
creates 2+ virtqueues for it. So the rest of the virtqueues are not
initiated. vq->used->flags cannot be used directly without any
condition.

Tracked-On: #3203
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-05-31 12:32:08 +08:00
Jian Jun Chen 811d1fe93d dm: pci: update MMIO EPT mapping when update BAR address
For PCI passthrough device when guest OS updates the BAR address
the corresponding EPT mapping should be updated as well.

Tracked-On: #2962
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Signed-off-by: Liu Shuo A <shuo.a.liu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-05-30 14:19:14 +08:00
yuhong.tao@intel.com 50f50872e0 DM: Cleanup vmcfg
Removed the entire vmcfg feature, these changes are made:
1.Deleted devicemodel/vmcfg/
2.Deleted devicemodel/include/vmcfg.h
3.Cleanup vmcfg in devicemodel/Makefile

Tracked-On: #3192
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2019-05-29 14:07:45 +08:00
yuhong.tao@intel.com 7315515c7c DM: Cleanup vmcfg APIs usage for removing the entire vmcfg
Vmcfg is useless and should be removed. Before removing vmcfg code,
cleanup vmcfg APIs in core/main.c

Tracked-On: #3192
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2019-05-29 14:07:45 +08:00