Commit Graph

3104 Commits

Author SHA1 Message Date
Peter Fang 0f7535fdbe dm: add absolute timer mode
Allow specifying the initial expiration in absolute time.

Tracked-On: #2319
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-23 10:33:28 +08:00
Peter Fang d1e1aa3077 dm: create mevent's pipe in non-blocking mode
It was designed to be used in non-blocking mode to prevent the mevent
thread from blocking itself indefinitely, but it was created in
blocking mode.

Tracked-On: #2319
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-23 10:33:28 +08:00
Shiqing Gao a9709bf857 hv: Makefile: add the dependency of $(LIB_FLAGS)
This patch adds the dependency of $(LIB_FLAGS) when building .out file.
So that the target is updated whenever there is a update in
debug/release library.

Tracked-On: #2389
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-23 08:27:39 +08:00
Shiqing Gao b489aec3e1 hv: idt: separate the MACRO definition
For binutils <= 2.26:
'U' suffix for unsigned constant is not accepted by binutils assembler.

This patch separates the MACRO definition for ASSEMBLER
and non-ASSEMBLER code in idt.h

Tracked-On: #2200
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
2019-01-23 08:23:48 +08:00
Tw 862ed16ed7 Makefile: add rules for installing debug information
Add rules for installing debug information.

Tracked-On: #2344
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-22 15:00:37 +08:00
Minggui Cao 173b534b05 HV: modularization cleanup instr_emul header file
separate the private macro/structure/functions, which are just used
in instr_emul.c;

and move instr_emul.h to public include path.

Tracked-On: #1842
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-22 10:50:30 +08:00
Victor Sun 18dbdfd5d7 HV: replace lapic_pt with guest flag in vm_config
The member of lapic_pt in acrn_vm_config will be replaced by
guest_flag of LAPIC_PASSTHROUGH;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun 68aa718ca0 HV: replace bootargs config with acrn_vm_os_config
The member of bootargs in acrn_vm_config will be replaced by
acrn_vm_os_config struct.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun 23f8e5e598 HV: replace memory config with acrn_vm_mem_config
The member of mem_size and start_hpa in acrn_vm_config struct will
be replaced with the acrn_vm_mem_config struct;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun 253b25937b HV: remove vm_config pointer in acrn_vm struct
For each vm_array[] item, its config is located in corresponding
index of vm_configs[], so vm_config pointer is not needed any more.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun 7bf9b1be2c HV: enable pcpu bitmap config for partition mode
All the legacy cpu configration in vm_description.c are all cleaned up;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun bc62ab79c2 HV: remove unused vm num config
The VM number configuration in description.c is never used, remove it;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun 2e32fba536 HV: remove sworld_supported in acrn_vm_config
We will use guest_flags of SECURE_WORLD_ENABLED to check wthether
sworld is supported.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun ec199d9609 HV: add get_sos_vm api
This patch creates a new get_sos_vm() api to replace get_vm_from_vmid(0U)
because VM 0 might not be SOS VM now;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun f3014a3c89 HV: show correct vm name per config
The patch will show correct VM name per its configuration. As we do not
validate vm id when call get_vm_from_vmid() any more, we only show VM's
states which their VM type are defined;

If VM name is not configured in config file, then the name is specified
with vm id, i.e. "ACRN VM_(vm id)"

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun e6117e0d5b HV: refine launch vm interface
When pcpu enter guest mode, it will call launch_vms() function to launch
VMs in global vm_configs array.

In launch_vms() function, current pcpu will go through vm_config array list
and check whether it is a bsp of configured VM, if yes then it will prepare
corresponding VM and start it. The index of vm_config array will be specified
to VM id.

The first least significant bit in pcpu_bitmap means the bsp of the VM.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Victor Sun 49e6deaf26 HV: rename the term of vm0 to sos vm
Under sharing mode, VM0 is identical with SOS VM. But the coupling of
SOS VM and VM 0 is not friendly for partition mode.

