Commit Graph

2685 Commits

Author SHA1 Message Date
Tianhua Sun
21083ee09c dm: fix some possible memory leak
free memory allocated by strdup()

Tracked-On: #3405
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-18 15:18:29 +08:00
Tianhua Sun
835605855e 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: #3333
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-05 15:15:35 +08:00
Tianhua Sun
e7cfd9c561 dm: fix strncpy null-terminated issues
Fix strncpy null-terminated issues.

Tracked-On: #3332
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-05 15:15:35 +08:00
Zhao Yakui
f4daf2d127 DM: Adjust the priority related with ioreq emulation for Android Guest
When the IO/MMIO acccess on Android guest causes the trap to hypervisor,
it will be blocked until the ioreq emulation is completed.
In order to get the better performance, it will be better that the ioreq
emulation can be completed ASAP. As it is handled in SOS kernel, the
corresponding thread priority will be raised.

Tracked-On:#3242
Signed-off-by: Liu, Shuo <shuo.liu@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2019-06-12 10:58:01 +08:00
Yin Fengwei
0a0213695e debug/release: Enable enable -g option for debug build
-g option should only be enabled for debug build and disabled
for release build.

Tracked-On: #3164
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2019-05-24 16:10:49 +08:00
Yin Fengwei
f2d654cc44 signal SIGINT: map SIGINT to watchdog reset
Map SIGINT(2) to watchdog reset.
NOTE:
We required guest to do a full reset after detect the recent last
reset type is watchdog. This is used to resume the passthru devices
in UOS.

Tracked-On: #3103
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2019-05-15 16:20:24 +08:00
Yin Fengwei
634e310f9b build: fix build issue with latest gcc
Fix build issues with gcc 9.1 version

Tracked-On: #3121
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2019-05-15 15:51:20 +08:00
Wei Liu
57ac00a61f acrn-dm: enable debug option for acrn-dm
enable acrn-dm debug option via RELEASE=0(by default)

Tracked-On: #2939
Reviewed-by: Minggui Cao <minggui.cao@intel.com>
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
2019-04-19 11:14:33 +08:00
Xiaoguang Wu
8f32193d99 DM USB: xHCI: refine the failure process logic of control transfer
The old logic to process control transfer failure is not complete, this
patch is used to fix this issue.

Tracked-On: #2824
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-20 11:57:51 +08:00
Xiaoguang Wu
7c79f50752 DM USB: xHCI: workaround for libusb timing issue
On some platforms, the VBus will drop after suspending is done, hence
a disconnect and re-connect for device connected before suspending will
be triggered in DM. But during the stress test, when the free memory is
limited to very low level, and put huge workload to SOS, under certain
possibility, the DM will receive re-connect event first and disconnect
event later, this behavior will result of failing to emulate USB device
to UOS.

The reason is due to a timing issue from libusb. Before we could upstream
fixing patch to libusb or find some other better solution, this workaround
patch will be used to avoid errors happen.

Tracked-On: #2823
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-20 11:57:51 +08:00
Xiaoguang Wu
66dabd1260 DM USB: xHCI: fix an synchronization issue during resuming process
When disable slot cmd is received by device model, the operation
should be: release the pci_xhci_dev_emu variable first, and signal
xhci_vbdp_thread to wakeup later. Tho old implementation is not
right, this patch is used to fix it.

Tracked-On: #2823
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-20 11:57:51 +08:00
Yin Fengwei
d5b35aa785 acrn-dm: revert the change which apply realtime schedule to vcpu0
Applying realtime scheduler to vcpu0 thread could trigger
stability issue. So revert it here.

Tracked-On: #2717
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2019-03-19 10:36:25 +08:00
Xiaoguang Wu
3593135673 DM USB: xHCI: Fix CTS test failure
This patch fixes the failure of CTS 'USB Device Test' itme.

Tracked-On: #2800
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-18 13:30:36 +08:00
Xiaoguang Wu
c6efc67c20 DM USB: xHCI: fix issue of discarding zero sized BULK transfer
Should not disacard zero-size bulk transfer.

