Commit Graph

366 Commits

Author SHA1 Message Date
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
Yonghua Huang e8d5a497f3 refine external interrupt VM exit handler
- According to Intel SDM 24.9.2,Vol3, should check the
  validity of "VM-exit interruption information" before
  extracting the vector of interrupt.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-15 17:25:58 +08:00
Yonghua Huang 121d14a616 rename 'req_buf' field in 'struct vm_sw_info'
- rename it to 'io_shared_page' to keep consistent
   with ACRN HDL foils.

 - update related code that reference this data structure.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-15 17:25:58 +08:00
Geoffroy Van Cutsem bf0d79b69d Make the Service OS bootloader configurable
This patch makes the Service OS bootloader configurable by passing
a command-line argument to 'acrn.efi' when setting up the EFI
bootloader using, e.g., 'efibootmgr'. If no argument is passed, the
default bootloader used is: "\EFI\org.clearlinux\bootloaderx64.efi".
This is the default bootloader/setting used by Clearlinux and is set
in the bsp/uefi/include/bsp/bsp_cfg.h file (via the
CONFIG_UEFI_OS_LOADER_NAME define)

The general format of the argument is: "bootloader=<\path\to\bootloader>".

As a concrete example, imagine the following set-up:
* You have installed the Service OS (bare-metal for now)
* Bootloader is "\EFI\org.clearlinux\bootloaderx64.efi"
* Boot device is '/dev/sda'
* EFI System Partition (ESP) is '1'
* You put the ACRN hypervisor under "\EFI\acrn\"
To change the default boot entry to boot the ACRN hypervisor, enter:
   # efibootmgr -c -l "\EFI\acrn\acrn.efi" -d /dev/sda -p 1 \
      -L "ACRN Hypervisor" -u "bootloader=\EFI\org.clearlinux\bootloaderx64.efi"
And reboot your machine.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-15 17:25:58 +08:00
David B. Kinder 7dd647672c doc: GSG formating fix, RTD theme tweak
Fix some formatting problems with a recent GSG update.  Tweak the
custom CSS to adjust code block (and code literal) colors.  Update
Makefile to document doc build options for pulling source from the other
repos and for publishing targets.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:25:58 +08:00
Geoffroy Van Cutsem c3b1d0c436 Getting Started Guide: update to reflect the new boot flow
The boot process has changed a bit and the ACRN hypervisor is now
directly loaded by the platform EFI firmware. This commit reflects
those changes and also reference a newer version of Clearlinux that
includes the ACRN hypervisor that has these changes in.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:25:58 +08:00
Yonghua Huang 85716e8b01 security: fix issues reported by Klocwork
- NULL pointer reference risk
 - buffer overflow risk

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-15 17:25:57 +08:00
Li, Fei1 b61e6af228 hv: cpuid: don't reference the crossed array
We should consider the boundary condition although we didn't
access it.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-05-15 17:25:57 +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
Yan, Like ccc67ceae4 hv: add build type and detail time to version string
- Add "DBG" or "REL" to indicate the DBG build or REL build explicityly;
- Change the build time format to "%F %T".

Example:
HV version 0.1-rc4-2018-04-28 14:20:32-b2d7282-dirty DBG build by like

Change-Id: Ib410064b0a6603e3c90f30dffa722237c07fc069
Signed-off-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@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
Victor Sun 55bced400e HV cleanup: assert on vm setup cpu px
Make assert on max px cnt of boot cpu data, since it shouldn't happen if
px data is properly initialized in boot process.

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 765805da21 HV cleanup: move iobitmap ini out of loop
The initial of iobitmap pointer should be moved out of loop since address
is sequentially incremented.

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 c2c1932a65 HV Cx: add cx data of bxt j3455 SOC
This is cx data for APL NUC.

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 8b29ce1991 HV Cx: allow guest to access host idle port
with this patch guest could access idle io port and enter idle normally.

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 ebf184f038 HV Cx: add hypercall function to retrieve host cx
The patch add function in vhm hypercall to retrieve physical cx data
to VHM/DM.

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 1c3b7a629a HV Cx: load cx data while create VM
Each VM would have its own Cx data, for now we copy it from boot_cpu_info.

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 373a828058 HV Cx: load cx data to boot_cpu_data when boot
The cx data is hardcoded within HV, load it to boot_cpu_data when HV boot.
The patch provide a3960 soc cx data for example.

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
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
Jason Chen CJ c0d4b90415 ptdev: change remapping entry from virtual to physical based
currently, pass-thru devices are managed by per-vm's remapping entries
which is virtual based:
- MSI entry is identified by virt_bdf+msix_index
- INTx entry is identified by virt_pin+vpin_src
it works but it's not a good design for physical resource management, for
example a physical IOAPIC pin could belong to different vm's INTx entries,
the Device Model then must make sure there is no resource conflict from
application's level.

