Commit Graph

2609 Commits

Author SHA1 Message Date
Chaohong guo
3fee32c0bb EFI: Allocate EFI boot related struct from EFI allocation pool
Current EFI boot related structs are allocated right after HV binary, and
marked as EfiResered. In fact, the memory should be reclaimed and
managed by HV once EFI boot is done, Moreover, HV is doing 2M alignment,
which is overwriting this allocated memory. This patch is to allocate EFI
info from EFI allocation pool and marked as EFiloaderdata, so that the
memory is used by HV, also, it will reduce the fragmentation.

Tracked-On: #2035
Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2019-01-24 08:27:55 +08:00
Chaohong guo
ea143dc43b EFI: Allocate 2M aligned memory for hypervisor image
Hypervisor does memory alignment during initializing paging(init_paging)
although the starting address allocated by EFI stub doesn't meet the
requirement. As a result, HV might overwrite some memory belong to UEFI
BIOS. The patch introduces a new routine to fix the issue.

Tracked-On: #2035
Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
2019-01-24 08:27:55 +08:00
yuhong.tao@intel.com
fa768b875f tools: acrn-manager: fix mngr_send_msg() return 0 when read ack fail
When do IPC with mngr_send_msg(), and ack is required but failed to
get ack,  mngr_send_msg() still return 0, that is not correct.

Tracked-On: #2398
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2019-01-23 12:52:11 +08:00
Binbin Wu
a86008ebf0 dm: script: use -d to check existence of gpio460
/sys/class/gpio/gpio460 is a directory,
should use -d instead of -f to check its existence.

Tracked-On: #2328
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-01-22 08:33:57 +08:00
Wei Liu
6a6fe829c7 launch_uos.sh remove sd card passthru option
1. remove the sd card option to reducing the boot time.

Tracked-On: #2331
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
2019-01-17 16:52:03 +08:00
Binbin Wu
38d9eb5611 dm: script: echo 'high' instead of "out" to direction for gpio460
echo 'high' instead of "out" to direction for gpio460 to avoid gpio pin value glitch.

Tracked-On: #2328
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-01-17 14:38:22 +08:00
Binbin Wu
80c394a86a dm: passthru: increase the delay after wifi reset
Increase the delay to 200ms after wifi reset for link training done.

Tracked-On: #2328
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-01-16 13:06:21 +08:00
Wei Liu
19b6eea150 dm: add dm log to kmsg for profiling
Collect the dm log to dmesg for profiing.
These mesage will be easy to profile when dm booting.

Tracked-On: #2336
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-01-14 19:38:54 +08:00
Xiaoguang Wu
83279f8573 DM USB: xHCI: WA for an isochronous crash issue
The current xHCI mediator doesn't well support disable endpoint command.
This patch is one workaround for disable endpoint command to avoid
xHCI mediator to continue handle already dropped data.

Tracked-On: #2325
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-01-14 13:27:57 +08:00
Xiaoguang Wu
79b145f89f DM USB: xHCI: WA for the 'lost adb' issue.
This patch is one xDCI passthrough workaround. To support DRD in Guest,
the xDCI does VT-d pass through, and DRD be emulated in xHCI mediator.
With Guest S3 stress test, ramdonly the xDCI can't be emuerated by USB
host even the DRD is already switch to device mode. When this issue
reproduce, does DRD switch to host then switch back can resuce this
issue.

Besides, the virtual drd regiters need to be set to reset value during
Guest warm reset flow.

Tracked-On: #2326
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>y
2019-01-14 13:27:37 +08:00
Binbin Wu
a4014db275 dm: passthru: reset wifi chip via gpio
During UOS reboot, sometime the wifi firmware status is wrong and can't
handled by UOS driver, this patch add gpio reset for the wifi chip to avoid
such error.

Tracked-On: #2328
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-01-14 12:47:53 +08:00
Binbin Wu
a021cb26bb dm: script: export gpio460 for wifi reset
GPIO460 is used to reset wifi chip on apl-mab.
Export the GPIO pin to userspace so that it can be used in device model.

