Commit Graph

4564 Commits

Author SHA1 Message Date
Kaige Fu 366f4be454 acrntrace: Use correct format for total run time
It is better to output it using float instead of int. Otherwise, we will
get '0 sec' for total run time if it is less than one second.

Tracked-On: #4175
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2019-12-10 15:11:12 +08:00
Kaige Fu 1e192f05d7 acrntrace: break when finding the matching key
The key in the list is unique. So, it is better to break the loop
when find the matching key instead of traversing the whole list.

Tracked-On: #4175
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2019-12-10 15:11:12 +08:00
Kaige Fu 9655b9de15 acrntrace: Fix the incorrect total vmexit cnt issue
Originally, we assume that the vmenter will sit at the first line
of the trace file. But if the vmexit comes earlier than vmenter.
The total vmexit cnt will be set as 0 by the first vmenter.

This patch fixes the issue by:
   - Search the trace file to find the first vmexit entry and start to analyze here
     and mark the TSC_BEGIN as the tsc of this vmexit.
   - Inc the total vmexit cnt by 1 when meet the vmexit entry.
   - Calc the vmexit duration when meet the vmenter in pair with the last vmexit.

Tracked-On: #4175
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2019-12-10 15:11:12 +08:00
Shuang Zheng 1115c0c6af acrn-config: UI supports to edit multiple virtio input devices.
This is to make acrn config UI supports to edit more than one virtio
input devices in multi-lines.

Tracked-On: #4163
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2019-12-10 13:45:22 +08:00
Conghui Chen 557e7f19f7 Makefile: add gcc flags to prevent some optimization
Add the below flags, they are needed in -O2:

-fno-delete-null-pointer-checks:
    * tells the compiler NOT to assume that null pointer deference does
    not exist.

    * Without this flag, below case cannot be detected:
    a pointer might point to nullsometime during run-time and if there
    is no validation for that pointer, it will cause the program to crash.
    Since we don’t receive an error message saying that a pointer is
    pointing to null, we will have a hard time trying to find the problem.

-fwrapv:
    * tells the compiler that signed overflow always wraps.

    * Without this flag, x + 10 > x will always be true for signed x.
     With the flag, x + 10 > x is not always be true, as the overflow is
     defined for x, and it could wrap.

Tracked-On: #4194
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
2019-12-10 10:02:15 +08:00
Li Fei1 c2c05a29da hv: vlapic: kick targeted vCPU off if interrupt trigger mode has changed
In APICv advanced mode, an targeted vCPU, running in non-root mode, may get outdated
TMR and EOI exit bitmap if another vCPU sends an interrupt to it if the trigger mode
of this interrupt has changed.
This patch try to kick vCPU off to let it get the latest TMR and EOI exit bitmap when
it enters non-root mode again if new coming interrupt trigger mode has changed. Then
fill the interrupt to PIR.

Tracked-On: #4200
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2019-12-10 09:07:54 +08:00
Vijay Dhanraj ed65ae61c6 HV: Kconfig changes to support server platform.
This patch updates kconfig to support server platforms
for increased number of VCPUs per VM and PT IRQ number.

Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Tracked-On: #4196
2019-12-09 11:29:34 +08:00
Vijay Dhanraj 706dbc0e00 acrn-config: support non-contiguous HPA for pre-launched VM
This patch modifies the python scripts in scenario,
board and vm-configuration to support,
	1. Generation of seperate ve820 for each VM.
	2. Ability to configure each VM's HPA from
	   acrn-config UI tool.
	3. Non-contiguous HPAs for pre-launched VMs.

Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Tracked-On: #4195
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-12-09 11:28:38 +08:00
Vijay Dhanraj 6e8b413689 HV: Add support to assign non-contiguous HPA regions for pre-launched VM
On some platforms, HPA regions for Virtual Machine can not be
contiguous because of E820 reserved type or PCI hole. In such
cases, pre-launched VMs need to be assigned non-contiguous memory
regions and this patch addresses it.

To keep things simple, current design has the following assumptions,
	1. HPA2 always will be placed after HPA1
	2. HPA1 and HPA2 don’t share a single ve820 entry.
	(Create multiple entries if needed but not shared)
	3. Only support 2 non-contiguous HPA regions (can extend
	at a later point for multiple non-contiguous HPA)

Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Tracked-On: #4195
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-12-09 11:28:38 +08:00
Vijay Dhanraj 9b44e57d27 acrn-config: Fix target xml generation issue when no
P-state scaling driver is present

