Commit Graph

6323 Commits

Author SHA1 Message Date
Yang,Yu-chu ad48bf254d config-tools: update qemu.xml
Make up qemu.xml to compromise the static allocators which use the
new xpath based on board inspector.

Tracked-On: #6102
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-06-03 14:43:44 +08:00
Kunhui Li ff2102a5c1 config_tools: replace illegal character with escaped character
For illegal characters, replace original characters with escaped characters in board.xml.

Tracked-On: #6113
Signed-off-by: Kunhui Li <kunhuix.li@intel.com>
2021-06-01 11:28:52 +08:00
Yonghua Huang d0426fd249 dm: add RTCT v2 support for guest
The latest version of RTCT specification is version 2.

 This patch is to add RTCT v2 support for virtual RTCT
 of guest.

Tracked-On: #6020
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-06-01 10:41:51 +08:00
Yonghua Huang 69808297b1 dm: update vRTCT module to support new vLAPIC solution
Emulation of guest lapic ID has been enhanced to
 indicate the topology of vCPU hierarchy.

 This patch refine logic to build virtual RCTC_v1 table
 of guest to adapt above lapic ID changes.

Tracked-On: #6020
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-06-01 10:41:51 +08:00
Shuang Zheng 2247aeed69 config_tools: add RTCT table support in pre-launched VMs
add RTCT table integrated with ACPI binary for pre-launched
VMs.

Tracked-On: #6015

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
2021-06-01 09:11:03 +08:00
Jie Deng c08ceb25c5 dm: NULL check of vq->used in virtio_net_ping_rxq
Add a check on this place to avoid NULL access issue.

Tracked-On: #6100
Signed-off-by: Jie Deng <jie.deng@intel.com>
2021-06-01 08:22:45 +08:00
Yonghua Huang 1a6ead9af5 hv: update RTCT ACPI table detecting
Signature of RTCT ACPI table maybe "PTCT"(v1) or "RTCT"(v2).
 and the MAGIC number in CRL header is also changed from "PTCM"
 to "RTCM".

 This patch refine the code to detect RTCT table for both
 v1 and v2.

Tracked-On: #6020
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
2021-06-01 08:22:20 +08:00
Kunhui Li 80a9b3bf1e Config_tools: Update get slot logic
Modify the initial value of PT_SLOT variable and
update the get slot logic that all device call the virtual_dev_slot function to get slot number directly.
Copy the launch_uos_id1.sh to launch_win.sh.

Tracked-On: #6072
Signed-off-by: Kunhui Li <kunhuix.li@intel.com>
2021-05-31 07:39:16 +08:00
Kunhui Li 6466edd057 Config_tools: Update Hybrid Cores
Update the severity from "warning" to "error" for hybrid cores check.

Tracked-On: #5918
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Signed-off-by: Kunhui Li <kunhuix.li@intel.com>
2021-05-31 07:39:01 +08:00
Geoffroy Van Cutsem db2e986673 doc: update ACRN version QEMU tutorial
We missed a section during our last update to the QEMU tutorial
that references which version (tag) of ACRN to use.

Tracked-On: #5928
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2021-05-28 18:25:55 -04:00
Shuang Zheng 90420123e2 config_tools: fix the guest_flag error when saving scenario xml
fix the guest_flag error when saving scenario xml from config
tool UI.

Tracked-On: #6075
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
2021-05-27 13:10:45 +08:00
Rong Liu 8f6c17f1f1 dm: check if PTM root is enabled
hv is responsible to ensure PTM is always enabled on hw root port if
that root port is PTM root-capable.  If PTM root is not enabled already in physical
root port before guest launch, guest OS can only enable it in root port's virtual
config space and PTM may not function as desired so we would rather not
to allow user to enable PTM on pass-thru device in this case.
Also revisit a few comments to add assumption that acrn only support a
simple PTM hierarch emulation i.e., EP (ptm requestor) is directly connected
to root port (ptm root), or ptm requestor is rcie).

V4:
 - Change behavior from V3: When users tries to enable PTM while PTM root is not enabled on
physical root port, allow user to launch VM and pass thru the device
with no PTM support.
V3:
 - When users tries to enable PTM while PTM root is not enabled on
