Commit Graph

2444 Commits

Author SHA1 Message Date
Li, Fei1 a1ac585b85 hv: add brackets to make operator expression more readable
v1-v2:
Bypass this case:
When binary arithmetic operators of different precedence (e.g. '+'
and '*') are mixed in an expression, parentheses are added to the
sub-expressions using the operator with a higher precedence.

v1:
The operator precedence rules are complicated and it is easy to make a mistake.
So add brackets to make operator expression more readable.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-11-29 11:10:22 +08:00
Geoffroy Van Cutsem aefe9168d1 Update 'launch_uos.sh' script for UEFI platforms
Update the 'launch_uos.sh' script for UEFI platforms to point at the latest
iot-lts2018 kernel installed by means of the
/usr/lib/kernel/default-default-iot-lts2018 symlink which is set-up by the
kernel-iot-lts2018 bundle.

Update the Getting Started Guide to reflect this minor change.

Tracked-On: #1927
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-11-29 10:57:13 +08:00
Qi Yadong 839680f09b DM: build TPM2 ACPI table when TPM device enabled
Add TPM2 ACPI table build function.

If virtual tpm device is initialized successfully, then create
corresponding TPM2 ACPI table.

Tracked-On: #1924
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
Qi Yadong aae70db6b9 DM: Add support for virtual TPM enabling
Support TPM enable option when launch UOS.

New option: "--vtpm sock_path=$PATH_OF_SWTPM_SOCKET".
If valid option parsed, then init virtual tpm device.

Tracked-On: #1924
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
Qi Yadong 7df90a2527 DM: Support TPM2 CRB device virtualization
Full virtualized TPM CRB device.

The TPM CRB module will handle TPM2 MMIO access. It will forward
the command/data to TPM emulator for command processing if there
is a valid TPM command.

Tracked-On: #1924
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
Qi Yadong 4b83e37c7a DM: tpm emulator to communicate with swtpm
This patch will create control channel and command channel
so as to communicate with swtpm. Based on the 2 channels,
a set of APIs will be implemented and exposed.

Tracked-On: #1924
Signed-off-by: Deng Wei <wei.a.deng@intel.com>
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
Reviewed-by: Zhu Bing <bing.zhu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-29 09:19:16 +08:00
David Kinder 1ba7cebb1d Update tools/README.rst
Co-Authored-By: gvancuts <geoffroy.vancutsem@intel.com>
2018-11-28 12:24:44 -08:00
Geoffroy Van Cutsem 419feb1a61 Documentation: add a README.rst to the tools/ folder
Add a basic README.rst file to the tools/ folder to give a very brief
introduction and redirect the reader to the online documentation for more
details.

Tracked-On: #1896
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-11-28 12:24:44 -08:00
Tonny Tzeng 6d6c5b959c [doc] Enhance Using partition mode on UP2 tutorial 2018-11-28 12:13:37 -08:00
Geoffroy Van Cutsem d3d474cf1e Documentation generation: update kernel-doc script to latest
Update the 'kernel-doc' script to the latest version available from
https://github.com/projectacrn/acrn-kernel.

This solves the following error when generating the ACRN documentation:
"Unescaped left brace in regex is deprecated here (and will be fatal in Perl
5.32), passed through in regex; marked by <-- HERE in m/({ <-- HERE .*})/ at
scripts/kernel-doc line 2176."

Tracked-On: #1926
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-11-28 12:01:25 -08:00
Shiqing Gao 2d2f96afce hv: clean up function definitions in profiling.h
seperate the function definitions into debug/release directories
to better distinguish debug/release libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:57:49 +08:00
Shiqing Gao 14f30a23c1 hv: clean up function definitions in npk_log.h
seperate the function definitions into debug/release directories
to better distinguish debug/release libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:57:49 +08:00
Shiqing Gao 079566056a hv: clean up function definitions in trace.h
seperate the function definitions into debug/release directories
to better distinguish debug/release libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:57:49 +08:00
Shiqing Gao 637326bc6d hv: clean up function definitions in vuart.h
seperate the function definitions into debug/release directories
to better distinguish debug/release libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:57:49 +08:00
Shiqing Gao 7b74b2b909 hv: clean up function definitions in console.h
seperate the function definitions into debug/release directories
to better distinguish debug/release libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:57:49 +08:00
Shiqing Gao 649d0e323b hv: clean up function definitions in dump.h
seperate the function definitions into debug/release directories
to better distinguish debug/release libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:57:49 +08:00
Shiqing Gao 8920fbacaa hv: clean up function definitions in logmsg.h
seperate the function definitions into debug/release directories
to better distinguish debug/release libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:57:49 +08:00
Huihuang Shi 5b6c611a1d hv: msix: fix "Procedure has more than one exit point"
IEC 61508,ISO 26262 standards highly recommend single-exit rule.

Reduce the count of the "return entries".
Fix the violations which is comply with the cases list below:
1.Function has 2 return entries.
2.The first return entry is used to return the error code of
checking variable whether is valid.

V1->V2:
  remove the unrelated code.

