Commit Graph

303 Commits

Author SHA1 Message Date
Yuan Liu a5760e07d3 IOC mediator: add check_dir function to avoid symbol link failure
To avoid PTY device symbol link failure due to non-exist directory passed from
parameter. Add check_dir function to check the directory and create it if not
exist.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-01 16:40:19 +08:00
Yuan Liu d904202cfb IOC mediator: Set default boot wakeup reason for IOC mediator
Set default boot wakeup reason to avoid acrn-dm boot failed with
invalid acrn-dm boot parameter.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-01 16:40:19 +08:00
David B. Kinder 04323a0663 doc: fix doxygen comments in virtio.h
Fixes a recent PR #311 that added a new API but the doxygen comments for
one of the parameters didn't match the parameter name.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-01 13:16:58 +08:00
Geoffroy Van Cutsem c396c5361c Update Travis CI files to account for new build dependencies
* Add Fedora 28 and Ubuntu 18.04 Dockerfile
* Add new build dependencies (for the ACRN tools)
* Change default Fedora version to 28

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-01 13:16:06 +08:00
David B. Kinder f4122d99c5 license: Replace license text with SPDX tag
Replace the BSD-3-Clause boiler plate license text with an SPDX tag.

Fixes: #189

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-01 10:43:06 +08:00
Fei Jiang 4a1f922242 Revert "DM sample: update sos/uos boot arg to let UOS see two displays"
This reverts commit 5b1c536eee.
For normal case, we connected two HDMI monitors, one for SOS, another for UOS.
Previously UOS has problem when only see one display, it was the bug of
user space driver, then to work around this issue, submit temp patch to let
UOS see two displays.
From latest info, after switch to use github latest user spce driver in stable
branch, such problem was resolved. Then we need revert previous workaround
patch, otherwise, UOS will show on both HDMI1 and HDMI2.
2018-06-01 10:25:56 +08:00
Long Liu c11a162993 DM: virtio-heci: Add enum type status variable represent devices status
In virtio_heci struct there have deiniting/pending_reset/resetting
variables. All these variables represent the status of virtio heci devices.
Change them into one enum type variable for vheci status.

Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-01 10:25:20 +08:00
Edwin Zhai dcb8a75dee DM: Turn on WIFI/BT passthrough for Android UOS
This patch turn on WIFI/BT in launch_UOS.sh based on WIFI BDF on SBL,
which is different from ABL. Still need WIFI/BT driver in Android to
make WIFI/BT passthrough work.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-06-01 10:21:29 +08:00
Huang, Yang 8838c94d5b DM: Fix a potential null-pointer dereference
Signed-off-by: Huang Yang <yang.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-31 16:19:39 +08:00
Edwin Zhai 3d7aa346b8 DM: Disable audio NHLT table by default
NHLT table is used by some audio driver for topology data, but current
default audio driver doens't depend on it. Disable it by default due
to possible boot failure with different SOS firmware.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 16:15:43 +08:00
Yuan Liu 247c5eeb22 IOC mediator: Send open channel command to activate CBC signal channel by default
To send open channel command after opening CBC signal channel successfully.
For the latest IOC firmware, the IOC mediator needs to send open channel command
to activate CBC signal channel. Otherwise, there will be no any signal data will
be received.

The open channel command is forward compatible that it would not impact for
older IOC firmware.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 15:31:59 +08:00
Kaige Fu 39cce18de7 DM: Remove dead code wrapped by #if 0
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 15:27:10 +08:00
Liang Yang 72104468f2 DM USB: xHCI: support xHCI parameter option for extended capabilities.
This patch implements scalable xHCI parameter for extended capabilities.
For future supported platform, user can be easy to specify their
platform to emulate corresponding xHCI capabilities.

The new usage:
-s <n>,xhci,[bus1-port1,bus2-port2]:[tablet]:[log=x]:[cap=x]
The old usage:
-s <n>,xhci,[bus1-port1,bus2-port2]:[tablet]:[log=x]

Change-Id: Ie8ba056d57cac9446bcf3f39b342c7ac22245c61
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 11:26:38 +08:00
YanLiang 0679a81972 DM USB: xHCI: Support APL extended capability for DRD.
This patch implements Intel ApolloLake xHCI extended capabilities. It
includes two dual role switch registers for switching shared
USB2&USB3 phys between xHCI and xDCI.

Change-Id: I2533537d8a4224da3cf9b2e7475aab9f65347a4a
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 11:26:38 +08:00
YanLiang 1687765371 DM USB: xHCI: add write function for extended capability registers.
Some xHCI extended capabilities are writable. This patch adds the
writing function for excap.

Change-Id: Ie8b144b47ffa261f97d0461bf97b0c4d312a9333
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 11:26:38 +08:00
YanLiang c91590ccfd DM USB: xHCI: refine xHCI extended capability related functions.
Every platform should have their own xHCI specific extended
capabilities, but the current xHCI DM is not scalable for them. This
patch refines related logic to make it scalable.

Current code only support 4 registers(4*32) as basic extended
capabilites. Base on this new implementation, the mmio range from
excapoff to regsend will cover real excap size according to the cap
parameter.

Change-Id: Ic55a4494e090ec255939cdb8f32950e3c8a66082
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 11:26:38 +08:00
yuhong.tao@intel.com 9af35baf5a DM:monitor: add monitor_register_vm_ops()
monitor_vm_ops and its helpers is added to allow DM to register operations
, so thant vm manager could trigger the power state changes of VM.

Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Wang, Yu <yu1.wang@intel.com>
signed-off-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-05-31 11:25:47 +08:00
yuhong.tao@intel.com eada59c934 DM: adapt dm-monitor and acrnctl to use the helpers
Adapt dm-monitor and acrnctl to use the helper functions and new message
definitions in acrn_mngr.h.
These jobs must be done in one commit to avoid build problems:
1. message transmission and callback registration code are moved
 to libacrn-mngr.a, so old functions in dm-monitor could be removed to
 make code clean;
