Commit Graph

428 Commits

Author SHA1 Message Date
Jie Deng 18ba75248f 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-11 17:40:31 +08:00
Binbin Wu f572d1ecdd [RevertMe] dm: pci: restore workaround when alloc pci mem64 bar
There was a workaround in DM that allocates PCI 64bit mem bar in 32bit mem space
if the bar size is within 32MB.

After the workaround being removed, there is an issue to enter fastboot
mode for inappropriate handling of 64bit mem bar in guest driver.
The patch bring the workaround back, and skip the workaround when the guest
is booted by OVMF.

Revert the patch after the guest fixs the issue of handling 64bit mem bar in
fastboot mode.

Tracked-On: #2677
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-03-05 15:14:24 +08:00
Jian Jun Chen 29b1ebcd43 dm: add support of high MMIO mapping
1G PCI hole is added just after 4G address which is used as the
PCI high MMIO address space. Guest high memory is mapped from 5G
address for both EPT and device model user space address. Guest
e820 table and API vm_map_gpa are updated accordingly.

Tracked-On: #2577
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-28 18:33:11 +08:00
Liu Shuo A 32925c10bd dm: allocate 64bit MMIO above 4G strictly to pass OVMF check
Remove the >32MB limitation for 64bits mmio hole allocation, ACRN
hasn't met such buggy devices for this limitation. Besides, OVMF
has one bug which requires 64bits BAR must allocate from 4G+ address,
otherwise trigger assert. This patch can workaround it.

Tracked-On: #2577
Signed-off-by: Liu Shuo A <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-28 18:33:11 +08:00
Shuo Liu aed75145c1 dm: Limit 64 bits PCI BAR region address space
Limit 64 bits PCI BAR space from 0x100000000UL ~ 0x140000000UL,
as HV now only support 0x400000000UL+0x80000000 as top of guest memory
address. EPT table size is static allocated.

Tracked-On: #2577
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-28 18:33:11 +08:00
Yuan Liu 7628e790e7 DM: virtio-gpio: use virtio_base as the first member of virtio_gpio
For virtio-based device, it needs to use virtio_base as the first member
otherwise, virtio_linkup will fail.

Tracked-On: #2512
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-28 17:19:36 +08:00
Huang Yang 2f7ed65f90 DM: Attestation Keybox support in SOS DM
Retrieve the encrypted attestation Keybox from CSE
and provision it to RPMB storage.

Tracked-On: #2604
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-25 16:40:25 +08:00
Yuan Liu 780f520fc6 DM: virtio-gpio: return a valid length for GPIO request
When the backend completes a GPIO request, it returns a valid length
to ensure that response correct.

Tracked-On: #2512
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 14:17:05 +08:00
Yuan Liu 21ae3e7451 DM: virtio-gpio: add print log
if the gpio debug is enabled, print gpio mapping information about
virtual gpio and native gpio, also print virtio-gpio data, which shows
the gpio operations flow.

Tracked-On: #2512
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-21 14:11:52 +08:00
Yuan Liu 6b0643b535 DM: virtio-gpio: implementation of gpio opearations
Implement gpio set/get value, direction input/output and set config operations.

Tracked-On: #2512
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-21 14:11:52 +08:00
Yuan Liu 77e17b5dff DM: virtio-gpio: gpio initialization.
Add gpio initializaiton and gpio usage implementation

gpio usage:
-s <slot>,virtio-gpio,<gpio resources>

<gpio resources format>
<@chip_name{offset|name[=vname]:offset|name[=vname]:...}
[@chip_name{offset|name[=vname]:offset|name[=vname]:...}]
[@chip_name{offset|name[=vname]:offset|name[=vname]:...}]
...>

Tracked-On: #2512
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-21 14:11:52 +08:00
Yuan Liu 57029315d7 DM: virtio-gpio: virtio framework implementation.
virtio framework implementation for virtio-based gpio virtualization.
virtio-based gpio uses one virtqueue to implement gpio operaions and
frontend gpio chip base and number are provided by virtio config.

Tracked-On: #2512
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-21 14:11:52 +08:00
Minggui Cao 07656a9cc6 DM: modify acpi for IASL to support ACPI6.3
patch is from Alex Du for IASL tool updated to support
ACPI 6.3 version.

