Skip to content

Commit 3936d05

Browse files
committed
pc-bios/s390-ccw/virtio: Add a function to reset a virtio device
To be able to properly silence a virtio device after using it, we need a global function to reset the device. Reviewed-by: Jared Rossi <jrossi@linux.ibm.com> Reviewed-by: Eric Farman <farman@linux.ibm.com> Tested-by: Jared Rossi <jrossi@linux.ibm.com> Message-ID: <20250116115826.192047-2-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
1 parent 807830e commit 3936d05

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pc-bios/s390-ccw/virtio.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd)
217217
return 0;
218218
}
219219

220+
int virtio_reset(VDev *vdev)
221+
{
222+
return run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false);
223+
}
224+
220225
int virtio_setup_ccw(VDev *vdev)
221226
{
222227
int i, cfg_size = 0;
@@ -235,7 +240,7 @@ int virtio_setup_ccw(VDev *vdev)
235240
vdev->config.blk.blk_size = 0; /* mark "illegal" - setup started... */
236241
vdev->guessed_disk_nature = VIRTIO_GDN_NONE;
237242

238-
run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false);
243+
virtio_reset(vdev);
239244

240245
status = VIRTIO_CONFIG_S_ACKNOWLEDGE;
241246
if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) {

pc-bios/s390-ccw/virtio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ void vring_send_buf(VRing *vr, void *p, int len, int flags);
274274
int vr_poll(VRing *vr);
275275
int vring_wait_reply(void);
276276
int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd);
277+
int virtio_reset(VDev *vdev);
277278
int virtio_setup_ccw(VDev *vdev);
278279

279280
int virtio_net_init(void *mac_addr);

0 commit comments

Comments
 (0)