physical root port, allow user to launch VM and enable PTM in virtual
root port.  This is not going to enable PTM on physical root port.

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Jason Chen <jason.cj.chen@intel.com>
2021-05-27 09:00:50 +08:00
Rong Liu 43acbdd345 hv: ensure PTM root is always enabled in hw
For post launch VM, ACRN supports PTM under these conditions:
1. HW implements a simple PTM hierarchy: PTM requestor device (ep) is
directly connected to PTM root capable root port. Or
2. ptm requestor itself is root complex integrated ep.
Currently acrn doesn't support emulation of other type of PTM hiearchy, such
as if there is an intermediate PTM node (for example, switch) inbetween
PTM requestor and PTM root.
To avoid VM touching physical hardware, acrn hv ensures PTM is always enabled
in the hardware.
During hv's pci init, if root port is ptm capable,
hv will enable PTM on that root port.  In addition,
log error (and don't enable PTM) if ptm root
capability is on intermediate node other than root port.

V2:
 - Modify commit messages to clarify the limitation
of current PTM implementation.
 - Fix code that may fail FUSA
 - Remove pci_ptm_info() and put info log inside pci_enable_ptm_root().

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2021-05-27 09:00:50 +08:00
Li Fei1 0d5f12e281 hv: vlapic: a minor refine about vlapic_x2apic_pt_icr_access
In physical destination mode, the destination processor is specified by its
local APIC ID. When a CPU switch xAPIC Mode to x2APIC Mode or vice versa,
the local APIC ID is not changed. So a vcpu in x2APIC Mode could use physical
Destination Mode to send an IPI to another vcpu in xAPIC Mode by writing ICR.

This patch adds support for a vCPU A could write ICR to send IPI to another
vCPU B which is in different APIC mode.

Tracked-On: #5923
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2021-05-27 09:00:08 +08:00
Tao Yuhong c8ae79b332 DM: change 32-bit mmio limit to 3.5G
the VM 32-bit mmio window is 2G~3.5G

Tracked-On: #6011
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2021-05-26 13:52:46 +08:00
dongshen a3d06929e7 config-tools: retrieve physical APIC IDs and use them to fill in the ACPI MADT table
Retrieve physical APIC IDs from board xml file and use them to fill in the ACPI MADT table
for pre-Launched VMs.

Note that the config-tool will throw an error if the processors/die/core/thread tags are absent.
User needs to run board_inspector.py to regenerate the board xml file when this commit is merged,
if the processors/die/core/thread tags are missing in the board xml file.

Tracked-On: #6020
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2021-05-26 11:23:06 +08:00
dongshen 818c821d04 dm: acpi: retrieve physical APIC IDs and use them to fill in the ACPI MADT table
Two utility functions are copied and adapted from hyerpervisor:
ffs64
bitmap_clear_nolock

Two public functions are provided for future use (such as for RTCTv2)
pcpuid_from_vcpuid
lapicid_from_pcpuid

Tracked-On: #6020
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2021-05-26 11:23:06 +08:00
dongshen 6680208ed9 dm: vmmapi: augment the vm_get_config() vmmapi to include a struct platform_info* parameter
This allows users to retrieve and use the requested platform_info information from hypervisor

Tracked-On: #6020
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2021-05-26 11:23:06 +08:00
dongshen 3e1fa0fb98 hv: hypercall: 72 reserved bytes are used in struct hc_platform_info to pass physical APIC and cat IDs shift to DM
So that DM can retrieve physical APIC IDs and use them to fill in the ACPI MADT table for
post-launched VMs.

Note:
1. DM needs to use the same logic as hypervisor to calculate vLAPIC IDs based on physical APIC IDs
and CPU affinity setting

2. Using reserved0[] in struct hc_platform_info to pass physical APIC IDs means we can only support at
most 116 cores. And it assumes LAPIC ID is 8bits (X2APIC mode supports 32 bits).

Cat IDs shift will be used by DM RTCT V2

Tracked-On: #6020
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2021-05-26 11:23:06 +08:00
dongshen 5e3c6ae941 hv: vcpuid: passthrough host CPUID leaf.0BH to guest VMs
Using physical APIC IDs as vLAPIC IDs for pre-Launched and post-launched VMs
is not sufficient to replicate the host CPU and cache topologies in guest VMs,
we also need to passthrough host CPUID leaf.0BH to guest VMs, otherwise,
guest VMs may see weird CPU topology.

Note that in current code, ACRN has already passthroughed host cache CPUID
leaf 04H to guest VMs

Tracked-On: #6020
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2021-05-26 11:23:06 +08:00
dongshen f332ef15b2 hv: vlapic: use physical APIC IDs as vLAPIC IDs for pre-launched and post-launched VMs
In current code, ACRN uses physical APIC IDs as vLAPIC IDs for SOS,
and vCPU ids (contiguous) as vLAPIC IDs for pre-Launched and post-Launched VMs.

Using vCPU ids as vLAPIC IDs for pre-Launched and post-Launched VMs
would result in wrong CPU and cache topologies showing in the guest VMs,
and could adversely affect performance if the guest VM chooses to detect
CPU and cache topologies and optimize its behavior accordingly.

Uses physical APIC IDs as vLAPIC IDs (and related CPU/cache topology enumeration
CPUIDs passthrough) will replicate the host CPU and cache topologies in pre-Launched
and post-Launched VMs.

Tracked-On: #6020
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2021-05-26 11:23:06 +08:00
Zide Chen 6428ca8f5b hv: VMPTRLD and VMCLEAR VMCS with the common APIs
Remove the direct calls to exec_vmptrld() or exec_vmclear(), and replace
with the wrapper APIs load_va_vmcs() and clear_va_vmcs().

Tracked-On: #5923
Signed-off-by: Zide Chen <zide.chen@intel.com>
2021-05-26 11:22:26 +08:00
Jiang, Yanting e9d1fa1f98 config-tools: fix guest_flag issue in config xml for adl
commit 873ed75 ("misc: sanity check VM config for nested virtualization")
requires that the guest_flag tag can't be empty, or it will fail to build.

This patch changes adl instances of "<guest_flag></guest_flag>" to
"<guest_flag>0</guest_flag>".

Tracked-On: #5923
Signed-off-by: Jiang, Yanting <yanting.jiang@intel.com>
2021-05-26 08:55:34 +08:00
Yang,Yu-chu 0c55743f50 config-tools: add <enable_ptm> and <PTM>
Add <enable_ptm> which configures ptm feature dm argument.
Add <PTM>n</PTM> to post-launched vms.

Tracked-On: #6054
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-05-25 11:32:11 +08:00
Yang,Yu-chu 346490a7dc config-tools: enable PTM through config-tools
Configure PTM in post-launched VM using <PTM> element. If the //vm/PTM
sets to 'y', pci_dev.c.xsl appends the virtual root port to
corresponding struct acrn_vm_pci_dev_config of that VM. Currently it
supports only post-launched VMs.

Configure enable_ptm for dm argument. If a uos/enable_ptm with uos id
= 'vm_id 'sets to 'y' and the vm/PTM with the same vm_id sets to 'y',
append an "enable_ptm" flag to the end of passthrough ethernet devices.
Currently there is only ethernet card can support the "enable_ptm"flag.

For the schema validation, the <PTM> can only be ['y', 'n'].

For the launched script validation, the <enable_ptm> can only be ['y',
'n']. If the <enable_ptm> sets to 'y' but the corresponding <PTM> sets
to 'n', the launch script will fail to generate.

Tracked-On: #6054
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-05-25 11:32:11 +08:00
Geoffroy Van Cutsem 68e4c66175 Update doc/tutorials/using_hybrid_mode_on_nuc.rst
Co-authored-by: David Kinder <david.b.kinder@intel.com>
2021-05-24 14:06:50 -04:00
Geoffroy Van Cutsem a9c4fb2039 Update doc/tutorials/using_hybrid_mode_on_nuc.rst
Co-authored-by: David Kinder <david.b.kinder@intel.com>
2021-05-24 14:06:50 -04:00
Geoffroy Van Cutsem d7c29968f0 doc: add more details to GSG for the hybrid scenario
Add a number of steps and details that were not called
out in the "Getting Started Guide for ACRN Hybrid Mode". Those
are not obvious to the first-time or novice user so the user
guide was hard to follow and confusing. At a high-level:
* How to build Zephyr
* How to install ACRN
* How to install the ACRN kernel

The hybrid scenario overview diagram has been updated too.

Tracked-On: #5992
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2021-05-24 14:06:50 -04:00
Yang,Yu-chu 1de47b0433 config-tools: build acrn with xslt generated pci_dev.c and board_info.h
Build acrn using xslt transformed pci_dev.c and board_info.h.

Tracked-On: #6024
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-05-24 21:53:22 +08:00
Yang,Yu-chu 1b7a2c98f5 config-tools: add board_info.h.xsl
Add an xslt file "board_info.h.xsl". This file is used to
generate board_info.h which is used by hypervisor.

Tracked-On: #6024
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-05-24 21:53:22 +08:00
Yang,Yu-chu a1a399c360 config-tools: add pci_dev.c.xsl
Add an xslt file "pci_dev.c.xsl". This file is used to
generate pci_dev.c which is used by hypervisor.

Tracked-On: #6024
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-05-24 21:53:22 +08:00
Yang,Yu-chu ad4bbc3d32 config-tools: add acrn specific functions to lib.xsl
acrn:get-vbdf: get the virtual bdf from allocation.xml based on vmid and device name
acrn:get-pbdf: get physical bdf from <pci_dev>
acrn:ptdev-name-suffix: fix the name to look up allocation.xml
acrn:get-hidden-device-num: get the number of hidden devices based on
board name
acrn:is-vmsix-supported-device: check if a device is a vmsix supported
device based on the vendor and identifier

Tracked-On: #6024
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2021-05-24 21:53:22 +08:00
Yang,Yu-chu 9736ab8295 config-tools: add bdf static allocator
Assign bdf to pci emulated and passthrough devices.

For pre-launched VM, assigns unique bdf to passthrough devices, inter-vm
shared memory, pci vuart(console and communication vuarts).

For SOS vm, assigns unique bdf to inter-vm shared memory and pci
vuart(console and communication vuarts).

The bdf follows the rules below:
- the bdf 00:00.0 is reserved for pci hostbridge
- the assigned bdf range: bus is 0x00, dev is in range [0x1, 0x20)
and the fuc is 0x00
- the bdf must be unique, which means any vm's emulated devices cannot
share the same bdf with existing devices
- some devices's bdf is hardcoded, modify its bdf would leads the
device cannot be dicoverd by os. A HARDCODED_BDF_LIST in bdf.py documents
them
- the passthrough devices' bdf can be reused in SOS vm

Tracked-On: #6024
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-05-24 21:53:22 +08:00
Yang,Yu-chu 152d0bce5c config-tools: add methods to allocate mmio windows for emulated devices
Add methods allocates the mmio bar base to console vuart,
communication vuarts, inter-vm shared memory and passthrough pci
devices.

For SOS:
 - get low mem by parsing board xml.
 - get high mem by parsing board xml, if the high mem is not enabled,
 the high mem start address would be ~0UL and the end address is 0UL
 - get the occupied mmio windows by parsing board.xml
 - for each console vuart, communication vuart and inter-vm shared memory
 devices, assign unused mmio windows to them
 - all the assigned mmio windows must be unique and should not overlay
 with any devices' mmio window
 - the passthrough devices mmio windows can be reused in SOS vm
 - each allocated mmio start address must be 4k alignment if the length
 of bar is smaller than 4k
 - each allocated mmio start address must be aligned with the bar length
 if its length is greater than 4k
 - the 32bits bar will fall in low mem range only
 - 64bits bar will look for free mmio in low mem rage first, if the high
 mem is enabled, the 64bits bar will look for free mmio in high mem
 range if there is not enough space in low mem range
 - allocator raises an error if there is not enough mmio space

For pre-launched VM:
 - the high mem range is [256G, 512G)
 - the low mem range is [2G, 3.5G)
 - there is no used mmio window initially
 - for each console vuart, communication vuart, inter-vm shared memory
 devices and passthrough devices, assign unused mmio windows to them
 - all the assigned mmio windows must be unique and should not overlay
 with any devices' mmio window
 - the 32bits bar will fall in low mem range only
 - 64bits bar will look for free mmio in low mem rage first and then
 look for free mmio in high mem range if there is not enough space in
 low mem range
 - each allocated mmio start address must be 4k alignment if the length
 of bar is smaller than 4k
 - each allocated mmio start address must be aligned with the bar length
 if its lenght is greater than 4k
 - allocator raises an error if there is not enough mmio space

Tracked-On: #6024
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-05-24 21:53:22 +08:00
Yang,Yu-chu c13acf3045 config-tools: add get_shmem_regions and vm type checking to lib.py
Add a common method "get_shmem_regions":
This method get <IVSHMEM_REGION> and extracts the region size, region
position in xml and and vm ids which share this regions. Returns a
dictionary:
{'vm_id':{'region_name':{'id': region position,'size': region size,}}}

Add vm type checking methods:
is_pre_launched_vm, is_post_launched_vm and is_sos_vm.

Tracked-On: #6024
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-05-24 21:53:22 +08:00
Kunhui Li 7943c944b8 Config_tools: Update board xml for acrn 2.5
Add nuc11tnbi5.xml;
Update adl-rvp.xml, cfl-k700-i7.xml, nuc7i7dnb.xml, whl-ipc-i5.xml and whl-ipc-i7.xml.

Tracked-On: #5922
Signed-off-by: Kunhui Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2021-05-24 16:35:46 +08:00
Li Fei1 5939c1afba dm: rb: only free rb_entry when we remove this entry from the rb tree
Only free rb_entry when we remove this entry from the rb tree, otherwise, a
page fault would trigger when next rb itreation would access the freed rb_entry.

Tracked-On: #6056
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2021-05-24 13:24:28 +08:00
Zide Chen 6d69058a9d hv: nested: support for VMREAD and VMWRITE emulation
This patch implements the VMREAD and VMWRITE instructions.

When L1 guest is running with an active VMCS12, the “VMCS shadowing”
VM-execution control is always set to 1 in VMCS01. Thus the possible
behavior of VMREAD or VMWRITE from L1 could be:

- It causes a VM exit to L0 if the bit corresponds to the target VMCS
  field in the VMREAD bitmap or VMWRITE bitmap is set to 1.
- It accesses the VMCS referenced by VMCS01 link pointer (VMCS02 in
  our case) if the above mentioned bit is set to 0.

This patch handles the VMREAD and VMWRITE VM exits in this way:

- on VMWRITE, it writes the desired VMCS value to the respective field
  in the cached VMCS12. For VMCS fields that need to be synced to VMCS02,
  sets the corresponding dirty flag.

- on VMREAD, it reads the desired VMCS value from the cached VMCS12.

Tracked-On: #5923
Signed-off-by: Alex Merritt <alex.merritt@intel.com>
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
2021-05-24 10:34:01 +08:00
Zide Chen 2bd269c11c hv: nested: support for VMCLEAR emulation
This patch is to emulate VMCLEAR instruction.

L1 hypervisor issues VMCLEAR on a VMCS12 whose state could be any of
these: active and current, active but not current, not yet VMPTRLDed.

To emulate the VMCLEAR instruction, ACRN sets the VMCS12 launch state to
"clear", and if L0 already cached this VMCS12, need to sync it back to
guest memory:

- sync shadow fields from shadow VMCS VMCS to cache VMCS12
- copy cache VMCS12 to L1 guest memory

Tracked-On: #5923
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
2021-05-24 10:34:01 +08:00
Zide Chen 5379b14108 hv: nested: define VMCS shadow fields
Enable VMCS shadowing for most of the VMCS fields, so that execution of
the VMREAD or VMWRITE on these shadow VMCS fields from L1 hypervisor
won't cause VM exits, but read from or write to the shadow VMCS.

Tracked-On: #5923
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Alexander Merritt <alex.merritt@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
2021-05-24 10:34:01 +08:00
Zide Chen 863e58e539 hv: nested: define software layout for VMCS12 and helper functions
Software layout of VMCS12 data is a contract between L1 guest and L0
hypervisor to run a L2 guest.

ACRN hypervisor caches the VMCS12 which is passed down from L1 hypervisor
by the VMPTRLD instructin. At the time of VMCLEAR, ACRN syncs the cached
VMCS12 back to L1 guest memory.

Tracked-On: #5923
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
2021-05-24 10:34:01 +08:00
Zide Chen f5744174b5 hv: nested: support for VMPTRLD emulation
This patch emulates the VMPTRLD instruction. L0 hypervisor (ACRN) caches
the VMCS12 that is passed down from the VMPTRLD instruction, and merges it
with VMCS01 to create VMCS02 to run the nested VM.

- Currently ACRN can't cache multiple VMCS12 on one vCPU, so it needs to
  flushes active but not current VMCS12s to L1 guest.
- ACRN creates VMCS02 to run nested VM based on VMCS12:
  1) copy VMCS12 from guest memory to the per vCPU cache VMCS12
  2) initialize VMCS02 revision ID and host-state area
  3) load shadow fields from cache VMCS12 to VMCS02
  4) enable VMCS shadowing before L1 Vm entry