Tracked-On: #2568
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
2019-02-20 20:05:32 +08:00
Vijay Dhanraj c2e741ad90 dm: Add socket backend support for virtio-console
Socket is not currently supported as backend for virtio-console.
Kata containers require socket backend for virtio-console in order to
communicate between the agent running in the VM and the proxy running
in the host. In order to support Kata with ACRN, this feature is required.

v1-->v2:
Prevent new accepts on an already established socket connection. This
removes the need for accepted_fd and accept_evp varibles introduced in
previous patch.

v2-->v3:
Fixed coding style and removed debug prints.

Tracked-On: #2448
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-02-14 10:16:44 +08:00
Peter Fang 24cf377d5d dm: vhpet: fix vHPET memory leak on device reset
Need to properly remove and free its MMIO entry during deinit.

Tracked-On: #2453
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-02-06 08:53:27 +08:00
Yuan Liu be946ca8e0 IOC mediator: dynamically enable dummy channels
The dummy channels can emulate cbc lifecycle, cbc signal and cbc raw
channel instead canbox, and the feature can be enabled by ioc command
line within wakeup reason bit 24.

Tracked-On: #2481
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-01 16:05:43 +08:00
Xiaoguang Wu 80dc0bce3e DM: ACPI: Avoiding hard code the ASL_COMPILER macro
The ASL_COMPILER macro is hard coded as /usr/sbin/iasl, it is
complained by some developers. This patch changes it to a
flexible way, by which the following make command lines are
supported:

make
make devicemodel
make ASL_COMPILER=/path/to/iasl
make ASL_COMPILER=/path/to/iasl devicemodel

Tracked-On: #2298
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-02-01 13:47:55 +08:00
Conghui Chen ca925f0dd4 dm: storage: change DISCARD to synchronous mode
For virtio-blk, when the backend is a regular file, the discard
and
is implemented by fallocate(), but this function will not wait for
the discard command handled by disk.
So, add fdatasync to make sure the DISCARD is executed
synchronously.

Tracked-On: #2395
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
2019-01-23 12:56:47 +08:00
Peter Fang 4642269248 dm: vhpet: add vHPET support
vHPET is used as a source of system timer by UEFI (e.g. OVMF).

This provides an alternative to using vPIT, which OVMF assumes is always
connected to vPIC.

This is ported from Bhyve, with a few changes:

- move to user space, using acrn_timer
- enable timers only when necessary

Origin: FreeBSD
License: BSD-3-Clause
URL: https://svnweb.freebsd.org/
commit: 326257
Purpose: Adding vHPET support.
Maintained-by: External

Tracked-On: #2319
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-23 10:33:28 +08:00
Peter Fang 0343da8c70 dm: vhpet: add HPET-related header files
Add the necessary header files for vHPET.

Origin: FreeBSD
License: BSD-3-Clause
URL: https://svnweb.freebsd.org/
commit: 326257
Purpose: Adding vHPET support.
Maintained-by: External

Tracked-On: #2319
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-23 10:33:28 +08:00
Peter Fang 3fe4c3f2a8 dm: provide timer callback handlers the number of expirations
It is possible for multiple timeouts to occur in one mevent epoll
iteration. Providing the number of timer expirations to the timer
callback handlers can be useful. E.g., this could improve emulation of
timing-sensitive hardware components.

Tracked-On: #2319
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-23 10:33:28 +08:00
Yuan Liu 62e058a001 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: #2301
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-11 11:26:42 +08:00
Yuan Liu 1049053e2e 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: #2283
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-01-11 09:21:35 +08:00
Tianhua Sun 01c8f546e0 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-03 22:42:40 +08:00
Peter Fang 57c661c48d dm: vrtc: add RTC to ACPI DSDT
Clear Linux complains about not finding RTC as a PNP device:

platform rtc_cmos: registered platform RTC device (no PNP device found)

This is a port of Bhyve vRTC's user-space logic.

