Commit Graph

3885 Commits

Author SHA1 Message Date
Zhao Yakui baf7d90fdf HV: Refine the usage of monitor/mwait to avoid the possible lockup
Based on SDM Vol2 the monitor uses the RAX register to setup the address
monitored by HW. The mwait uses the rax/rcx as the hints that the process
will enter. It is incorrect that the same value is used for monitor/mwait.
The ecx in mwait specifies the optional externsions.

At the same time it needs to check whether the the value of monitored addr
is already expected before entering mwait. Otherwise it will have possible
lockup.

V1->V2: Add the asm wrappper of monitor/mwait to avoid the mixed usage of
inline assembly in wait_sync_change

v2-v3: Remove the unnecessary line break in asm_monitor/asm_mwait.
       Follow Fei's comment to remove the mwait ecx hint setting that
treats the interrupt as break event. It only needs to check whether the
value of psync_change is already expected.

Tracked-On: #3442
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-26 10:55:58 +08:00
Li, Fei1 11cf9a4a8a hv: mmu: add hpa2hva_early API for earlt boot
When need hpa and hva translation before init_paging, we need hpa2hva_early and
hva2hpa_early since init_paging may modify hva2hpa to not be identical mapping.

Tracked-On: #2987
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-26 09:10:06 +08:00
Li, Fei1 40475e22b8 hv: debug: use printf to debug on early boot
1) Using printf to warn if platform ram size configuration is wrong.
2) Using printf to warn if the platform is not supported by ACRN hypervisor.

Tracked-On: #2987
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-26 09:10:06 +08:00
Li, Fei1 cc47dbe769 hv: uart: enable early boot uart
Enable uart as early as possible to make things easier for debugging.
After this we could use printf to output information to the uart. As for
pr_xxx APIs, they start to work when init_logmsg is called.

Tracked-On: #2987
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-26 09:10:06 +08:00
Conghui Chen 3945bc4c40 dm: array bound and NULL pointer issue fix
Remove the possible NULL pointer access code for virtio-console.c
Add '\0' to end of native_patch[], to avoid the potential issue when
using %s to print the array for virtio-i2c.c

Tracked-On: #3467
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yonghua Huang <Yonghua.huang@intel.com>
2019-07-26 08:55:11 +08:00
David B. Kinder 9fef51abf9 doc: organize release notes into a folder
Unclutter the main doc folder by putting all the release notes
into a separate folder.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-07-24 09:47:24 -07:00
Gao Junhao ff299d5c50 dm: support VMs communication with virtio-console
Add feature that client uos can still connect to server uos after
rebooting.

Tracked-On: #3459
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-07-24 16:26:36 +08:00
Li, Fei1 18ecdc123a hv: uart: make uart base address more readable
Now if the uart is mapped to a PIO address space, the uart base address is a physical
PIO address; if it's mapped to a MMIO address space, the uart base address is a
virtual MMIO address. Add union uart_addr structure to imply this.
And define a console_uart structure to add all uart related fields into this structure.

Tracked-On: #2987
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-24 16:11:38 +08:00
Yonghua Huang 49e60ae151 hv: refine handler to 'rdpmc' vmexit
PMC is hidden from guest and hypervisor should
 inject UD to guest when 'rdpmc' vmexit.

Tracked-On: #3453
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-24 15:05:46 +08:00
Lei Lu 0887eecde8 doc: remove deprecated sos_bootargs
SOS bootargs is specified in vm_configurations.h in different scenarios.
  The files in devicemodel/samples/<board>/sos_bootargs_*.txt are removed.
  remove deprecated sos_bootargs in create-up2-images.sh

Tracked-On: #3443

Signed-off-by: Lei Lu <leix.lu@intel.com>
2019-07-23 17:41:29 -07:00
yunzha4x 2e79501e4d doc:udpate using_partition_mode_on_nuc nuc7i7bnh to nuc7i7dnb
Signed-off-by: yunzha4x <yunx.zhang@intel.com>
2019-07-23 09:46:09 -07:00
Victor Sun a7b6fc74e5 HV: allow write 0 to MSR_IA32_MCG_STATUS
Per SDM, writing 0 to MSR_IA32_MCG_STATUS is allowed, HV should not
return -EACCES on this case;

