Commit Graph

56 Commits

Author SHA1 Message Date
Rusty Lynch
504d1f9d28 Fix compiler warnings when building for UEFI
Signed-off-by: Rusty Lynch <rusty.lynch@intel.com>
2018-03-28 09:28:24 +08:00
Jason Chen CJ
11dad7732a debug: make ASSERT empty under release version
ASSERT is only for debug purpose, for release version, it should try
error handling instead of deadloop there.

v1:
- change the ASSERT under release version to empty code

TODO: revise all ASSERT usage

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong (Eddie.dong@intel.com)
2018-03-26 16:40:20 +08:00
Li, Fei1
0dd30044b3 cpuid restruct
Generate all common virtual cpuid entries for flexible support of
guest VCPUID emulation, by decoupling from PCPUID.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Xu, Anthony <anthony.xu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Chen, Jason CJ <jason.cj.chen@intel.com>
2018-03-23 13:41:35 -07:00
T
75b9a27d93 Update .travis.yml 2018-03-23 10:10:57 +00:00
T
aa88742c82 Update .travis.yml 2018-03-23 10:10:57 +00:00
T
209271749f Create .travis.yml
Initial commit. Will be refined
2018-03-23 10:10:57 +00:00
Yin Fengwei
fb612904bf hv: microcode: Enable microcode update from SOS.
microcode update from UOS is disabled.
microcode version checking is available for both SOS and UOS.

There are two TODOs of this patch:
1. This patch only update the uCode on pCPUs SOS owned. For the
   pCPUs not owned by SOS, the uCode is not updated. To handle
   this gap, we will have SOS own all pCPUs at boot time. So
   all pCPUs could have uCode updated. This will be handled
   in the patch to enable SOS own all pCPUs at boot time.

2. gva2gpa now doesn't check possible page table walk failure.
   Will add the failure check in gva2gpa in different patch.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Anthony Xu (anthony.xu@intel.com)
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tian, Kevin <kevin.tian@intel.com>
2018-03-23 08:04:07 +00:00
Li, Fei1
bf1a312fa6 Add cpuinfo_x86 to cache cpu capability/feature
Add a global boot_cpu_data to cache common cpu capbility/feature
for detect cpu capbility/feature.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Xu, Anthony <anthony.xu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-03-23 08:03:11 +00:00
Jason Chen CJ
95b6661540 ioreq: only clear vcpu->req when io request needed
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-22 14:15:39 -07:00
Li, Fei1
65233802f0 Minor cleanup not to use uart for release on platform uefi
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-22 14:15:08 -07:00
Li, Fei1
576e6917a0 Don't build in debug directory for release
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-22 14:15:08 -07:00
Li, Fei1
304cab9acf Don't use HV_DEBUG outside debug directory
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-22 14:15:08 -07:00
Li, Fei1
fd1d937035 Remove redefine macro
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-22 14:15:08 -07:00
Yonghua Huang
4e23623ab9 hv: rename VM exit handlers in vlapic
to keep aligned with the vmexit reasons' name defined in
SPEC.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-03-22 17:03:16 +08:00
David B. Kinder
263a0c9de0 makefile: adjust linker path in Makefile
As mentioned in https://github.com/projectacrn/acrn-documentation/pull/38
on some operating systems, the ``gnu-efi`` package installs the
linker under a ``gnuefi`` folder in ``${LIBDIR}``. This is the
case in Fedora for example. Check if the gnuefi folder is there
and use it if it is in the path to the linker.  This PR fixes the
Makefile rather than documenting how to edit it yourself.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-03-22 10:00:12 +08:00
Yonghua Huang
0a5806ea8e hv:enable APICv features based on CPU capability
this patch is to detect and enable only APICv features which
are actually supported by the processor, instead fo tuning on
all features by default.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-03-21 15:34:25 -07:00
Yonghua Huang
c8dc56e08b Add APIC ACCESS VMexit handler
Update 'apic_access_exit_handler()' function to emulate
guest instruments to read/write guest's lapic registers page

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-03-21 15:34:25 -07:00
Yonghua Huang
7ce4248e34 Add handle EOI case when APIC-write VM exit
-If "virtual-interrupt delivery" VM-execution control is 0,
  Processor will causes an APIC-write VM exit if page offset
  is 0xB0 (EOI), SDM Vol3, Chapter 29.4.3

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-03-21 15:34:25 -07:00
Li, Fei1
1b33e5bf2e Move s[n]printf to lib for release
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-21 15:02:31 +08:00
Jason Chen CJ
d1237e81f0 uefi: init vlapic according to native lapic
this patch save native lapic configuration and restore it to vm0's vlapic
before its running, then doing hpet timer interrupt injection through vlapic
interface -- this will not mess up vlapic and we can see hpet
timer interrupt coming continuously.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-21 12:14:01 +08:00
Jason Chen CJ
9f3c723d0a uefi: remove old interrupt injection method
we added uefi stub for hv, and want vm0 continue running under uefi env to
boot other uefi payload (osloader or bzImage).