Tracked-On: #2176
Signed-off-by: Peter Fang <peter.fang@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2018-12-29 10:33:32 +08:00
Binbin Wu 59e2de4805 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: #888
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>
2018-12-28 22:11:09 +08:00
Yin Fengwei 329ea42d73 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-27 09:58:20 +08:00
Yin Fengwei 8f57c61da9 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-27 09:58:20 +08:00
Yin Fengwei 72d1fa503a 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-27 09:58:20 +08:00
Shuo A Liu 4b3ebf69c7 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-25 18:40:04 +08:00
Shuo A Liu b3ad44d4c1 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-25 18:40:04 +08:00
Shuo A Liu 3e0b06cfd6 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-25 18:40:04 +08:00
Yin Fengwei f6ae835137 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-23 22:35:09 +08:00
Conghui Chen 5253ac7af5 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-21 15:27:01 +08:00
Xiaoguang Wu 1d1d24345f DM USB: xHCI: change log level of some logs for S3 online debugging
S3 emulation is complicated and greatly dependent on system timing,
hence this patch changes log level for some important logs to help
online debugging (could output log by modifing launch_uos.sh and
without re-compiling)

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-20 20:22:25 +08:00
Binbin Wu ccda4595bc dm: passthru: add error handling if msix table init failed
Release the resource reqeusted during msix table init if error occurs.
Change the type of the second arg of deinit_msix_table from pci_vdev to ptdev,
to align with init_msix_table.

Tracked-On: #1782
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2018-12-20 09:08:37 +08:00
Binbin Wu 3363779d8d dm: passthru: msi/msix handling revisit
Currently, the emulation of pci msi/msix can be handled by hypervisor code.
The logic in dm passthru driver can be simplified.

This patch remaps msix table to usersapce in DM passthru driver.
1. The access to the msix table in passthru driver will be trapped, and emulated by hv code.
2. The access to the config space in passthru driver will be trapped, and emulated by hv code.

So dm passthru driver no longer needs to keep the whole logic of handling msi/msix.
No need to do msix table remapping in sos kernel.
After the patch, the msix table ioremap code in vhm_dev.c can be removed.

Tracked-On: #1782
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
2018-12-20 09:08:37 +08:00
Conghui Chen 2ddd24e022 dm: storage: support discard command
Support DISCARD command is meaningful when eMMC usage is high or
there are lots of remove operations. For example, when Guest
Android is running, there will be lots of files being created and
removed. However, virtio-blk BE does not support DISCARD command,
data remove operation in UOS will not trigger erase in eMMC. After
period of time, the eMMC will be consumed out, and erase must be
done by eMMC firmware before writing any new data. This causes the
eMMC performance decrease in the whole system (SOS and UOS).
To solve the problem, DISCARD should be supported in virtio-blk BE.

Tracked-On: #2011
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-18 13:21:07 +08:00
Conghui Chen f71370ad81 dm: storage: rename delete to discard
To keep consistent with kernal code, change delete to discard.

Tracked-On: #2011
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-18 13:21:07 +08:00
Long Liu 5ab68eb97b dm: hw: Replace sscanf with permitted string API
Replace sscanf in device model hw directory

Tracked-On: #2079
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 19:17:29 +08:00
Long Liu 63b814e7e9 dm: hw: Replace strlen with strnlen
Replace strlen function with strnlen function in device-model

Tracked-On: #2079
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 19:17:29 +08:00
Long Liu eab7cd47ae dm: hw: Replace sprintf with snprintf
Replace function sprintf with snprintf in device model

Tracked-On: #2079
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 19:17:29 +08:00
Xiaoguang Wu d2627ecfcc DM USB: xHCI: fix an issues for failing to enumerate device
This is an obvious bug, which releases memory but still access the
data on the released memory. It is risky operation, and may result
failing to do normal enumlation process. This patch is used to fix
it.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 13:31:00 +08:00
Xiaoguang Wu 1c3344b782 DM USB: xHCI: change log level for S3 process
The USB S3 virtualization logic is complicated and heavily affected by system
timing. To make the debugging work easily, change related log level to facilitate
quick bug fixing.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 13:31:00 +08:00
Yin Fengwei 73ab727434 dm: set correct thread name
When issue happen, we could identify which thread is impacted.
This could help stability issue debugging.