This patch is a pure term change of vm0 to sos VM, it does not change
any code logic or senmantic.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 18:03:31 +08:00
Mingqiang Chi 55e5ed2e1a hv:move ept violation handler to io_emul.c
move this api from ept.c to io_emul.c to avoid
reverse dependency.

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 13:49:54 +08:00
Mingqiang Chi 1d98b7012d hv: move 'setup_io_bitmap' to vm.c
move this api from io_emul.c to vm.c to avoid reverse
dependency

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
2019-01-21 13:49:54 +08:00
Mingqiang Chi de4ab6fdfa hv:modulization for IO Emulation
-- rename io.c to io_emul.c, add io_emul.h
-- rename io_request.c to io_req.c,rename ioreq.h to io_req.h
-- move some APIs declaration from ioreq.h to io_emul.h
   related IO emulation

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
	modified:   ../doc/acrn.doxyfile
	modified:   Makefile
	renamed:    arch/x86/io.c -> arch/x86/io_emul.c
	renamed:    common/io_request.c -> common/io_req.c
	modified:   include/arch/x86/hv_arch.h
	modified:   include/arch/x86/io.h
	new file:   include/arch/x86/io_emul.h
	renamed:    include/arch/x86/ioreq.h -> include/arch/x86/io_req.h
2019-01-21 13:49:54 +08:00
Minggui Cao 808d0af2c8 HV: check to avoid interrupt delay timer add twice
to edge interrupt, like eth device, it can triger the interrupt again
when its IRQ in softirq entry queue or in timer list.

in current design, for sofrirq entry, it calls "list_del" before
"list_add_tail", to avoid the entry added twice.

so for interrupt delay timer, add to check if it is started
then just drop the next one; to avoid it enqueue twice.

Tracked-On: #2365
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
2019-01-21 11:18:08 +08:00
Victor Sun d9c38bafa5 HV: remove unused mptable info
mptable pointer in acrn_vm_config struct and also extern struct mptable_vm1/2
declared in mptable.h are not used any more, remove them.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-18 11:50:00 +08:00
Victor Sun a8e4f227ba HV: add new acrn_vm_config member and config files
- add new struct member for acrn_vm_config;

- add sharing_config.c file with initialized vm_config array;

- add SOS VM config header for apl-mrb/apl-nuc/up2 and dnv-cb2 board;

- and partition_config.c file with dummy vm_config array;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-18 11:50:00 +08:00
Victor Sun c4a230f313 HV: rename the term of vm_description to vm_config
This patch is a pure term change of vm_description to vm_config,
the struct name of vm_description is changed to acrn_vm_config.

The patch does not change any code logic or senmantic.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-18 11:50:00 +08:00
Tw fe35dde421 Makefile: support SBL binary for E2E build
Currently, we support SBL on two different boards.
So build and install them all in E2E build.

Tracked-On: #2344
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-18 11:22:15 +08:00
Zhao Yakui 13c44f5661 acrn/dm: Check device file of /dev/acrn_hsm to determine the path of offline VCPU
For the upstream purpose the device file of /dev/acrn_vhm is renamed
to /dev/acrn_hsm. Correspondingly the path of offline CPU is also changed.
So the device file of /dev/acrn_hsm is checked to configure the path
of ooffline VCPU.

Tracked-On: projectacrn/acrn-hypervisor#2356
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2019-01-18 11:04:22 +08:00
Zhao Yakui ca32881666 acrn/dm: Add the check of acrn_vhm/acrn_hsm to open the VHM driver
Currently VHM driver is opened by using the device file of /dev/acrn_vhm.
But for the upstream purpose it is renamed to /dev/acrn_hsm.
So we need to check that the device file is acrn_vhm or acrn_hsm and then
open the VHM driver.

