Commit Graph

1709 Commits

Author SHA1 Message Date
Yan, Like c51e213905 tools: acrntrace: update Makefile
Update the Makefiel to sync the compiler options with devicemode
and enable options to harden software.

Tracked-On: #1122
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-09-25 13:09:41 +08:00
Yan, Like 5e0acac490 tools: acrntrace: fix several compiler warnings
This commit fixes several compiler warnings before enabling compiler
options to harden software by:
- remove unused variables;
- add parentheses around assignment as compiler suggests;
- print warning if format string is truncated.

Tracked-On: #1122
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-09-25 13:09:41 +08:00
Yan, Like 1b9a3b3e71 tools: acrn-manager: update Makefile
Update the Makefiel to sync the compiler options with devicemode
and enable options to harden software.

Tracked-On: #1122
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-25 13:09:41 +08:00
Yan, Like 227a8c436b tools: acrn-manager: fix warnings before updating Makefile
- Print warning if string truncated to avoid the warning generated
  by -Wformat-truncation by GCC 7.0 and newer version;
- fixed strncpy size.

Tracked-On: #1122
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-25 13:09:41 +08:00
yuhong.tao@intel.com 270a833283 tools: acrnd: bugfix: service lack of prerequisition
As a system service, acrnd will launch UOS, that must be done
after all required services and conditions are ready, such as
acrnprobe, weston, etc.

Tracked-On: #1278
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-09-25 13:08:54 +08:00
CHEN Gang 5affe53a9f tools: acrn-crashlog: update Makefile flags
This patch is to sync the compiler options as the Makefile of device model.

Tracked-On: #1122
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: Liu, Xinwu <xinwu.liu@intel.com>
2018-09-25 13:07:43 +08:00
CHEN Gang 726711e27d tools: acrn-crashlog: fix some compiler warnings
This patch is to fix some compiler warnings before enabling the flag to make
compiler warning as compiler error.

The warning message is like:
ignoring return value of ‘write’, declared with attribute warn_unused_result.

Tracked-On: #1122
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: Liu, Xinwu <xinwu.liu@intel.com>
2018-09-25 13:07:43 +08:00
Shiqing Gao 4e17d2076c hv: fix 'Static procedure is not explicitly called in code analysed'
MISRA-C states that redundant code reduce the maintainability of code.

In some cases, we would like to keep the current unused static functions
for code completeness, such as checking register info. These functions
might be used later.

This patch removes the unused static function 'mmu_pt_for_pde'.
Looks like it is legacy code and not being used in our project.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
2018-09-25 13:06:54 +08:00
ailin,yang ac9ebc5e0f update to support v0.2 release
updated Clear Linux version to 25130 as getting started
updated pk kernel version to 4.14.68-99
added one bundle installation
2018-09-24 21:05:44 -07:00
Shiqing Gao 71b047cb61 hv: fix 'Switch case not terminated with break'
MISRA-C requires that every switch case shall be terminated with break
to avoid the unintentional fall through.

The code will become redundant if we enforce this rule.
So, we will keep the current implementation for the following two cases.
1. The fall through is intentional.
2. The function is returned in the switch case.
    If we decide to eliminate the mutiple returns in one function later,
    this case would be handled properly at that time.

What this patch does:
- add the mssing break for the default case
- add the pre condition for some functions and remove the corresponding
  panic which will never happen since the function caller could guarantee
  the pre condition based on the code implementation

