Commit Graph

2609 Commits

Author SHA1 Message Date
Jason Chen CJ 63773db437 change get_monitor_cap to has_monitor_cap
has_monitor_cap is more suitable name

v2:
- rename to has_monitor_cap

Changes to be committed:
	modified:   arch/x86/cpu.c
	modified:   arch/x86/cpu_caps.c
	modified:   include/arch/x86/cpu_caps.h

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-19 09:07:14 +08:00
Jason Chen CJ 6830619d08 modulization: combine vmx_caps into cpu_caps
in cpu_caps.c, the vmx_caps & cpu_caps can be combined.

Changes to be committed:
	modified:   arch/x86/cpu_caps.c

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-19 09:07:14 +08:00
Jason Chen CJ 746fbe147d modulization: move functions related with cpu caps into cpu_caps.c
move cpu caps related functions like capability init/detect/check
in cpu.c & mmu.c into a new file cpu_caps.c

Changes to be committed:
	modified:   developer-guides/hld/hv-memmgt.rst
	modified:   ../hypervisor/Makefile
	modified:   ../hypervisor/arch/x86/cpu.c
	new file:   ../hypervisor/arch/x86/cpu_caps.c
	modified:   ../hypervisor/arch/x86/mmu.c
	modified:   ../hypervisor/arch/x86/vmx_asm.S
	modified:   ../hypervisor/include/arch/x86/cpu.h
	new file:   ../hypervisor/include/arch/x86/cpu_caps.h
	modified:   ../hypervisor/include/arch/x86/guest/vm.h
	modified:   ../hypervisor/include/arch/x86/mmu.h
	modified:   ../hypervisor/include/arch/x86/vmcs.h

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-19 09:07:14 +08:00
Yonghua Huang b8ffac8bac hv:fix possible buffer overflow in 'ptirq_get_intr_data()'
- 'buffer'with size of 'buffer_cnt',  will overflow in
    next loop if 'index == buffer_cnt - 1'.

Tracked-On: #1252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-18 20:07:36 +08:00
Huihuang Shi 6aa4227277 fix "Procedure has more than one exit point."
Misra C requires Function must have only 1 return entry.
Fixed it by use "if ... else ..." format.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-18 20:04:20 +08:00
Mingqiang Chi 65a7be8f52 hv:refine alloc_vm_id api
Fix violation "procedure has more than one exit point"
for this api.

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-18 16:31:21 +08:00
Li, Fei1 235ad0ff5d hv: refine memcpy_s
Use enhanced rep fast-string operation to refine memcpy_s.
And assume that the destination and the source would not overlap.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-12-18 16:30:27 +08:00
Li, Fei1 f9897c6f4e hv: refine memset
Use enhanced rep fast-string operation to refine memset.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-12-18 16:30:27 +08:00
Li, Fei1 78e9a84f39 hv: add fast string enhanced rep movsb/stosb check on initial
The ACRN suppose the CPU support fast string enhanced rep.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-12-18 16:30:27 +08:00
Zide Chen 3515ca1e65 hv: vpci: fix "Procedure has more than one exit point"
IEC 61508,ISO 26262 standards highly recommend single-exit rule.

Tracked-On: #861
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-18 16:29:53 +08:00
Zhipeng Gong c547e9cfb4 hv: enable/disable snoop control bit per vm
For security, this patch add one flag per vm and disable snoop control
for sos and enable snoop control for uos by default.

v2: add one flag in vm, not in iommu domain.
v3: add vm null check

Tracked-On: #2086
Signed-off-by: Zhipeng Gong <zhipeng.gong@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-18 13:45:10 +08:00
Zide Chen 2028034151 hv: MISRA-C fix "identifier reuse" in vpci code
13X: Identifier reuse: tag vs component.
A tag name shall be a unique identifier

Change the following names:
  struct msi --> struct pci_msi
  struct msix --> struct pci_msix
  struct vpci --> struct acrn_vpci
  union cfgdata -> union pci_cfgdata

Tracked-On: #861
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-18 13:39:15 +08:00
Conghui Chen 2ddd24e022 dm: storage: support discard command
Support DISCARD command is meaningful when eMMC usage is high or
there are lots of remove operations. For example, when Guest
Android is running, there will be lots of files being created and
removed. However, virtio-blk BE does not support DISCARD command,
data remove operation in UOS will not trigger erase in eMMC. After
period of time, the eMMC will be consumed out, and erase must be
done by eMMC firmware before writing any new data. This causes the
eMMC performance decrease in the whole system (SOS and UOS).
To solve the problem, DISCARD should be supported in virtio-blk BE.