2. remove unnecessary monior_msg.h;
3. minor changes to acrnctl accordingly.

Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Wang, Yu <yu1.wang@intel.com>
signed-off-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-05-31 11:25:47 +08:00
Jian Jun Chen c001911e19 dm: virtio: support virtio 1.0 PCI configuration access capability
The VIRTIO_PCI_CAP_PCI_CFG capability creates an alternative access
method to the common configuration, notification, ISR and device-
specific configuration regions.

To access a device region, the driver writes into the capability
structure (ie. within the PCI configuration space) as follows:

- The driver sets the BAR to access by writing to cap.bar
- The driver sets the size of the access by writing 1, 2 or 4 to
  cap.length
- The driver sets the offset within the BAR by writing to cap.offset

At that point, pci_cfg_data will provide a window of size cap.length
into the given cap.bar at offset cap.offset.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 11:25:15 +08:00
Jian Jun Chen b25a30f271 dm: add default handling in pci_emul_capwrite
Virtio 1.0 introduced several PCIY_VENDOR capabilities. When trying to
write to these capabilities no action is taken so the registers in
the capability of VIRTIO_PCI_CAP_PCI_CFG such as bar, offset and length
remain the default value 0. Later a read or write of pci_cfg_data needs
these information to perform the indirect read or write to the bar
region.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 11:25:15 +08:00
Jian Jun Chen f0729cd91d dm: add pci_emul_find_capability
pci_emul_find_capability can be used to get the offset of a PCI
capability in PCI configuration space.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-31 11:25:15 +08:00
Jack Ren f2b524385a version: v0.1-rc5
Signed-off-by: Jack Ren <jack.ren@intel.com>
2018-05-31 07:30:24 +08:00
Huang, Yang 7003e50e4e DM: Refactor RPMB files
Move rpmb_sim.c and rpmb_backend.c to hw/platform/rpmb/

Signed-off-by: Huang Yang <yang.huang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-30 13:51:03 +08:00
Huang, Yang 113ece2854 DM: Enable full 4MB access
A simulated rpmbfile requires to enable 4MB access by writing
the last byte.
Otherwise, the read operation should be failed if no write
was operated on the address greater than the read address.
Writing the last byte during file creating ensures the whole
4MB address is readable.

Signed-off-by: Huang Yang <yang.huang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-30 13:51:03 +08:00
Huang, Yang dc566ab3ac DM: refine vRPMB logs
Remove unused logs and correct spelling

Signed-off-by: Huang Yang <yang.huang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-30 13:51:03 +08:00
Huang, Yang c7d1460dfb DM: Fix potential overflow and return value issues
Fix by a fixed string length and correcting return value

Signed-off-by: Huang Yang <yang.huang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-30 13:51:03 +08:00
Fei Jiang 5b1c536eee DM sample: update sos/uos boot arg to let Android UOS see two displays
Android HWC has problem when only see one display, then this is
workaround patch to make Android HDMI2 display normal.

V2: only change AaaG UOS kernel boot arg

Signed-off-by: Fei Jiang <fei.jiang@intel.com>
2018-05-29 16:53:22 +08:00
Junjie Mao ef3cb5ba1c treewide: remove unnecessary unnamed structs/unions
According to the syntax defined in C99, each struct/union field must have an
identifier. This patch removes unnamed struct/union fields that can be easily
expressed in a C99-compatible way.

Here is a summary of structs/unions removed.

struct vhm_request:

    union {
        uint32_t type;                  uint32_t type;
        int32_t reserved0[16];    =>    int32_t reserved0[15];
    };

struct vhm_request_buffer:

    struct vhm_request_buffer {
        union {                         union vhm_request_buffer {
            struct vhm_request ...; =>        struct vhm_request ...;
            int8_t reserved[4096];            int8_t reserved[4096];
        }                               }
    }

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-29 14:12:15 +08:00
Edwin Zhai 4b4e1e1c59 DM: Add option of no check against ptdev reset
With '--ptdev_no_reset', DM doen not abort but warn when assign PCIe
dev without reset capability.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-29 13:44:13 +08:00
Edwin Zhai b19d936356 DM: refuse passthrough PCIe without reset support
Check reset method for PCIe dev according to 'reset' in sysfs, which
indicates reset capability, like FLR and secondary bus reset. PCIe dev
without reset capability is refused for passthrough to avoid failure
after UOS reboot.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-29 13:44:13 +08:00
Huang, Yang c3793e19ed DM sample: update uos launch script for virtio rpmb
Added virtio-rpmb for launch android

Signed-off-by: weideng <wei.a.deng@intel.com>
Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:50 +08:00
Wu, Xiaoguang 9f56364cad DM USB: xHCI: add log level switch
Support log level options, which could change the related log level
without code change.

The new usage:
  -s <n>,xhci,[bus1-port1,bus2-port2]:[tablet]:[log=x]
  eg: -s 8,xhci,1-2,2-2:log=D
  eg: -s 7,xhci,tablet
  eg: -s 7,xhci,1-2,2-2:tablet

Note: please follow the board hardware design, assign the ports
according to the receptacle connection

Change-Id: I44639c7b076d21a40eb8f7b99cea8decc5c13c0c
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang be4406c8d9 DM USB: xHCI: modify option parsing function to enable USB virtualiztion
Re-write the xHCI option parse function to support port mapper.

The new usage:
  -s <n>,xhci,[bus1-port1,bus2-port2]:[tablet]
  eg: -s 8,xhci,1-2,2-2
  eg: -s 7,xhci,tablet
  eg: -s 7,xhci,1-2,2-2:tablet

Note: please follow the board hardware design, assign the ports
according to the receptacle connection

Change-Id: I3c8392f7e15580cf768c8c4a619d705411da699d
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 6449950ccc DM USB: xHCI: add xHCI de-initialization support
add support for xHCI de-initialization when the guest
dose shutdown or reboot.