Fix the violations in "if else" format.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 14:34:12 +08:00
yuhong.tao@intel.com 2f33d1bcf2 tools: acrn-manager: Fix acrnctl mistake displaying suspended to paused
When UOS is sleeping, 'acrnctl list' command show it is 'paused', not
'suspended'. That is not correct. Because pausing an UOS means to block
its VCPUs immediately, otherwise suspending an UOS means to put it to
sleep.

Tracked-On: #1910
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-11-28 13:42:27 +08:00
Li, Fei1 e1d0f7e432 hv: instr_emul: fix decode_modrm no default case in switch statement
MISRA-C required every switch statement shall have a default label.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 13:25:56 +08:00
Li, Fei1 042c393526 hv: trusty: fix get_max_svn_index return type inconsistent
Function return type should consistent.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-11-28 13:25:56 +08:00
Li, Fei1 c200c98405 hv: include: remove name starts with underscore
Remove name starts with underscore for HV_CONFIG

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-11-28 13:25:56 +08:00
Chen Gang G 0100b5a2e1 HV: replace dynamic memory with static for crypto library
Remove dynamic memory allocation in crypto lib, use array to
replace them.

Tracked-On: #1900
Reviewed-by: Bing Zhu <bing.zhu@intel.com>
Signed-off-by: Chen Gang G <gang.g.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-28 10:24:57 +08:00
Huihuang Shi 2afa7173ef hv: vlapic: fix "Procedure has more than one exit point"
IEC 61508,ISO 26262 standards highly recommend single-exit rule.

Reduce the count of the "return entries".
Fix the violations which is comply with the cases list below:
1.Function has 2 return entries.
2.The first return entry is used to return the error code of
checking variable whether is valid.

Fix the violations in "if else" format.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-27 14:43:16 +08:00
Liu, Xinwu 3d1332f392 tools: acrn-crashlog: refine the log storage
1. remove watching TOMBSTONE in AaaG.
2. add a configurable parameter "foldersize" in MB, sender will drop
   all events when the storaged log size exceeds this parameter.

Tracked-On:#1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Chen Gang <gang.c.chen@intel.com>
Acked-by: Zhang Di <di.zhang@intel.com>
2018-11-27 14:26:25 +08:00
Shiqing Gao 06efc58a7e hv: assign: clean up HV_DEBUG usage related to vuart pin
replace HV_DEBUG with CONFIG_COM_IRQ which is more reasonable

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-27 13:09:24 +08:00
Mingqiang Chi c380ee9eeb hv:Revise sanitized page size
now the size of sanitized_page is 32KB,
revise it to 4KB.

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-11-27 13:09:04 +08:00
Kaige Fu a5fd552456 debug: rename struct logmsg to struct acrn_logmsg_ctl
For data structure types "struct logmsg", its name is identical
with variable name in the same scope. This is a MISRA C violation.

This patch fix it.

Tracked-On: #1801
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-27 09:32:27 +08:00
Kaige Fu e555f75b8d debug: Remove early logbuf support
This patch remove early logbuf support which is used to hold
log massges before shared buf setup by SOS.

Tracked-On: #1801
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-11-27 09:32:27 +08:00
Huihuang Shi 9f13a51e8a hv: hypercall: VM management fix "Procedure has more than one exit point"
IEC 61508,ISO 26262 standards highly recommend single-exit rule.

Reduce the count of the "return entries".
Fix the violations which is comply with the cases list below:
1.Function has 2 return entries.
2.The first return entry is used to return the error code of
checking variable whether is valid.

Fix the violations in "if else" format.
V1->V2:
    update the git comment to describe why comply with the
single-exit rule.

V2->V3:
    update the git comment title to give a scope declaration of this
patch.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-27 09:27:00 +08:00
Huihuang Shi a7398e8a2f hv: hypercall: general fix "Procedure has more than one exit point"
IEC 61508,ISO 26262 standards highly recommend single-exit rule.

Reduce the count of the "return entries".
Fix the violations which is comply with the cases list below:
1.Function has 2 return entries.
2.The first return entry is used to return the error code of
checking variable whether is valid.

Fix the violations in "if else" format.
V1->V2:
    update the git comment to describe why comply with the