Tracked-On: #2800
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-18 13:30:36 +08:00
Binbin Wu
2ada1d4dbf hv: vtd: fix compile warning on UEFI platform
Fix compile warning on UEFI platform when check bus number.

Tracked-On: #2743
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-03-13 13:53:13 +08:00
Binbin Wu
0a9aeaa10e hv: vtd: check bus limit when add/remove device
Check bus limit when add/remove device in iommu.

Tracked-On: #2743
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-03-13 11:34:03 +08:00
yuhong.tao@intel.com
3e5bccd755 tools: acrnctl fix potential buffer overflow
When run 'acrnctl add', acrnctl dryruns launch script to get
vmname. Acrnctl assumes there are no more than 64 words in each
line of the script, and creates a buffer to hold 64 pointers to these
words. But we didn't check if the number of words exceed 64 limitation,
which can lead to buffer overflow. This commit fixed this potential
overflow problem.
And also refine some confusing error messages in 'acrnctl add'

Tracked-On: #2734
Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-03-13 10:22:50 +08:00
Conghui Chen
2171b6d2b9 dm: usb: fix possible memory leak
fix possible memory leak for usb.

Tracked-On: #2705
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-03-13 10:17:20 +08:00
Jie Deng
d585389554 dm: virtio-net: fix memory leak
Dynamic memory stored in 'net' allocated through function 'calloc'
should be freed correspondingly when return fail.

Tracked-On: #2704
Signed-off-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-03-12 10:22:05 +08:00
Binbin Wu
d4f7a1e142 dm: fix typo of path for cgroup cpu tasks
typo fix:
/sys/fs/cgroup/cpu/task -> /sys/fs/cgroup/cpu/tasks

Tracked-On: #2717
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2019-03-11 20:02:52 +08:00
Yuan Liu
7a07dfb9c7 dm: usb: fix SWWDT_UNHANDLED issue
add a delay for usb in launch_uos.sh

Tracked-On: #2633
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-11 11:34:32 +08:00
Xiaoguang Wu
b8017080b3 DM USB: xHCI: fix an logic error during USB reset
Should not set hci_address to zero during USB reset.

Tracked-On: #2633
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-11 11:34:32 +08:00
Yin Fengwei
8144f6218c acrn-dm: set realtime sched policy for vcpu thread
To reduce the io emulation impact to audio FE which could
trigger audio glitch.

Tracked-On: #2717
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2019-03-11 11:11:25 +08:00
Yonghua Huang
80d3584b07 dm: fix possible memory leak in 'load_elf32()'
Dynamic memory stored in 'elf32_phdr' allocated
through 'calloc' be lost.

Tracked-On: #2705
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-03-11 10:11:31 +08:00
Binbin Wu
8cd892a4f0 dm: passthru: fix potential memory leak
Fix potential memory leakage in some error case handling.

Tracked-On: #2705
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-03-11 10:11:11 +08:00
Wei Liu
92d75f0dc2 dm: replace string function api for acrn-dm
String function of strlen()/vsnprintf() shuould be replaced.
This patch remove the strlen(). And vsnprintf() replaced by vasprintf().

Tracked-On: #2687
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-03-07 12:21:23 +08:00
Min He
4fa293c402 hv: refined the pmu passthru irq handling
This patch refined the pmu passthru irq handling, which will re-enable
the PMC interrupt in the vlapic handler. So that can avoid some
interrupt storm situation happens.

This patch can fix the remaining Android perf CTS failure.

Tracked-On: #2598
Signed-off-by: Min He <min.he@intel.com>
2019-03-07 11:27:45 +08:00
Binbin Wu
9d4b18dc2e dm: bios: update vsbl to v1.3
Update vFastboot to v1.3
Pass secureboot status to guest.