Tracked-On: #2011
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-18 13:21:07 +08:00
Conghui Chen f71370ad81 dm: storage: rename delete to discard
To keep consistent with kernal code, change delete to discard.

Tracked-On: #2011
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-18 13:21:07 +08:00
Jason Chen CJ 36863a0b54 modulization: vmx on/off should not use vcpu param
vmx.c should only take care host vmx operations, which should not
contain vcpu reference, so refine vmx on/off APIs, move out use
of vcpu by adding one per cpu vmcs_run pointer.

as now each pcpu only run on one vcpu, so just keep running vmcs
in per cpu vmcs_run pointer is enough.

Changes to be committed:
	modified:   arch/x86/cpu.c
	modified:   arch/x86/init.c
	modified:   arch/x86/pm.c
	modified:   arch/x86/vmcs.c
	modified:   arch/x86/vmx.c
	modified:   include/arch/x86/per_cpu.h
	modified:   include/arch/x86/vmx.h

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-18 10:00:56 +08:00
Jason Chen CJ bed82dd3f8 cleanup vmcs source and header files
remove no need included header files and macro definitions

Changes to be committed:
	modified:   arch/x86/vmcs.c
	modified:   include/arch/x86/vmcs.h

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-12-18 10:00:56 +08:00
Jason Chen CJ 731c4836dd modulization: separate vmx.c into two parts
one part is pure vmx operations which keeps in vmx.c
the other part is vmcs operations which is vcpu related, move them
into vmcs.c

Changes to be committed:
	modified:   Makefile
	copied:     arch/x86/vmx.c -> arch/x86/vmcs.c
	modified:   arch/x86/vmx.c
	modified:   arch/x86/vmx_asm.S
	modified:   include/arch/x86/hv_arch.h
	new file:   include/arch/x86/vmcs.h
	modified:   include/arch/x86/vmx.h

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-12-18 10:00:56 +08:00
Peter Fang 0d5c65f1d2 hv: enforce data size on all out exits
The bit mask for an out instruction is only applied to hv inout
handlers.

Apply the bit mask to dm inout handlers as well.

Tracked-On: #2075
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-18 08:51:18 +08:00
Long Liu 5ab68eb97b dm: hw: Replace sscanf with permitted string API
Replace sscanf in device model hw directory

Tracked-On: #2079
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 19:17:29 +08:00
Long Liu 63b814e7e9 dm: hw: Replace strlen with strnlen
Replace strlen function with strnlen function in device-model

Tracked-On: #2079
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 19:17:29 +08:00
Long Liu eab7cd47ae dm: hw: Replace sprintf with snprintf
Replace function sprintf with snprintf in device model

Tracked-On: #2079
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 19:17:29 +08:00
Yin Fengwei 69dc939243 hv: drop the temperory stack for AP startup
By switching AP wakeup from broadcast to one by one, we could
set correct stack for each AP and drop the temp stack used during
AP boot.

Tracked-On: #2034
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-17 19:16:43 +08:00
Mingqiang Chi 74849cd983 modulization:move out efi dir from hypervisor
move acrn-hypervisor/hypervisor/bsp/uefi/efi
to   arcn-hypervisor/efi-stub
move acrn-hypervisor/hypervisor/bsp/uefi/clearlinux
to   acrn-hypervisor/efi-stub/clearlinux

Changes to be committed:
  modified:   Makefile
  modified:   doc/getting-started/apl-nuc.rst
  renamed:    hypervisor/bsp/uefi/efi/Makefile -> efi-stub/Makefile
  renamed:    hypervisor/bsp/uefi/efi/boot.c -> efi-stub/boot.c
  renamed:    hypervisor/bsp/uefi/efi/boot.h -> efi-stub/boot.h
  renamed:    hypervisor/bsp/uefi/clearlinux/acrn.conf ->
	      efi-stub/clearlinux/acrn.conf
  renamed:    hypervisor/bsp/uefi/efi/efilinux.h -> efi-stub/efilinux.h
  renamed:    hypervisor/bsp/uefi/efi/malloc.c -> efi-stub/malloc.c
  renamed:    hypervisor/bsp/uefi/efi/multiboot.h -> efi-stub/multiboot.h
  renamed:    hypervisor/bsp/uefi/efi/pe.c -> efi-stub/pe.c
  renamed:    hypervisor/bsp/uefi/efi/stdlib.h -> efi-stub/stdlib.h
  modified:   hypervisor/Makefile

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-17 15:46:23 +08:00
Jason Chen CJ 59e3f562b8 remove check_tsc
there is no need to clear CR4.TSD as there is no user mode
in ACRN hypervisor.

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
2018-12-17 14:31:52 +08:00
Jason Chen CJ d2bac7cc5d cpu_dead should only run on current pcpu
no need for input param pcpu_id.

Tracked-On: #1842
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-17 14:31:52 +08:00
Xiaoguang Wu d2627ecfcc DM USB: xHCI: fix an issues for failing to enumerate device
This is an obvious bug, which releases memory but still access the
data on the released memory. It is risky operation, and may result
failing to do normal enumlation process. This patch is used to fix
it.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 13:31:00 +08:00
Xiaoguang Wu 1c3344b782 DM USB: xHCI: change log level for S3 process
The USB S3 virtualization logic is complicated and heavily affected by system
timing. To make the debugging work easily, change related log level to facilitate
quick bug fixing.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-17 13:31:00 +08:00
Minggui Cao 3dadb62d0f HV: fix bug change default vuart IRQ for UP2 board
now UP2 board use ttyS1 as debug uart in HV, and vuart ttyS0 in
SOS kernel (acrn.conf default configure), its default IRQ is 4,
but SOS kernel will also assign IRQ4 to its ttyS1, they're sharing
one IRQ, and it can cause SOS boot hung issue, for HV not support
sharing IRQ now.

some boards use ttyS0 as debug uart, it has not this issue; for that
board, SOS will assign IRQ5 to its ttyS1, no sharing IRQ.

change it to IRQ6 to avoid the issue.

Tracked-On: #2030
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-17 11:08:56 +08:00
Zide Chen a3d2a7e726 hv: vpci: 2 MISRA-C violation fixes
36D Prototype and definition name mismatch
  pci_scan_bus() and sharing_mode_find_vdev() wrong parameter in prototype.
14D Attempt to change parameter passed by value.
  vmsix_table_rw() uses function parameter as local viarable.

Tracked-On: #861
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-16 14:52:44 +08:00
Zide Chen 44e9318c45 hv: vmsr: fix MISRA_C violations
106D No prototype for non-static function.
  2 functions missing prototyle declarations in header file.

120S Use of bit operator on signed type.
123S Use of underlying enum representation value.
  enum values are treated like unsigned integer in vmsr.c

Tracked-On: #861
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-16 14:52:22 +08:00
David B. Kinder 117b71e6af doc: add partition mode hld
Partition mode HLD content added to hypervisor hld.
Add target links in referenced docs.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-12-15 10:35:38 -08:00
Xie, nanlin ed5e210d91 Doc: Update GSG for v0.4 version and launch and acrn.conf sample script
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2018-12-15 10:12:44 -08:00
Yonghua Huang 57bf26dc17 hv: fix possible buffer overflow issues
- cpu_secondary_init() @cpu.c
 - ptirq_intx_pin_remap() @ assign.c
   etc.

Tracked-On: #1252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-14 20:38:15 +08:00
Yin Fengwei 73ab727434 dm: set correct thread name
When issue happen, we could identify which thread is impacted.
This could help stability issue debugging.

Tracked-On: #2037
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:50:50 +08:00
Jian Jun Chen cb31381561 dm: vhost: remove support for non-msix devices
irqfd only supports msix devices. In the current code a mevent is
added to poll the callfd from userspace to support intx devices.
This patch removes the support for non-msix devices since they are
not used in the current device model.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:49:55 +08:00
Jian Jun Chen b29fc619af dm: virtio-net: apply new mevent API to avoid race issue
Teardown callback is provided when mevent_add is called and it is
used to free the virtio-net resources.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-14 19:49:55 +08:00
Jian Jun Chen 4f36244fef dm: virtio-console: apply new mevent API to avoid race issue
Teardown callback is provided when mevent_add is called. A ref_count
is added to virtio_console data structure. Teardown callback needs to
free the resources of the backend and when the ref_count of the
virtio_console is zero the whole virtio-console is freed.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-14 19:49:55 +08:00
Jian Jun Chen baf8f8bdbf dm: virtio-input: apply new mevent API to avoid race issue
Teardown callback is provided when mevent_add is called and it is
used to free the virtio-input resources.

Tracked-On: #1877
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-12-14 19:49:55 +08:00
Xiaoguang Wu c2df4a8557 DM USB: xHCI: no wait logic implementation for S3
On Intel Apllo Lake platform, the VBus will drop after the SOC suspended,
hence during the SOS resuming process, there will be a disconnecting event
and a connecting event sent to each native USB device in order.