Tracked-On: #2328
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-01-14 12:47:53 +08:00
Wei Liu
c85153e7fa lunch_uos.sh: reduce the booting time
1. reduce the time once offline cpu failed.
2. remove the passthru of sd card for GP2.0.

Tracked-On: #2331
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
2019-01-14 12:28:20 +08:00
Feng Tang
7fa8886907 DM: sos_bootargs: Add panic_print parameter to help debugging
Adding this parameter so that it could provide more info when
kernel panic happens. And this has almost no overhead as it only
uses several existing kernel APIs.

The 0x1f is a bitmask for type of info to be dumped, and it means
it will print task/memory/timer/lock/ftrace info when panic happens.

Tracked-On: #2309
Signed-off-by: Feng Tang <feng.tang@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-14 11:29:50 +08:00
yuhong.tao@intel.com
d7199ccc3b tools: acrnd: Fix launch UOS by timer list without fork()
When acrnd_vm_timer_func() launch UOS, it need fork() and run, so
that do not block the main process.

Tracked-On: #2306
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2019-01-14 11:18:46 +08:00
yuhong.tao@intel.com
377fdea08d tools: acrn-manager: fix a race condition on updating VM state
For a running or suspended VM, its state is updated in 2 steps.
It is first set to VM_CREATED, then set to VM_STARTED/VM_PAUSED. IF
one thread check a running/suspend VM, it may get wrong state VM_CREATED,
while another thread is updating the VMs state.

Tracked-On: #2306
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2019-01-14 11:18:46 +08:00
yuhong.tao@intel.com
838d40c9c2 tools: acrn-manager: print more debug information
Print more information at acrnd_add_work(), query_state()
try_do_works() and handle_acrnd_resume()

Tracked-On: #2306
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
2019-01-14 11:18:46 +08:00
Yuan Liu
8b9100b15d IOC mediator: fix the issue of abnormally missing tx package
The issue will result in the loss of wakeup reason and signal
data, because the CBC header was not added when generating the
tx package.

Tracked-On: #2282
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-01-11 13:06:30 +08:00
Yuan Liu
24e4464b5a DM: mei: solving the issue of closing the fd
The issue leads that the IOC mediator's fd is turned off
incorrectly, causing the IOC mediator to fail.

The root cause is because after closing fd is not set
to an invalid fd.

The issue can be reproduced by the S3 stress test.

Tracked-On: #2300
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-11 11:26:59 +08:00
Min Lim
465d7f2cc4 profiling: code cleanup
This is to align the types used in hypervisor core and profiling.
That cleans up unnecessary type conversions. It also fixes inconsistent
tab/space in data structures.

Tracked-On: #2257
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
2019-01-10 11:02:10 +08:00
Min Lim
70a626bdac profiling: fix the profiling tool crash by page faults
Profiling tools are broken, which cause page faults during collection.
The issue happens by enabling SMAP recently. Therefore,
stac() and clac() are used to allow access to buffers allocated
by guest.

Tracked-On: #2157
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
2019-01-10 11:02:10 +08:00
wei.tan@intel.com
9adc990662 Makefile: specify BOARD&FIRMWARE in sb-hypervisor-install
BOARD&FIRMWARE are wrong When 'make sbl-hypervisor-install' w/o parameters
due to default platform is uefi. So set them clearly.

Tracked-On: #1995
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-10 10:53:10 +08:00
Zhao Yakui
c0547bbbf9 DM: Try to load audio mediator BE driver before starting UOS
Currently whether audio works in virtio mediator or pass-through mode can be determined
by checking the device file of vbs_k_audio

But before the completion of loading audio virtio-BE module, the device file of /dev/vbs_k_audio
doesn't exist. In such case in course of loading UOS, the incorrect work mode is selected
for audio device (passthru instead of mediator). This is incorrect