Change-Id: I3dfc1ed1a905b455ef455dff2065e872aa5c1ef8
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 048b2c76a3 DM USB: xHCI: add port sharing feature
add support for xHCI port sharing feature, which enable the ability
to assign different native ports to different multi-UOSes. For
example:
1-2,1-2 assigned to UOS-1.
1-1,2-1 assigned to UOS-2.

Change-Id: I899070f7a8a6eb23179e41e7b1f1da24c52482b2
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 8aef2cb34b DM USB: Add some APIs for check native related configurations.
New USB APIs:
usb_native_is_bus_existed/usb_native_is_port_existed: Check if specific
usb bus or port are valid or not.
usb_native_is_ss_port: Check if the specific port is supper speed usb port.

Change-Id: I9ab54f6e81742321128d6abd5845ef966f0e9f37
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 0181d19a61 DM USB: xHCI: support USB hot plug out.
Implements the disconnect callback of libusb which will be called once
USB device plug out.

Change-Id: Ic5f072f08a92270e6e5836b49e5066da783af243
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 7687a3d0d7 DM USB: xHCI: support bulk and interrupt transfer for port mapper
Support USB mouse, USB keyboard and USB flash drive by enabling the
USB bulk and interrupt transfer for port mapper.

Change-Id: Ia202729e0cfb26fb44a6b278cf4306f2b0b6fa36
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 3b6392740e DM USB: xHCI: DM USB: xHCI: Support port change event for hot connection
This patch implements the port change event related function, it
triggered when USB device be hot plugged in.

Change-Id: I065c1e93779f85f8ee6031960e129b59146e1bb7
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang caf4916e99 DM USB: xHCI: Support control transfer for USB port mapper.
This patch implements the control transfer for port mapper. With this
patch, USB2.0 device can be enumerated successfully in user OS.

Change-Id: I567bd00ca310d68375acd94a5cc5bcd287665df1
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang b12527f35d DM USB: add libusb error conversion function
Add a function to covert libusb error to the common USB core
error type.

Change-Id: Icb03fae2acdc914b3d32a5942faf7d79793a4bee
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 2d1fb7e480 DM USB: move the UREQ macro into common header
move the UREQ macro from usb_mouse.c to usb.h

Change-Id: I977cf73291610b0448eb031a500788a397b55f88
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 17d4e9a995 DM USB: xHCI: implement connect callbacks for USB port mapper
Allocate an emulated USB instance in connect callback function. This
instance is the entity of virtual USB device which will be enumerated
by the UOS.

Change-Id: I948d2ce9eca7e9d5bbab673f2505efc0a03c03b4
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang aa0480f44e DM USB: extend the API for struct usb_devemu
For the purpose of USB port mapper, change struct usb_devemu to
common interface between HCD layer and USB device layer.

Besides, implements ue_init/ue_deinit/ue_info for port mapper.

Change-Id: Id4b7345c7b321b9bdab58139c61169d9229cb6f8
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 1816d3e608 DM USB: introduce data structure and APIs for USB port mapper
Introduce the struct usb_dev which is used to abstract the physical USB
devices. And APIs for external call are also provided.

Change-Id: Ia25d52a6c670040da787f82b3bea34eee9f3d04d
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 51f7633f82 DM USB: involve the libusb
This patch involves the libusb to communicate with the SOS USB kernel
stack, and the README.rst is also updated for this purpose.

The libusb is under GNU Lesser General Public License version 2.1.

Change-Id: Ieecd08f41993162115e8e588980b81b769c89a37
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Wu, Xiaoguang 8f3f66bae5 DM USB: enable log level feature for USB subsystem
Change the DPRINTF macro to UPRINTF for USB subsystem. The
UPRINTF will print log according to certain log level.

Change-Id: I5db8813357c9f684c25f23650e7c914f9063f842
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-29 10:35:05 +08:00
Yonghua Huang 71975d63fd DM: using 'strncpy' coding style cleanup
- check buffer boundaries to avoid buffer overflow

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-25 15:36:25 +08:00
Liu Yuan 0b7af5b6e1 IOC mediator: Implement state transfer operations
This patch implements INIT, ACTIVE, SUSPENDING and SUSPENDED operations of
IOC mediator lifecycle virtualization.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-25 15:34:44 +08:00
Liu Yuan 11208dd6d5 IOC mediator: Implement state transfer framework
Implements state transfer framework to support IOC lifecycle virtualization.
Four states will be involved in this framework includes INIT, ACTIVE,SUSPENDING and
SUSPENDED.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-25 15:34:44 +08:00
Liu Yuan 92da8f4954 IOC mediator: Separate wakeup reason and heartbeat
Separate wakeup reason and hearbeat functions from lifecycle processing since
lifecycle virtualization only contains wakeup reason and heartbeat, the other
functions of lifecycle like boot selector, are not handled by IOC mediator.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-25 15:34:44 +08:00
Huang, Yang 8db85ecb25 DM: RPMB virtualization
Full logic to supprot vRPMB:
1. Automatic switch between physical or simulated RPMB.
   But hardcode to use simulated one.
2. Parse RPMB cmd to basic APIs to:
   2.1 check request frame HMAC with uos vkey
   2.2 replace RPMB frame with real values.
3. RPMB partitioning for multiple UOS.
   It's hardcoded for coming config file support.

Signed-off-by: Huang Yang <yang.huang@intel.com>
Signed-off-by: Du Min <minx.du@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-05-25 10:45:24 +08:00
Huang, Yang e6d57f439f DM: Add simulated RPMB support
Create file as simulated RPMB storage for pre-production usage.
Add RPMB APIs to emulate behavior of physical RPMB controllor.

Signed-off-by: Huang Yang <yang.huang@intel.com>
Signed-off-by: Du Min <minx.du@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-05-25 10:45:24 +08:00
Qi Yadong 76d2441378 DM: Generate vRPMB key when creating UOS
Generate virtual RPMB key and pass it to HV when
creating UOS.

Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-05-25 10:45:24 +08:00
yingbinx b6bec540f7 VRPMB-BE: add RPMB protocol
This patch implements RPMB protocol into vRPMB backend
VBS-U. It will handle RPMB request from VRPMB FE.

