[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/18] vfio-user: handle reset of remote device
From: |
Stefan Hajnoczi |
Subject: |
[PULL 16/18] vfio-user: handle reset of remote device |
Date: |
Wed, 15 Jun 2022 16:51:27 +0100 |
From: Jagannathan Raman <jag.raman@oracle.com>
Adds handler to reset a remote device
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
112eeadf3bc4c6cdb100bc3f9a6fcfc20b467c1b.1655151679.git.jag.raman@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/remote/vfio-user-obj.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
index 5ecdec06f6..c6cc53acf2 100644
--- a/hw/remote/vfio-user-obj.c
+++ b/hw/remote/vfio-user-obj.c
@@ -676,6 +676,20 @@ void vfu_object_set_bus_irq(PCIBus *pci_bus)
max_bdf);
}
+static int vfu_object_device_reset(vfu_ctx_t *vfu_ctx, vfu_reset_type_t type)
+{
+ VfuObject *o = vfu_get_private(vfu_ctx);
+
+ /* vfu_object_ctx_run() handles lost connection */
+ if (type == VFU_RESET_LOST_CONN) {
+ return 0;
+ }
+
+ qdev_reset_all(DEVICE(o->pci_dev));
+
+ return 0;
+}
+
/*
* TYPE_VFU_OBJECT depends on the availability of the 'socket' and 'device'
* properties. It also depends on devices instantiated in QEMU. These
@@ -795,6 +809,12 @@ static void vfu_object_init_ctx(VfuObject *o, Error **errp)
goto fail;
}
+ ret = vfu_setup_device_reset_cb(o->vfu_ctx, &vfu_object_device_reset);
+ if (ret < 0) {
+ error_setg(errp, "vfu: Failed to setup reset callback");
+ goto fail;
+ }
+
ret = vfu_realize_ctx(o->vfu_ctx);
if (ret < 0) {
error_setg(errp, "vfu: Failed to realize device %s- %s",
--
2.36.1
- [PULL 06/18] vfio-user: build library, (continued)
- [PULL 06/18] vfio-user: build library, Stefan Hajnoczi, 2022/06/15
- [PULL 08/18] vfio-user: instantiate vfio-user context, Stefan Hajnoczi, 2022/06/15
- [PULL 10/18] vfio-user: run vfio-user context, Stefan Hajnoczi, 2022/06/15
- [PULL 09/18] vfio-user: find and init PCI device, Stefan Hajnoczi, 2022/06/15
- [PULL 12/18] vfio-user: IOMMU support for remote device, Stefan Hajnoczi, 2022/06/15
- [PULL 13/18] vfio-user: handle DMA mappings, Stefan Hajnoczi, 2022/06/15
- [PULL 11/18] vfio-user: handle PCI config space accesses, Stefan Hajnoczi, 2022/06/15
- [PULL 14/18] vfio-user: handle PCI BAR accesses, Stefan Hajnoczi, 2022/06/15
- [PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug(), Stefan Hajnoczi, 2022/06/15
- [PULL 15/18] vfio-user: handle device interrupts, Stefan Hajnoczi, 2022/06/15
- [PULL 16/18] vfio-user: handle reset of remote device,
Stefan Hajnoczi <=
- [PULL 18/18] linux-aio: explain why max batch is checked in laio_io_unplug(), Stefan Hajnoczi, 2022/06/15