Commit Graph

2161 Commits

Author SHA1 Message Date
Shiqing Gao b430b00a08 hv: fix 'Expression is not Boolean'
MISRA-C requires that the controlling expression of an if statement or
an iteration-statement shall be Boolean type.

v1 -> v2:
* update the U suffix of constant to let the type of operands
  to bit operations (&) is the same.
* update the type of 'i' from uint64_t to uint16_t in
  'profiling_set_control' since it is limited by phys_cpu_num,
  which is uint16_t.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-08 13:04:11 +08:00
Li, Fei1 121454c4bd hv: fix a minor bug of static checks
When a macro is expanded, the two tokens on either side of each ‘##’ operator
are combined into a single token, which then replaces the ‘##’ and the two
original tokens in the macro expansion. So we need use CAT__ to expand the
__LINE__ MACRO and use CAT_ to combine the expaneded MACRO.

Tracked-on: #1750
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-11-08 09:26:56 +08:00
Binbin Wu 0800624fe5 hv: vtd: use pre-defined function for bdf calculation
Use pre-defined inline function for pci bus/slot/function calculation.

Tracked-on: #1747
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-08 09:12:30 +08:00
Binbin Wu 039a1c0f2e hv: pci: replace fucntion like macro with inline func
Replace fucntion like macro with inline function.

Tracked-on: #1747
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-08 09:12:30 +08:00
Zhi Jin 36aaaa1cfd DM NPK: unmap the MMIO in pci_npk_deinit
Otherwise, after UOS crashes, the PTE for the MMIO may be added
again.

Tracked-On: #1745
Signed-off-by: Zhi Jin <zhi.jin@intel.com>
2018-11-08 09:06:17 +08:00
Mingqiang Chi ef974d1adf hv:Remove atomic operation to set initial value for 'created_vcpu'
It is not necessary to use atomic operation to
set the initial value for 'created_vcpu' in vm structure.

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
2018-11-07 15:58:08 +08:00
Yin Fengwei 0fc47b5a7c hv: fix release build issue
The old doc update commit changed the code by accident and broke
release version build. This patch fix the release build issue.

Tracked-On: #1595
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-07 15:39:01 +08:00
Tw a8a1e22981 hv:vtd: fix minor bug in domain count
domain count should be CONFIG_MAX_VM_NUM+1 instead of CONFIG_MAX_IOMMU_NUM+1

Tracked-On: #861
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-07 15:36:12 +08:00
Binbin Wu 78dd92e4ed DM: sos_bootargs: split sos_bootargs into multiple lines
Difficult to review the changes of sos_bootargs when the args is a single line.
Split sos boot args into multiple lines.

Tracked-On: #1730
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2018-11-07 09:21:13 +08:00
David B. Kinder 44ce3a664f doc: update HLD Trace/Log
Transcode, edit, and upload HLD 0.7 section 9 (Trace/Log)

Tracked-on: #1738

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-06 16:14:49 -08:00
David B. Kinder 27fffb96b9 doc: update HLD Power Management
Transcode, edit, and upload HLD 0.7 section 8 (Power Management)

Tracked-on: #1736

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-06 13:51:35 -08:00
David B. Kinder b3d21683de doc: update HLD VM Management
Transcode, edit, and upload HLD 0.7 section 7 (VM Management)

Tracked-on: #1734

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-06 12:23:25 -08:00
David B. Kinder dfcc06df30 doc: update HLD Virtio Devices
Transcode, edit, and upload HLD 0.7 section 6.5 (Supported Virtio
Devices), merging with existing reviewed content.

Tracked-on: #1732

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-06 11:37:29 -08:00
Shiqing Gao 366042cac2 hv: fix integer violations
- Fix the integer violations related to the following rules:
  1. The operands to shift operations (<<, >>) shall be unsigned
     integers.
  2. The operands to bit operations (&, |, ~) shall be unsigned
     integers.

- Replace 12U with CPU_PAGE_SHIFT when it is address shift case.

v1 -> v2:
 * use existed MACRO to get bus/slot/func values
 * update PCI_SLOT MACRO to make it more straightforward
 * remove the incorrect replacement of 12U with CPU_PAGE_SHIFT
   dmar_fault_msi_write

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-06 16:18:56 +08:00
Yuan Liu 65a2613ab6 IOC mediator: fix wakeup reason issue when UOS resuming
IOC mediator should keep sending acnrd boot reason until received
UOS heartbeat init message, then turn to send SOS wakeup reason
through read native cbc lifecycle cdev.

