watchdog/diag288: correctly register for system reset requests
The diag288 watchdog is no sysbus device, therefore it doesn't get triggered on resets automatically using dc->reset. Let's register the reset handler manually, so we get correctly notified again when a system reset was requested. Also reset the watchdog on subsystem resets that don't trigger a full system reset. Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
		
							parent
							
								
									0030ff4047
								
							
						
					
					
						commit
						0c7322cfd3
					
				| 
						 | 
					@ -36,7 +36,7 @@ typedef struct S390CcwMachineState {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void io_subsystem_reset(void)
 | 
					void io_subsystem_reset(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DeviceState *css, *sclp, *flic;
 | 
					    DeviceState *css, *sclp, *flic, *diag288;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    css = DEVICE(object_resolve_path_type("", "virtual-css-bridge", NULL));
 | 
					    css = DEVICE(object_resolve_path_type("", "virtual-css-bridge", NULL));
 | 
				
			||||||
    if (css) {
 | 
					    if (css) {
 | 
				
			||||||
| 
						 | 
					@ -51,6 +51,10 @@ void io_subsystem_reset(void)
 | 
				
			||||||
    if (flic) {
 | 
					    if (flic) {
 | 
				
			||||||
        qdev_reset_all(flic);
 | 
					        qdev_reset_all(flic);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    diag288 = DEVICE(object_resolve_path_type("", "diag288", NULL));
 | 
				
			||||||
 | 
					    if (diag288) {
 | 
				
			||||||
 | 
					        qdev_reset_all(diag288);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int virtio_ccw_hcall_notify(const uint64_t *args)
 | 
					static int virtio_ccw_hcall_notify(const uint64_t *args)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,6 +40,13 @@ static void wdt_diag288_reset(DeviceState *dev)
 | 
				
			||||||
    timer_del(diag288->timer);
 | 
					    timer_del(diag288->timer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void diag288_reset(void *opaque)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    DeviceState *diag288 = opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    wdt_diag288_reset(diag288);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void diag288_timer_expired(void *dev)
 | 
					static void diag288_timer_expired(void *dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n");
 | 
					    qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n");
 | 
				
			||||||
| 
						 | 
					@ -80,6 +87,7 @@ static void wdt_diag288_realize(DeviceState *dev, Error **errp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DIAG288State *diag288 = DIAG288(dev);
 | 
					    DIAG288State *diag288 = DIAG288(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    qemu_register_reset(diag288_reset, diag288);
 | 
				
			||||||
    diag288->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, diag288_timer_expired,
 | 
					    diag288->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, diag288_timer_expired,
 | 
				
			||||||
                                  dev);
 | 
					                                  dev);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue