Commit Graph

4062 Commits

Author SHA1 Message Date
fuyanX bde1d4b1bb acrn-hv: code review fix lib/string.c
In lib/string.c, strncmp doesn't consider condition "n_arg=0",
just add a process to "n_arg=0".

Tracked-On: projectacrn/acrn-hypervisor#3466
Signed-off-by: YanX Fu <yanx.fu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-30 14:38:03 +08:00
yuhong.tao@intel.com 653aa859b1 DM: monitor support force stop
When someone send DM message DM_STOP, with a non-zero data.acrnd_stop.force
value, DM set suspend mode to VM_SUSPEND_POWEROFF directly, that will
cause DM quit main loop. That can force stop VM

Tracked-On: #3484
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2019-07-30 13:27:16 +08:00
yuhong.tao@intel.com 8b27daa778 tools: acrnctl add '--force' option to 'stop' cmd
Run 'acrnctl stop VM_NAME --force‘ to force stop VM

When run 'acrnctl stop VM_NAME', acrn-dm let guest OS to shutdown
itself. If something wrong with guest OS, it can't shutdown, we can
run 'acrnctl stop VM_NAME --force', thus acrn-dm directly set suspend
mode to VM_SUSPEND_POWEROFF and quit main loop.

Tracked-On: #3484
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2019-07-30 13:27:16 +08:00
yuhong.tao@intel.com 59fd4202d3 tools: add force parameter to acrn VM stop operations
Add 'force' parameter to acrn_stop(), which will be write to request
message, the value of data.acrnd_stop.force. So we can tell DM to
force stop VM, instead of telling UOS to shutdown itself.

Tracked-On: #3484
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
2019-07-30 13:27:16 +08:00
Yang, Yu-chu d1c8a514f6 doc: Add ovmf option description
Added ovmf NV storage writeback option "w" description and usage example.

Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2019-07-29 20:36:43 -07:00
Victor Sun 9139f94ec9 HV: correct CONFIG_BOARD string of apl up2
The CONFIG_BOARD value in defconfig should match with Makefile, otherwise
the build might be failed in some condition.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
2019-07-30 09:50:10 +08:00
David B. Kinder 8ee1615e51 doc: fix issues from moving tools to misc/tools
PR #3483 cleaned up the project root folder and moved stuff that was in
/tools into a new /misc folder.  There were a few references to
the old /tools folder missed in that update, addressed in this PR.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-07-29 14:23:04 -07:00
Deb Taylor f44517c772 final edits 3
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor 879d01319f final edit 2
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor 1ccb902048 final edits
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor d485ed86c0 edits
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor 28e49ac183 more edits 2019-07-29 13:58:41 -07:00
Deb Taylor cc2714eee9 edits from David review
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor 7ee02d8eb0 Image resize
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor 87162e8b3e Making three images even smaller
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor 42960ddcc8 Adjust picture size for SGX
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Deb Taylor d0f7563d89 Corrected images and formatting
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
deb-intel ce7a126f7e Added 3 SGX images 2019-07-29 13:58:41 -07:00
Deb Taylor 01504ecf93 Initial SGX Virt doc upload
Signed-off-by: Deb Taylor <deb.taylor@intel.com>
2019-07-29 13:58:41 -07:00
Terry Zou a9c38a5cfb HV:Acrn-hypvervisor Root Directory Clean-up and create misc/ folder for Acrn daemons, services and tools.
This patch is to clean-up acrn-hypervisor root directory, targt only 5 folders under acrn-hypervisor:1.hypervisor,2.devicemodel,3.misc,4.doc,5.build

Tracked-On: #3482
Signed-off-by: Terry Zou <terry.zou@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-29 22:58:24 +08:00
Victor Sun 555a03db99 HV: add board specific cpu state table to support Px Cx
Currently the Px Cx supported SoCs which listed in cpu_state_tbl.c is limited,
and it is not a wise option to build a huge state table data base to support
Px/Cx for other SoCs. This patch give a alternative solution that build a board
specific cpu state table in board.c which could be auto-generated by offline
tool, then the CPU Px/Cx of customer board could be enabled;

Hypervisor will search the cpu state table in cpu_state_tbl[] first, if not
found then go check board_cpu_state_tbl. If no matched cpu state table is found
then Px/Cx will not be supported;

Tracked-On: #3477

Signed-off-by: Victor Sun <victor.sun@intel.com>
2019-07-29 20:25:16 +08:00
Victor Sun cd3b8ed7f1 HV: fix MISRA violation of cpu state table
Per MISRA C, the dimention of a array must be specified.

Tracked-On: #3477

Signed-off-by: Victor Sun <victor.sun@intel.com>
2019-07-29 20:25:16 +08:00
dongshen a092f40009 HV: make the functions void
The functions always return 0 so it makes sense to make them void functions

Tracked-On: #3475
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-29 09:58:57 +08:00
dongshen d6bf060573 HV: remove redundant function calling
The caller function has already done the checking to make sure the req is targeted
for the called functions, so there is no need to do the same checking in called
functions.

Remove calling of is_bar_offset() in vdev_pt_read_cfg/vdev_pt_write_cfg:
 In vpci.c's vpci_read_pt_dev_cfg and vpci_write_dev_cfg, vbar_access is called
 first to make sure the req is targed for vdev pt (vbar emulation) before
 dispatching the request to vdev_pt_read_cfg/vdev_pt_write_cfg, so there is no
 need to call is_bar_offset() again to do the same checking in vdev_pt_read_cfg/vdev_pt_write_cfg.

The same goes for msicap_access/msixcap_access

vbar_access should only check if the req is for bar access, it should not care
about whether the bar access is 4 bytes or 4 bytes aligned. The called function
vdev_pt_write_vbar will check and ignore the write access if it is not 4 bytes or 4 bytes
aligned, although this is counted as a bar access.

vdev_pt_read_vbar will check if the read access is 4 bytes or 4 bytes
aligned, although this is counted as a bar access, set read value (*val) to
-1 if the access is not 4 bytes (or aligned).

Tracked-On: #3475
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-07-29 09:58:57 +08:00
Gao Junhao c175141c77 dm: bugfix for remote launch guest issue
when stdio is set as a virtio-console, guest run in backend, the open
file descriptor is not referring to a terminal.

Tracked-On: #3473
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
2019-07-29 09:53:35 +08:00
Li, Fei1 4a27d08360 hv: schedule: schedule to idel after SOS resume form S3
After "commit f0e1c5e init vcpu host stack when reset vcpu", SOS resume form S3
wants to schedule to vcpu_thread not the point where SOS enter S3. So we should
schedule to idel first then reschedule to execute vcpu_thread.

Tracked-On: #3387
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2019-07-29 09:53:18 +08:00
Zhao Yakui 7b22456786 HV: Remove the mixed usage of inline assembly in wait_sync_change
When monitor/mwait is not supported, it still uses the inline assembly in
wait_sync_change. As it is not allowed based on MISRA-C, the asm wrapper
is used for pause scenario in wait_sync_change.

Tracked-On: #3442
Suggested-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2019-07-26 10:55:58 +08:00
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