Tracked-On: #2681
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2019-03-06 11:15:19 +08:00
wenlingz
b3962b229a Script: Fix snd_soc_skl typo in launch script
Tracked-On: #2666
2019-03-05 15:32:12 +08:00
Yuan Liu
36a243ddaa Change machine driver used
snd_soc_sst_bxt_sos_tdf8532 machine driver should be used on SOS

Tracked-On: #2652
Signed-off-by: Marcin Pietraszko <marcin.pietraszko@intel.com>
2019-02-28 18:49:13 +08:00
Yuan Liu
2199fc85b2 Domain id and name added to launch_uos.sh
For multiple guest os and particular audio features support domain id
and name is required.

Tracked-On: #2652
reviewed-by: Yu Wang <yu1.wang@intel.com>
reviewed-by: Yakui zhao <yakui.zhao@intel.com>
reviewed-by: Binbin Wu <binbin.wu@intel.com>
Signed-off-by: Marcin Pietraszko <marcin.pietraszko@intel.com>
2019-02-28 18:49:13 +08:00
wenlingz
aa7938577d Revert "sos-bootargs: change i915 initial mode setting to 0"
This reverts commit f750311005.
2019-02-28 13:40:54 +08:00
wenlingz
f750311005 sos-bootargs: change i915 initial mode setting to 0
Tracked-On: #2638
2019-02-27 17:45:32 +08:00
Conghui Chen
1d7c69a69f Revert "dm: script: enable discard feature for virtio-blk"
This reverts commit 5df9cbe36a.
As DISCARD support will cause kernel hung in stability test of warm
reset, so not enable this feature in launch script.

Tracked-On: #2633
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2019-02-27 11:09:20 +08:00
Huang Yang
1a59fa26fe DM: Attestation Keybox support in SOS DM
Retrieve the encrypted attestation Keybox from CSE
and provision it to RPMB storage.

Tracked-On: #2625
Signed-off-by: Huang Yang <yang.huang@intel.com>
Signed-off-by: Wei Xinghai <xinghaix.wei@intel.com>
Signed-off-by: Chen Gang <gang.g.chen@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2019-02-27 10:00:12 +08:00
Conghui Chen
0066171468 dm: virtio: add memory barrier before notify FE
Without memory barrier, the change of used ring index could not
immediately detected by FE, this would bring some problems.

For virtio-blk FE driver, when it receives an interrupt, and confirms the
used ring index has changed, it will first set ring flags with
VRING_AVAIL_F_NO_INTERRUPT, then get buffer from virtqueue, after
process this request, it will mask VRING_AVAIL_F_NO_INTERRUPT, and get
used ring index again before return. If used ring changes, it will
process it. At the same time, BE will read this flags before each notify,
if VRING_AVAIL_F_NO_INTERRUPT was set, BE will not inject interrupt.

Without memory barrier, before FE mask VRING_AVAIL_F_NO_INTERRUPT, BE
has finished notify without interrupt, then FE mask
VRING_AVAIL_F_NO_INTERRUPT, and get used ring index but failed (index
has changed from BE side). FE will return from interrupt handler
function, and wait for next interrupt which was not injected by BE. Thus,
this will cause kernel hung.

Tracked-On: #2628
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2019-02-27 09:54:57 +08:00
Min He
fd61d626b3 Makefile: adding profiling option in Makefile
This patch added a option to control profiling on/off, by default,
profiling is on, so that VTune can be used to capture perf data from
SOS.
When running: make PROFILING=0, it will disable profiling and pmu will
be pass-thru and perf tools can be run directly inside UOS.

Signed-off-by: Min He <min.he@intel.com>
2019-02-26 13:46:21 +08:00
Min He
328c276152 hv: pass-thru PMU registers when no PROFILING_ON
Signed-off-by: Min He <min.he@intel.com>
2019-02-26 13:46:21 +08:00
Min He
d9d6ab05f0 hv: fix an issue in vlapic_trigger_lvt
In commit e24899d9c9 ("fix "Recursion in procedure calls found""), it
added a check if vector < 16U in vlapic_trigger_lvt() by a mistake, since
the vector variable in vlapic_trigger_lvt() is not the interrupt vector.