Tracked-On: #3454

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-23 15:24:50 +08:00
Victor Sun 3cf1daa480 HV: move vbar info to board specific pci_devices.h
The vbar info which hard-coded in scenarios/logical_partition/pt_dev.c
is board specific actually, so move these information to
arch/x86/configs/$(CONFIG_BOARD)/pci_devices.h.

Please be aware that the memory range of vBAR should exactly match with
the e820 layout of VM.

Tracked-On: #3214

Signed-off-by: Victor Sun <victor.sun@intel.com>
2019-07-23 09:12:50 +08:00
Yin Fengwei ce4d71e038 vpci: fix coding style issue
This is a followup patch to fix the coding style issue introduced
in by commit "c2d25aafb889ade954af8795df2405a94024d860":
  The unmodified pointer should be defined as const

Also addressed one comments from Fei to use reversed function call
in vpci_init_pt_dev and vpci_deinit_pt_dev.

Tracked-On: #3241
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-22 16:21:40 +08:00
Victor Sun a27ce27a2e HV: rename nuc7i7bnh to nuc7i7dnb
NUC7i7BNH is not a board name but a product name of KBL NUC, and it is
outdated to support LOGICAL_PARTITION scenario and HYBRID scenario.

NUC7i7DNH is the product name of KBL NUC that ACRN currently supported,
but its official board name is NUC7i7DNB, so change the folder name from
"nuc7i7bnh" to "nuc7i7dnb" under arch/x86/configs/.

Please refer more details on below documentation:
Intel® NUC Board/Kit NUC7i7DN Technical Product Specification

Tracked-On: #3446

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Xiangyang Wu <xiangyang.wu@linux.intel.com>
2019-07-22 16:21:12 +08:00
Yonghua Huang dde20bdb03 HV:refine the handler for 'invept' vmexit
'invept' is not expected in guest and hypervisor should
inject UD when 'invept' VM exit happens.

Tracked-On: #3444
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-22 13:23:47 +08:00
Yang, Yu-chu 16a7d2522c DM: ovmf NV storage writeback support
To support modification of OVMF NV storage, add an option "w" for
--ovmf to write the changed OVMF NV data section back to the OVMF image
from guest memory before deinit operations. This will enable persistent
EFI variables. Only option "w" is supported, dm will exit if passing
invalid option. It expects OVMF NV storage writeback with option "w"
when power off or reboot the UOS, poweroff, cold and warm reboot in EFI
shell and when dm recieves SIGINT and SIGHUP.

Tracked-On: #3413
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Reviewed-by:Eddie Dong <eddie.dong@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-07-22 11:18:47 +08:00
Peter Fang c787aaa328 dm: allow High BIOS to be modifiable by the guest
In order to support OVMF NV storage writeback, the High BIOS region in
the guest will behave as RAM and can be modified by OVMF itself. Give
the guest write permission to this page.

Tracked-On: #3413
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-07-22 11:18:47 +08:00
Yin, Fengwei 12955fa80f hv_main: Remove the continue in vcpu_thread
To avoid acrn_handle_pending_request called twice within one vmexit,
we remove the error-prone "continue" in vcpu_thread.

And make vcpu shecheduled out if fatal error happens with vcpu.

Tracked-On: #3387
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-22 09:55:06 +08:00
Yin Fengwei f0e1c5e55f vcpu: init vcpu host stack when reset vcpu
Otherwise, the previous local variables in host stack is not reset.

Tracked-On: #3387
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-22 09:55:06 +08:00
Yin, Fengwei 11e67f1c4a softirq: move softirq from hv_main to interrupt context
softirq shouldn't be bounded to vcpu thread. One issue for this
is shell (based on timer) can't work if we don't start any guest.

This change also is trying best to make softirq handler running
with irq enabled.

Also update the irq disable/enabel in vmexit handler to align
with the usage in vcpu_thread.

Tracked-On: #3387
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-22 09:55:06 +08:00
Yin Fengwei cb9866bc6c softirq:spinlock: correct vioapic/vpic lock usage
Now, we are trying to move softirq from vcpu thread context to
real softirq context (it was not real softirq context even it has
softirq name), we need to make sure all the spinlock could be
access from softirq handler to use spinlock_irqsave_obtain and
spinlock_irqrestore_release.