Signed-off-by: weideng <wei.a.deng@intel.com>
Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-05-25 10:45:24 +08:00
yingbinx 6c4ebe3f26 VRPMB-BE: create virtio rpmb backend VBS-U
This patch implements virtio rpmb backend VBS-U component,
it includes the basic module interface with DM. This
component will work with vRPMB FE driver together to
provide one communication channel between UOS and SOS.

Signed-off-by: weideng <wei.a.deng@intel.com>
Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
Acked-by: Zhu Bing <bing.zhu@intel.com>
2018-05-25 10:45:24 +08:00
Yonghua Huang fc93c649d5 DM: validate port range explicitly in inout.c
- check the port address range explicitly
  to avoid buffer overflow.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-25 09:46:15 +08:00
Jiang, Fei 95c289b15f DM: Change boot_args to assign one plane of pipe B and pipe C to SOS
After i915.avail_planes_per_pipe(0x0000F) is added to SOS, it will cause
that the pipe B/C is initialized without plane. In such case this pipe
can't be used by UOS, with error: primary plane disabled.
The bootarg is changed so that the pipe B/C on SOS can be initialized with
at least one plane.

Signed-off-by: Jiang Fei <fei.jiang@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2018-05-24 21:48:47 +08:00
Miguel Bernal Marin 9563e248b7 samples: move samples to specifi platform diretory
Move the platform apl-mrb samples to devicemodel samples directory.
Add the install target to the missing samples files and re-organize the
samples directory structure to have nuc and apl-mrb samples.

Suggested-by: Arzhan Kinzhalin <arzhan.i.kinzhalin@intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
2018-05-24 19:34:49 +08:00
Yonghua Huang 3df0fbfefb DM: bugfix - use of freed memory in 'monitor_close()'
-memory was dereferenced after being freed:
   MACRO 'LIST_FOREACH()' dereference
  'client' for next list node after 'client'
   was freed.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-24 11:13:26 +08:00
Fei Jiang 4c0181a5db DM/GVT: implement emulated graphics pci device
Enable graphics virtualization GVT-g

Signed-off-by: Fei Jiang <fei.jiang@intel.com>
Reviewed-by: He, Min <min.he@intel.com>
2018-05-23 13:11:28 +08:00
Yonghua Huang 160df8433a DM: fix buffer overflow risk issues in hugetlb.c
Add buffer boundaries to avoid overflow

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-23 11:10:10 +08:00
Yonghua Huang cd07c2c9a4 DM: initialize 'create_vm' before reference it in 'vm_open'
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-23 11:09:34 +08:00
Yonghua Huang eb943e7b13 DM:fix the possible buffer overflow issue using 'strncpy'
function 'strncpy' may incorrectly check buffer boundaries
and may overflow buffers.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-22 17:17:26 +08:00
Yonghua Huang 4ed6d92226 DM:fix suspicious dereference of pointer in 'pci_emul_deinit()
suspicious dereference of pointer 'fi->fi_devi'
  by passing it to function 'pci_emul_free_bars()'
  before  NULL check.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-22 17:16:49 +08:00
Yonghua Huang f58fe33687 DM: avoid NULL pointer dereferenced in 'ioc_parse()'
Pointer 'tmp' may be NULL before passing it to 'strtoul()'

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-22 16:37:06 +08:00
Jie Deng 130f45e9cf Revert "dm: free entries in pci_businfo[] when deinit"
This commit is reported to cause UOS reboot fail becasue the
pci_businfo[] only be allocated when calling pci_parse_slot
in dm initialization while UOS reboot will not allocate again.
So we can't free it here.

This reverts commit 7aaff68798.

Signed-off-by: Jie Deng <jie.deng@intel.com>
2018-05-22 11:38:33 +08:00
Yonghua Huang 9e61accbed DM: add spanning devices check for i/o access
- i/o access whose handler is not registered should
  not be allowed.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-18 15:01:35 +08:00
Edwin Zhai 30549a59c7 DM: increase vioapic pin count
Current only 8 vioapic pins for pci irq (total 24 with 16 reserved),
which easily leads virtual GSI sharing with more and more passthrough
devices. This patch doulbes vioapic pin count and adds reboot hooks to
allocate from same pin after each reboot.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Anthony Xu <anthony.xu@intel.com>
2018-05-16 15:09:48 +08:00
Geoffroy Van Cutsem 3efef5790c Remove duplicate license file
Remove 'license_header' files that were located in hypervisor/ and
devicemodel/ and used by the respective Makefiles to build the
'include/version.h' header file.

Both Makefiles were adjusted to use the top-level LICENSE file

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-16 13:22:17 +08:00
Jie Deng 7aaff68798 dm: free entries in pci_businfo[] when deinit
Entries of pci_businfo[] allocated in function "pci_parse_slot"
using calloc need to be freed when deinit.

Signed-off-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Anthony Xu <anthony.xu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 18:03:34 +08:00
Yan, Like 867e56d04b Move ACRN tools code directory one level higher
The tools directory is moved out of ./devicemodle, to be in parallel with
hypervisor, devicemodel and doc.

Signed-off-by: Yan, Like <like.yan@intel.com>
2018-05-15 18:03:33 +08:00
Jack Ren 60c07fba51 add .gitignore
Signed-off-by: Jack Ren <jack.ren@intel.com>
2018-05-15 17:41:53 +08:00
Yu Wang 8c06b69622 dm: Reorganize ACRN DM directory.
The current dm, all non-pci and non-acpi related files are put into
hw/platform directory. This is actually disturbed the meaning of
*platform*. The platform devices are mean of board and SoC specific
non-PCI devices, like usb devices, etc.

This patch refines the ACRN dm directory architecture.

For some common device logic files, likes block_if.c/uart_core.c or
usb_core.c. They will move to hw/ directly.

For platform architecture depended files, create arch/ under root dir.
And create sub-dir arch/x86 for x86 architecture, will create more
architectures in future. The pm.c will move to this new dir.