v1 -> v2:
 * remove the redundant cases above default in 'vlapic_get_lvtptr'
 * add the similar pre condition for 'lvt_off_to_idx' as
   'vlapic_get_lvtptr' since all the function callers could guarantee it
 * remove the assertion in 'lvt_off_to_idx' since the pre condition
   could guarantee that the assertion will never happen
 * add the similar pre condition for 'vpic_set_irqstate' as
   'vioapic_set_irqstate' since all the function callers could guarantee it
 * remove the assertion in 'vpic_set_irqstate' since the pre condition
   could guarantee that the assertion will never happen

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-09-25 11:10:44 +08:00
Jie Deng f37588505b dm: virtio_net: remove netmap/vale backend support
Netmap/vale attempts to speed up network communication by bypassing the
TCP/IP network stack, which requires patching the physical NIC driver so
that applications developed based on netmap can interact directly with
the physical NIC driver. It may make sense for some specific scenarios
which requres very high bandwith (10Gb/s or 100Gb/s), we can even put up
with the complexity and compatibility introduced by this techology.
However for ACRN, a virtualization solution for IoT, there is no need to
support this backend. For 1Gb NICs or below, the VBS-U/tap solution
can already achieve near-native bandwidth. To keep simplicity and
improve compatibility, remove the netmap/vale support in dm.

Tracked-On: #1313

Signed-off-by: Jie Deng <jie.deng@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-09-25 11:10:28 +08:00
Shiqing Gao e0973e4883 hv: ioapic: convert some MACROs to inline functions
Convert GSI_MASK_IRQ and GSI_UNMASK_IRQ to inline functions.

v1 -> v2:
After changing GSI_MASK_IRQ and GSI_UNMASK_IRQ from MACROs to functions,
'gsi_(mask|unmask)_irq' are the exposed APIs and 'irq_gsi_mask_unmask'
becomes internal.
In order to reflect this change,
- change 'irq_gsi_mask_unmask' as internal function in ioapic.c
- declare 'gsi_(mask|unmask)_irq' in ioapic.h
- define 'gsi_(mask|unmask)_irq' in ioapic.c

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-09-25 11:09:56 +08:00
Minggui Cao 99ed5469ab DM: add a thread to monitor UOS ptdev intr status
This patch is for "interrupt storm mitigation", used to reduce
the effect on SOS if an "interrupt storm" happens in UOS.

Add a monitor thread to get UOS pass-through devices interrupt
freqency data; currently, if "interrupt storm" happens, it'll
send a command to delay interrupt injection to UOS for some time.

The parameters: interrupt storm threshold and delay time can be
adjusted according differt HW configure and use case.

Tracked-On: #866
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-09-25 11:09:35 +08:00
Minggui Cao d123083fa9 HV: add hypercall to monitor UOS PTdev intr status
The hypercall can be used by SOS/DM to monitor UOS
pass-thru devices' interrupt data; and if an "interrupt
storm" happens in UOS, it can be used to delay the UOS
PTdev interrupt's injection for sometime.

The two functions are implemented by one hypercall with
two sub-commands, and with the data/params in the buffer.

Tracked-On: #866
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-09-25 11:09:35 +08:00
Minggui Cao 918403f925 HV: modify code for intr storm detect & handling
This patch is to enhance the feature of "interrupt storm
mitigation"; when interrupt storm happens on one UOS
it should keep as smaller effect to SOS as possible.

Add variables in PTdev entry & VM, used to record one
UOS's pass-thru devices' interrupt data; add a function
to collect the data.

Also add a timer used to delay UOS pass-thru devices'
interrupt injection if an "interrupt storm" detected
by SOS.

