Commit Graph

793 Commits

Author SHA1 Message Date
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
Binbin Wu a3073175a6 dm: e820: reserve memory range for EPC resource
Reserved 128MB memory range for EPC resource in E820 table, starting
from 0x80000000.
Need to align the base address b/t DM and HV.
For hypervisor, the base address will be specified in epc field in
vm_configurations.c

Tracked-On: #3179
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-05-29 11:24:13 +08:00
ZhangYun 610ad0ced8 dm: update uos path in launch_hard_rt_vm.sh
Tracked-On: #3188
Signed-off-by: ZhangYun <yunx.zhang@intel.com>
2019-05-29 09:35:19 +08:00
Vijay Dhanraj 517707dee4 DM/HV: Increase VM name len
VM Name length is restricted to 32 characters. kata creates
a VM name with GUID added as a part of VM name making it around
80 characters. So increasing this size to 128.

v1->v2:
It turns out that MAX_VM_OS_NAME_LEN usage in DM and HV are for
different use cases. So removing the macro from acrn_common.h.
Definied macro MAX_VMNAME_LEN for DM purposes in dm.h. Retaining
original macron name MAX_VM_OS_NAME_LEN for HV purposes but defined
in vm_config.h.

Tracked-On: #3138
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-27 12:13:51 +08:00
Vijay Dhanraj f010f99d67 DM: Decouple and increase kernel boot args length
Currently, we use STR_LEN for all checking the size of all the
acrn-dm parameters. But some parameters like kernel boot args
can grow based on different needs. For example, when kata launches
guest VM using acrn, the kernel boot args increases by 256 bytes
(i.e 1024 +256).

Just increasing STR_LEN will unnecessarily increase allocations
for other acrn-dm parameters. So decoupling only boot_args
length and increasing it to 2048.

PS: If other parameters like ramdisk path, kernel path,
elf_path etc. don't need 1024 bytes, we can reduce STR_LEN
to 256 or 512 bytes.

Tracked-On: #3138
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-27 12:13:51 +08:00
Xiaoguang Wu b10ad4b311 DM USB: xHCI: refine the logic of CCS bit of PORTSC register
The CCS bit of PORTSC register should be set according to the mapped
native port connection status, use xdev->devices if equal NULL is not
enough due to devices only be clear in disable slot which can't reflect
the native connection state in some gaps.

Tracked-On: #3163
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-05-24 13:21:12 +08:00
Xiaoguang Wu ae066689bb DM USB: xHCI: re-implement the emulation of extented capabilities
There are many quirks in Intel xHCI implementation and it is very hard
to debug under Microsoft Windows OS, hence use ACRN xHCI extented
capabilities as the default setting.

Tracked-On: #3163
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-05-24 13:21:12 +08:00
wenlingz 5f9cd25324 Revert "DM: Get max vcpu per vm from HV instead of hardcode"
This reverts commit 356bf18491.
2019-05-24 13:02:36 +08:00
yliu79 8bca0b1ae9 DM: remove unused function mptable_add_oemtbl
Change-Id: Icf92fd5bbbfe935960dc47307822827092a46369
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 bd3f34e952 DM: remove unused function vm_get_device_fd
Change-Id: I9056838bbf150983c8011706d3d0a07aed043917
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 9224277b5e DM: remove unused function vm_setup_ptdev_msi
Change-Id: Ia62d4a75ef6074cfd4f5b271ab21ff9ed0a64f51
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 bb8584dd4a DM: remove unused function vm_apicid2vcpu
Change-Id: I3bb503058df8e0048370f6c1ab77f63aadf1eb57
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 ec924385ae DM: remove unused function vm_create_devmem
Change-Id: I1d6b56688e533a00a484548ed97fd1968f01041d
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 75ef7e8458 DM: remove unused function vm_set_lowmem_limit
Change-Id: I0f9ad089b8e72c7ecd9c83a9115727140c945c4f
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 683e2416b1 DM: remove unused function console_ptr_event
Change-Id: If8dc5ba21d172a6794d86b048d61d9ccfc28cab4
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 12f55d1389 DM: remove unused function console_key_event
Change-Id: I6ab81750757fd12929fd60c9d7fa92fd96c9520b
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 aacc6e5926 DM: remove unused function console_refresh
Change-Id: I7ad16ecf3325e012fd738f2774aec6d957efd678
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 2711e553ce DM: remove unused function console_fb_register
Change-Id: I334b83c0b0a69f705c11ff7017a96dc6875e5c9a
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 d19d0e26c6 DM: remove unused function gc_init
Change-Id: I91f498b9ae98002bc86b78fce2a0836c508b3945
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 43c01f8e26 DM: remove unused function console_init
Change-Id: I5c06a1dd057cea0edd364c846958074ee3df4987
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 e6360b9b7f DM: remove unused function gc_resize
Change-Id: I82504374fed44f08d92910d0d34a02337d844fd0
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 d153bb8664 DM: remove unused function gc_set_fbaddr
Change-Id: I005edc5f69fcd3b4969c7c7d75f633d2219acbe5
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 475c51e53a DM: remove unused function console_set_fbaddr
Change-Id: Ia0d96880a53a7564492ec4d7943b3040e32dd6e0
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 4e7703161e DM: remove unused function swtpm_reset_tpm_established_flag
Change-Id: I8253df84ef490418e37ac3d565dcdc7bb8123f3b
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 2a33d52ec6 DM: remove unused function vrtc_reset
Change-Id: If0dbd40cf54eb81ca4ced9acae273d291e99b25c
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 1a726ce010 DM: remove unused function vrtc_get_time
Change-Id: I2074295234f8cfaf5f325bfbacab9c86779653bf
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 8cb64cc71f DM: remove unused function vrtc_nvram_read
Change-Id: I0b8c42879256e53762aeb031f63fc043ae2d9128
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 dcd6d8b5a9 DM: remove unused function virtio_pci_modern_cfgread and virtio_pci_modern_cfgwrite
Change-Id: I3f362858956a642ae0de9ab36387e274fc939659
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 62f14bb11f DM: remove unused function virtio_dev_error
Change-Id: I6e94ab0286e73435429e2ccf971207c7d8ed6ef6
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
yliu79 2d6e6ca375 DM: remove unused function usb_native_is_ss_port
Change-Id: I7991560b40b936776e45f7b81fee085935eb6eae
Tracked-On: #3123
Signed-off-by: Ying Liu <ying2.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-05-24 11:51:00 +08:00
Arindam Roy 3d459dfddc DM: Fix minor issue of USB vendor ID
Provide a minor fix for following issue:
Emulated USB controller Vendor ID and Device ID are swapped.