There seems to be a corner case where target xml file
fails to get generated if there was no P-state scaling driver
or C-state idle driver present. This patch addresses it by
handling the file not present exception and setting a warning
as well a "not available" string to successfully generate
target xml file.

Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Tracked-On: #4199
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-09 11:28:11 +08:00
Zide Chen 03a1b2a717 hypervisor: handle reboot from non-privileged pre-launched guests
To handle reboot requests from pre-launched VMs that don't have
GUEST_FLAG_HIGHEST_SEVERITY, we shutdown the target VM explicitly
other than ignoring them.

Tracked-On: #2700
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-12-09 11:27:32 +08:00
Zide Chen 2680121097 Makefile: fix make failure for logical_partition or hybrid scenario
If "make menuconfig" chooses hybrid or logical_partition scenario,
currently the build fails with "SCENARIO <$(SCENARIO)> is not supported.".

- CONFIG_LOGICAL_PARTITION: "awk -F "_|=" '{print $$2}'" yields the second
  field (LOGICAL) only. The new "cut -d '_' -f 2-" keeps all fields after
  "CONFIG_".

- Add the missing HYBRID scenario.

Tracked-On: #4067
Signed-off-by: Zide Chen <zide.chen@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2019-12-09 11:26:56 +08:00
Minggui Cao 65a553205a acrn-config: add xml to support TGL RVP board
1. Use acrn-configure tool to generate xml files to support TGL
RVP board. You need make menuconfig as guide in github, and then
comiple as following:
  make hypervisor BOARD_FILE=path/xxx.xml SCENARIO_FILE=path/yyy.xml

2. Also uos launch script can be generated by acrn-configure tool with the
uos luanch xml file

Tracked-On: #4181
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-09 11:25:51 +08:00
Sainath Grandhi 1fe1afd4c6 acrn-config: Add ramdisk tag parsing support
Pre-launched or SOS VMs could use ramdisks to boot. This
patch adds acrn-config tool support to parse such use-case
scenario xmls.

Tracked-On: #4197
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-06 14:02:03 +08:00
Sainath Grandhi 2b9fa85647 acrn-config: Add ramdisk tag to supported board/scenario xmls
This patch adds ramdisk_mod tag to all supported boards and
logical partition, hybrid, industry and sdc xmls

Tracked-On: #4197
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-06 14:02:03 +08:00
Li Fei1 da3ba68cb6 hv: remove corner case in ptirq_prepare_msix_remap
ptirq_prepare_msix_remap was called no matter whether MSI/MSI-X was enabled or not
and it passed zero to input parameter virtual MSI/MSI-X data field to indicate
MSI/MSI-X was disabled. However, it barely did nothing on this case.
Now ptirq_prepare_msix_remap is called only when  MSI/MSI-X is enabled. It doesn't
need to check whether MSI/MSI-X is enabled or not by checking virtual MSI/MSI-X
data field.

Tracked-On: #3475
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2019-12-05 16:43:22 +08:00
Li Fei1 c05d9f8086 hv: vmsix: refine vmsix remap
Do vMSI-X remap only when Mask Bit in Vector Control Register for MSI-X Table Entry
is unmask.
The previous implementation also has two issues:
1. It only check whether Message Control Register for MSI-X has been modified when
guest writes MSI-X CFG space at Message Control Register offset.
2. It doesn't really disable MSI-X when guest wants to disable MSI-X.

Tracked-On: #3475
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2019-12-05 16:43:22 +08:00
Li Fei1 5f5ba1d647 hv: vmsi: refine write_vmsi_cfg implementation
1. disable physical MSI before writing the virtual MSI CFG space
2. do the remap_vmsi if the guest wants to enable MSI or update MSI address or data
3. disable INTx and enable MSI after step 2.

The previous Message Control check depends on the guest write MSI Message Control
Register at the offset of Message Control Register. However, the guest could access
this register at the offset of MSI Capability ID register. This patch remove this
constraint. Also, The previous implementation didn't really disable MSI when guest
wanted to disable MSI.

Tracked-On: #3475
Signed-off-by: Li Fei1 <fei1.li@intel.com>
2019-12-05 16:43:22 +08:00
Junming Liu 2f642002fc dm:gvt:enable gvt bar registration
Need to enable gvt bar registration, so remove the previous workaround patch.

Tracked-On: projectacrn#4005

Signed-off-by: Junming Liu <junming.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Liu XinYun <xinyun.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-12-05 11:20:11 +08:00
Junming Liu 89908bf510 dm:gvt:update gvt bars before other pci devices write bar address
The current design has the following problem:
uos kernel may update gvt bars' regions,
but ACRN-DM doesn't know this update.
ACRN-DM only know out-of-date gvt bar regions,
For simplicity, mark these bar regions as OOD bar regions.
uos kernel may allocate OOD bar regions for
other pci devices, which will result in ACRN-DM
bar regions inconsistency with uos kernel.

