Commit Graph

647 Commits

Author SHA1 Message Date
Long Liu 6865210493 ACRN: dm: Modify runC default rootfs directory
The patch changes runC container's default rootfs directory. In the patch
change the rootfs to runC bundle's parent directory. Because in ACRN we map
SOS rootfs to container so the rootfs is an empty directory, after move it to
parent directory all the container can share the same rootfs.

Tracked-On: #2020
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 20:24:22 +08:00
Long Liu 55cb777000 ACRN: dm: Add new capabilities for runC container
The patch adds more Linux capabilities for runC container. In ACRN runC
we will map native root directory to the container, when we launch UOS from
container it need more Linux capabilities to operate dev node. So add the
capabilities in runC configuration file.

Tracked-On: #2020
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 20:24:22 +08:00
Long Liu 5690b7626f ACRN: dm: Change runC container's start arguments
Change the default runC container start application to sh which will be
modified by launch_uos.sh during UOS boot. And the replacement is the
parameter set by "acrnctl add" command.

Tracked-On: #2020
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
2019-02-25 20:24:22 +08:00
Long Liu 6e919d2afe ACRN: dm: Add launch container method in script
This patch implements acrn-dm QoS. When the script be launched with "-C"
parameter, the acrn-dm will be executed in container for isolating the
resouce of service OS.

The QoS parameter is described in
/usr/share/acrn/samples/apl-mrb/runC.json, users can modify it following
their performance requirements.

Tracked-On: #2020
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
2019-02-25 20:24:22 +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
Yuan Liu 8e8ed07dd7 dm: implement power button for power managerment
Listen to power button state via /dev/input/event0. When the power
button is pressed, then set PWRBTN_STS bit. If PWRBTN_EN is set, the
sci interrupt is triggered.

For suspend or shutdown of UOS by power button, needs UOS to configure
the default behavior of the power button.

Tracked-On: #2560
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-02-21 11:48:02 +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
Min He 4b53ed677c script: remove enable_initial_modeset for UP2 platform
For UP2 releases, we don't need enable_initial_modeset, just as the NUC
platforms, so remove this parameter from the boot args.

Tracked-On: #2516
Signed-off-by: Min He <min.he@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
2019-02-13 12:52:24 +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
Xie, nanlin 2a25f4e9fc Doc: Remove CL release number from GSG document
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2019-01-30 15:16:56 +08:00
Yan, Like 878c4e2ddc dm: add example script to launch vm for realtime scenarios
This example script launch a VM with lapic passthrough for realtime scenarios.

Tracked-On: #2351
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-28 19:47:33 +08:00
Yan, Like c873d60ae2 dm: add option "lapic_pt" to create VM for realtime scenarios
New option "--lapic_pt" added to create VM with local apic passthrough, for
realtime scenarios.
When the option is set, a VM is created with LAPIC_PASSTHROUGH.
The option is not set by default.

Tracked-On: #2351
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-28 19:47:33 +08:00
Yan, Like 8925da64d9 dm: adapt mptable generation for VM with lapic pt
- don't generate io apic entry for vm with lapic pt.

Tracked-On: #2351
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-28 19:47:33 +08:00
Ross Burton 5ba4afcffe Use $(MAKE) when recursing
Using 'make' directly means that the jobserver environment variables don't get
passed down, so sub-builds for example don't use -j.

This is documented as the wrong thing to do:
https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html#MAKE-Variable

Use $(MAKE) instead, and compile times drastically improve:

  acrn-devicemodel    do_compile   -13.5s   -89.6%      15.0s -> 1.6s

Tracked-On: #2370
Signed-off-by: Ross Burton <ross.burton@intel.com>
2019-01-24 08:22:32 +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
Peter Fang 0f7535fdbe dm: add absolute timer mode
Allow specifying the initial expiration in absolute time.

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 d1e1aa3077 dm: create mevent's pipe in non-blocking mode
It was designed to be used in non-blocking mode to prevent the mevent
thread from blocking itself indefinitely, but it was created in
blocking mode.

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
Victor Sun 49e6deaf26 HV: rename the term of vm0 to sos vm
Under sharing mode, VM0 is identical with SOS VM. But the coupling of
SOS VM and VM 0 is not friendly for partition mode.

This patch is a pure term change of vm0 to sos VM, it does not change
any code logic or senmantic.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Tw fe35dde421 Makefile: support SBL binary for E2E build
Currently, we support SBL on two different boards.
So build and install them all in E2E build.

Tracked-On: #2344
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-18 11:22:15 +08:00
Zhao Yakui 13c44f5661 acrn/dm: Check device file of /dev/acrn_hsm to determine the path of offline VCPU
For the upstream purpose the device file of /dev/acrn_vhm is renamed
to /dev/acrn_hsm. Correspondingly the path of offline CPU is also changed.
So the device file of /dev/acrn_hsm is checked to configure the path
of ooffline VCPU.

Tracked-On: projectacrn/acrn-hypervisor#2356
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2019-01-18 11:04:22 +08:00
Zhao Yakui ca32881666 acrn/dm: Add the check of acrn_vhm/acrn_hsm to open the VHM driver
Currently VHM driver is opened by using the device file of /dev/acrn_vhm.
But for the upstream purpose it is renamed to /dev/acrn_hsm.
So we need to check that the device file is acrn_vhm or acrn_hsm and then
open the VHM driver.

Tracked-On: projectacrn/acrn-hypervisor#2356
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2019-01-18 11:04:22 +08:00
wenlingz 34b4294334 Doc: Update GSG for v0.5 version and launch and acrn.conf sample script
modify sbl_up2 version and scripts
2019-01-16 16:28:26 +08:00
Feng Tang ed9b533747 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: #2330
Signed-off-by: Feng Tang <feng.tang@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-14 16:19:59 +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
Min He e3b33a9871 script: remove DP-x:d parameters for UP2 board
There's a DP port on UP2 board, so we cannot add video=DP-x:d paramter,
otherwise, DP monitors will not be able to be detected on UP2 boards.

Tracked-On: #2268
Signed-off-by: Min He <min.he@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-10 10:08:56 +08:00
Shuang Zheng 79f40a569b Update and complete `acrn-dm` parameters description
Update and complete `acrn-dm` parameters description in the user guide and HLD

Tracked-On: #2036
Signed-off-by: Shuang Zheng shuang.zheng@intel.com
2019-01-09 16:19:35 -08:00
Zhao Yakui d094a39a7f 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-09 19:20:10 +08:00
Tw d2b03e8c33 dm:script: remove ioc related stuff from uos on UP2
UP2 don't have ioc, there is no need to simulate it.

Tracked-On: #1995
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-08 11:26:27 +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
Shuang Zheng 04d9f52f68 update acrn-dm comment, remove the series of dot
Tracked-On: #2036
Signed-off-by: Shuang Zheng shuang.zheng@intel.com
2019-01-02 13:19:31 +08:00
Peter Fang 40f6a9fdff dm: allow PM1_RTC_EN to be written to PM1A
Clear Linux complains about not being able to write the bit to PM1A:

ACPI Error: Could not enable RealTimeClock event (20180531/evxfevnt-184)

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
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
Tw 90fd5d5894 script: fix launch_uos script issue due to unseen character
Tracked-On: #1995
Space is tampered with unseen characters.
Reviewed-by: Binbin Wu <binbin.wu@intel.com>

Signed-off-by: Tw <wei.tan@intel.com>
2018-12-28 14:54:38 +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
Tw e5c12a64d5 Makefile: add install-samples-up2
Add a rule to add UP2 related samples in rootfs.

Tracked-On: #1995
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2018-12-26 16:19:59 +08:00