during this, the uefi timer irq need be handled elegantly.

there are 3 types for uefi timer:
1. 8254 based on IRQ0 of PIC
2. HPET based on IOAPIC
3. HPET based on MSI

currently, we only support type 3 (HPET+MSI). But we are following a
in-correct flow to handle this timer interrupt:
- we set VMX_ENTRY_INT_INFO_FIELD directly if a timer interrupt happened
  before vcpu launching, this will make its vlapic mess up, which finally
  cause hpet timer stop.

this patch remove this in-correct approach, the new approach patch will
be followed by next patch.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-21 12:14:01 +08:00
Geoffroy Van Cutsem
e61f4659c1 .gitignore: add 2 entries to ignore version.h file if present
If you build for a platform (e.g. uefi) and right after that for
another platform ('sbl'), the new build will fail and a version.h
file is left in the tree (bsp/uefi/include/bsp/version.h or
bsp/sbl/include/bsp/version.h depending on the order you built one
after the other). This commit makes git ignore any of those in case
it is there. Note that 'make clean' with the corresponding
PLATFORM variable will clean this file.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-03-21 10:02:27 +08:00
Mingqiang Chi
db93d80358 mmu: Rename several variables related to page table type
rename 'PT_HOST' to 'PTT_HOST'
rename 'PT_EPT' to 'PTT_EPT'
rename 'ept_type' to 'table_type'

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2018-03-20 16:44:53 +08:00
Zheng, Gen
a0b206ba3c vm load: fix bug in loading kernel
According to the explaination for pref_address
in Documentation/x86/boot.txt, a relocating bootloader
should attempt to load kernel at pref_address if possible.
But due to a non-relocatable kernel will unconditionally
move itself and to run at perf address, no need to copy
kernel to perf_address by bootloader.

Signed-off-by: Zheng, Gen <gen.zheng@intel.com>
2018-03-20 15:52:53 +08:00
Jason Chen CJ
6d6e10484f ptdev: fix bug when update ptdev entry
info->phys_pin need be used by ptdev_build_native_rte when updating entry

TODO: currently ptdev entry is virtual based, the better solution should
be physical based.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-20 14:37:08 +08:00
Zhao Yakui
ab10b950e2 Jmp to vm_exit directly to avoid calling vmlaunch again if vm-entry fails in vmresume
It is possible that the vm-entry fails in vmresume instr under some scenarios.
It will pass to next instruction following vmresume. In such case it will call
the vmlaunch again.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2018-03-20 14:36:41 +08:00
Mingqiang Chi
2a298fad3f Remove unnecessary variable in map_mem
the variable 'table_present' is redundant
in function(map_mem_region)

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2018-03-20 14:36:13 +08:00
Minggui Cao
7013b06c6c to support firmware & ramdisk as multiboot mods
1. refine multiboot related code, move to /boot.
2. firmware files and ramdisk can be stitched in iasImage;
and they will be loaded as multiboot modules.