The hw/acpi will be moved to hw/platform/acpi due to acpi also be
considered as part of platform.

Signed-off-by: Yu Wang <yu1.wang@intel.com>
2018-05-15 17:25:58 +08:00
Victor Sun 4817134297 DM: rename acrn_register to acpi_generic_address
The name of acrn_register is too generic, rename to acpi_generic_address
which is more common.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:58 +08:00
Zheng, Gen e386a814ae DM: bug fix in handling signal
With curren code, DM will ignore the SIGHUP signal generated from
SOS reboot that causes DM will not release resource when SOS reboot
occurs.

Signed-off-by: Zheng, Gen <gen.zheng@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-05-15 17:25:58 +08:00
Long Liu 2550d719d3 Subject: DM: virtio-heci: process all available client each time
Right now, the virtio_heci_proc_rx only process the first
available client at a time, then clear rx_need_sched flag to make
rx_thread sleep. It cause the remain data available clients lost the
current change to be processed. This patch resolves this issue, to
process all data available clients in a round prior to push rx_thread
enter sleep.

Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Long Liu 5ed3dbf93c Subject: DM: virtio-heci: Use atomic_xchange in client get/put
With rare probability, the two threads may try to get&put client
together. For client getting, the subsequent thread will get one
destroyed client. For client putting, it will cause acrn-dm get crashed
due to assert be triggered in virtio_heci_client_put.

Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Conghui Chen df2d925a27 DM: move boot device option 'b' just after emul
The original code assume there is only one configuration for
virtio-blk, and 'b' is just located after that configuration,
so to get the value of 'b', it will end char *config by adding
'\0' after the first configuration.

Thus, char *config will change from:
  /XXXX_vdisk_file,range=xxx/xxx
to:
  /XXXX_vdisk_file
and char *b will point to:
  range=xxx/xxx
So, the range will never take effect for virtio-blk.

Now, 'b' is designed to located just after emul, and
char *config will point to all configurations after 'b'.

Note: only ",b," is taken for boot device option.

Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Jian Jun Chen 919aa3d374 dm: virtio-input: implement virtio_input_deinit
All related resources are freed in virtio_input_deinit.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Jian Jun Chen 181ff20bcb dm: virtio-input: implement virtio_input_get_config
The implementation of virtio_input_get_config is based on ioctl of
evdev fd. The following properties of input device are got by ioctl
to service configuation request from FE driver:
- name and devids
- propbit
- evbit: keybit/relbit/absbit/mscbit/swbit
- absbit

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Jian Jun Chen 772a43ac50 dm: virtio-input: implement input event tx/rx
Input events are read from host evdev fd and cached into a local queue.
When SYN_REPORT is read, the cached input events are sent to guest via
EVENT virtqueue. Guest input events are read from STATUS virtqueue then
written to host evdev fd.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Jian Jun Chen 25fe5634d3 dm: virtio-input: implement callbacks of virtio_input_ops
This patch implements the callbacks required by virtio_input_ops:
reset/cfgread/cfgwrite/apply_features/set_status.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Jian Jun Chen 9741e1ab2c dm: virtio-input: implement virtio_input_init
The following are done in virtio_input_init:
- parse the command line to get the path of host evdev
- parse the command line to get the optional serial string
- calloc struct virtio_input and initialize it
- call virtio framework APIs to initialize virtio PCI

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Jian Jun Chen 8123483ae1 dm: virtio-input: add virtio-input data structures
This patch adds the data structures and macros used to implement
virtio-input.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:58 +08:00
Victor Sun 3fc5ebcd50 DM Cx: build DSDT with cx data
With this patch, UOS would be capable of guest Cx controling.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:57 +08:00
Victor Sun 5e7e816981 DM Cx: add function to write Cx data to DSDT
The function would write CST objects which needed to enable Cx control
to UOS DSDT table.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:57 +08:00
Victor Sun a042538565 DM Cx: add function to get cx cnt and cx data
DM will use these functions to get cx entry cnt and cx data then inject
_CST objects to UOS DSDT table.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:57 +08:00
Victor Sun bdd90e6597 DM Cx: code cleanup for getting cpu state cnt
Then we could use a common interface to get cx count.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:57 +08:00
Yin Fengwei 81cf3e19f8 DM: main loop cleanup
Move all virtual devices init/deinit to function to simplify the
failure path of main loop. In the future, new virtual device will
not touch main loop.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-15 17:25:57 +08:00
Yin Fengwei edc584611a DM: ioc code cleanup
- make ioc_init/ioc_deinit take struct vmctx as argument
- ioc_init return int instead of pointer to struct ioc_dev
- add ioc_dev in vmctx to track ioc_dev
- remove the atkbdc.h included in vmmapi.h

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Liu, Yuan1 <yuan1.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-15 17:25:57 +08:00
Yin Fengwei 4fcdebc434 DM: vrtc code cleanup
- Move the variable local_time from main.c to rtc.c
- Change vrtc_init to return int instead of pointer to vrtc. We do
  track vrtc in struct vmctx.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:57 +08:00
Icarus Sparry 7073173ec3 Use exit instead of assert when checking images
Print an error message and exit rather than using assert, so it is
more obvious what the problem is and no core files are produced.

Fixes #61

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2018-05-15 17:25:57 +08:00
Jie Deng d63b9002dd dm: code clean up
Following functions have never been used anywhere.
Let's remove them.

fbsdrun_muxed()
fbsdrun_vmexit_on_hlt()
fbsdrun_vmexit_on_pause()
fbsdrun_disable_x2apic()

Remove weird prefix "fbsdrun" from following functions' name.

fbsdrun_virtio_msix()  -->  virtio_uses_msix()
fbsdrun_start_thread() -->  start_thread()

Signed-off-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:57 +08:00
Jie Deng d1a17a6401 dm: rename fbsdrun_addcpu and fbsdrun_deletecpu
Remove weird prefix "fbsdrun" from the function name.
Since "fbsdrun_addcpu" has never been called by external
functions, Let's remove its declaration from "dm.h" and
make it as a static function to keep consistency with
"fbsdrun_deletecpu".