Tracked-On: #866
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Li Fei1 <fei1.li@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-09-25 11:09:35 +08:00
Jack Ren de68ee7a09 version: 0.3-unstable
Signed-off-by: Jack Ren <jack.ren@intel.com>
2018-09-25 09:49:34 +08:00
Jack Ren cd4919a93c version: v0.2
Signed-off-by: Jack Ren <jack.ren@intel.com>
2018-09-25 09:44:20 +08:00
David B. Kinder d08256dfa9 doc: code-block text not readable
The .. code-block:: console directive (used for white text on a black
background) didn't handle some CSS cases properly resulting in
unreadable grey text on a black background.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-24 15:31:37 -07:00
David B. Kinder 23cf8079e7 doc: update tagged release doc build instructions
Update the doc build instructions to include how to update the version
navigation selector (bottom of the left nav panel), and make commands
for building and publishing specific tagged releases (e.g., 0.2)

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-24 13:43:03 -07:00
David B. Kinder b5bf00b6e0 doc: update doc version menu for v0.2 release
Update conf.py selector list to include version 0.2 documentation (and
fix an URL typo in the release notes).

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-24 11:01:15 -07:00
David B. Kinder c7d87795f0 doc: release notes update for v0.2 release
Remove "DRAFT" indicator, and a few tweaks to repo description and
download instructions noticed in PR #1316

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-24 10:44:19 -07:00
Xie, nanlin 8dba99f8c1 doc: Add new known issue in v0.2 release note.
Add new known issue in v0.2 release note.

Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2018-09-24 08:50:34 -07:00
David B. Kinder f20ca31145 doc: add tags and checkout info to release notes
Add instructions for accessing source for the v0.2 tagged
release.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-20 23:19:26 -07:00
Xie, nanlin 6709a08580 doc: Add change log in v0.2 release note.
Add change log in v0.2 release note.

Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2018-09-20 21:30:57 -07:00
David B. Kinder 7dd3207a6a doc: fix typo in network virt hld
punctuation fix

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-20 10:23:48 -07:00
David B. Kinder 01ce3b6aee doc: sort title in developer HLD section
We've got enough docs now that it would be better to put them in sorted
order by title.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-20 10:11:12 -07:00
David B. Kinder dae98a0409 doc: add network virtualization hld
Review, edit, and transcode network virtualization doc

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-20 10:02:43 -07:00
David B. Kinder 55a71e402d doc: add watchdog high-level design
Review, transcode, and publish watchdog high-level design doc.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-20 09:57:55 -07:00
David B. Kinder 31285a9fdd doc: add security hld document
review and publish ACRN security hld document, also added the oplus
replacement symbol

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-20 09:45:36 -07:00
Sainath Grandhi 8c9e0d17db hv: init_iommu rework to enable IOMMU for partition mode ACRN
Current code enables IOMMU from init_iommu_vm0_domain which is called
from vm0/sos boot sequence. For partition mode VMs, this is not called as
VMs are numbered from 1.

This patch adds support to initialize root table pointer for each IOMMU
and enable all IOMMUs from init_iommu. Hence IOMMUs are enabled even
though ACRN does not boot vm0.

This patch also has changes to fix #1270.

Tracked-On: #1246 #1270
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
2018-09-20 11:14:07 +08:00
Binbin Wu 53731905d7 dm: passthru: enable NHLT table for audio passthru
CAVS audio driver depends on the NHLT table to get topology info.
Enable NHLT table in DM for audio passthrough.
Also increase the size reserved for NHLT in ACPI table from 2048B to 2560B.

Tracked-On: #1284
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-09-20 11:13:32 +08:00
CHEN Gang 33acca5d86 tools: acrn-crashlog: exclude crashlog tool for release version
This patch is to exclude crashlog tool for release version.

Tracked-On: #1024
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Acked-by: Zhang Di <di.zhang@intel.com>
2018-09-20 11:12:52 +08:00
Chaohong guo 9817eb3909 Add a comment for switch fallthrough to quiet lint warning
Some code has switch fallthrough cases, it causes some warning during
compiling. Adding a comment can quiet it.

Tracked-On:#1260
Signed-off-by: Chaohong Guo <chaohong.guo@intel.com>
Acked-by: Gen Zheng <gen.zheng@intel.com>
2018-09-19 14:32:02 +08:00
Chaohong guo 0306bb47c8 Removed dead funcs in EFI stub module
Due to the last patches, some funcs in malloc.c and stdlib.h files for
EFI stub module are no longer used. This commit just removes them, no
other changes is being introduced. The funcs are:
    emalloc/efree, calloc/malloc/free, strstr/strdup

Tracked-On:#1260
Signed-off-by: Chaohong Guo <chaohong.guo@intel.com>
Ackedr-by: Gen Zheng <gen.zheng@intel.com>
2018-09-19 14:32:02 +08:00
Chaohong guo 1d15b98730 Replace the call to emalloc() to uefi pool allocation
emalloc() is called only by construct_mbi() during creating e820 mmap
layout. The switching has two benefits: first, UEFI FW might keep some
memory in pool, unlike call to emalloc(), call to allocate_pool() might
have no impact on e820 mmap; on the other hand, we can remove emalloc()
routine after this switching.

