Skip to content

Commit d34700a

Browse files
fyin1NanlinXie
authored andcommitted
hv: prepare for Sx(S3/S5) support in ACRN.
Couple of small changes merged in this change: - export main_entry, trampoline_spinlock and stop_cpus. - change vm_resume() name to resume_vm() - change resume_console_enable() name to resume_console() - extend reset_vcpu to reset more fields of vcpu Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent a06a2f2 commit d34700a

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ void reset_vcpu(struct vcpu *vcpu)
278278
vcpu->ioreq_pending = 0;
279279
vcpu->arch_vcpu.nr_sipi = 0;
280280
vcpu->pending_pre_work = 0;
281+
282+
vcpu->arch_vcpu.exception_info.exception = VECTOR_INVALID;
283+
vcpu->arch_vcpu.cur_context = NORMAL_WORLD;
284+
vcpu->arch_vcpu.irq_window_enabled = 0;
285+
vcpu->arch_vcpu.inject_event_pending = false;
286+
memset(vcpu->arch_vcpu.vmcs, 0, CPU_PAGE_SIZE);
287+
281288
vlapic = vcpu->arch_vcpu.vlapic;
282289
vlapic_reset(vlapic);
283290
}

hypervisor/arch/x86/guest/vm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void pause_vm(struct vm *vm)
274274
pause_vcpu(vcpu, VCPU_ZOMBIE);
275275
}
276276

277-
int vm_resume(struct vm *vm)
277+
void resume_vm(struct vm *vm)
278278
{
279279
int i;
280280
struct vcpu *vcpu = NULL;
@@ -283,8 +283,6 @@ int vm_resume(struct vm *vm)
283283
resume_vcpu(vcpu);
284284

285285
vm->state = VM_STARTED;
286-
287-
return 0;
288286
}
289287

290288
/* Create vm/vcpu for vm0 */

hypervisor/include/arch/x86/cpu.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,12 @@ extern uint8_t trampoline_pdpt_addr[];
174174
extern uint8_t trampoline_gdt_ptr[];
175175
extern uint8_t trampoline_start64_fixup[];
176176

177+
/* In trampoline range, hold the jump target which trampline will jump to */
178+
extern uint64_t main_entry[1];
179+
177180
extern uint64_t trampoline_start16_paddr;
178181
extern int ibrs_type;
182+
extern spinlock_t trampoline_spinlock;
179183

180184
/*
181185
* To support per_cpu access, we use a special struct "per_cpu_region" to hold
@@ -260,6 +264,7 @@ bool is_vapic_virt_reg_supported(void);
260264
bool cpu_has_cap(uint32_t bit);
261265
void load_cpu_state_data(void);
262266
void start_cpus();
267+
void stop_cpus();
263268

264269
/* Read control register */
265270
#define CPU_CR_READ(cr, result_ptr) \

hypervisor/include/arch/x86/guest/vm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ struct vm_description {
171171

172172
int shutdown_vm(struct vm *vm);
173173
void pause_vm(struct vm *vm);
174+
void resume_vm(struct vm *vm);
174175
int start_vm(struct vm *vm);
175176
int create_vm(struct vm_description *vm_desc, struct vm **vm);
176177
int prepare_vm0(void);

hypervisor/include/debug/console.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static inline void suspend_console(void)
7070
del_timer(&console_timer);
7171
}
7272

73-
static inline void resume_console_enable(void)
73+
static inline void resume_console(void)
7474
{
7575
console_setup_timer();
7676
}
@@ -101,7 +101,7 @@ static inline void console_setup_timer(void) {}
101101
static inline uint32_t get_serial_handle(void) { return 0; }
102102

103103
static inline void suspend_console(void) {}
104-
static inline void resume_console_enable(void) {}
104+
static inline void resume_console(void) {}
105105
#endif
106106

107107
#endif /* CONSOLE_H */

0 commit comments

Comments
 (0)