This patch change the design from virtual to physical based:
- MSI entry is identified by phys_bdf+msix_index
- INTx entry is identified by phys_pin
The physical resource is directly managed in hypervisor, a miss adding
entry will be found by hypervisor and return error message with failure.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Xu, Anthony <anthony.xu@intel.com>
2018-05-15 17:25:57 +08:00
Zide Chen a39509a8fe HV: fixed the issue of AP initialization code can't be loaded to address high than 64K
Signed-off-by: Zheng, Gen <gen.zheng@intel.com>
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
2018-05-15 17:25:57 +08:00
yechunliang 1cd06ba303 efi: clean RuntimeServices code
efi runtime service table unused

Signed-off-by: Chris Ye <yechunliangcn@163.com>
2018-05-15 17:25:57 +08:00
David B. Kinder e35874cae1 doc: introduce howto area for technical notes
Tech note articles about technology and process tips now have a place in
the ACRN documentaion.

Move the doc process documention into this new area, and add a
placeholder for tech tips for now.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:25:57 +08:00
David B. Kinder e0a45e8c0f doc: fix doc build processing
Some assumptioins about the doc build process were removed to make it
easier for contributors to build local version of the docs.  Assumption
now is that acrn-hypervisor and acrn-devicemodel content is up to date
rather than pulling from upstream on every build.

make pullsource    will do an upstream pull manually
make html          generates local docs

Also fixed broken link in the README.md file (moved the tech doc root)

Signed-off-by: David B. Kinder <david.b.kinder@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
Li, Fei1 ac253f8c60 hv: timer: add periodic timer setup support
and add MIN_TIMER_PERIOD_US for limit periodic timer frequency.
Now it's set to 500 us.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-05-15 17:25:56 +08:00
Li, Fei1 9bfa574a27 hv: timer: restruct add_timer/del_timer API
add initialize_timer to initialize or reset a timer;
add_timer add timer to corresponding physical cpu timer list.
del_timer delete timer from corresponding physical cpu timer list.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-05-15 17:25:56 +08:00
Li, Fei1 be9f4ee9e6 hv: timer: pass timer callback function parameter by pointer
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Li, Fei1 dace32eca1 hv: timer: add calibrate tsc hz by cpuid 0x15
Get tsc hz by cpuid 0x15 if we supported, otherwise
calibrate tsc by pit timer.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Li, Fei1 cfc87903b2 hv: cpuid: add cpuid_level
Get maximum input value for basic cpuid information.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Li, Fei1 ab97963088 hv: lib: add max()/min() API
Add max()/min() lib API

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Li, Fei1 7f4332f539 hv: timer: rename cpu/cpu_id to pcpu_id
timer is physical cpu related.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong>
2018-05-15 17:25:56 +08:00
Li, Fei1 d129659ecd hv: timer: remove statistics for timer
Since there no dump related API.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Yin Fengwei 0287ac4a99 hv: Not to destroy ept of trusty memory if it's not initialized.
If guest reboot is issued before trusty init hypercall is issued,
we shouldn't destroy ept fo trusty memory because the ept is not
created yet.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-05-15 17:25:56 +08:00
Minggui Cao f8a26a69e9 remove deadcode of vm1 config in vm_description
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@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
Zheng, Gen 529ccd7944 UEFI: bug fix on redundant waking up APs
Due to redundant waking up APs When rebooting UOS, the crash occurs
and fail to reboot UOS.

Signed-off-by: Zheng, Gen <gen.zheng@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 17:25:56 +08:00
Zheng, Gen 1c57adc8b3 hv: bug fix on synchronizing with APs
Using eax will truncate the high 32bit part of 64bit virtual address.
And the type of sync is unsigned long, so using rbx instead of ebx.

Signed-off-by: Zheng, Gen <gen.zheng@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
2018-05-15 17:25:56 +08:00
Zhao Yakui b37c049ef4 HV: Use mmio_read/write_long for IOAPIC mmio-access
This is to do the clean-up of IOAPIC mmio-access. Use the same API to
access the IOAPIC register. At the same time it also helps to avoid the
optimization in direct access mode.(The volatile is already added in
mmio_read_long/mmio_write_long)

V1->V2: Follow Fengwei's suggestion to use the mmio_read/write_long

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by:  Yin Fengwei <fengwei.yin@intel.com>
2018-05-15 17:25:56 +08:00
Zhao Yakui ec13f4e1f2 HV:Remove the "immediate" constraint for inline assembly in bits operation
The input operand for inline assembly is passed from the caller. And they
are not the immediate type. Instead the register should be used.
This also helps to reduce the compile error if the optimizatin is enabled.

Signed-off-by: Zhao Yakui<yakui.zhao@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
Li, Fei1 1b1f723c7b hv: add hardware_detect_support to detect which hardware we support
Now just add some basic feature/capability detect (not all). Vapic
didn't add here for if we must support vapic then the code which
for vapic not supported must remove, like mmio apic r/w.

Signed-off-by: Li, Fei1 <fei1.li@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