Tracked-On: #1727
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-06 16:18:35 +08:00
Huihuang Shi a2516ecc85 fix "Casting operation to a pointer"
The print_param struct's member emit who is used for callback,
the forth parameter of it is used for transmit the private data
of the "print_param".

The type translation between "void *" and private date broke the
violations.

Use the same type to fix it out.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Xu Anthony <anthony.xu@intel.com>
2018-11-06 13:37:33 +08:00
Xinyun Liu ad1e2ab678 DM/sos_bootargs: remove unused parameters for graphics
remove these options from legacy release:

i915.tsd_init=7 i915.tsd_delay=2000
i915.enable_preemption=1 i915.context_priority_mode=2

Tracked-On: #1697
Signed-off-by: Xinyun Liu <xinyun.liu@intel.com>
Reviewed-by: He, Min <min.he@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-11-06 13:13:36 +08:00
Manisha Chinthapally ee918f8533 HV:debug:profiling Fixed inappropriate condition check
Fixed the condition to be able to collect MSR sample data
Also populating addition information to help identifity appropriate data

Tracked-On: #1693
Signed-off-by: Manisha Chinthapally <manisha.chinthapally@intel.com>
2018-11-06 09:19:33 +08:00
Yin Fengwei 7f57a74fe7 hypercall doc: Sync the comments for each hypercall from .h to .c
For all the hypercalls, we sync the comments from .h to .c as
comments in .h file are used in architectural design and the
comments in .c are used in module design.

Tracked-On: #1595
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
2018-11-06 09:12:40 +08:00
Xiangyang Wu 99586e32cc HV:treewide:rename vm data structure
For data structure types "struct vm", its name is identical
with variable name in the same scope. This is a MISRA C  violation.

Naming convention rule:If the data structure type is used by multi
modules, its corresponding logic resource is exposed to external
components (such as SOS, UOS), and its name meaning is simplistic
(such as vcpu, vm), its name needs prefix "acrn_".

The following udpates are made:
struct vm *vm-->struct acrn_vm *vm

Tracked-On: #861

Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com>
2018-11-05 15:35:49 +08:00
Xiangyang Wu ace4f48c9a HV:treewide:rename vcpu_arch data structure
For data structure types "struct vcpu_arch", its name
shall follow Naming convention.

Naming convention rule:If the data structure type is
used by multi modules, its corresponding logic resource
is exposed to external components (such as SOS, UOS),
and its name meaning is simplistic (such as vcpu, vm),
its name needs prefix "acrn_". Variable name can be
shortened from its data structure type name.

The following udpates are made:
struct vcpu_arch arch_vcpu-->struct acrn_vcpu_arch arch

Tracked-On: #861

Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com>
2018-11-05 15:35:49 +08:00
Xiangyang Wu fa26a16645 HV:treewide:rename vcpu data structure
For data structure types "struct vcpu", its name is identical
with variable name in the same scope. This is a MISRA C  violation.

Naming convention rule:If the data structure type is used by multi
modules, its corresponding logic resource is exposed to external
components (such as SOS, UOS), and its name meaning is simplistic
(such as vcpu, vm), its name needs prefix "acrn_".

The following udpates are made:
struct vcpu *vcpu-->struct acrn_vcpu *vcpu

Tracked-On: #861

Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com>
2018-11-05 15:35:49 +08:00
Zhao Yakui 969f7cf071 DM:Check the device file of /dev/vbs_ipu to determine IPU mode
The /dev/vbs_ipu is used as the backend driver of IPU mediator on SOS kernel.
If the file of /dev/vbs_ipu exists, it indicates that IPU works in mediator mode.
Other it will fall back to the pass-through mode.

Tracked-on: https://github.com/projectacrn/acrn-hypervisor/issues/1373
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2018-11-05 14:45:38 +08:00
Jason Chen CJ 8efd9edb82 hv: vPCI needs to handle reset IO port CF9 differently
Currently vpci treats IO port CF9 as a regular PCI CONFIG_ADDRESS port,
so that SOS can't do system reboot through port CF9.

This patch handles port CF9 in this way:
- SOS (vm0): it is allowed to actually access the physical IO port for byte
  accesses.
- UOS (non-vm0) or partitioning guests: any accesses to port CF9 are
  ignored.

