Commit Graph

835 Commits

Author SHA1 Message Date
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