Tracked-On: #2037
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:50:50 +08:00
Jian Jun Chen cb31381561 dm: vhost: remove support for non-msix devices
irqfd only supports msix devices. In the current code a mevent is
added to poll the callfd from userspace to support intx devices.
This patch removes the support for non-msix devices since they are
not used in the current device model.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:49:55 +08:00
Jian Jun Chen b29fc619af dm: virtio-net: apply new mevent API to avoid race issue
Teardown callback is provided when mevent_add is called and it is
used to free the virtio-net resources.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-14 19:49:55 +08:00
Jian Jun Chen 4f36244fef dm: virtio-console: apply new mevent API to avoid race issue
Teardown callback is provided when mevent_add is called. A ref_count
is added to virtio_console data structure. Teardown callback needs to
free the resources of the backend and when the ref_count of the
virtio_console is zero the whole virtio-console is freed.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-14 19:49:55 +08:00
Jian Jun Chen baf8f8bdbf dm: virtio-input: apply new mevent API to avoid race issue
Teardown callback is provided when mevent_add is called and it is
used to free the virtio-input resources.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-14 19:49:55 +08:00
Xiaoguang Wu c2df4a8557 DM USB: xHCI: no wait logic implementation for S3
On Intel Apllo Lake platform, the VBus will drop after the SOC suspended,
hence during the SOS resuming process, there will be a disconnecting event
and a connecting event sent to each native USB device in order.

This patch will use new strategy for S3 resuming emultion.
  1. The DM set PORTSC register to 'no device attached' state when S3
     suspending started,
  2. SOS resuming starts and do nothing for device disconnecting event,
  3. 'Cache' device connecting event and don't report it to UOS,
  4. UOS believe no device attached due to PORTSC register state and
     begin to clear the resource allocated for the device before S3
     suspending,
  5. DM receives the Disable Slot command from UOS and report the 'cached'
     device connecting event to UOS, hence trigger the emulation behavior
     for the device.

The purpose of this strategy is to let UOS resuming proceed as quickly as
possible, which means the UI will be turned on quickly to user.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
Xiaoguang Wu 82659831f0 DM USB: xHCI: refine emulation for command XHCI_CMD_RS
According to xHCI spec 5.4.1.1, this command hasn't ask to clear
PORTSC for R/S handling. So the PORTSC should always present the
physical usb bus status.

The old implementation changes the PORTSC according whether the
pci_xhci_dev_emu struct is allocated, it is not consistent with
spec and this patch is used to fix it.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
Xiaoguang Wu e5c98e6d9a DM USB: add usb_dev_path_cmp function for convenience
Comparing two USB devices' path is frequently used operation, abstract
it as an seperated function for convenience.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
Xiaoguang Wu 6c1ca13767 DM USB: xHCI: remove the waiting 5 seconds wa for s3
This workaround will delay the UOS resuming for 5 seconds, this
behavior is not right and should be replaced by dynamic style.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
yingbinx 6b998580d6 Fix KW issues for tpm_emulator
There are several KW issues which uninitialized variables
are used. This patch will fix those KW issues.

Signed-off-by: weideng <wei.a.deng@intel.com>
Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
2018-12-14 09:05:28 +08:00
Yang Liang fbaecde6bb DM USB: xHCI: Fix banned API issue.
In USB mediator, sscanf, strtok and atoi API is banned, so replace them
with permitted API function.

Tracked-On: #1254
Signed-off-by: Yang Liang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-13 13:24:55 +08:00
Peter Fang e835f5f5d2 dm: enforce data size when accessing PCI BARs
Always enforce data size when using BAR access functions.

Currently, the size serves as a hint to the BAR access functions and
these functions are expected to behave accordingly. Some of the access
functions, e.g. virtio ones, don't always truncate the data but expect
the caller to take care of the data size. This causes problems with
OVMF's virtio drivers during I/O instruction emulation because RAX can
contain junk bits that shouldn't be written to the device.

v1 -> v2:
- improve readability