Tracked-On: #1568
Signed-off-by: Zide Chen zide.chen@intel.com
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-11-05 14:42:50 +08:00
Shuo Liu d261b4bce2 doc: update virtio related functions doc comments
Update some virtio, VBS-K, vhost APIs documents.

Tracked-On: #1595
Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
2018-11-04 20:32:50 -08:00
Shuo Liu ea801a1672 dm: Remove unused duplicated API dm_gpa2hva
paddr_guest2host has same function with dm_gpa2hva. And There is no
usage of dm_gpa2hva. Remove it.

Tracked-On: #1595
Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Fengwei Yin <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-11-04 20:32:50 -08:00
Junjie Mao 4e540e5494 HV: doc: use doxygen-generated API docs in HLD
This patch adds ioreq.h to the input of doxygen and replaces hard-coded API docs
with doxygen-generated ones.

Tracked-On: #1595
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2018-11-04 20:30:38 -08:00
Junjie Mao e0fcb70daa HV: io: add structure and API docs
This patch adds more comments to describe the structures and functions that are
public to the other components in the hypervisor. The comments are in
doxygen-style for document generation.

v2 -> v3:

* Reformat the flow in the doc for vhm_io_request.

v1 -> v2:

* Fix typos and inconsistencies in the comments.
* Wrap the text-based diagram in the doc for vhm_request in @verbatim

Tracked-On: #1595
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2018-11-04 20:30:38 -08:00
Li, Fei1 a4be10f375 hv: mmu: unmap the trusty EPT when destroy_secure_world
Unmap the trusty EPT mapping when destroy_secure_world. The reason is
now the normal world and trusty will share the PD and PT page. Before
we add the mapping for each world, we should unmap it from another world.
Besides, fix a minor bug for condition priority.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-11-05 11:27:34 +08:00
Shiqing Gao e8229879a6 hv: use MMIO read/write APIs to access MMIO registers
MMIO registers might be changed at any time.
The changes might not be catched due to compiler optimization
if there is no 'volatile' keyword.

We have defined MMIO read/write APIs to address the above issue.
'volatile' keyword is being used in these defined MMIO read/write
APIs.

This patch updates the MMIO registers access implementation in
'msix.c' to use these defined MMIO read/write APIs.

v1 -> v2:
 * update the algorithm to get the address of high 32-bit of
   'pentry->addr'
   - previous way:
           &(pentry->addr) + 4U
           ===> &(pentry->addr) + 4 * 64 bits
           since 'pentry->addr' is 64 bits
   - new way:
           (char *)&(pentry->addr) + 4U
           ===> &(pentry->addr) + 4 * 8 bits
           since 'char' is 8 bits

Tracked-On: #1711
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-11-05 09:50:28 +08:00
Tianhua Sun 313941e853 tools: acrn-manager: remove unsafe api sscanf
function sscanf is banned according to the security
requirements. So remove sscanf api.

Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-11-05 09:50:04 +08:00
Tianhua Sun e24464a039 tools: acrnlog: remove usage of banned APIs
1, remove unsafe function sscanf
2, replace strlen with strnlen
3, replace atoll with strtoll and replace aoti with strtol

Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-11-05 09:50:04 +08:00
David B. Kinder 1d96ce5fb7 doc: add doyxgen alias for easy reST inclusion
Tracked-on: #1595

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-03 10:44:21 -07:00
Yonghua Huang d2d0cbc661 hv:doc:use doxyen-generated API docs in HDL for vIRQ
Adds below header files to the input of doxygen
 and replaces hard-coded API docs with doxyen-generated ones:

 - vlapic.h
 - vioapic.h
 - vpic.h
 - irq.h

Tracked-On: #1595
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-11-03 08:40:14 -07:00
Yonghua Huang cbe0313588 hv: revise interfaces description in virq
Add comments for APIs:
  - vcpu_queue_exeception()
  - vcpu_inject_extint()
  - vcpu_inject_nmi()
  - vcpu_inject_gp()
  - vcpu_inject_pf()
  - vcpu_inject_ud()
  - vcpu_inject_ac()
  - vcpu_inject_ss()

Tracked-On: #1595
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-11-03 08:40:14 -07:00
Yonghua Huang f23606a4c3 hv: revise interfaces description in vioapic
Add comments for APIs:
 - vioapic_set_irq();
 - vioapic_set_irq_nolock();