Tracked-On: projectacrn/acrn-hypervisor#2356
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2019-01-18 11:04:22 +08:00
Zhao Yakui e4a3a63496 acrn/vhm: change the default notification vector to 0xF3
Currently the SOS kernel will call hcall_set_callback_vector to config
the expected up-notification vector(0xF3) and then hypervisor uses the
passed vector to raise the interrupt to SOS when needed.
As sos kernel already switches to 0xF3 notification vector, the default 
notification vector can be changed from 0xF7 to 0xF3. In such case it still
can work well even when the SOS kernel doesn't reconfigure the notification
vector. 

Tracked-On: projectacrn/acrn-hypervisor#2355 
Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
2019-01-18 11:04:22 +08:00
Minggui Cao f45605dd49 HV: modularization to separate CR related code
1. move the CR related code from vmcs/vcpu to vCR source files.
2. also add virtual_cr.h to acrn.doxyfile to avoid doc failure.

Tracked-On: #1842
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2019-01-18 10:50:18 +08:00
Mingqiang Chi 8265770f05 hv:Change acrn_vhm_vector to static
-- Change acrn_vhm_vector to static, only used in io_request.c
-- Add set_vhm_vector() api, it will call this api instead of
   acrn_vhm_vector except io_request.c

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-18 08:29:36 +08:00
Zide Chen b22c8b696b hv: add more MSR definitions
- add definitions of all architectural MSRs
- add definitions of majority of non architectural MSRs

The non-architectural MSR definitions are specific to particular CPU model
or family.

e.g. MSR 0xE01 could refer to different MSRs in difference processors, and
in this patch, MSR_R0_PMON_BOX_STATUS is chosen without any particular reasons.
  MSR_R0_PMON_BOX_STATUS in Xeon Processor 7500 Series
  MSR_C0_PMON_EVNTSEL0 in Xeon E5 V3 family
  MSR_UNC_PERF_GLOBAL_CTRL in 6th plus generations Core Processors

Tracked-On: #1867
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-17 12:53:09 +08:00
Mingqiang Chi 6372548e11 hv:Fix violation "Cyclomatic complexity greater than 20" in instr_emul.c
Split decode_prefixes() to 2 small APIs

v1-->v2:
    split decode_prefixes to 2 APIs

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-17 11:22:02 +08:00
yuhong.tao@intel.com ae144e1a56 hv:fix MISRA-C violation in virq.c
The MISRA-C Standards suggests procedures to be single exit

Tracked-On: #861
Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2019-01-17 08:48:42 +08:00
Yan, Like 6641bc7949 hv: remove ACRN_REQUEST_TMR_UPDATE and unnecessary codes
Because ACRN_REQUEST_TMR_UPDATE is not needed anymore, this commit remove
the MACRO definition and its related logic, including following functions:
- apicv_batch_set_tmr()
- vlapic_apicv_batch_set_tmr()
- vlapic_set_tmr_one_vec()
- vioapic_update_tmr()

Tracked-On: #2343
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-17 08:48:22 +08:00
Yan, Like fc61536b07 hv: rework EOI_EXIT_BITMAP update logic
This commit changes the EOI_EXIT_BITMAP as follows:
- add a eoi_exit_bitmap to vlapic structure;
- go through all the RTEs and set eoi_exit_bitmap in the vlapic structure when related RTE fields are modified;
- add ACRN_REQUEST_EOI_EXIT_UPDATE, if eoi_exit_bitmap changed, request the corresponding vcpu to write the bitmap
  to VMCS.

Tracked-On: #2343
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-17 08:48:22 +08:00
Yan, Like f15cc7d6de hv: set/clear TMR bit like hardware behave
Current ACRN implementation update TMR bits one time only when related RTE fields changed,
which is not acting like actual hardware.

From SDM vol3 10.8.4:
"Upon acceptance of an interrupt into the IRR, the corresponding TMR bit is cleared for
edge-triggered interrupts and set for leveltriggered interrupts."

This commit change the ACRN implementation to set/clear corresponding TMR bit when inject
intr to vlapic.

