From 26aece0492486df33293f62bdb0dca086409c89d Mon Sep 17 00:00:00 2001 From: Jian Jun Chen Date: Wed, 12 Jul 2023 14:46:16 +0800 Subject: [PATCH] dm: virtio: fix a asyncio/ioeventfd bug ACRN_IOEVENTFD_FLAG_ASYNCIO is not set when unregister ioeventfd in the current implementation which will cause the old asyncio_desc will be remained in hypervisor link list when switching from OVMF to kernel. Tracked-On: #8612 Signed-off-by: Jian Jun Chen Acked-by: Wang, Yu1 --- devicemodel/hw/pci/virtio/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devicemodel/hw/pci/virtio/virtio.c b/devicemodel/hw/pci/virtio/virtio.c index d98f3ff27..67b86522e 100644 --- a/devicemodel/hw/pci/virtio/virtio.c +++ b/devicemodel/hw/pci/virtio/virtio.c @@ -1988,12 +1988,12 @@ int virtio_register_ioeventfd(struct virtio_base *base, int idx, bool is_registe int rc = 0; if (!is_register) - ioeventfd.flags = ACRN_IOEVENTFD_FLAG_DEASSIGN; - else if (base->iothread) + ioeventfd.flags |= ACRN_IOEVENTFD_FLAG_DEASSIGN; + if (base->iothread) /* Enable ASYNCIO by default. If ASYNCIO is not supported by kernel * or hyperviosr, this flag will be ignored. */ - ioeventfd.flags = ACRN_IOEVENTFD_FLAG_ASYNCIO; + ioeventfd.flags |= ACRN_IOEVENTFD_FLAG_ASYNCIO; /* register ioeventfd for kick */ if (base->device_caps & (1UL << VIRTIO_F_VERSION_1)) { /*