Tracked-On:#1260
Signed-off-by: Chaohong Guo <chaohong.guo@intel.com>
Reviewed-by: Anthony Xu <Anthony.Xu@intel.com>
Acked-by: Gen Zheng <gen.zheng@intel.com>
2018-09-19 14:32:02 +08:00
Chaohong guo 951a24cd3d allocate boot related struct right after hypervisor memory
To reduce the call to dynamic memory allocation, the patch tries to
alloate memroy together with hypervisor when hypervisor is being
relocated by efi stub code. The memory allocated will be right at the
end of HV memory. Three structs will be done in this way: 1) boot_ctx,
which saves EFI boot state and is passed to SOS; 2) multiboot_info,
faked multi-boot header for passing boot info to hypervisor;  and 3)
multiboot_mmap, e820 mmap structure.

after this, the EFI stub code (which boot hypervisor) will only have 3
to dynamic memory:
 1. the call for hv binary and the 3 struct;
 2. the call to CPU boot trampoline code;
 3. the call to alloc mmap buf when inquery memory layout from UEFI FW;

Tracked-On:#1260
Signed-off-by: Chaohong Guo <chaohong.guo@intel.com>
Reviewed-by: Jason Chen <jason.cj.chen@intel.com>
Reviewed-by: Anthony Xu <Anthony.Xu@intel.com>
Reviewed-by: Eddie Dong <Eddid.Dong@intel.com>
Acked-by: Gen Zheng <gen.zheng@intel.com>
2018-09-19 14:32:02 +08:00
Chaohong guo 6085781983 Replace __emalloc() with a call to uefi allocate_page()
UEFI provides the func allocate_pages() with the option of AllocateAddress
and AllocateMaxAddress to allocate memory at fixed address or below the
specified address respectively. Make use of the interface, simplify the
memory allocation for hyperivosr when CONFIG_RELOC is enabled.

Tracked-On:#1260
Signed-off-by: Chaohong Guo <chaohong.guo@intel.com>
Reviewedd-by: Anthony Xu <Anthony.Xu@intel.com>
Acked-by: Gen Zheng <gen.zheng@intel.com>
2018-09-19 14:32:02 +08:00
Chaohong guo fea102ea69 Remove emalloc_for_low_mem() routine in EFI boot code of HV
CPU boot binary need to reside in the memory below 1MB. UEFI firmware
does provide that functionality to limit the highest physical addr of
allocated memory. we just call the right UEFI API and no longer do it
in EFI stub code.

Tracked-On:#1260
Signed-off-by: Chaohong Guo <chaohong.guo@intel.com>
Reviewed-by: Jason Chen <jason.cj.chen@intel.com>
Acked-by: Gen Zheng <gen.zheng@intel.com>
Reviewed-by: Anthony Xu <Anthony.Xu@intel.com>
2018-09-19 14:32:02 +08:00
Yan, Like ccf562402e hv:irq: avoid out-of-range access to irq_alloc_bitmap[]
Logically, out-of-range access won't happen at these places. However, it
depends on the behaviour of other codes.
This commit makes changes to explicitly eliminate the possibility in these
functions.

Tracked-On: #1235
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-09-19 12:58:59 +08:00
Yin Fengwei 4a038d18b1 dm: workaroud for DM crash when doing fastboot reboot
This is temperory workaround for DM crash when doing fastboot
reboot. In fastboot, it will disable USB host functionality by
disable device respsone to one PCI bar. While DM code just release
the bar in this case. Which break the reboot functionality.

The workaround is to remove the assert to avoid DM abort. This is
safe because reboot will remove all memory range registered.

We will have offiical fixing later.

