hv: save/restore TSC in host's suspend/resume path

TSC would be reset to 0 when enter suspend state on some platform.
This will fail the secure timer checking in secure world because
secure world leverage the TSC as source of secure timer which should
be increased monotonously.

This patch save/restore TSC in host suspend/resume path to guarantee
the mono increasing TSC.

Note: There should no timer setup before TSC resumed.

Tracked-On: #3697
Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Qi Yadong
2019-09-18 10:58:09 +08:00
committed by wenlingz
parent b888d50c6a
commit 3ebeecf060
2 changed files with 23 additions and 1 deletions

View File

@@ -56,6 +56,7 @@ struct per_cpu_region {
struct profiling_info_wrapper profiling_info;
#endif
uint16_t shutdown_vm_id;
uint64_t tsc_suspend;
} __aligned(PAGE_SIZE); /* per_cpu_region size aligned with PAGE_SIZE */
extern struct per_cpu_region per_cpu_data[CONFIG_MAX_PCPU_NUM];