This patch fixed the issue mentioned above.

Tracked-On:#2598
Signed-off-by: Min He <min.he@intel.com>
2019-02-26 13:46:21 +08:00
Qi Yadong
46c72d963d hv: fix possibility of using uninitialized params
'len' and 'arg' might be used uninitialized in abl_seed_parse().
Fix them by setting initial value.

 Tracked-On: #2618
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
2019-02-26 13:30:02 +08:00
Minggui Cao
e3f1947744 DM: rm console in release args for security reuest
as security request, release build can't inlcude console
configure, so remove it.

Tracked-On: #2613
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
2019-02-25 20:25:07 +08:00
Xiaoguang Wu
ecedf31bd1 DM USB: xHCI: delay 2s for enumeration in resuming process
During UOS S3 resume, the UOS will handle USB disconnect flow then
re-enumeration flow due to vbus drop be emulted for UOS S3 case. The
re-enumeration flow will impact UOS S3 resume latency, this patch
delayed the re-enumeration 2s as the workaround for this issue. Need to
do performance optimization in future.

This 2s can be tune which is depend on how fast UOS S3 resume, it should
be as short as possible to make virtual USB device ready immediately
after UOS screen turn on.

Tracked-On: #2576
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 16:43:18 +08:00
Xiaoguang Wu
9844ff0266 DM USB: xHCI: re-design the S3 logic to speed up resuming process
This patch unbinds the kernel driver usbfs with device before suspending
is completed and binds them again during resuming process, this could
avoid a busy loop in SOS due to VBUS drop. This patch could save ~200ms
for resuming process.

Tracked-On: #2576
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 16:43:18 +08:00
Xiaoguang Wu
b77755cd58 DM USB: xHCI: refine the de-init logic of xHCI vdevice
Add 'full' and 'non-full' de-initialize support for xHCI virtual
device. The non-full de-initialization mainly release usb_dev
structure and unbind the usbfs with native device. And the full
de-initialize will release all the resources allocated for xHCI
virtual device including the unbinding operation mentioned above

Tracked-On: #2576
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 16:43:18 +08:00
Xiaoguang Wu
76a5131b37 DM USB: xHCI: fix PORTSC error in 'pci_xhci_cmd_disable_slot'
The disable slot command is used for forcing a device slot to enter into
disconnect state, a typical usage would be to free a Device Slot when an
USB device is disconnected. But it should not impact the portsc value.

Tracked-On: #2576
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 16:43:18 +08:00
Xiaoguang Wu
c9d85cfaea DM USB: xHCI: fix a logic error in 'pci_xhci_portregs_write'
The function 'pci_xhci_portregs_write' always set CCS bit in
Port Status and Control (PORTSC) register when there is
pci_xhci_dev_emu instance existed. This is not right and this
patch is used to fix it.

Tracked-On: #2576
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 16:43:18 +08:00
Xiaoguang Wu
5f36580190 DM USB: xHCI: introduce get/set function for PORTSC register
Port Status and Control (PORTSC) register is one of the most frequently
accessed regiseter according the xHCI spec. This patch implement a pair
of set/get function to access PORTS and it gives a clear code structure
and help a lot for debugging work.

Tracked-On: #2576
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 16:43:18 +08:00
Qi Yadong
b7f5614387 hv: search additional argument when parsing seed from ABL
Due to ABL design change, it will reword the "dev_sec_info.param_addr="
to "ABL.svnseed" in command line.

Tracked-On: #2605
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2019-02-25 16:03:21 +08:00
Victor Sun
3c16a5ebc2 HV: code style change for abl_seed_parse.c
- remove goto;

- make sure procedure has one exit point;

Tracked-On: #861
Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-02-25 16:03:21 +08:00
Zhi Jin
2fa810076b hv: debug: mark the mmio address for npk log as hv owned
Otherwise, page fault will be triggered when writing npk log
to these mmio addresses.

Tracked-On: #2589
Signed-off-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-02-22 13:50:13 +08:00