Tracked-On: #1277
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-09-19 10:47:59 +08:00
Xiaoguang Wu 688cddac6a DM USB: xHCI: enable USB xHCI emulation in LaaG and AaaG.
Change launch_uos.sh to enable USB xHCI full emulation support.

Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Tracked-On: #1242
2018-09-19 10:47:10 +08:00
Zhang, wenling d4afddc0a7 Revert "hv: init_iommu rework to enable IOMMU for partition mode ACRN"
This reverts commit d8508e4229.
2018-09-19 09:24:02 +08:00
David B. Kinder 40dfd3fc24 doc: edit 0.2 release notes
Followup #1281 update with some spelling and formatting fixes

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-18 09:19:48 -07:00
Xie, nanlin 737c29fad8 doc: Add known issues in v0.2 release note.
Add known issues and description in v0.2 release note.

Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2018-09-18 09:06:09 -07:00
Yonghua Huang 994a375103 HV:fix potential buffer overflow issues
- use sizeof(struct lapic_regs),instead of arbitrary size
   to lear 'apic_page' memory region in vlapic.c
 - fix potential buffer overflow issues in vpic.c & ioapic.c

Tracked-On: #1252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-18 16:14:27 +08:00
Victor Sun b501ce4388 HV: remove dead APIC info MACROs in bsp
These MACROs are never used by current code so remove it. The needed APIC
info is defined in other files with other MACROs.

We will unify kinds of APIC info definition in one place soon.

Tracked-On: #1274

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-18 15:56:18 +08:00
Victor Sun 2197f4306a HV: Add acpi_fixup api to override acpi on needs
Add acpi_fixup() api in bsp that can override platform ACPI info when
do init_bsp(), this is useful when platform bootloader is not lock
down before production.

In current code only the wake vector addresses would be parsed after
boot and then override to host_acpi_info, we can add more in furture
based on our needs.

Tracked-On: #1264

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-18 13:34:47 +08:00
Victor Sun 0d5ad8a522 HV: add simple parser for ACPI data table
Per ACPI spec, there are two fundamental types of ACPI tables:

Tables that contain AML code produced from the ACPI Source Language (ASL).
These include the DSDT, any SSDTs, and sometimes OEM-specific tables (OEMx).

Tables that contain simple data and no AML byte code. These types of tables
are known as ACPI Data Tables. They include tables such as the FADT, MADT,
ECDT, SRAT, etc. -essentially any table other than a DSDT or SSDT.

The second type of table, the ACPI Data Table, could be parsed here.

If Kconfig of CONSTANT_ACPI is set to yes, this parser is not needed.

Tracked-On: #1264

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-18 13:34:47 +08:00
Victor Sun a1e9fdc7f9 HV: add Kconfig of CONSTANT_ACPI
If CONFIG_CONSTANT_ACPI is true, then the value in host_acpi_info structure
is constant. Otherwise the host_acpi_info value could be overrided.

This is useful when platform ACPI table value is not fixed in Bootloader
before production.

In production release, this config should be set to yes.

Tracked-On: #1264

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-18 13:34:47 +08:00
Junjun Shan eb8c4fb0d5 hv:Fix Implict conversion:actual to formal param
MISRAC has requirement about implict conversion: actual to formal
param. This patch is used to fix part of these violations.

1.Add a new structure seg_desc_vmcs to hold the VMCS field address of
segment selector to clean up seg_desc structure.

2.Add the definition of maximum MSI entry and the relevant judgement.

3.The violations in shell.c, logmsg.c will be fixed in other series of
patches with modification of function snprintf(), vsnprintf() and other
related usages.

v1->v2:
  *Move the definition of struct seg_desc_vmcs from instr_emul.h to
   instr_emul.c.
  *Modify the formal parameter type in function definition from uint8_t
   to char instead of using cast.
  *Drop the const declaration for char data in formal parameter.

v2->v3:
  *update the data missing conversion.
  *change type of internal parameter len to avoid casting in npklog.c.
  *change the conversion from signed char to unsigned int in
   uart16550_getc() to solve sign-extension.

Tracked-On: #861
Signed-off-by: Junjun Shan <junjun.shan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-09-18 13:09:39 +08:00