Tracked-On: projectacrn/acrn-hypervisor#2247
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Alek Du <alek.du@intel.com>
2019-01-08 12:31:05 +08:00
Miguel Bernal Marin
24451b6b0d Makefile: add RELEASE variable to make command
1. use RELEASE to control ./tools install target.

Tracked-On: #2168
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-08 11:23:37 +08:00
Alek Du
6790332cd8 Makefile: keep files used for debug target
1. keep symbols files for debug usage
2. they are saved when build for rootfs.

Tracked-On: #2168
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-08 11:23:37 +08:00
Binbin Wu
62eb7af36d dm: acpi: add PSDS table in ACPI table
Expose a new ACPI table PSDS to UOS.
This PSDS table show the security capability of the VM.
Only enable this table in UOS when PSDS presented in SOS.

Tracked-On: #2241
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-01-08 11:22:57 +08:00
Tianhua Sun
473792c12a Revert "EFI: Disable RELOC by default temporary"
This reverts commit 39d54c8765.

Tracked-On: #1122
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
2019-01-04 16:06:25 +08:00
Tianhua Sun
633ede73d8 DM: xHCI: array bound checking before it is used
Array index of "vbdp_devs" may be out of bounds if
"i >= XHCI_MAX_VIRT_PORTS", so index checking is necessary.

Tracked-On: #1252
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-01-04 16:06:25 +08:00
Conghui Chen
5213a0d3a2 dm: virtio: fix compile issue on ubuntu
As VIRTIO_CONFIG_S_NEEDS_RESET is not defined in standard virtio header
file on ubuntu, there will be compile issue. so add
VIRTIO_CONFIG_S_NEEDS_RESET to fix it.

Tracked-On: #2219
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-01-02 10:19:00 +08:00
Shuo Liu
a17d559db4 dm: remove unnecessary ioreq status changing from DM
We will mark ioreq as COMPLETE in VHM via IC_NOTIFY_REQUEST_FINISH
ioctl. vm_notify_request_done can do it. So remove this one.

Tracked-On: #1821
Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-29 10:16:20 +08:00
Shuo Liu
01c52c51c5 dm: Add vm_clear_ioreq to clear ioreq status
VHM will provide a ioctl to clear all IO requests' status. This is
useful to handle ioreqs in VM normal reboot and emergency reboot.

Tracked-On: #1821
Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-29 10:16:20 +08:00
Shuo A Liu
ae9aa8c061 hv: decouple IO completion polling from idle thread
IO completion polling will access vcpu and vm structs. If doing it in
idle thread, there might be some race issues between vm destroying and
idle thread. They are running on different cores.
Got suggestion from Fengwei, decouple the polling action from idle
thread and just do it in vcpu thread, then we can guarantee idle thread
in really idle status.

Tracked-On: #1821
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-29 10:16:20 +08:00
Shuo A Liu
3e9f4b958d hv: clear NEED_RESCHEDULE flag in schedule
Now, need_reschedule will test_and_clear the bit NEED_RESCHEDULE in
schedule context, then call schedule. It is not a exact match with the
name.
This patch move the flag clearing into scheudle, and need_reschedule
just check and return.

Tracked-On: #1821
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-29 10:16:20 +08:00
Wei Liu
2c70a1e115 hv: fix sos kernel hang when migrate irq to different cpu
With kernel 4.19, it's possible that same irq vector assigned
to different devices on different cpu.

So when we update the tmr, we should update the value for cpu
which is irq target.

Tracked-On: #2212
Signed-off-by: Alek Du <alek.du@intel.com>
2018-12-29 10:04:33 +08:00
Yin Fengwei
ea1ac8a939 dm: fix the memory leak in virtio mei
The possible memory leak was introduced by commit
7fce2462a0

If mevent add fails in virtio mei, the resource allocated doesn't
be released. This patch fix this memory leak issue.