rule(function's return entry should be only one).
V2->V3:
    update the git comment title to give a scope declaration of this
patch.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-27 09:27:00 +08:00
Zide Chen b627c2c979 hv: switch IA32_TSC_AUX between host/guest through VM Controls
Currently guest IA32_TSC_AUX MSR is loaded manually right before VM
entry, and saved right after VM exit.

This patch enables VM-Entry Control and VM-Exit Control to switch
MSR IA32_TSC_AUX between host and guest automatically. This helps to
keep vcpu_thread() function and struct acrn_vcpu cleaner.

Also it removes the dead code of intercepting IA32_TSC_AUX.

Tracked-On: #1867
Signed-off-by: Zide Chen <zide.chen@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-27 09:26:29 +08:00
Li, Fei1 d0b37f8ea2 hv: reloc: define data structure and MACRO when necessary
Some data structure are only used under some condition. This patch move data
structure definition under its corresponding contion. Otherwise, it would
violate MISRA-C 413 S "User type declared but not used in code analysed".
For MACRO, it would violate MISRA-C 628 S "Macro not used in translation unit".

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-26 12:42:03 +08:00
Yuan Liu d043171de5 IOC mediator: Add VehicalSteeringWheelAngle signal to the whitelist
The signal is used to get camera right and left values.

Tracked-On: #1886
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-23 14:59:07 +08:00
Tomas Winkler 580579a392 dm: mei: Use compare and swap primitive for refcnt.
Simple atomic add/dec do no guarantee reference count full
synchronization without a lock. Compare and swap operations
are required for correct implementation.

Tracked-On: #1875
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-23 14:13:14 +08:00
Shiqing Gao b1047224aa hv: assign: clean up HV_DEBUG usage related to shell
remove the usage of HV_DEBUG related to shell command in assign.c

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-23 12:21:02 +08:00
Shiqing Gao f21e36f43b hv: vioapic: clean up HV_DEBUG usage
remove the usage of HV_DEBUG in vioapic.c

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-23 12:21:02 +08:00
Shiqing Gao a931229888 hv: irq: clean up HV_DEBUG usage
remove the usage of HV_DEBUG in irq.c

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-23 12:21:02 +08:00
Shiqing Gao dfe48811d4 hv: vcpu: clean up HV_DEBUG usage
remove the usage of HV_DEBUG in vcpu.c

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-23 12:21:02 +08:00
Shiqing Gao e49929a776 hv: ioapic: clean up HV_DEBUG usage
remove the usage of HV_DEBUG in ioapic.c

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-23 12:21:02 +08:00
Yonghua Huang 9d529fb9e6 hv:use copy of guest's memory block in 'hcall_set_vm_memory_regions()'
to avoid passing guest's memory block into hypervisor internal
process for security.

Tracked-On: #861
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-23 09:05:15 +08:00
Shiqing Gao 81db242292 hv: enhance Makefile to compile debug/release into 2 libraries
enhance Makefile to compile debug/release into 2 libraries

v1 -> v2:
 * auto make all the libraries

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
2018-11-23 08:47:34 +08:00
Yin Fengwei 19b35f9730 acrn-dm: wait for monitor thread canceling finish
When thread_cancel() is called to exit pthread, we can't know
when the thread exit done unless pthread_join() is used to
wait for thread exit.

Tracked-On: #1868
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-11-22 12:52:12 +08:00
Li, Fei1 02a89dd473 hv: lapic: fix a theoretic infinite loop when clear lapic isr
In theory, there would have 256 pending interrupts on lapic ISR.
Add this check to avoid theoretic infinite loop for clearing
lapic isr. Leave the potentially hardware issue to machine check.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-11-22 12:44:21 +08:00
Li, Fei1 dbe3d986c0 hv: lapic: save lapic base MSR when suspend
Although the lapic base MSR have the same value in per-cpu except that the BSP bit.
However, we would enter s3 on the BSP cpu. After the resume from s3, the BSP bit was
clear on the BSP cpu. This patch fix this bug.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-22 12:44:21 +08:00
Li, Fei1 b8a553d16a hv: lapic: remove union apic_lvt
Since it's unused.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-11-22 12:44:21 +08:00
Mingqiang Chi 538ba08c2b hv:Add vpin to ptdev entry mapping for vpic/vioapic
Now if the vmexit reason is virtulized EOI for level triggered
interrupts, HV will loop all the ptdev entries, it is time-consuming,
this patch add vpin to ptdev entry mapping for vpic and vioapic
when add intx entry for a vm,it can use the ptdev entry directly
according to the mapping for vpin and ptdev entry when EOI vmexit.

v3-->v4:
  -- add check vpin in remove_intx_remapping
  -- move check vpin from ptdev_add_intx_remapping to add_intx_remapping

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2018-11-22 11:26:04 +08:00
Mingqiang Chi 297a264a74 hv:Cleanup ptdev lock
Move ptdev lock out from add_intx_remapping/add_msix_remapping
/remove_intx_remapping/remove_msix_remapping and make it protect
the whole add entry/remove entry process

v3-->v4:
  --move ptdev lock out

v2-->v3:
  -- still use ptdev lock for add/remove ptdev entry
Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2018-11-22 11:26:04 +08:00
Mingqiang Chi b7bbf81287 hv:Replace dynamic memory with static for ptdev
-- Config MAX_PT_IRQ_ENTRIES 64 in Kconfig
-- Remove ptdev list
-- Add alloc_ptdev_entry_id api

v3-->v4:
  -- move is_entry_active from assign.c to ptdev.h
  -- Add clear active flag in release_entry
v2-->v3:
  -- Remove redundancy active check for ptdev entry
     in release_all_entries and get_ptdev_info
v1-->v2:
  -- split to small patches

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2018-11-22 11:26:04 +08:00
dongshen b0e1657b4f HV: Adding partition mode support for cb2_dnv
Adding partition mode support for cb2_dnv.

Tracked-On: #1853
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2018-11-21 15:21:37 +08:00