Signed-off-by: Jie Deng <jie.deng@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:57 +08:00
yuhong.tao@intel.com 15e15c9a86 Bugfix: DM:tools:acrnctl launch script output is binary file
The launch script can output log messages, that should be text.
But it is not always true. E.g. "launch_UOS.sh -U 2" echo message
contain '\0', The 'grep' command will show "Binary file (xxxxxx)
matches", thus acrnctl can't get the vmname. We can use 'grep -a'
instead.

Acked-by: Xu Anthony <anthony.xu@intel.com>
Reviewed-by: Yan Like <like.yan@intel.com>
Reported-by: Chen ChengX <chengx.chen@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-05-15 17:25:56 +08:00
Yin Fengwei d2945e757e DM: fix virtio_net tx_thread block issue
If guest doesn't initialize the net device, the tx thread will
block at the first tx_cond wait. When virtio_net_tx_stop is
invoked, the tx_thread will block on second tx_cond then.

Check whether we should exit tx_thread after first tx_cond
waiting

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Liu Yuan cb41210104 IOC mediator: update signal whitelist
Add AmbientTemperature signal into the whitelist,
instead of TemperatureSensorEnvironment signal.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Liu Yuan 10c3a98577 IOC mediator: update signal whitelist
Remove some useless signals from the whitelist and add new three signals into
the whitelist based on requirement.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Edwin Zhai 3648a0cd6f VTd: bluetooth passthrough support
Adds ACPI tables for 0:18.0(UART) device

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:56 +08:00
Jason Chen CJ 4f6bdee0c5 DM: change VM_SYSMEM/VM_MMIO to VM_MEMMAP_SYSMEM/VM_MEMMAP_MMIO
these MACROs are only for MEMMAP

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-05-15 17:25:56 +08:00
Jason Chen CJ 25ef14edac hugetlb: add ept map memseg support
adding API vm_map_memseg_vma() which using ioctl IC_SET_MEMSEG call
into VHM for futher mem(ept) mapping, based on user vma information.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Xu, Anthony <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Jason Chen CJ 4cad694be2 dm: add hugetlb memory management support
Type '-T' in DM cmdline to enable hugetlb memory allocation.
It enabled 2 level of huge page:
Level 1: size 2M, path: /run/hugepage/acrn/huge_lv1/guid
Level 2: size 1G, path: /run/hugepage/acrn/huge_lv2/guid

NOTE:
before running, please make sure system already have enough hugepages
reserved under:
/sys/kernel/mm/hugepages/hugepages-xxxxkB/nr_hugepages

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Xu, Anthony <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Minggui Cao fdfb71e075 delete watchdog timer when deinit is called
to avoid system resource/memory leaked when guest os reboot.

Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:55 +08:00
Jian Jun Chen a3316241d4 dm: virtio-console: Fix the bug that ports cannot work
If multiple ports are defined in the command line, is_console is
not set to a correct value for non-console ports when the definition
of this non-console port is following the definition of a console port.
For example in below definition, the second port is configured as
console port which is not correct:

-s 5,virtio-console,@pty:pty_port,file:file_port=/home/root/test1

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Yin Fengwei 96085d960f DM: release mem range allocated in init_pci
Two memory ranges are allocated:
  - PCI ECFG
  - PCI hole
They should be released when deinit_pci. Old code mark
this two ranges not unregistered. Which is wrong for
warm reboot case. Make them could be unregistered.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Yin Fengwei 097aee76bf DM: release mevent when doing virtual device deinit
When doing warm reboot, the mevent module will not be deinitialized.
We need to delete all mevent registered while deinit virutal device.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Yin Fengwei e65b98bf36 DM: lpc_deinit doesn't release all resources allocated.
Also refine the failure path of lpc_init to make sure all
resources allocated get release.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Yin Fengwei 1a2a07476b DM: cleanup resource for uart.
Add deinit function for uart.
Another work is add resource cleanup functions which is called
by other components when they are using uart.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Yin Fengwei c8585a22e3 DM: add deinit function for bvmcons
Move the bvmcons enable flag from main.c to consport.c.
So we don't need the flag in main.c for bvmcons.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:55 +08:00
Liu Yuan 5b06d17fb1 IOC mediator: boot IOC device from the main entry
Add "-i" in the DM boot command line for booting IOC mediator.

NOTE: currently only ioc_init will be called in the main entry, ioc_deinit
hasn't be called so far. The DM plans to add one virtual devices list inside
of struct vmctx in the near furture, and virtual devices data structure will
add one common deinit callbacks which will be called during VM exits.

Will support ioc_deinit once that patch merged.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan fd5472b421 IOC mediator: DEBUG: add dummy channels
Add three PTY devices as dummy native channels. They are used for emulating
native lifecycle channel, native signal channel and native OEM raw channel
for IOC debugging.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan 75b5e670d5 IOC mediator: DEBUG: support IOC log file
This patch is used for IOC mediator debugging. Due to IOC message logs are
too much, need to save into one file instead of output stdout directly.
By default, the debug log is disabled.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan 746d437642 IOC mediator: support IOC signal whitelist
This patch implements the signal whitelist feature.
All the signal messages will be discarded if they are not existed in whitelist.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan 76e74b0cf8 IOC mediator: support CBC signal services
This patch implements the IOC CBC signal serivces including single signal,
multi-signal and group signal. All of them are used for CAN devices
communication and IOC on-board peripherals control.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan 61db2c78cc IOC mediator: support IOC lifecycle
This patch implements the IOC lifecycle virtualization.