Tracked-On: #1877
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-28 15:04:03 +08:00
Yin Fengwei
e8a57d78ea dm: Add teardown callback for mevent in uart_core
To avoid the race issue for mevent in uart, we introduce the
teardown callback to handle resource free case.

Tracked-On: #1877
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-28 15:04:03 +08:00
Yin Fengwei
83f19b7507 dm: refine the uart_core
Make uart_init and uart_deinit internal functions. And make
uart_set_backend/uart_release_backend cover uart_init/uart_deinit
function.

This will make mevent teardown callback adding easier for uart_core.

Tracked-On: #1877
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-28 15:04:03 +08:00
Yonghua Huang
b6603015bc hv: remove the usage of 'atoi()'
this function is not from libc but has the same name,
  atoi() in libc is unbounded and not safe.

  replace this function with 'strtol_deci()' in this case.

Tracked-On: #2187
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-27 21:07:33 +08:00
Yonghua Huang
3ca1a583de HV: [v2] bugfix in 'hv_access_memory_region_update()'
- bugfix:the actual 'size' of memory region that
    to be updated is incorrect.

  - replace CONFIG_UEFI_STUB with DMAR_PARSE_ENABLED
    when update memory pages for ACPI_RECLAIM region,
    as DMAR_PARSE_ENABLED may be enabled on non-EFI
    platform.

V2 update:
    wrap roundup to 2M and rounddown to 2M inline
    functions.

Tracked-On: #2056
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-12-27 21:07:33 +08:00
Shuo A Liu
381d59de72 dm: use snprintf to replace sprintf
Also remove the '\n' from the hugetlb's file name.

Tracked-On: #2133
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2018-12-26 14:10:32 +08:00
Shuo A Liu
b313993b64 dm: use strncpy to replace strcpy
Tracked-On: #2133
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2018-12-26 14:10:32 +08:00
Shuo A Liu
0bb20c3812 dm: use strnlen to replace strlen
Tracked-On: #2133
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2018-12-26 14:10:32 +08:00
Shuo A Liu
ff2ed240a0 dm: Fix some issues from string operations
The patch fix some string operations issues and also improve readability
of several snippet.

Tracked-On: #2133
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2018-12-26 14:10:32 +08:00
Yin Fengwei
193c646432 dm: flush the input/output during tty open.
Discard the input/output data when open tty file. To avoid the
mevent callback is triggered immediately when the fd is added to
epoll.

Also update the uart_drain only read the data from tty file when
fifo has available space.

Tracked-On: #2159
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-25 14:47:31 +08:00
Binbin Wu
2b0d9c931c hv: vcpuid: remove unnecessary check code
The removed check code is not necessary.

Tracked-On: #861
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-25 14:47:31 +08:00
Binbin Wu
26b05e59a6 hv: vcpuid: leaf 02h has no subleaf, delete un-needed code.
According to SDM Vol. 2A 3-191 & Vol. 2A 3-213, leaf 02h has no subleaf.
This patch removes the un-needed code.

Tracked-On: #861
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-25 14:47:31 +08:00
Conghui Chen
eb96914a1c dm: virtio: refine header file
Reuse linux common virtio header file and remove the repetitive
definition.

Tracked-On: #2145
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-25 14:47:31 +08:00
Li, Fei1
09634d8215 hv: coding style: refine set_vcpuid_entries to one exit
Fix procedure has more than one exit point.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-12-25 14:47:31 +08:00
totoroow
e218075c69 dm: pass mac seed not to use vm name on UP2
Physical NIC mac address is used for generate UOS mac address.
This patch uses a new parameters to pass this information
instead of vm name.

Tracked-On: #1987
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2018-12-25 14:47:31 +08:00
Kaige Fu
4d7dd6dbc8 Debug: Add one hypercall to quary hardware info
acrntrace/log kernel modules will use this hypercall to fetch
pcpu num of hardware platform. Then, initialize driver accordingly.

Tracked-On: #1775;#1776
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-12-25 14:47:31 +08:00