aboutsummaryrefslogtreecommitdiff
path: root/lib/libvfio-user.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-04-06 15:37:09 +0100
committerGitHub <noreply@github.com>2021-04-06 15:37:09 +0100
commit0b722b79212dfd4a5fb6f7b9137c27f27bd46105 (patch)
treeb4e367e5e6351f123ed26aad7fe37bc6e247efb9 /lib/libvfio-user.c
parentf7f0ea6c4beedbb3cd2c010e84feecb76db3f46f (diff)
downloadlibvfio-user-0b722b79212dfd4a5fb6f7b9137c27f27bd46105.zip
libvfio-user-0b722b79212dfd4a5fb6f7b9137c27f27bd46105.tar.gz
libvfio-user-0b722b79212dfd4a5fb6f7b9137c27f27bd46105.tar.bz2
vfu_reset_ctx(): tear down DMA and IRQs (#418)
When we lose the client connection, the IRQ and DMA region state is no longer valid; clean them up. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/libvfio-user.c')
-rw-r--r--lib/libvfio-user.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c
index c041694..d9e58e0 100644
--- a/lib/libvfio-user.c
+++ b/lib/libvfio-user.c
@@ -1112,6 +1112,14 @@ vfu_reset_ctx(vfu_ctx_t *vfu_ctx, const char *reason)
{
vfu_log(vfu_ctx, LOG_INFO, "%s: %s", __func__, reason);
+ if (vfu_ctx->dma != NULL) {
+ dma_controller_remove_regions(vfu_ctx->dma);
+ }
+
+ if (vfu_ctx->irqs != NULL) {
+ irqs_reset(vfu_ctx);
+ }
+
if (vfu_ctx->tran->detach != NULL) {
vfu_ctx->tran->detach(vfu_ctx);
}