Tracked-On: #3053
Signed-off-by: Arindam Roy <arindam.roy@intel.com>
Reviewed-by: Xu, Anthony <anthony.xu@intel.com>
2019-05-24 09:31:42 +08:00
Tw 321e4f1300 DM: add virtual hostbridge in launch script for RTVM
Hostbridge is necessary for passing kernel pci subsystem initialization
sanity check which is located in pci_sanity_check(). It will check
whether a host bridge exists.

BTW, set rtvm flag explicitly.

Tracked-On: #3152
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-05-23 14:07:05 +08:00
Wei Liu bb48a66b96 dm: refine the passthrough devices with dictionary
As vm config tool will override the passthrough devices if run on
different hw, and it will take a lot of work to search and
replace the passthrough device.
This patch refine the passthrough devices that tools to overwrite.

Tracked-On: #3127
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2019-05-17 11:06:31 +08:00
fuyongjie 49350634b1 DM: virtio-gpio: fixed static variable keeps increasing issue
virtio_gpio_ops variable type is static,so use "+=" will let
the value keep increasing when acrn-dm reset.

Tracked-On: #3118
Reviewed-by: Yuan Liu <yuan1.liu@intel.com>
Signed-off-by: fuyongjie <fuyongjie@neusoft.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-05-15 15:20:28 +08:00
Kaige Fu 356bf18491 DM: Get max vcpu per vm from HV instead of hardcode
This patch tries to fetch max vcpu per vm from HV instead of hardcode in DM.

Tracked-On: #3116
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-05-15 09:30:59 +08:00
lijianpi d9717967d7 dm:add grep -w option for uos launch sh
for vm_name  with vxworks_vm1  or zephyr_vm1 or vm1
grep "vm1" will match three of them, add -w option fix this issue
Tracked-On:#3081
Signed-off-by: zhangyun <yunx.zhang@intel.com>
2019-05-14 09:15:29 +08:00
Jian Jun Chen 4c28a37440 dm: add sample script to launch Windows as guest
This patch adds one sample script to launch Windows as guest.

Tracked-On: #3099
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-05-13 14:43:07 +08:00
Liu Xinyun d9e6cdb593 dm: not register/unregister gvt bar memory
AcrnGT traps and intercepts the memory region defined by PCI bar in
service OS kernel driver. No need to register the bar associated region
in dm. By the way, some OS changes BAR start address and there is no
mechanism to reflect the gvt changes back to dm. It causes problem that
other devices may register new region which falls in GVT `old` region,
and leads to hypervisor crash.

v4: Add FIXME tag. It's a short term solution before migrated to OVMF
v3: rewording the comments
v2: removed unnecessary braces and use printf to log (Peter)

Tracked-On: #2976

Reviewed-by: He, Min <min.he@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Liu Xinyun <xinyun.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-05-09 17:28:16 +08:00
Kaige Fu 0cadc16b8b DM: Add one sample script to launch VxWorks as guest
This patch add one sample script to launch VxWorks as guest.

Tracked-On: #3069
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-05-07 11:40:35 +08:00