Tracked-On: #1935
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-13 13:22:44 +08:00
Jie Deng ed1c576d08 dm: pass mac seed not to use vm name
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: Jie Deng <jie.deng@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-12 13:22:18 +08:00
Jian Jun Chen 2ef06450dc dm: virtio-input: ignore all MSC events from FE
EV_MSC is configured as INPUT_PASS_TO_ALL in input driver. There is
a loop in the use case of virtio-input. They should not be forwarded
back to BE since they have already been sent to native driver before
sending to FE.

Tracked-On: #2006
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-12 09:31:57 +08:00
Yang Liang da0cf3af71 DM: xHCI: unbind slot id and ndevices relationship.
After mutiple usb devices send enable slot commnad and get slot id each
other, address device setup flow is not sorted by slot id. According to
current design, it will casue assert failure. This patch takes off this
restriction.

Tracked-On: #2017
Signed-off-by: Yang Liang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-12 09:11:29 +08:00
Yin Fengwei 7fce2462a0 dm: apply new mevent API to avoid race issue in mei
Pass teardown callback when add mevent in mei mediator code.
Which could avoid run_callback calling after the related data
structure is freed.

Tracked-On: #1877
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-07 20:21:33 +08:00
Yin Fengwei 64d9c59aa1 dm: enhence the mevent API
There is one race issue between mevent callback (which is called
in mevent_dispatch thread) and mevent_delete (which could be called
in dev thread). And the callback is called after mevent_delete.

libevent have the exactly same issue. The issue is decripted here:
https://github.com/libevent/libevent/blob/master/whatsnew-2.1.txt

The fixing is:
We introduce a teardown callback to mevent and make sure there is
no race issue between callback and teardown call.

This patch updates the mevent API and the caller as well.

Tracked-On: #1877
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-07 20:21:33 +08:00
Xiaoguang Wu 9d4b5d7e1b DM USB: add some preparing time for xHCI emulation before resuming.
If the USB kernel drives and devices of SOS are not available and
functional ready after UOS is resumed from frozen state, the comming
USB command from UOS will cause a disaster because the DM has no
resourse to to emulation.

This patch add a dynamic time span (could change according to number
of native USB devices attached) to give USB drivers and devices of
SOS an opportunity to be ready.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 19:59:00 +08:00
Xiaoguang Wu b159d66fb3 DM USB: refine the polling thread for libusb events
The thread function usb_dev_sys_thread is the source of libusb events,
which is also the basis of USB/xHCI emulation. During S3 process,
function libusb_handle_events_timeout may fail and return -1, which
could result of exit of the thread (BTW, this failure is resulted from
USB native reseting behavior during S3). Under this situation, the emulation
of USB/xHCI could never continue.

This patch fix this issue by continuing to call libusb_handle_events_timeout
even it reture -1. The return value will be finally ok after S3 process is
completed.

This patch will continue poll after failure and hence fix this issue.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 19:59:00 +08:00
Xiaoguang Wu 966c587260 DM USB: xHCI: fix potential NULL pointer issue.
During S3 process, the dev in the function pci_xhci_device_doorbell
may be set to NULL when disconnection is detected by DM. This patch
is used to remove this risk.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 19:59:00 +08:00
Xiaoguang Wu 5b39fd0ed3 DM USB: xHCI: fix error logic of allocating xHCI slot
The 'slot_allocated[]' field of pci_xhci_vdev is used as flag of
slot allocation. In current design, this variable is not set to
false in disconnection callback 'pci_xhci_native_usb_dev_disconn_cb'.
This patch is used to fix it.

Tracked-On: #1894
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 19:59:00 +08:00
Xiaoguang Wu 32c4ce9b9a DM USB: xHCI: refine the xHCI S3 process
In the old implementation, function vm_get_suspend_mode is used
as the interface to check whether the UOS is in the S3, That is
not saft way.

This patch use Port Link State (PLS) to substitute the old logic.
According to xHCI spec 5.4.8, the PLS should be U3 during the
UOS is in the S3 state.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 19:59:00 +08:00
Xiaoguang Wu 9e471d7258 DM USB: xHCI: refine the PLC bit emulation logic during S3
According to xHCI 5.4.8, the Port Link State Change (PLC) bit
should not be set to 1 during suspend process. This patch is used
to fix it.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 19:59:00 +08:00
Xiaoguang Wu 29e81501c5 DM USB: xHCI: refine error handling logic for ctrl transfer
Under current implementation, when USB control transfer failed
with Endpoint Stall error, there is no response reporting to UOS.
This logic will result of timeout in UOS kernel and hence a longer
enumeration process.

