Skip to content

Commit cb93a83

Browse files
committed
drivers: watchdog: virtio_wdt: Support modern systemd
Modern versions of systemd require the ability to call the WDIOF_SETTIMEOUT ioctl. Since we don't support changing the watchdog frequency ignore that value. This isn't a problem as systemd reads the value back to identify what the hardware supported. Signed-off-by: Rob Bradford <rbradford@meta.com>
1 parent 39545a8 commit cb93a83

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

drivers/watchdog/virtio_wdt.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,27 @@ static int virtio_watchdog_stop(struct watchdog_device *wdd)
114114
return 0;
115115
}
116116

117+
/* Accept but ignore the requested timeout; the VMM controls the real
118+
* timeout. wdd->timeout remains at VW_HEARTBEAT_DEFAULT from probe so
119+
* GETTIMEOUT always reports the actual hardware value.
120+
*/
121+
static int virtio_watchdog_set_timeout(struct watchdog_device *wdd,
122+
unsigned int timeout)
123+
{
124+
return 0;
125+
}
126+
117127
static struct watchdog_info vw_info = {
118128
.identity = "virtio-watchdog",
119-
.options = WDIOF_KEEPALIVEPING,
129+
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
120130
};
121131

122132
static const struct watchdog_ops vw_ops = {
123133
.owner = THIS_MODULE,
124134
.start = virtio_watchdog_start,
125135
.stop = virtio_watchdog_stop,
126136
.ping = virtio_watchdog_ping,
137+
.set_timeout = virtio_watchdog_set_timeout,
127138
};
128139

129140
static int probe_common(struct virtio_device *vdev)
@@ -156,8 +167,8 @@ static int probe_common(struct virtio_device *vdev)
156167

157168
vi->wdd.info = &vw_info;
158169
vi->wdd.ops = &vw_ops;
159-
vi->wdd.min_timeout = VW_HEARTBEAT_DEFAULT;
160-
vi->wdd.max_timeout = VW_HEARTBEAT_DEFAULT;
170+
vi->wdd.min_timeout = 1;
171+
vi->wdd.max_timeout = 0xFFFF;
161172
vi->wdd.timeout = VW_HEARTBEAT_DEFAULT;
162173

163174
err = watchdog_register_device(&vi->wdd);

0 commit comments

Comments
 (0)