In native environment, lifecycle is uesed for SoC system power control,
likes enter/exit S3/S5. So these related messages can not forward directly
between physical IOC and Guest OS, they need to be mapped to VM pause, exit
and launch.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan a1d7cae148 IOC mediator: IOC signal and group definitions
This patch adds the IOC signal identities and signal group identities,
that will be used by subsequent signal support patches.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan 4eff8d10a1 IOC mediator: implement CBC protocol stack
Carrier Board Communication(CBC) protocol is a duplex protocol for IOC data
transfer, including physical layer, link layer, address layer and service layer.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan c9d7643462 IOC mediator: add IOC channel operations
IOC mediator communicates with native IOC HW through several native channels of
CBC protocol. And IOC mediator communicates with virtual UART through one virtual
channel.

This patch implements channel operations including open/close/read/write.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan cfa6481bc9 IOC mediator: initialize IOC mediator
IOC mediator main functionality is transfer data between native CBC char
devices and virtual UART, it is implemented as full virtualization, Guest
OS can reuse native CBC driver directly.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Liu Yuan 45758be573 IOC mediator: add IOC mediator definition
Add Automotive IOC mediator data structure definitions.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:54 +08:00
Jack Ren f3db18b981 version: v0.1-rc4
Signed-off-by: Jack Ren <jack.ren@intel.com>
2018-05-15 17:25:50 +08:00
Yin Fengwei c6bf67543c DM: mevent_add/del refine for Linux
Unlike kqueue/kevent of BSD, the epoll of Linux could be
add/del by using different API on the fly.

This patch drops the notify used by mevent_add/del and
call epoll_ctl to add/delete target fd. Only keeps
global_head to track mevent added and makes the code
logic in mevent_dispatch() a littel bit simpler.

Another thing is related with epoll_ctl. If the target
fd is regular fd which doesn't support epoll, epoll_ctl
will return -1. When DM is start by systemd, the STDIO
is not mapped to terminal, epoll_ctl on STDIO could
return -1. Which block UOS boot. We only call mevent_add
after confirm STDIO is mapped to terminal.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:27 +08:00
Yin Fengwei db46df940e DM: add init/deinit function for mevent
Current, mevent cleanup path has issue. There are possible
following calling sequence happen when reboot/poweroff UOS:
 1. mevent_dispatch() calls mevent_destroy
 2. do_close_post calls some virtual device deinit to delete
    mevent.

This patch introduce mevent init/deinit to make sure:
 1. mevent init
 2. mevent_add is called when init virtual device
 3. mevent_del is called when deinit virtual device
 4. mevent deinit

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:27 +08:00
Yin Fengwei d3a640da92 DM: add add_e820_entry to update e820 table.
For vSBL boot path, we need to mark the memory vSBL is using
as reserved in e820 table. The add_e820_entry is added to
update the e820 table dynamically.

To simplify the code logic, we assume:
  - vSBL is put the middle of one entry of default e820 table
  - That entry has orignal RAM type in e820 table
  - The e820 table has enough space to hold two more new entries.

If there is more complicated case in the future, we could extend
add_e820_entry to handle it.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:26 +08:00
Yin Fengwei 223efeb986 DM: Update the default e820 table to reserve 0xF0000~0x100000
The region of MPtable/ACPI table/SMBios resides in
0xF0000 ~ 0x100000. They should be marked as RESERVED instead of
RAM type in e820 table.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:26 +08:00
Liu Shuo ee43f23b0e dm: release host memory after devices de-init
Devices' de-init process might access some mapped memory space, such as
virtio virtqueues. Access after unmap will cause a fault.

Release the memory map after de-init processes can avoid it. Reading
more code, there are many error handling lost to unmap the memory.
Refined the code to do it.

Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:26 +08:00
Yin Fengwei cee499f867 DM: fix build issue with gcc 4.8.4 on ubuntu 14.04
There are two build issues:
- add -fno-strict-aliasing to address
  error: dereferencing type-punned pointer will break strict-aliasing rules

- initialize tfd to zero to address
  error: ‘tfd’ may be used uninitialized in this function

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-05-15 17:25:26 +08:00
Qi Yadong e86b01f57e Revert "Fix compilation on Ubuntu 14.04"
This reverts commit bc0579d0ff.

The commit bc0579d makes acrn-dm crashed when launch UOS.
Crash log:
./launch_UOS.sh: line 112:   377 Segmentation fault (core dumped) acrn-dm ...
dmesg log:
acrn-dm[1264]: segfault at 1f0 ip 0000000000412257 sp 00007fffc1af9920 error 6 in acrn-dm[400000+3d000]

After this patch reverted, UOS launched successfully.
2018-05-15 17:25:26 +08:00
Liu Shuo c5b14c2646 DM: use standard offsetof to avoid duplicate definition
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:26 +08:00
Liu Shuo d9545abefb virtio-heci: disconnect client when message buffer overflowed
Firmware need to disconnect the client connection when host's message
overlow the receive buffer in firmware. We emulate this behavior in
backend service.

Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Li Hao <hao.l.li@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:26 +08:00
Liu Shuo 33e84efef9 virtio-heci: Add firmware reset handling
Now, we treat a read/write ENODEV error as a firmware reset. When MEI
reset happens in driver, we need disconnect all active clients and
restart HBM flow.

Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Li Hao <hao.l.li@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:26 +08:00
Liu Shuo 37cae5884d virtio-heci: Add HBM handler for backend service
HECI Bus Message is important for HECI clients communication. They use
HBM for connect, disconnect, get property and so on. In backend service,
we need do some emulation for HBM as we are running on top of native
MEI driver.

Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Li Hao <hao.l.li@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:26 +08:00
Liu Shuo 12b9299ff6 virtio-heci: Introduce TX and RX threads for data transfer
Backend service access the native HECI driver through MEI driver
interface in service OS. Some MEI clients need to be multiplexed,
the backend service will engage necessary service at clients filter.

TX thread is for passing data from guest to host MEI driver, then to
native hardware. RX thread is for passing data from native hardware to
guest.

Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Li Hao <hao.l.li@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:26 +08:00
Liu Shuo 418c266bfc virtio-heci: Add ME client mapping in backend service
ME client mapping is for tracking ME clients operations between frontend
driver and backend service. It contains buffers for send/recv packing
and forwarding.

Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Li Hao <hao.l.li@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:26 +08:00
Liu Shuo 23c3fbd485 virtio-heci: Backend service for HECI virtualization
This patch implement HECI virtualization backend service based on virtio
userspace framework. This service introduce a virtio-heci device model
for DM, and can be enabled by DM parameter '-s [BUS NO],virtio-heci'.