This patch reports the Stall Error to UOS by xHCI Completion Event,
which will fix this issue.

Tracked-On: #1895
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 19:59:00 +08:00
Jie Deng b261e74dd5 dm: virtio poll mode support for RT
Device trap has great impact on latency of real time (RT) tasks.
This patch provide a virtio poll mode to avoid trap.

According to the virtio spec, backend devices can declare the
notification is not needed so that frontend will never trap.
This means the backends make commitment to the frontends they have a
poll mechanism which don’t need any frontends notification.

This patch uses a periodic timer to give backends pseudo notifications
so that drive them processing data in their virtqueues. People should
choose a appropriate notification peroid interval to use this poll
mode. Too big interval may cause virtqueue processing latency while
too small interval may cause high SOS CPU usage. The suggested interval
is between 100us to 1ms.

The poll mode is not enabled by default and traditional trap
notification mode will be used. To use poll mode for RT with interval
1ms. You can add following acrn-dm parameter.

	--virtio_poll 1000000

Tracked-On: #1956
Signed-off-by: Jie Deng <jie.deng@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-04 18:27:53 +08:00
Libin Yang 7f08ad8375 use 4 vqs
Signed-off-by: Libin Yang <libin.yang@intel.com>
Tracked-On: #1915
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-03 10:35:38 +08:00
Zhu Yingjiang 333629682a change the vq count and vendor id
Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Tracked-On: #1915
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-03 10:35:38 +08:00
Junjie Mao 97eb72a4a0 doc: always use 'None' for functions not returning a value
It is preferred to state the absence of a return value explicitly in the
doxygen-stile comments. Currently there are different styles of doing this,
including:

  @return None
  @return NULL
  @return void
  @return N/A

This patch unifies the above with `@return None`.

Tracked-On: #1595
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2018-11-30 14:55:17 +08:00
Zheng, Kankan cbe1b74eee HDCP virtio back-end driver
Initial HDCP back-end driver.

Signed-off-by: Romli, Khairul Anuar <khairul.anuar.romli@intel.com>
2018-11-30 14:45:24 +08:00
Yu Shiqiang fa012e6987 CoreU virtio back-end driver
v4 -> v5
    Replace strcpy with strncpy
    Refine resource free if error happens
    Remove meaningless *in_progress* label for pthread wait/signal
    Rename the coreu thread routine name (virtio_coreu_thread)

v3 -> v4
    Move setsocketopt to connect_to_daemon
    Cleanup coreu file descriptor after close
    Reconnect CoreU daemon if the socket descriptor is invalid

v2 -> v3
    Move the daemon connection to vdev_init
    Diagram the CoreU virtualization architecture
    Create a seperate thread for sending and receving the CoreU message
    Change the socket name

v1 -> v2
    No change

v1
    Initial CoreU back-end driver

Signed-off-by: Yu Shiqiang <shiqiang.yu@intel.com>
2018-11-30 14:45:24 +08:00
Qi Yadong 839680f09b DM: build TPM2 ACPI table when TPM device enabled
Add TPM2 ACPI table build function.

If virtual tpm device is initialized successfully, then create
corresponding TPM2 ACPI table.

Tracked-On: #1924
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
Qi Yadong aae70db6b9 DM: Add support for virtual TPM enabling
Support TPM enable option when launch UOS.

New option: "--vtpm sock_path=$PATH_OF_SWTPM_SOCKET".
If valid option parsed, then init virtual tpm device.

Tracked-On: #1924
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
Qi Yadong 7df90a2527 DM: Support TPM2 CRB device virtualization
Full virtualized TPM CRB device.

The TPM CRB module will handle TPM2 MMIO access. It will forward
the command/data to TPM emulator for command processing if there
is a valid TPM command.

Tracked-On: #1924
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
Qi Yadong 4b83e37c7a DM: tpm emulator to communicate with swtpm
This patch will create control channel and command channel
so as to communicate with swtpm. Based on the 2 channels,
a set of APIs will be implemented and exposed.