Tracked-On: #5923
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
2021-05-24 10:34:01 +08:00
Zide Chen 0a1ac2f4a0 hv: nested: support for VMXOFF emulation
This patch implements the VMXOFF instruction. By issuing VMXOFF,
L1 guest Leaves VMX Operation.

- cleanup VCPU nested virtualization context states in VMXOFF handler.
- implement check_vmx_permission() to check permission for VMX operation
  for VMXOFF and other VMX instructions.

Tracked-On: #5923
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
2021-05-24 10:34:01 +08:00
Zide Chen 3fdad3c6d1 hv: nested: check prerequisites to enter VMX operation
According to VMXON Instruction Reference, do the following checks in the
virtual hardware environment: vCPU CPL, guest CR0, CR4, revision ID
in VMXON region, etc.

Currently ACRN doesn't support 32-bit L1 hypervisor, and injects an #UD
exception if L1 hypervisor is not running in 64-bit mode.

Tracked-On: #5923
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
2021-05-24 10:34:01 +08:00
Zide Chen fc8f07e740 hv: nested: support for VMXON emulation
This patch emulates VMXON instruction. Basically checks some
prerequisites to enable VMX operation on L1 guest (next patch), and
prepares some virtual hardware environment in L0.

Tracked-On: #5923
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
2021-05-24 10:34:01 +08:00
Tao Yuhong b93d6b2ef0 HV: Fix mistake use stac() & clac()
The commit 2ab70f43e5
HV: cache: Fix page fault by flushing cache for VM trusty RAM in HV

