mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 01:07:57 +00:00
hv: sched: support vcpu context switch on one pcpu
To support cpu sharing, multiple vcpu can run on same pcpu. We need do necessary vcpu context switch. This patch add below actions in context switch. 1) fxsave/fxrstor; 2) save/restore MSRs: MSR_IA32_STAR, MSR_IA32_LSTAR, MSR_IA32_FMASK, MSR_IA32_KERNEL_GS_BASE; 3) switch vmcs. Tracked-On: #3813 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Signed-off-by: Yu Wang <yu1.wang@intel.com> Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
7e66c0d4fa
commit
dadcdcefa0
@@ -538,6 +538,17 @@ static inline bool is_pae(struct acrn_vcpu *vcpu)
|
||||
return (vcpu_get_cr4(vcpu) & CR4_PAE) != 0UL;
|
||||
}
|
||||
|
||||
static inline void save_fxstore_guest_area(struct ext_context *ext_ctx)
|
||||
{
|
||||
asm volatile("fxsave (%0)"
|
||||
: : "r" (ext_ctx->fxstore_guest_area) : "memory");
|
||||
}
|
||||
|
||||
static inline void rstor_fxstore_guest_area(const struct ext_context *ext_ctx)
|
||||
{
|
||||
asm volatile("fxrstor (%0)" : : "r" (ext_ctx->fxstore_guest_area));
|
||||
}
|
||||
|
||||
struct acrn_vcpu *get_running_vcpu(uint16_t pcpu_id);
|
||||
struct acrn_vcpu* get_ever_run_vcpu(uint16_t pcpu_id);
|
||||
|
||||
|
@@ -41,6 +41,7 @@ static inline uint64_t apic_access_offset(uint64_t qual)
|
||||
return (qual & APIC_ACCESS_OFFSET);
|
||||
}
|
||||
void init_vmcs(struct acrn_vcpu *vcpu);
|
||||
void switch_vmcs(const struct acrn_vcpu *vcpu);
|
||||
|
||||
void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu);
|
||||
#endif /* ASSEMBLER */
|
||||
|
Reference in New Issue
Block a user