The new design is the following:
When other pci device update bar regions
(1) ACRN-DM updates gvt bars' regions
provided by a system file.
(2) ACRN-DM updates this pci device bar regions

v5 -> v6:
	* add more comments

v4 -> v5:
	* remove & for callback func assignment

v3 -> v4:
	* compare gpu bar address to avoid unnecessary
	* unregistered/registered operation

v2 -> v3:
	* call unregister_bar and register_bar when update gvt bars
	* update gvt reserved regions when update gvt bars

Tracked-On: projectacrn#4005

Signed-off-by: Junming Liu <junming.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Liu XinYun <xinyun.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-12-05 11:20:11 +08:00
Junming Liu f27d47542a dm:gvt:adjust pci bar region with reserved bar regions
ACRN-DM has reserved gvt bar regions.

This patch ensures other pci devices' bar regions
won't overlap with reserved bar regions.

v6 -> v7:
	* rename some struct and func

v5 -> v6:
	* remove outdated comment
	* add comments for code reading
	* code cleaning about gvt bar0 and bar2 size

v4 -> v5:
	* rename adjust_bar_region and adjust_bar_region_by_gvt_bars
	* change adjust_bar_region_by_gvt_bars interface for code cleaning

v3 -> v4:
	* add static struct gvt_region  instead of definition or pointer array.

v2 -> v3:
	* repalce pci_emul_alloc_bar with gvt_reserve_resource when allocate gvt bars
	* use register_bar to detect if gvt bars confilts with pci devices

v1 -> v2:
	* don't limit the gvt bar type is MEM32 when deal with pci bar
	* add is_two_region_overlap func to detect if two regions overlap
	* add region array to store gvt bar0 and bar2 regions

Tracked-On: projectacrn#4005

Signed-off-by: Junming Liu <junming.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Liu XinYun <xinyun.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-12-05 11:20:11 +08:00
Junming Liu 1ac0b57c6a dm:gvt:reserve gvt bar regions in ACRN-DM
The current design has the following problem:
gvt uses some pci bar regions,
but ACRN-DM isn't aware of these regions.
So ACRN-DM may allocate these regions for other pci devices,
which will result in other pci devices bar regions
overlap with gvt bar regions.

The new design is the following:
(1) ACRN-DM reads gvt bar regions
which are provided by physical gpu;
(2) ACRN-DM reserves gvt bar regions

v6 -> v7:
	* use array to store reserved bar regions
	* rename some struct and func

v5 -> v6:
	* rename enable_gvt to gvt_enabled
	* add a interface to reserve bar regions
	* reserve gvt bar regions

Tracked-On: projectacrn#4005

Signed-off-by: Junming Liu <junming.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Liu XinYun <xinyun.liu@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2019-12-05 11:20:11 +08:00
Shuo A Liu 72644ac2b2 hv: do not sleep a non-RUNNING vcpu
It's meaningless to sleep a non-running vcpu. Add a state check before
sleep the thread object of the vcpu.

Tracked-On: #4178
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-05 11:19:35 +08:00
Shuo A Liu d624eb5e6c hv: io: do schedule in IO completion polling loop
Now, we support schedule inplace. And with cpu sharing, there might be
multi vcpu running on same pcpu. Reschedule request will happen when
switch the running vcpu. If the current vcpu is polling on the IO
completion, it need to be scheduled back to the polling point.

In the polling path, construct a loop for polling, and do schedule in the
loop if needed.

Tracked-On: #4178
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-05 11:19:35 +08:00
Conghui Chen d48da2af3a hv: bugfix for debug commands with smp_call
With cpu-sharing enabled, there are more than 1 vcpu on 1 pcpu, so the
smp_call handler should switch the vmcs to the target vcpu's vmcs. Then
get the info.

dump_vcpu_reg and dump_guest_mem should run on certain vmcs, otherwise,
there will be #GP error.

Renaming:
vcpu_dumpreg -> dump_vcpu_reg
switch_vmcs -> load_vmcs

Tracked-On: #4178
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-05 11:19:35 +08:00
Shuo A Liu 47139bd78c hv: print current sched_object in acrn logmsg
Add a header field in acrnlog message to indicate the current
running thread.

Tracked-On: #4178
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-05 11:19:35 +08:00
Shuang Zheng 5eb8040284 acrn-config: update UI to support virtio devices
Add multi device editing UI for Virtio-net and virtio-blk devices.

