Skip to contentSkip to conversation

hw/s390x: why watchdog device diag288 is resetted twice?

DISCUSSION Philippe Mathieu-Daudé 2 participants 2 messages Sep 26, 2019

lore
Share & tools
lore
#0 lore raw

Hi,

hw/watchdog/wdt_diag288.c use 2 different resets:

1/ registered handler:

    qemu_register_reset(diag288_reset, diag288);

2/ DeviceClass reset:

    dc->reset = wdt_diag288_reset;

diag288_reset() simply calls wdt_diag288_reset():

static void wdt_diag288_reset(DeviceState *dev)

{
    DIAG288State *diag288 = DIAG288(dev);

    diag288->enabled = false;
    timer_del(diag288->timer);
}

static void diag288_reset(void *opaque)

{
    DeviceState *diag288 = opaque;

    wdt_diag288_reset(diag288);
}

Why do we need this distinction?
Is this some special corner case?
Isn't this device connected to the QOM bus?

Thanks,

Phil.

#1 lore raw
Quoted 29 lines · Philippe Mathieu-Daudé

Hi,

hw/watchdog/wdt_diag288.c use 2 different resets:

1/ registered handler:

    qemu_register_reset(diag288_reset, diag288);

2/ DeviceClass reset:

    dc->reset = wdt_diag288_reset;

diag288_reset() simply calls wdt_diag288_reset():

static void wdt_diag288_reset(DeviceState *dev)

{
    DIAG288State *diag288 = DIAG288(dev);

    diag288->enabled = false;
    timer_del(diag288->timer);
}

static void diag288_reset(void *opaque)

{
    DeviceState *diag288 = opaque;

    wdt_diag288_reset(diag288);
}
Quoted 4 lines

Why do we need this distinction?
Is this some special corner case?
Isn't this device connected to the QOM bus?

It's not a qdev device, so it won't get reset via the sysbus (I saw patches changing that but I think they are not upstream yet).

The "dc->reset = wdt_diag288_reset;" is needed to make hw/s390x/s390-virtio-ccw.c:subsystem_reset() work.

Signature · 3 lines
Thanks,

David / dhildenb