Tracked-On: #3387
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-07-22 09:55:06 +08:00
Conghui Chen 87558b6f98 doc: remove vuart configuration in nuc and up2
As the vuart config option is not support anymore, remove it.

Signed-off-by: Conghui Chen <conghui.chen@intel.com>
2019-07-19 12:13:11 -07:00
lirui34 e729b657c0 doc: Add ACRN tag or Clear Linux version info for some tutorials
Neither ACRN tag nor Clear Linux version is specified in some tutorials.
Declare those information for those tutorials.

Signed-off-by: lirui34 <ruix.li@intel.com>
2019-07-19 12:12:23 -07:00
lirui34 ffa7f80544 doc: Add tutorial to learn to sign binaries of a Clear Linux image.
This tutorial will describe steps to sign binaries of
a Clear Linux image that allows user to launch VM
throught the secure boot enabled OVMF.

Signed-off-by: lirui34 <ruix.li@intel.com>
2019-07-19 12:10:23 -07:00
David B. Kinder be44e138fd doc: update WaaG doc
Update batch script documentation and add reference to source of
material.  Also some grammar cleanup in a few places.

Include an updated install_by_vga_gsg.tar.gz with an updated script with
copyright/licensing added.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-07-19 12:09:08 -07:00
Yan, Like a4abeaf980 hv: enforce no interrupt to RT VM via vlapic once lapic pt
Because we depend on guest OS to switch x2apic mode to enable lapic pass-thru, vlapic is working at the early stage of booting, eg: in virtual boot loader.
After lapic pass-thru enabled, no interrupt should be injected via vlapic any more.

This commit resets the vlapic to clear the pending status and adds ptapic_ops to enforce that no more interrupt accepted/injected via vlapic.

Tracked-On: #3227
Signed-off-by: Yan, Like <like.yan@intel.com>
2019-07-19 16:47:06 +08:00
Yan, Like 97f6097f04 hv: add ops to vlapic structure
This commit adds ops to vlapic structure, and add an *ops parameter to vlapic_reset().
At vlapic reset, the ops is set to the global apicv_ops, and may be assigned
to other ops later.

Tracked-On: #3227
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-19 16:47:06 +08:00
Conghui Chen c1b4121e3b dm: virtio-i2c: minor fix
Change the condition of checking native adapter number.
Change sprintf to snprintf.

Tracked-On: #3437
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-19 09:12:34 +08:00
David B. Kinder d28264ff56 doc: update CODEOWNERS for doc reviews
Deb (@deb-intel) added as a reviewer for ACRN documentation.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Tracked-On: #3419
2019-07-18 08:41:58 -07:00
fuzhongl a90a6a1059 HV: add SDC2 config in hypervisor/arch/x86/Kconfig
Per community requirement;up to three post-launched VM might be
needed for some automotive SDC system, so add SDC2 scenario to
satisfy this requirement.

Tracked-On: #3429
Signed-off-by: fuzhongl <fuzhong.liu@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2019-07-18 15:03:14 +08:00
Tianhua Sun 796ac55016 hv: fix symbols not stripped from release binaries
In release environment, binary files must be stripped in
order to remove debugging code sections and symbol information
that aid attackers in the process of disassembly and reverse
engineering.
Use '-s' linking option to remove symbol table and relocation
information from release binaries.

Tracked-On: #3427
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-18 15:03:00 +08:00
Tianhua Sun 63e258bd01 efi-stub: update string operation in efi-stub
Remove unsafe API in efi-stub
1, use Strnlen instead of StrLen except the parameter
   is a static string.
2, strlen() only work on static strings.

Tracked-On: #3276
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-07-18 15:03:00 +08:00
Conghui Chen 05acc8b705 hv: vuart: bugfix for communication vuart
When a VM send data to its communication vuart, the vuart driver should
inject a DR interrupt to target VM and also inject a THRE interrupt to
self VM. But the original code inject the THRE interrupt to target VM,
correct it in this patch.

Tracked-On: #3423
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-18 09:28:27 +08:00
David B. Kinder ecc472f9b4 doc: fix format in WaaG document
Update WaaG document with Windows (upper case) and step numbering.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-07-17 09:35:32 -07:00
ruix.li 7990f52f59 doc: Add introduction of using Windows Guest OS
Add introduction of using Windows Guest OS