Tracked-On: #4185
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
2019-12-04 16:52:40 +08:00
Wei Liu 5309e41528 acrn-config: modify the description of usb xhci
modify the description of usb xhci about the input format.

Tracked-On: #3854
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-04 16:52:40 +08:00
Wei Liu 7838b53763 acrn-config: add virtio-net mediator support for launch config
Add virtio-net mediator support to parse and get 'virtio-network' item value
from launch config files, these values are editable by user.

Tracked-On: #4185
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-04 16:52:40 +08:00
Wei Liu 25b2a26e34 acrn-config: add 'virtio-network' info in launch xmls
Some vm need mediator of 'virtio-net', so add 'virtio-network'
item into the launch config files that user could edit them from webUI.

Tracked-On: #4185
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-04 16:52:40 +08:00
Wei Liu 8464419af3 acrn-config: add virtio-block support for launch config
Add virtio-block support to parse and get 'block' item value
from launch config files, these values are editable by user.

Tracked-On: #4172
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-04 16:52:40 +08:00
Wei Liu 40140281ae acrn-config: add rootfs_dev/rootfs_img with virtio-blk item
remov rootfs_dev and rootfs_img item and replace them with vritio-blk
item.

The format for virtio-blk:
[blk partition:][img path] e.g.: /dev/sda3:./a/b.img

For vbootloader of ovmf: [img path] e.g.:./a/b.img

Tracked-On: #4172
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-04 16:52:40 +08:00
Kaige Fu aedd2c70e7 acrntrace: parse leaf and subleaf of cpuid
We have changed the cpuid trace-entry in HV to trace
the leaf and subleaf of cpuid. This patch modifies the
format accordingly.

Tracked-On: #4175
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2019-12-03 16:34:14 +08:00
Kaige Fu aae974b473 HV: trace leaf and subleaf of cpuid
We care more about leaf and subleaf of cpuid than vcpu_id.
So, this patch changes the cpuid trace-entry to trace the leaf
and subleaf of this cpuid vmexit.

Tracked-On: #4175
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
2019-12-03 16:34:14 +08:00
Sainath Grandhi 77039f2911 acrn-config: Extend ve820 generation script for sizes gt 512 MB
Current ve820 generation script assumes the size of pre-launched
VM memory is less than or equal to 512 MB (Must be the assumption
of logical partition scenario as such).
This patch extends the script to handle pre-launched VM memory
sizes greater than 512 MB.

Tracked-On: #4182
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-03 14:42:55 +08:00
Yonghua Huang 450d2cf2e9 hv: trap RDPMC instruction execution from any guest
PMU is hidden from any guest, UD is expected when guest
try to execute 'rdpmc' instruction.

this patch sets 'RDPMC exiting' in Processorbased
VM-execution control.

Tracked-On: #3453
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-03 14:14:27 +08:00
Binbin Wu 3d412266bc hv: ept: build 4KB page mapping in EPT for RTVM for MCE on PSC
Deterministic is important for RTVM. The mitigation for MCE on
Page Size Change converts a large page to 4KB pages runtimely during
the vmexit triggered by the instruction fetch in the large page.
These vmexits increase nondeterminacy, which should be avoided for RTVM.
This patch builds 4KB page mapping in EPT for RTVM to avoid these vmexits.

Tracked-On: #4101
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-03 09:17:04 +08:00
Binbin Wu 0570993b40 hv: config: add an option to disable mce on psc workaround
Add a option MCE_ON_PSC_WORKAROUND_DISABLED to disable the software
workaround for the issue Machine Check Error on Page Size Change.

Tracked-On: #4101
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-03 09:17:04 +08:00
Binbin Wu 192859ee02 hv: ept: apply MCE on page size change mitigation conditionally
Only apply the software workaround on the models that might be
affected by MCE on page size change. For these models that are
known immune to the issue, the mitigation is turned off.

Atom processors are not afftected by the issue.
Also check the CPUID & MSR to check whether the model is immune to the issue:
CPU is not vulnerable when both CPUID.(EAX=07H,ECX=0H).EDX[29] and
IA32_ARCH_CAPABILITIES[IF_PSCHANGE_MC_NO] are 1.

Other cases not listed above, CPU may be vulnerable.

This patch also changes MACROs for MSR IA32_ARCH_CAPABILITIES bits to UL instead of U
since the MSR is 64bit.