Signed-off-by: Minggui Cao <minggui.cao@intel.com>
2018-03-20 14:35:42 +08:00
Mingqiang Chi
67871c42ea Add page mask MACRO
Add 'CPU_PAGE_MASK' used for calculate address,
Change IA32E_REF_MASK from 0x7ffffffffffff000 to 0x000ffffffffff000
for MMU/EPT entry, bit62:52(ignore) bit63(VE/XD)
if we want to obtain the address from the MMU/EPT entry,need to clear
bit63:52 by IA32E_REF_MASK

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2018-03-20 14:19:41 +08:00
Geoffroy Van Cutsem
e8236e552d Makefile: fix a couple of wrong variable assignments
Fix a couple of wrong assignments to D_SRCS and C_SRCS.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-03-20 11:40:22 +08:00
Yonghua Huang
c63f21c4a8 align the coding style when access VMEXIT_QUAL
- align coding style to avoid redundant operations
   when operating on reading  VMX_EXIT_QUALIFICATION

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-03-19 16:36:22 +08:00
Louie Lu
28ede18b2d Update typo and add full name of UOSloader 2018-03-19 16:33:23 +08:00
Louie Lu
a1c4669145 Fix typo 2018-03-19 16:33:23 +08:00
David B. Kinder
9ddc6e47b9 add .gitignore
create a .gitignore that ignores output created by Make

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-03-16 21:55:05 +08:00
Li, Fei1
bd21cdb624 minor fix on get_ptdev_info
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-16 21:52:34 +08:00
Mingqiang Chi
bf8714b7e0 add create secure world ept API
This patch is prepared for enabling secure world feature.
this api will create new eptp for secure world, whose PDPT
entries are copied form normal world,the PML4/PDPT for secure
world are separated from Normal World, PD/PT are shared in the
Secure World's EPT and Normal World's EPT.Secure world can
access Normal World's memory, but Normal World can not access
Secure World's memory
This function implemented:
-- Unmap specific memory from guest ept mapping
-- Copy PDPT from Normal world to Secure world
-- Map specific memory for Secure world
-- Unmap specific memory from SOS ept mapping

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2018-03-16 21:52:15 +08:00
Li, Fei1
4f65dd477a Simple get_vmx_cap()
Don't check MSR Control Features in get_vmx_cap

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-15 16:33:08 +08:00
Yan, Like
05b8f366f6 Remove ASSERT in lib functions
Replace ASSERT in lib functions with error message print and return a
value indicating error to allow the caller of lib functions to handle
the error.

Change-Id: If166484238dc0734041adfdbb19a5b374c044e33
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-03-15 16:29:51 +08:00
Li, Fei1
b0f8781500 Call monitor_cap_detect in bsp_boot_init
On the APL NUC board (CPU family: 0x6 model: 92), the monitor is buggy.
We can't use it to wake up CPU core from mwait by memory monitor.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-03-15 16:28:02 +08:00
Mingqiang Chi
78649c4a52 add data structure in vm for enable trusty feature
add key info structure
add sworld_eptp in vm structure, and rename ept->nworld_eptp
add secure world control structure

Change-Id:
Tracked-On:220921
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2018-03-15 16:26:55 +08:00
Jason Chen CJ
b4580d69b8 retpoline: replace indirect jmp in switch_to function
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-15 16:25:53 +08:00
Jason Chen CJ
f61d7ed41f retpoline: add indirect thunk support
for gcc version > 7.3, enable CONFIG_RETPOLINE

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-15 16:25:53 +08:00
Jason Chen CJ
aaeb52577f vpic: use calloc to init vpic instead of malloc
vpic struct should be init as 0

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-15 16:25:53 +08:00
Jason Chen CJ
4b750331b1 uefi: restore cr registers according to efi context
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-15 16:25:53 +08:00
Yin Fengwei
9848000879 apicv: cancel event injection if vcpu is scheduled out
And re-inject the event after vcpu is scheduled in.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-03-15 16:24:13 +08:00
wenshelx
5e1b371b24 security: fortify source and format string check
"-O2 -D_FORTIFY_SOURCE=2":
GCC C-Compiler can analyze the source code to be compiled and detect
certain insecure sections, that might create a security problem. The
compiler will replace the insecure function calls with special hardened
code that will perform extra runtime checks while the process is
executed.
"-Wformat -Wformat-security":
It warns about calls to "printf" and "scanf" functions where the format
string is not a string literal and there are no format arguments, as in
"printf (foo);". This may be a security hole if the format string came
from untrusted input and contains %n.

Tracked-On: 224003
Signed-off-by: wenshelx <wenshengx.wang@intel.com>
2018-03-13 19:30:05 -07:00
Jack Ren
7ace7f2558 version: v0.1-rc2
Signed-off-by: Jack Ren <jack.ren@intel.com>
2018-03-09 20:50:45 +08:00
Jack Ren
b9c08c9faa minor fix on acrn.conf
Signed-off-by: Jack Ren <jack.ren@intel.com>
2018-03-09 20:48:44 +08:00
Miguel Bernal Marin
5efd3481fe use efi instead of linux in acrn.conf
acrn.efi is an EFI executable image and not a linux kernel image.
This commit changes linux to efi in the boot-loader configuration.

For more reference please review:
https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
2018-03-09 15:29:37 +08:00
Jason Chen CJ
c865e427ad decouple hv sw version and api version
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-03-09 13:43:20 +08:00