It is wrong in using stac()/clac()

Tracked-On: #6020
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2021-05-24 10:32:54 +08:00
Li Fei1 6077152c4b hv: vlapic: extend vlapic_x2apic_pt_icr_access to support more destination mode
Now guest would use `Destination Shorthand` to broadcast IPIs if there're more
than one destination. However, it is not supported when the guest is in LAPIC
passthru situation, and all active VCPUs are working in X2APIC mode. As a result,
the guest would not work properly since this kind broadcast IPIs was ignored
by ACRN. What's worse, ACRN Hypervisor would inject GP to the guest in this case.

This patch extend vlapic_x2apic_pt_icr_access to support more destination modes
(both `Physical` and `Logical`) and destination shorthand (`No Shorthand`, `Self`,
`All Including Self` and `All Excluding Self`).

Tracked-On: #5923
Signed-off-by: Zide Chen <zide.chen@intel.com>
Signed-off-by: Li Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2021-05-24 10:27:32 +08:00
Li Fei1 a69e67b58b hv: vlapic: wrap a function to calculate destination vcpu mask by shorthand
1. Rename vlapic_calc_dest to vlapic_calc_dest_noshort
2. Remove vlapic_calc_dest_lapic_pt, use vlapic_calc_dest_noshort instead
3. Wrap vlapic_calc_dest to calculate destination vcpu mask according shorthand

Tracked-On: #5923
Signed-off-by: Zide Chen <zide.chen@intel.com>
Signed-off-by: Li Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2021-05-24 10:27:32 +08:00
Peter Fang b068656e71 doc: add documentation for allow_trigger_s5 in pm_notify_channel
Tracked-On: #6034
Signed-off-by: Peter Fang <peter.fang@intel.com>
2021-05-21 12:08:24 -04:00
Peter Fang c66bbe9e67 OVMF release v2.5
- Change 64-bit MMIO BAR window to 256G-512G

The release is the same as 736a03222f.
This is just to update the changelog.

Tracked-On: #5913
Signed-off-by: Peter Fang <peter.fang@intel.com>
2021-05-21 10:23:23 +08:00