Tracked-On: #2343
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-17 08:48:22 +08:00
Sainath Grandhi c9b617485f hv: Make reserved regions in E820 table to Supervisor pages
On platforms that put ACPI RSDT in "Reserved" type memory, ACRN
fails to parse RSDP and therefore ACPI Tables. This patch adds
"Reserved" memory regions in E820 as Supervisor pages.

Tracked-On: #2320
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
2019-01-17 08:48:07 +08:00
Jack Ren 4322b02468 version: 0.6-unstable
Signed-off-by: Jack Ren <jack.ren@intel.com>
2019-01-16 23:33:04 +08:00
wenlingz 34b4294334 Doc: Update GSG for v0.5 version and launch and acrn.conf sample script
modify sbl_up2 version and scripts
2019-01-16 16:28:26 +08:00
Chen Gang G b4a1dd2b56 hv: fix identifier reuse violations in sha256.c
Refer to sha256 description to rename function name

Tracked-On: #861
Signed-off-by: Chen Gang G <gang.g.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-16 10:24:49 +08:00
Zhipeng Gong 7c56243225 hv: hv_main: adjust vm exit trace position
When we use script to analyze the latency between vm_exit and vm_entry,
it does not include the duration of vm_exit handler.

The patch moves the vm_exit trace before vmexit_handler.

v2: move vm_exit trace right after run_vcpu.

Tracked-On: #2341
Signed-off-by: Zhipeng Gong <zhipeng.gong@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2019-01-16 10:24:33 +08:00
Chaohong guo dc6d1d5fa7 HV: fix MISRA issue in apicv_pending_intr()
Remove multi-return statement in apicv_pending_intr().

Tracked-On: #861
Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-15 13:48:19 +08:00
Chaohong guo 2ca218bfb8 HV: Removed ununsed struct vm_lu_mem_map from guest.h
The struct vm_lu_mem_map is not used by code. Remove it.
Also, add bracks () for the variables in macro foreach_vcpu.

Tracked-On: #861
Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-15 13:48:19 +08:00
Chaohong guo aebb971d41 HV: misra clean for guest.c file
to meeting MISRA, add more bracks for if conditions; also a small
change to copy_gpa() to fix DD flow complaint from MISRA

Tracked-On: #861
Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-15 13:48:19 +08:00
Chaohong guo 6a1c865671 HV: add empty else statement for if condition in vlapic.c
To meeting MISRA, add empty else {} for corresponding if-else-if {}.
Also, remove a DD flow violation in vlapic_free()

Tracked-On: #861
Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-01-15 13:48:19 +08:00
Victor Sun 952356099c HV: rename dnv_cb2 to dnv-cb2
To follow the same (albeit implicit) convention with apl-mrb and use dnv-cb2.

Tracked-On: #2291
Signed-off-by: Victor Sun <victor.sun@intel.com>
2019-01-15 13:42:36 +08:00
Zide Chen b30dfb1da8 hv: fix MISRA-C violations in vmsr.c
In enable_msr_interception(), by removing the local pointer declarations and
all pointer arithmetic operations, the following violations are fixed.

- Use of pointer arithmetic.
- Pointer arithmetic is not on array.
- Pointer not checked for null before use.

Tracked-On: #861
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-15 08:49:34 +08:00
Xie, nanlin 6bdcaf7fe4 Doc: Add one new known issue into v0.5 release note
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2019-01-14 07:03:58 -08:00
Yonghua Huang 67c7422aed hv: fix coding style violations in acpi.c
1. to avoid data type cast when using 'global_rsdp'
 2. other minor fix

Tracked-On: #861
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2019-01-14 23:00:57 +08:00
Feng Tang ed9b533747 DM: sos_bootargs: Add panic_print parameter to help debugging
Adding this parameter so that it could provide more info when
kernel panic happens. And this has almost no overhead as it only
uses several existing kernel APIs.

The 0x1f is a bitmask for type of info to be dumped, and it means
it will print task/memory/timer/lock/ftrace info when panic happens.

Tracked-On: #2330
Signed-off-by: Feng Tang <feng.tang@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
2019-01-14 16:19:59 +08:00