DM: add vm_stop/reset_watchdog
When guest enter/exit S3, we need to do 1. stop watchdog timer when guest enter S3 to avoid watchdog timer reset guest when guest is in S3 state. 2. reset watchdog timer when guest exit from S3. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
a2241d983d
commit
8ee4c0b1dd
|
@ -49,6 +49,7 @@
|
|||
|
||||
#define WDT_TIMER_SIG 0x55AA
|
||||
#define DEFAULT_MAX_TIMER_VAL 0x000FFFFF
|
||||
#define DEFAULT_RESET_TIMER_VAL 60
|
||||
|
||||
/* for debug */
|
||||
/* #define WDT_DEBUG */
|
||||
|
@ -365,6 +366,31 @@ pci_wdt_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||
memset(&wdt_state, 0, sizeof(wdt_state));
|
||||
}
|
||||
|
||||
/* stop/reset watchdog will be invoked during guest enter/exit S3.
|
||||
* We stop watchdog timer when guest enter S3 to avoid watchdog trigger
|
||||
* guest reset when guest is in S3 state.
|
||||
*
|
||||
* We reset watchdog with a long peroid (2 * 60s) during guest exit
|
||||
* from S3 to handle system hang before watchdog in guest kernel start to
|
||||
* work.
|
||||
*/
|
||||
void
|
||||
vm_stop_watchdog(struct vmctx *ctx)
|
||||
{
|
||||
stop_wdt_timer();
|
||||
}
|
||||
|
||||
void
|
||||
vm_reset_watchdog(struct vmctx *ctx)
|
||||
{
|
||||
wdt_state.stage = 1;
|
||||
wdt_state.timer1_val = DEFAULT_RESET_TIMER_VAL;
|
||||
wdt_state.timer2_val = DEFAULT_RESET_TIMER_VAL;
|
||||
wdt_state.unlock_state = 0;
|
||||
|
||||
start_wdt_timer();
|
||||
}
|
||||
|
||||
struct pci_vdev_ops pci_ops_wdt = {
|
||||
.class_name = "wdt-i6300esb",
|
||||
.vdev_init = pci_wdt_init,
|
||||
|
|
|
@ -148,4 +148,6 @@ int vm_reset_ptdev_intx_info(struct vmctx *ctx, int virt_pin, bool pic_pin);
|
|||
int vm_create_vcpu(struct vmctx *ctx, uint16_t vcpu_id);
|
||||
|
||||
int vm_get_cpu_state(struct vmctx *ctx, void *state_buf);
|
||||
void vm_stop_watchdog(struct vmctx *ctx);
|
||||
void vm_reset_watchdog(struct vmctx *ctx);
|
||||
#endif /* _VMMAPI_H_ */
|
||||
|
|
Loading…
Reference in New Issue