The HECI virtualization need both backend service in device-model and
frontend driver in guest to work. Backend service mainly emulates HECI
device's behaviors to satisfy frontend driver. They are based on virtio
userspace framework. Currently, it is using two virtqueues, one is for
TX and another is for RX.

Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Li Hao <hao.l.li@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:26 +08:00
Geoffroy Van Cutsem 473f222dce Add 'findutils' to Fedora-based Docker images
The 'find' command was not installed in our minimal Fedora 26
and 27-based Docker images. This resulted in a non-fatal error
when performing a 'make clean'. This commit adds this utility
(available in the 'findutils' package).

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-15 17:25:26 +08:00
Geoffroy Van Cutsem da1c860e8c Fix compilation on Ubuntu 14.04
A couple of problems appeared on Ubuntu 14.04 (gcc 4.8.4) when we
turned on additional compiler flags with commit
519c4285cf104a594776591075ee1c6ee4d61815a. This patch fixes these
problems by adhering to the strict anti-aliasing rules and also
initializing the 'tfd' variable where the compile believed it
_could_ be used uninitialized.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2018-05-15 17:25:26 +08:00
Mingqiang Chi 4f6c451278 dm: sync common header file to DM
sync acrn_common.h to device model
set secure world enabled flag

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:26 +08:00
yechunliang 2e2f02edeb replace malloc with calloc
malloc: allocate a block of memory, the contents of the block are undefined.
calloc: allocate a block of memory for an array of num elements and initializes all its bits to zero.

Signed-off-by: yechunliang <yechunliangcn@163.com>
2018-05-15 17:25:26 +08:00
Victor Sun e078ce7aae DM: hotfix for loop initial declaration in acpi_pm
for (int i = 0; i < ...; i++) is only allowed in C99 mode, so fix this
coding style to:

int i;
for (i = 0; i < ...; i++)

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:25 +08:00
Victor Sun a91118e3e8 DM: build UOS DSDT with vcpu px state data
With the DSDT which include virtual _PSS/_PCT/_PPC objects, UOS should
have ACPI Px control capability if acpi cpufreq driver is enalbed in
kernel.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:25 +08:00
Victor Sun e96fe060bc DM: add vmctx as write dsdt func ptr parameter
Some ACPI objects is per-vm and per-cpu specific so we need to pass
vmctx as function parameter when we write objects into DSDT table.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:25 +08:00
Victor Sun b50fcc022f DM: add function to write Px objects to UOS DSDT
There are 3 ACPI objects for Px: _PCT, _PPC and _PSS need to be writed
to DSDT, and the _PSS data is per-cpu specific so we need to pass the
vm id and vcpu id as parameter.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:25 +08:00
Victor Sun ea662e6d49 DM: add function of get px count and data
The px count and data is per-cpu so we should query them for specific
vm and specific vcpu, for px data we need to specify px num also.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:25 +08:00
Victor Sun 263bdf6cf2 DM: add vmm interface to get px data
The interface will be used to interact with VHM service via IOCTL.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
2018-05-15 17:25:25 +08:00
Tao, Yuhong 4e5029383d DM:tools: add acrnctl tool
The acrnctl can help user to create, delete, launch and stop UOSs,
To see what it can do, just run:
	# acrnctl
or
	# acrnctl help
you may see:
	support:
        	list
        	start
        	stop
        	del
		add
	Use acrnctl [cmd] help for details
There are examples:
(1) add a VM
    Each time you can just add one VM. Suppose you have an UOS
    launch script, such as launch_UOS.sh
    you can run:
	# acrnctl add launch_UOS.sh -U 1
	vm1-14:59:30 added
    Note that, launch script shoud be able to launch ONE UOS. If
    it fail, it is better to print some error logs, to tell user
    the reason, so that he knows how to solve it.
    The vmname is important, the acrnctl searchs VMs by their
    names. so duplicated VM names are not allowed. Beside, if the
    launch script changes VM name at launch time, acrnctl will
    not recgonize it.
(2) delete VMs
	# acrnctl del vm1-14:59:30
(3) show VMs
	# acrnctl list
	vm1-14:59:30            untracked
	vm-yocto            	stop
	vm-android		stop
(4) start VM
    you can start a vm with 'stop' status, each time can start
    one VM.
	# acrnctl start vm-yocto
(5) stop VM
    you can stop VMs, if their status is not 'stop'
	# acrnctl stop vm-yocto vm1-14:59:30 vm-android

Acked-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-05-15 17:25:25 +08:00
Tao, Yuhong 498e8c0543 monitor: an interface of acrn-dm
A monitor component will be added to acrn-dm, which crteats socket,
bind and listening at /run/acrn/vmname. Acrnctl & acrnd could conn
-ect to the socket for communication, using defined message, in
include/monitor_msg.h
For each defined message, a message handler callback could be
registered via monitor_add_msg_handler(). On received of a defined
message, a certain call back will be called. Each callback can only
see the message sender's socket-fd.
When acrn-dm want report something, not triggered by incoming message
it can send broadcast message, use monitor_broadcast().

Acked-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Yin, Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-05-15 17:25:25 +08:00
Geoffroy Van Cutsem 1ef6bba51e Enable Travis CI testing
Enable Travis CI testing for the following development host OSs:
* Clearlinux
* Ubuntu 16.04
* Fedora 26

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-15 17:25:25 +08:00
Yin Fengwei eadc921bf0 DM: refine cleanup functionality of virtual RTC
The patch includes:
1. vrtc_cleanup -> vrtc_deinit to align with other devices
2. delete timer created in vrtc_init
3. make call to vrtc_deinit in cleanup path

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-15 17:25:24 +08:00