Previously, on SMP VTI-domain, Guest OS was responsible for
syncing itc by calling ia64_sync_itc, but the round trip may
be very large on VTI domain, that may cause guest itcs are
not synced well and cause guest wall clock is not accurate.
This patch intends to fix this issue, when guest wants to sync
itc( vcpus other than vcpu0 write itc), VMM directly get vcpu0
itc for other vcpus.
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
}
-
-
void vtm_set_itc(VCPU *vcpu, uint64_t new_itc)
{
uint64_t vitm, vitv;
vitm = VCPU(vcpu,itm);
vitv = VCPU(vcpu,itv);
vtm=&(vcpu->arch.arch_vmx.vtm);
- vtm->vtm_offset = new_itc - ia64_get_itc();
- vtm->last_itc = new_itc;
+ if(vcpu->vcpu_id == 0){
+ vtm->vtm_offset = new_itc - ia64_get_itc();
+ vtm->last_itc = new_itc;
+ }
+ else{
+ vtm->vtm_offset = vcpu->domain->vcpu[0]->arch.arch_vmx.vtm.vtm_offset;
+ new_itc=vtm->vtm_offset + ia64_get_itc();
+ vtm->last_itc = new_itc;
+ }
if(vitm < new_itc){
clear_bit(ITV_VECTOR(vitv), &VCPU(vcpu, irr[0]));
stop_timer(&vtm->vtm_timer);