Commit Graph

2650 Commits

Author SHA1 Message Date
Yonghua Huang 9b269aee79 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-05-15 17:19:37 +08:00
Geoffroy Van Cutsem 34ccbb5f8e getting_started: update dependency for Fedora 27
Update the build dependency for Fedora. 'gnu-efi' was listed as
a dependency but it's actually 'gnu-efi-devel' that we need else
the header file ('efi.h') is not installed.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-15 17:19:37 +08:00
Li, Fei1 36148041bc Move s[n]printf to lib for release
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-05-15 17:19:37 +08:00
Shiqing Gao 819845c9bd dm: add ACPI info for ipu pass-through
IPU devices are using I2C device with physical BDF 0:16.0.
The I2C controller has the dependency on ACPI info.
This patch is to add ACPI info for the I2C controller and the two IPU
devices that are under the scope of I2C.

Note:
This patch is specific for GP platform.

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
2018-05-15 17:19:37 +08:00
Jason Chen CJ fcb95d02d6 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-05-15 17:19:37 +08:00
Jason Chen CJ a87757d602 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-05-15 17:19:37 +08:00
Yin Fengwei 23efb5a0e9 DM: reboot: clear the data of 0xcf9 if cold reboot
Linux kernel CF9 reboot is doing things like:
  - read value from 0xcf9
  - mask out the value according to the reboot type (warm vs cold)
  - BIT OR the value with reboot code
  - write the value to 0xcf9

If there are two reboot event and the first one is cold
reboot and the second one is warm reboot, vsbl query
reboot type after the second one and will get code reboot
instead of warm reboot.

We should clear the data of 0xcf9 if guest request cold reboot.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-05-15 17:19:37 +08:00
Yin Fengwei 66ddb67bdd DM: acpi: Update the reset value of FADT to trigger cold reboot
There are bootloaders require cold reboot as ACPI reboot
instead of warm reboot.

So we set 0xE to reset value of FADT to make ACPI reboot
cold reboot.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-05-15 17:19:37 +08:00
Geoffroy Van Cutsem 9e854eacc5 .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-05-15 17:19:37 +08:00
David B. Kinder d8b1fd2682 doc: add doc building/publishing instructions
Add a new document describing how doc building and publishing
works and how to setup a doc working directory and build tools to make
it so.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:37 +08:00
Geoffroy Van Cutsem eb31977817 Makefile (uefi): add gnu-efi(-devel) build dependency for Fedora/doc/CentOS
Add the 'gnu-efi' dependency required to build the ACRN hypervisor
with "PLATFORM=uefi" on Fedora. 'gnu-efi-devel' is required on CentOS.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-15 17:19:37 +08:00
Mingqiang Chi 2deb4cb458 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-05-15 17:19:37 +08:00
Zheng, Gen 124910ba14 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-05-15 17:19:37 +08:00
Yonghua Huang b6d73be1a6 Enable FORTIFY and FORMAT SECURITY compile flags
1. Enable below 2 defenses in Makefile
   "-O2 -D_FORTIFY_SOURCE=2"
   "-Wformat -Wformat-security"

2. Update related source code impacted by above 2 flags