Tracked-On: #1924
Signed-off-by: Deng Wei <wei.a.deng@intel.com>
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
Yuan Liu d043171de5 IOC mediator: Add VehicalSteeringWheelAngle signal to the whitelist
The signal is used to get camera right and left values.

Tracked-On: #1886
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-23 14:59:07 +08:00
Tomas Winkler 580579a392 dm: mei: Use compare and swap primitive for refcnt.
Simple atomic add/dec do no guarantee reference count full
synchronization without a lock. Compare and swap operations
are required for correct implementation.

Tracked-On: #1875
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-23 14:13:14 +08:00
Alexander Usyskin 378afc5093 dm: mei: fix clients scan in sysfs
Fix the prefix comparison, we need to compare on prefix length, not
on devpath len, otherwise we always fail.

Tracked-On: #1848
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-21 15:17:05 +08:00
Alexander Usyskin 7bd2976f9c dm: mei: add zero termination to devpath
Reset directory name to receive clean prints.

Tracked-On: #1847
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-21 15:17:05 +08:00
Tomas Winkler 87fbb7003d dm: mei: fix double fw_reset on uos reboot
Edge triggered mevent on sysfs file is triggered
immediately after mevent_add(), hence this has to be ignored.
The issue that is resolved that the 'first' flag was
global and wasn't reset on each mevent_add().

Tracked-On: #1846
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-21 15:17:05 +08:00
Alexander Usyskin 844553ef23 dm: mei: check for state before link reset callback
Prevent intercepting reset callback if reset state
transition is already in progress.

Tracked-On: #1846
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-21 15:17:05 +08:00
yuhong.tao@intel.com c4161c8784 dm: uart: fix UOS console output to stdin
At devicemodel/hw/uart_core.c, struct ttyfd has only one file
descriptor for uart backend device, that is OK if DM uart open
a tty characteor device under /dev/ for reading, writing and
terminal operating.

When use stdio as backend tty device, there are 2 fds, stdin/stdout.
DM should read from 'stdin' and output to 'stdout'. But ttyfd just
has one fd, and is only for 'stdin', so dm has to output to stdin,
too, not to stdout.

That cause a problem: if use stdio for uart backend, you can't
redirect UOS console to any other files. Because stdout is not used.

We hope to store information from VM console to system journal,
when UOS is launched by Acrnd automatically. The systemd need to
redirect stdout of dm to system journal files, but it can't be done.

So we can split the 'fd' of struct ttyfd to 'fd_in' & 'fd_out'.
they are same when use tty device; And they are different when use
stdio, 'fd_in' is for stdin and 'fd_out' is for stdout.

Tracked-On: #1759
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-11-08 15:14:15 +08:00
Zhi Jin 36aaaa1cfd DM NPK: unmap the MMIO in pci_npk_deinit
Otherwise, after UOS crashes, the PTE for the MMIO may be added
again.

Tracked-On: #1745
Signed-off-by: Zhi Jin <zhi.jin@intel.com>
2018-11-08 09:06:17 +08:00
Yuan Liu 65a2613ab6 IOC mediator: fix wakeup reason issue when UOS resuming
IOC mediator should keep sending acnrd boot reason until received
UOS heartbeat init message, then turn to send SOS wakeup reason
through read native cbc lifecycle cdev.

Tracked-On: #1727
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-06 16:18:35 +08:00
Shuo Liu d261b4bce2 doc: update virtio related functions doc comments
Update some virtio, VBS-K, vhost APIs documents.

Tracked-On: #1595
Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
2018-11-04 20:32:50 -08:00
Jian Jun Chen 94dadc1d14 dm: virtio-input: ignore MSC_TIMESTAMP from guest
(EV_MSC, MSC_TIMESTAMP) is added to each frame just before the
SYN event since kernel 4.15. EV_MSC is configured as
INPUT_PASS_TO_ALL. In the use case of virtio-input, there is
a loop as follows:
- A mt frame with (EV_MSC, MSC_TIMESTAMP) is passed to FE.
- FE will call virtinput_status to pass (EV_MSC, MSC_TIMESTAMP)
  back to BE.