Tracked-On: #4101
Signed-off-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-03 09:17:04 +08:00
Shuo A Liu 3cb32bb6e3 hv: make init_vmcs as a event of VCPU
After changing init_vmcs to smp call approach and do it before
launch_vcpu, it could work with noop scheduler. On real sharing
scheudler, it has problem.

   pcpu0                  pcpu1            pcpu1
 vmBvcpu0                vmAvcpu1         vmBvcpu1
                         vmentry
init_vmcs(vmBvcpu1) vmexit->do_init_vmcs
                    corrupt current vmcs
                        vmentry fail
launch_vcpu(vmBvcpu1)

This patch mark a event flag when request vmcs init for specific vcpu. When
it is running and checking pending events, will do init_vmcs firstly.

Tracked-On: #4178
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-02 16:20:43 +08:00
Victor Sun 15da33d8af HV: parse default pci mmcfg base
The default PCI mmcfg base is stored in ACPI MCFG table, when
CONFIG_ACPI_PARSE_ENABLED is set, acpi_fixup() function will
parse and fix up the platform mmcfg base in ACRN boot stage;
when it is not set, platform mmcfg base will be initialized to
DEFAULT_PCI_MMCFG_BASE which generated by acrn-config tool;

Please note we will not support platform which has multiple PCI
segment groups.

Tracked-On: #4157

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-02 16:20:24 +08:00
Wei Liu 80a7281f1e acrn-config: add MMCFG_BASE_INFO item in board config
Parse MMCFG base address value and store it to board config xml
as DEFAULT_PCI_MMCFG_BASE macro.

Tracked-On: #4173
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-02 16:19:55 +08:00
Wei Liu 0e273e996c acrn-config: get default pci mmcfg base address
parse default pci mmcfg base address from target board.

Tracked-On: #4173
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-12-02 16:19:55 +08:00
Yan, Like 0d998d6ac6 hv: sync physical and virtual TSC_DEADLINE when msr interception enabled/disabled
Starting with TSC_DEADLINE msr interception disabled, the virtual TSC_DEADLINE msr is always 0.
When the interception is enabled, need to sync the physical TSC_DEADLINE value to virtual TSC_DEADLINE.

When the interception is disabled, there are 2 cases:
 - if the timer hasn't expired, sync virtual TSC_DEADLINE to physical TSC_DEADLINE, to make the guest read the same tsc_deadline
   as it writes. This may change when the timer actually trigger.
 - if the timer has expired, write 0 to the virtual TSC_DEADLINE.

Tracked-On: #4162
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-02 16:10:50 +08:00
Yan, Like 97916364fc hv: fix virtual TSC_DEADLINE msr read/write issues
When write to virtual TSC_DEADLINE, if virtual TSC_ADJUST is not zero:
 - when guest intends to disarm the tsc_deadline timer, should not arm the timer falsely;
 - when guest intends to arm the tsc_deadline timer, should not disarm the timer falsely.

When read from virtual TSC_DEADLINE, if virtual TSC_ADJUST is not zero:
 - if physical TSC_DEADLINE is not zero, return the virtual TSC_DEADLINE value;
 - if physical TSC_DEADLINE is zero which means it's not armed (automatically disarmed after
   timer triggered), return 0 and reset the virtual TSC_DEADLINE.

Tracked-On: #4162
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-02 16:10:50 +08:00
Conghui Chen e61412981d hv: support xsave in context switch
xsave area:
    legacy region: 512 bytes
    xsave header: 64 bytes
    extended region: < 3k bytes

So, pre-allocate 4k area for xsave. Use certain instruction to save or
restore the area according to hardware xsave feature set.

Tracked-On: #4166
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-02 09:31:12 +08:00
Conghui Chen 8ba203a165 hv: change xsave init function name
change pcpu_xsave_init to init_pcpu_xsave.

Tracked-On: #4166
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-12-02 09:31:12 +08:00
Wei Liu 12a3ec8aa1 acrn-config: remove redundant get_leaf_tag_map in launch config lib
The function of get_leaf_tag_map(info_file, prime_item, item='') in
launch_config_lib.py is redundant and it will be called incorrectly
when generating the launch script. This patch remove the function.

Tracked-On: #3854
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
2019-11-29 16:28:27 +08:00
Wei Liu 2c2ccfc52c acrn-config: support OVMF vbootloader only
In current implementation, we only support OVMF as vbootloader, so
set vbootloader attributes to readonly in related XMLs to avoid issues.

Tracked-On: #3854

Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-11-29 13:36:27 +08:00
Wei Liu 38a647c8a5 acrn-config: correct epc_section base/size value
Current epc_section base/size vaule missed vm id so the configure item is not
working, the patch will fix this issue.

Tracked-On: #4165
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
2019-11-29 13:36:27 +08:00