Tracked-On: #1595
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-11-03 08:40:14 -07:00
Yonghua Huang 7c20cb0cbe hv: revise interfaces description in vpic
Add comments for APIs:
 - vpic_set_irq()
 - vpic_pending_intr()
 - vpic_intr_accepted()

Tracked-On: #1595
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-11-03 08:40:14 -07:00
Yonghua Huang c41f286085 hv: revise interfaces description in vlapic
Add comments for APIs:
 - vlapic_pending_intr();
 - vlapic_pending_accepted();
 - vlapic_post_intr();
 - lapicv_get_pir_desc_paddr();
 - vlapic_intr_level();
 - vlapic_intr_edge();
 - vlapic_set_local_intr();
 - vlapic_intr_msi();

Tracked-On: #1595
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-11-03 08:40:14 -07:00
Geoffroy Van Cutsem 469496311c Documentation: add 'make' to GSG and expand PATH for `sphinx-build`
Getting Started Guide: add one more bundle to be added on a Clear
Linux development machine to make sure 'make' and other development
packages are available.

ACRN Documentation Generation: expand the 'PATH' variable to include
'~/.local/bin' where 'sphinx-build' is installed.

Tracked-On: #1650

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-11-02 16:45:58 -07:00
Binbin Wu 4b3b11552d hv: doc: use doxygen-generated API docs in HLD for vtd
This patch adds vtd.h to the input of doxygen and replaces hard-coded API docs
with doxygen-generated ones.

Tracked-On: #1595
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2018-11-02 15:36:14 -07:00
Binbin Wu 1776d7e7fc hv: vtd: add structure and API docs
This patch adds more comments to describe the structures and functions of vtd
that are public to the other components in the hypervisor. The comments are in
doxygen-style for document generation.

Tracked-On: #1595
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
2018-11-02 15:36:14 -07:00
Yan, Like 7dc3e609be doc: hv: add comments to irq APIs for documentation
Tracked-On: #1595
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-11-02 15:34:36 -07:00
Xiangyang Wu f69dd1c6ea HV:doc:use doxygen-generated API docs in HLD
The patch adds related head files to the input of doxygen and
replaces hard-code API docs with doxygen-generated ones.

v1-->v2:
       Put the 'kerneldoc' back.
V2-->V3:
       Rebase

Tracked-On: #1595
Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com>
2018-11-02 15:30:36 -07:00
Xiangyang Wu 7c3c6ea442 HV:MM:add API docs
This patch adds more comment to describe functions that are
interfaces to the other modules in the hypervisor. The comments
are in doxygen-style for document generation.

V1-->V2:
       Rebase

Tracked-On: #1595
Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com>
2018-11-02 15:30:36 -07:00
David B. Kinder 17d43fe5cb doc: doc: update HLD Emulated Devices
Transcode, edit, and upload HLD 0.7 section 5 (Emulated Devices), including

- 5.1 USB Virtualization (merge with previously edited doc),
- 5.2 UART virtualization (merge with previous edited doc),
- NOT INCLUDING 5.3 (Automotive) I/O controller virtualization
- 5.4 Watchdog virtualization (merge with previously edited doc)
- 5.5 GVT-g GPU Virtualization (merge previously edited doc)

Tracked-on: #1687

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-02 15:27:08 -07:00
Minggui Cao bf88e24168 DOC: add main vcpu API & data structure into HLD.
add main vcpu API and data structure for doc auto-generated
info into HLD.

Tracked-On: #1595
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
2018-11-02 15:20:11 -07:00
Minggui Cao c885011457 HV: add main vcpu API comments for document
This patch adds comments to the main public functions
of vCPU in the hypervisor. The comments are in doxygen-style
for document generation.

Tracked-On: #1595
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
2018-11-02 15:20:11 -07:00
David B. Kinder 277c9330a2 doc: fix formatting error in l1tf doc
PR #1714 had one error that this PR is fixing.

Tracked-on: #1672

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-02 15:16:25 -07:00
Yonghua Huang 2c85480c2f doc: format l1tf.rst
Format this file to address review comments.

Tracked-On: #1672
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-11-02 15:11:23 -07:00
Yonghua Huang d6247ff721 doc: update l1tf.rst line endings setting to unix style
Convert line endings setting for l1tf.rst doc
from windows style to unix style.

Tracked-On: #1672
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2018-11-02 15:11:23 -07:00