- BE writes this event to evdev. Because (EV_MSC, MSC_TIMESTAMP)
  is configured as INPUT_PASS_TO_ALL, it will be written into
  the event buffer of evdev then be read out by BE without
  SYN followed.
- Each mt frame will introduce one (EV_MSC, MSC_TIMESTAMP).
  Later the frame becomes larger and larger...

This patch fixed above issue by ignoring MSC_TIMESTAMP from guest.
Besides that timestamp is added for every status event from guest
before writing to evdev.

Tracked-On: #1670
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-02 13:42:43 +08:00
Aviad Nissel 9ba75c55a7 dm: mei: fix firmware reset race.
The FW reset is currently detected from two points upon
a read failure from native read and from the reset
handler.
The fix removes the detection from the mevent rx callback,
leaving a single detection point.
To prevent reset hiccup, hw_ready is not set if a full rescan is
performed, it will be set only when virtio FW will request the FW reset.

Tracked-On: #1632
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
2018-10-31 09:43:45 +08:00
Alexander Usyskin 5f41d4a8d3 dm: mei: check return value of vmei_host_client_to_vmei()
vmei_host_client_to_vmei() may return NULL we need to check
for the return value.

Tracked-On: #1630
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
2018-10-31 09:43:45 +08:00
Tomas Winkler b4fbef4659 dm: mei: destroy mutex attribute on error path
Simplify the flow by adding mutex_type variable
and call pthread_mutexattr_destroy() on the error path.

Tracked-On: #1630
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
2018-10-31 09:43:45 +08:00
Alexander Usyskin 8abc931791 dm: mei: set addresses in the hbm disconnect reply
MEI HBM the disconnect replay doesn't have the address set,
breaking the protocol, fix the issue.

Tracked-On: #1570
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2018-10-31 09:43:45 +08:00
Xiaoguang Wu a0ace7254d DM USB: xHCI: fix process logic of TRB which has zero data length
Accoring to xHCI spec, there are some TRBs with zero data length
which used to pass command to xHCI. In the DM, those TRBs should
not be sent to native device through libusb. The logic in the
current implentation fails to process some corner cases, this
patch is used to fix it.

Tracked-On: #1639
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-31 09:08:53 +08:00
Yonghua Huang b686b562f4 DM: wrap ASSERT/DEASSERT IRQ line with Set/Clear IRQ line
- remove ASSERT & DEASSET IRQ line IOCTLs
 - remove PULSE IRQ line IOCTLs, use set/clear
   IRQ line instead.
 - Use IC_SET_IRQLINE to set or clear IRQ line

Tracked-On: #861
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-10-29 09:26:23 +08:00
Jian Jun Chen e12f88b8c7 dm: virtio-console: remove unused virtio_console_cfgwrite
Virtio-console device specific configuration is readonly, callback
for the cfgwrite is not required. This patch removed the unused
virtio_console_cfgwrite.

Tracked-On: #1364
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-27 22:28:04 +08:00
Conghui Chen 3010718d4a dm: cmdline: remove unused parameters
Remove unused parameters for acrn-dm

Tracked-On: #1616
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-10-26 13:37:47 +08:00
Xiaoguang Wu 4261ca223e DM USB: xHCI: refine logic of Disable Slot Command
Remove the changing operation for 'xdev->native_ports[].state' in
pci_xhci_cmd_disable_slot. The operation should not be done in this
funciton.

Tracked-On: #1589
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-26 13:36:50 +08:00
Xiaoguang Wu e1e0d3047e DM USB: xHCI: refine the USB disconnect logic in DM
On certain SOC, during the system suspend and resume process, connecting
and disconnecting events may happen. In previous implementation, DM didn't
clear PED bit in the xHCI PORTSC register, this will induce many invalid
polling operations in UOS and fail to enumerate one or more USB devices.

Tracked-On: #1589
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-26 13:36:50 +08:00
Xiaoguang Wu f799e8fa1c DM USB: xHCI: fix process logic of LINK type TRB
When the LINK type TRB are received, it should not be counted as
valid date block to give libusb. This patch is used to fix it.

Tracked-On: #1567
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-10-26 13:36:50 +08:00