Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM loader reshuffle #1231

Closed
fyin1-zz opened this issue Sep 13, 2018 · 2 comments
Closed

VM loader reshuffle #1231

fyin1-zz opened this issue Sep 13, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@fyin1-zz
Copy link

Reshuffle VM loader to avoid involving hypervisor when pass info from DM to guest.

@mwang106
Copy link
Contributor

mwang106 commented Sep 14, 2018

[External_System_ID] ACRN-2142

@mwang106 mwang106 added type: feature New feature status: new The issue status: new for creation priority: medium labels Sep 14, 2018
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 19, 2018
And re-arrange the boot_ctx struture to merge the set_cpu_state.
Fixed the build issue introduced by the change.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 19, 2018
DM will use this hypercall to set UOS bsp boot state like
segment selector/base, rip etc.

We also add init_ctx as one field of vcpu structure.
It will be initialized for BSP of VM from:
  - UEFI vm0: from efi_ctx saved in UEFI glue before acrn boot
  - none-UEFI VM0: from vm0_boot_context saved at very beginning
    of acrn boot
  - UOS: from hypercall called by DM

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 19, 2018
To unify the init_vmcs operations for BSP of UEFI/SBL, we
initialize the boot context of BSP for UEFI and SBL during
BSP is created. After BSP is created, all boot context
is gotten from BSP init_ctx.

This patch also fixes build error on UEFI platform.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 19, 2018
Add the parameter and cmd definition for ioctl to set vcpu state.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 19, 2018
After this patch, we drop the hypervisor invole for guest info
passing. The loader should setup correct cpu state for guest.

Regarding the vm loader is for VM, move the vm loader invoking
in HV from vcpu prepare to vm prepare.

Drop the help function for UOS loader in hypervisor. Also drop
guest gdt preparing code (should prepare in DM instead of HV).

Now the vcpu context is maintained by following:
1. VM0 BSP context is inherited from bootloader (UEFI or ABL)
2. VMx BSP context is setup in DM
3. All APs are default real mode
4. When reset vcpu, its contex is set to default real mode

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 19, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc).

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 19, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc).

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
Current SOS are using struct boot_ctx now which includes the
SOS BSP regs.

To align the SOS BSP init regs (from boot_ctx) and UOS BSP
init regs (from hypercall), we ajust the struct boot_ctx a
little bit. Make the hypercall parameter struct acrn_vcpu_regs
fit to the first field of struct boot_ctx.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
DM will use this hypercall to set UOS bsp regs like segment
selector/base, rip etc.

We also add init_ctx as one field of vcpu structure.
It will be initialized for BSP of VM from:
  - UEFI vm0: from efi_ctx saved in UEFI glue before acrn boot
  - none-UEFI VM0: from vm0_boot_context saved at very beginning
    of acrn boot
  - UOS: from hypercall called by DM

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
To unify the init_vmcs operations for BSP of UEFI/SBL, we
initialize the boot context of BSP for UEFI and SBL during
BSP is created. After BSP is created, all boot context
is gotten from BSP init_ctx.

This patch also fixes build error on UEFI platform.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
Add the parameter and cmd definition for ioctl to set vcpu regs

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
After this patch, we drop the hypervisor invole for guest info
passing. The loader should setup correct cpu state for guest.

Regarding the vm loader is for VM, move the vm loader invoking
in HV from vcpu prepare to vm prepare.

Drop the help function for UOS loader in hypervisor. Also drop
guest gdt preparing code (should prepare in DM instead of HV).

Now the vcpu context is maintained by following:
1. VM0 BSP context is inherited from bootloader (UEFI or ABL)
2. VMx BSP context is setup in DM
3. All APs are default real mode
4. When reset vcpu, its contex is set to default real mode

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc).

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc).

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 20, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc).

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
DM will use this hypercall to set UOS bsp regs like segment
selector/base, rip etc.

Also add help function to set the vcpu registers accordingly.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
So the struct acrn_vcpu_regs are used for both SOS and UOS
BSP init state. Then we could further use same API for
SOS and UOS BSP state initialization.

For UEFI, the info passed from efi_boot to hypervisor is
defined to struct acrn_vcpu_regs plus *rsdp and ap_trampoline_buf.
And the struct acrn_vcpu_regs will be used to initialize
SOS BSP state. And rsdp and ap_trampoline_buf will be only
used in hypervisor.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
Let SOS use set_vcpu_regs to init BSP state. Now, SOS and UOS
use same API to init BSP state.

The different thing is the init state of SOS BSP is saved when
hypervisor is started. While UOS BSP state is set by hypercall
from DM.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
Because AP always is in real mode with entry defined by sipi
vector. We add function to set AP init state and move the call
to the place where AP got SIPI signal.