Tracked-On: #3341
Signed-off-by: ruix.li <ruix.li@intel.com>
2019-07-17 09:10:10 -07:00
Victor Sun 600aa8ea5a HV: change param type of init_pcpu_pre
When initialize secondary pcpu, pass INVALID_CPU_ID as param of init_pcpu_pre()
looks weird, so change the param type to bool to represent whether the pcpu is
a BSP or AP.

Tracked-On: #3420

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-17 13:48:00 +08:00
Li, Fei1 e352553e1a hv: atomic: remove atomic load/store and set/clear
In x86 architecture, word/doubleword/quadword aligned read/write on its boundary
is atomic, so we may remove atomic load/store.
As for atomic set/clear, use bitmap_set/claer seems more reasonable. After replace
them all, we could remove them too.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-17 09:20:54 +08:00
Li, Fei1 b39526f759 hv: schedule: vCPU schedule state setting don't need to be atomic
vCPU schedule state change is under schedule lock protection. So there's no need
to be atomic.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-17 09:20:54 +08:00
Li, Fei1 8af334cbb2 hv: vcpu: operation in vcpu_create don't need to be atomic
For pre-launched VMs and SOS, vCPUs are created on BSP one by one; For post-launched VMs,
vCPUs are created under vmm_hypercall_lock protection. So vcpu_create is called sequentially.
Operation in vcpu_create don't need to be atomic.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-17 09:20:54 +08:00
Li, Fei1 540841ac5d hv: vlapic: EOI exit bitmap should set or clear atomically
For per-vCPU, EOI exit bitmap is a global parameter which should set or clear
atomically since there's no lock to protect this critical variable.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-07-17 09:20:54 +08:00
Li, Fei1 0eb0854858 hv: schedule: minor fix about the return type of need_offline
ACRN Coding guidelines requires type conversion shall be explicity. However,
there's no need for this case since we could return bool directly.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-17 09:20:54 +08:00
Li, Fei1 e69b3dcf67 hv: schedule: remove runqueue_lock in sched_context
Now sched_object and sched_context are protected by scheduler_lock. There's no
chance to use runqueue_lock to protect schedule runqueue if we have no plan to
support schedule migration.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
2019-07-17 09:20:54 +08:00
Li, Fei1 b1dd3e26f5 hv: cpu: pcpu_active_bitmap should be set atomically
It's a global parameter and could be set concurrently. So it should be set atomically.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Reviewed-by: Yin Fenwgei <fengwei.yin@intel.com>
2019-07-17 09:20:54 +08:00
Li, Fei1 1081e1000e hv: schedule: NEED_RESCHEDULE flag should be set atomically
Schedule context flag may set out of schedule lock protection, like NEED_OFFLINE
or NEED_SHUTDOWN_VM. So NEED_RESCHEDULE flag should be set atomically too.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-17 09:20:54 +08:00
Victor Sun 7d43a93fb7 HV: validate multiboot cmdline before merge cmdline
In grub 2.02, the flag of MULTIBOOT_INFO_HAS_CMDLINE is set even there is
no cmdline was configured. So we need to validate the content of cmdline
in multiboot info. If there is no cmdline exist, we should not do merge
cmdline for SOS VM.

Tracked-On: #3214

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-16 14:10:34 +08:00
Liu, Xinwu 45afd77712 tools:acrn-crashlog: detect the panic event from all pstore files
As all pstore files may include the kernel panic information, this patch
tries to find the clue from all messages under /sys/fs/pstore instead of
console-ramoops-0.
To avoid the constant growing of logs, it has to remove the pstore
files after panic being detected.

Tracked-On: #3390
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Acked-by: Chen, Gang <gang.c.chen@intel.com>
2019-07-16 11:13:09 +08:00
yunzha4x be586b4959 doc:Update Getting started guide for Intel NUC
Signed-off-by: yunzha4x <yunx.zhang@intel.com>
2019-07-15 13:46:54 -07:00
Yin Fengwei 009a16bd7d vhostbridge: update vhostbridge to use vdev_ops
And use vhostbridge for both SOS and pre-launched VM.

Tracked-On: #3241
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-15 10:35:47 +08:00
Yin Fengwei 9eba328bef vdev_ops: add general vdev ops
And use the ops based operations instead of direct access vdev
specific API.

Tracked-On: #3241
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-15 10:35:47 +08:00