hv: add vmx_off and update exec_vmxon_instr

To handle cpu down/up dynamically, arcn needs to support vmx off/on
dynamically. Following changes is introduced:
  vmx_off will be used when down AP. It does:
    - vmclear the mapped vcpu
    - off vmx.

  exec_vmxon_instr is updated to handle start and up AP both. It does
    - if vmx was on on AP, load the vmxon_region saved. Otherwise,
      allocate vmxon_region.
    - if there is mapped vcpu, vmptrld mapped vcpu.

Signed-off-by: Zheng Gen <gen.zheng@intel.com>
Signed-off-by: Yin Fegnwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
This commit is contained in:
Yin Fegnwei
2018-06-02 11:19:30 +08:00
committed by lijinxia
parent fbeafd500a
commit 08139c34f7
4 changed files with 43 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ struct per_cpu_region {
uint64_t vmexit_time[64];
uint64_t softirq_pending;
uint64_t spurious;
uint64_t vmxon_region_pa;
struct dev_handler_node *timer_node;
struct shared_buf *earlylog_sbuf;
void *vcpu;

View File

@@ -401,13 +401,16 @@
#define VMX_SUPPORT_UNRESTRICTED_GUEST (1<<5)
/* External Interfaces */
int exec_vmxon_instr(void);
int exec_vmxon_instr(uint32_t pcpu_id);
uint64_t exec_vmread(uint32_t field);
uint64_t exec_vmread64(uint32_t field_full);
void exec_vmwrite(uint32_t field, uint64_t value);
void exec_vmwrite64(uint32_t field_full, uint64_t value);
int init_vmcs(struct vcpu *vcpu);
int vmx_off(int pcpu_id);
int vmx_restart(int pcpu_id);
int exec_vmclear(void *addr);
int exec_vmptrld(void *addr);