Change-Id: Ib42214848f030b4cf508cd7c52a7e3cc809435d9
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-05-15 17:19:37 +08:00
Jason Chen CJ 155be81dbf 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-05-15 17:19:37 +08:00
Zhao Yakui fe9dfc7842 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-05-15 17:19:37 +08:00
Mingqiang Chi f4780c0cd4 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-05-15 17:19:37 +08:00
Minggui Cao 119b038551 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-05-15 17:19:37 +08:00
Mingqiang Chi 35f5eef658 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-05-15 17:19:37 +08:00
Geoffroy Van Cutsem 2efcbe3ab8 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-05-15 17:19:36 +08:00
David B. Kinder 3d3f264282 getting_started: fix note formatting
Indentation was off for a codeblock and a following note directive

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:36 +08:00
Geoffroy Van Cutsem cd72305368 getting_started: make instructions more specific
Make the Getting Started Guide instructions more specific and
comprehensive for Clear Linux version 21260 (version of reference)

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-15 17:19:36 +08:00
David B. Kinder a5e32731ad doc: update getting started images
New (and cleaner) images for the getting started guide.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:36 +08:00
David B. Kinder ed78db46ab update launch_uos.sh script
Documentation says to use CL version 21260, but sample script wasn't
updated.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:36 +08:00
Yonghua Huang 83e78e16c7 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-05-15 17:19:36 +08:00
Louie Lu 337706b6ba Update typo and add full name of UOSloader 2018-05-15 17:19:36 +08:00
Louie Lu ede4e911df Fix typo 2018-05-15 17:19:36 +08:00
David B. Kinder 3b86c9710e doc: improvements for sphinx generation
Handle version retrieval better when comments are present.
Add warning if Sphinx theme (read_the_docs) is missing.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:36 +08:00
David B. Kinder b55e6a8d74 add .gitignore
create a .gitignore that ignores output created by Make

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:36 +08:00
Li, Fei1 429302c72a minor fix on get_ptdev_info
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-05-15 17:19:36 +08:00
Mingqiang Chi c451f2e4fa 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-05-15 17:19:36 +08:00
Yin Fengwei 3775f29e3c vm: Pass uuid from DM commandline to vm as GUID.
Also save the uuid to ctx in case DM needs to access the
uuid.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-05-15 17:19:36 +08:00
David B. Kinder 81c47e776e add .gitignore
create a .gitignore that ignores build output created by make

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:36 +08:00
Geoffroy Van Cutsem 637a79da07 Getting Started Guide: add instructions for other OSs
Add instructions on how to build the hypervisor and device model
on other operating systems such as Ubuntu/Debian, Fedora/doc/Redhat
and CentOS.

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-15 17:19:36 +08:00
wenshelx d92f640829 security: data relocation and protection(RELRO)
RELRO rearranges the data sections inside an ELF
executable. It also marks certain areas as 'read-only'
so that these data structures cannot be overwritten while
the process is running.

Tracked-On: 224003
Signed-off-by: wenshelx <wenshengx.wang@intel.com>
2018-05-15 17:19:36 +08:00
wenshelx 156d61e20f security: enable stack protector
Enable stack-proctector-strong option for gcc emiting
extra code to check buffer overflow.

Enable noexecstack option for marking the object as not
requiring executable stack.

Tracked-On: 224003
Signed-off-by: wenshelx <wenshengx.wang@intel.com>
2018-05-15 17:19:36 +08:00
Yin Fengwei f86d91e1e1 dm: use getopt_long instead of getopt to parse dm cmdline
It will be easier if we want to add more command line options
with long options.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-05-15 17:19:36 +08:00
Li, Fei1 74e2bfc15f Simple get_vmx_cap()
Don't check MSR Control Features in get_vmx_cap

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-05-15 17:19:36 +08:00
Yan, Like 7e4b4c2546 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-05-15 17:19:36 +08:00
Li, Fei1 cc2256d3f6 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-05-15 17:19:36 +08:00
Mingqiang Chi cc1d532131 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-05-15 17:19:36 +08:00
Jason Chen CJ e91b6aa31a retpoline: replace indirect jmp in switch_to function
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-05-15 17:19:36 +08:00
Jason Chen CJ d14a7dbdd2 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-05-15 17:19:36 +08:00
Jason Chen CJ c244e8b5a3 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-05-15 17:19:36 +08:00
Jason Chen CJ eed8104f69 uefi: restore cr registers according to efi context
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-05-15 17:19:36 +08:00
Yin Fengwei 189329e0de 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-05-15 17:19:36 +08:00
David B. Kinder c8d2cdccda doc: update project documentation LICENSE
Per Project ACRN governance, documentation is under a Creative Commons
Attribution 4.0 International License (CC BY 4.0).  This patch updates
this information, and adds a tagline to documentation mentioning this
license.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:35 +08:00
David Kinder 4ecb849a71 Delete LICENSE 2018-05-15 17:19:35 +08:00
wenshelx 265499c2f2 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-05-15 17:19:35 +08:00
David B. Kinder 0dc93a5281 doc: filter known issues
make the doc build process quiet and add filtering of known (Sphinx)
issues.  Scripting comes from the open source Zephyr project.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-15 17:19:35 +08:00