This patch will use new strategy for S3 resuming emultion.
  1. The DM set PORTSC register to 'no device attached' state when S3
     suspending started,
  2. SOS resuming starts and do nothing for device disconnecting event,
  3. 'Cache' device connecting event and don't report it to UOS,
  4. UOS believe no device attached due to PORTSC register state and
     begin to clear the resource allocated for the device before S3
     suspending,
  5. DM receives the Disable Slot command from UOS and report the 'cached'
     device connecting event to UOS, hence trigger the emulation behavior
     for the device.

The purpose of this strategy is to let UOS resuming proceed as quickly as
possible, which means the UI will be turned on quickly to user.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
Xiaoguang Wu 82659831f0 DM USB: xHCI: refine emulation for command XHCI_CMD_RS
According to xHCI spec 5.4.1.1, this command hasn't ask to clear
PORTSC for R/S handling. So the PORTSC should always present the
physical usb bus status.

The old implementation changes the PORTSC according whether the
pci_xhci_dev_emu struct is allocated, it is not consistent with
spec and this patch is used to fix it.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
Xiaoguang Wu e5c98e6d9a DM USB: add usb_dev_path_cmp function for convenience
Comparing two USB devices' path is frequently used operation, abstract
it as an seperated function for convenience.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
Xiaoguang Wu 6c1ca13767 DM USB: xHCI: remove the waiting 5 seconds wa for s3
This workaround will delay the UOS resuming for 5 seconds, this
behavior is not right and should be replaced by dynamic style.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-12-14 19:40:44 +08:00
Yonghua Huang 4fc5dcfc3e hv: enable SMAP in hypervisor
With SMAP enabled, hypervisor can't access pages that
owned by guest(either SOS or UOS), and an override is
is provided: stac()/clac() to enable/disable access to
guest's memory pages.

 Pre-conditon:
    Mark hypervisor owned pages as supervisor mode (U/S = 0),
       and set all othter memory pages as user mode (U/S = 1).

Tracked-On: #2056
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-14 15:24:26 +08:00
Yonghua Huang 57dfc7de05 hv: refine IOREQ state operation functions in hypervisor
1) add functions to set/get VHM request state.
2) modify 'complete_ioreq()' in io.c
3) update the caller code

Tracked-On: #2056
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-14 15:24:26 +08:00
Zide Chen c89d6e6526 modularization: clean up namings in vMTRR module
- rename 3 module interface APIs
  init_mtrr() -> init_vmtrr()
  mtrr_rdmsr -> read_vmtrr()
  mtrr_wrmsr() -> write_vmtrr()

- follow naming convention for other modules, rename struct mtrr_state
  to struct acrn_vmtrr. And add acrn_vcpu to it.

- because MTRR is x86 architecture specific, move struct acrn_vmtrr to
  struct acrn_vcpu_arch.

Tracked-on: #1842
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-14 09:43:06 +08:00
Zide Chen 6bbd0129c3 modularization: move vMTRR code to guest directory
MTRR emulation belongs to virtual CPU component.

- rename mtrr.c to vmtrr.c and move it to arch/x86/guest
- rename mtrr.h to vmtrr.h and move it to include/arch/x86/guest

Tracked-On: #1842
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-12-14 09:43:06 +08:00
Li, Fei1 e066774a1c hv: refine strnlen_s/strstr_s to only one exit point
Fix procedure has more than one exit point

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-12-14 09:42:49 +08:00
Li, Fei1 e114ea7e5d hv: timer: fix procedure has more than one exit point
Refine add_timer/timer_init to only one exit point

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-12-14 09:42:49 +08:00
Li, Fei1 4131d46f84 hv: remove goto in ept_violation_vmexit_handler
Using goto leads the code to be difficult to read and maintain

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
2018-12-14 09:42:49 +08:00
Zide Chen a958fea7a4 hv: emulate IA32_TSC_ADJUST MSR
Intercept IA32_TSC_ADJUST MSR so that writing IA32_TSC_ADJUST from the
guests won't impact the TSC in root mode or potentially other vCPUs in
the same pCPU.

- MSR TSC_ADJUST needs to be isolated between normal and secure world,
  so it's included in NUM_WORLD_MSRS.
- Upon writing to either IA32_TSC_ADJUST or IA32_TSC from the guests,
  don't write to physical MSRS so it won't impact the host side, but
  update the TSC offset VM-execution control.
- don't need to intercept rdmsr for IA32_TIME_STAMP_COUNTER.
- add the missing statement in save_world_ctx() to save the tsc_offset
  during world switch.

Tracked-On: #1867
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-12-14 09:11:37 +08:00