We also drop init_guest_context_protect because BSP state init
doesn't call this function any more.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
With the new interface to set guest BSP init state, some code
become dead code and could be removed.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
Now, the sw_loader in hypervisor only support SOS. For partition
mode, all guests could be seen as SOS.

Update the code to align with this situation.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
Add ioctl parameter and API to set vcpu regs. The guest software
loader will call this API to set guest vcpu registers.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc) when DM load vsbl.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc) when DM load bzimage.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Sep 27, 2018
For SOS resume from S3, it's very similar like AP start:
real mode with entry set to wakeup_vec saved in ACPI table.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Oct 14, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc) when DM load vsbl.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Oct 14, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc) when DM load bzimage.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Oct 14, 2018
Now, we make UOS to set BSP init state by using hypercall. We
could drop the old UOS loader in HV and make vm loader in HV
only for SOS.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Oct 14, 2018
For UOS, there is no BSP init state saved in hv. We always need
DM to set BSP init state by using hypercall. So we can't auto
start vm during vm reset.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Oct 14, 2018
For UOS, we need to call hypercall to set BSP init state now.
So we can't combint the vm start and vm reset (vm reset will
reset the vcpu context). Remove vm start from reset_vm. DM
needs to start vm after every vm reset.

Update DM to set UOS BSP init state after vm reset and before
vm start.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Oct 14, 2018
Move vcpu mode set to function vcpu_set_regs.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Oct 14, 2018
Now, UOS will use hypercall to init BSP state, we could remove
set_bsp_real_mode_entry() and set_bsp_protect_mode_regs().

For SOS, GDT will inherit from SBL or UEFI. For UOS, DM will
prepare GDT. We don't need hypervisor to prepare GDT for guest.

The entry_addr of vcpu struct could be removed. The guest entry
is set through BSP rip register.

GUEST_CFG_OFFSET is not needed any more after this patchset.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
DM will use this hypercall to initialize the UOS BSP state.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
Add ioctl parameter and API to set vcpu regs. The guest software
loader will call this API to set guest vcpu registers.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc) when DM load vsbl.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
to use new interface to set the state of guest BSP (entries, general
registers etc) when DM load bzimage.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
Now, we make UOS to set BSP init state by using hypercall. We
could drop the old UOS loader in HV and make vm loader in HV
only for SOS.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
For UOS, there is no BSP init state saved in hv. We always need
DM to set BSP init state by using hypercall. So we can't auto
start vm during vm reset.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
For UOS, we need to call hypercall to set BSP init state now.
So we can't combint the vm start and vm reset (vm reset will
reset the vcpu context). Remove vm start from reset_vm. DM
needs to start vm after every vm reset.

Update DM to set UOS BSP init state after vm reset and before
vm start.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
Move vcpu mode set to function vcpu_set_regs.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
wenlingz pushed a commit that referenced this issue Oct 15, 2018
Now, UOS will use hypercall to init BSP state, we could remove
set_bsp_real_mode_entry() and set_bsp_protect_mode_regs().

For SOS, GDT will inherit from SBL or UEFI. For UOS, DM will
prepare GDT. We don't need hypervisor to prepare GDT for guest.

The entry_addr of vcpu struct could be removed. The guest entry
is set through BSP rip register.

GUEST_CFG_OFFSET is not needed any more after this patchset.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Nov 1, 2018
For CS of UOS, we would like to pass all related info (cs attribute,
limit, base) from DM.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Nov 1, 2018
Save the native cs limit and reuse it for SOS cs limit. To remove
the hardcode of cs limit for guest in hypervisor.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
fyin1-zz pushed a commit to fyin1-zz/acrn-hypervisor that referenced this issue Nov 1, 2018
For SOS BSP, we reuse native saved cs.limit
For UOS BSP, we set cs.limit in DM
For AP, we use initialized data from realmode_init_regs.

Tracked-On: projectacrn#1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
lijinxia pushed a commit that referenced this issue Nov 1, 2018
For CS of UOS, we would like to pass all related info (cs attribute,
limit, base) from DM.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
lijinxia pushed a commit that referenced this issue Nov 1, 2018
Save the native cs limit and reuse it for SOS cs limit. To remove
the hardcode of cs limit for guest in hypervisor.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
lijinxia pushed a commit that referenced this issue Nov 1, 2018
For SOS BSP, we reuse native saved cs.limit
For UOS BSP, we set cs.limit in DM
For AP, we use initialized data from realmode_init_regs.

Tracked-On: #1231
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
@fyin1-zz
Copy link
Author

fyin1-zz commented Nov 9, 2018

All the related patches were merged and we could close this issue.

@fyin1-zz fyin1-zz closed this as completed Nov 9, 2018
@mwang106 mwang106 added status: closed The issue been closed and removed status: new The issue status: new for creation labels Nov 9, 2018
@hwang37 hwang37 added this to the v0.3 milestone Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants