From 0ec9aaea6f5d8d34ee12131ac3656a3ab8728f6c Mon Sep 17 00:00:00 2001 From: Conghui Date: Wed, 24 Aug 2022 10:09:23 +0800 Subject: [PATCH] dm: support asyncio in ioeventfd Add a new flag in ioeventfd ioctl to support asyncio. After that, the IO request will be processed in asyncio path by kernel and hypervisor. Tracked-On: #8209 Signed-off-by: Conghui Acked-by: Wang, Yu1 --- devicemodel/hw/pci/virtio/virtio.c | 6 +++++- devicemodel/include/public/hsm_ioctl_defs.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devicemodel/hw/pci/virtio/virtio.c b/devicemodel/hw/pci/virtio/virtio.c index 546ec6f31..598bdbc5f 100644 --- a/devicemodel/hw/pci/virtio/virtio.c +++ b/devicemodel/hw/pci/virtio/virtio.c @@ -2000,7 +2000,11 @@ int virtio_register_ioeventfd(struct virtio_base *base, int idx, bool is_registe if (!is_register) ioeventfd.flags = ACRN_IOEVENTFD_FLAG_DEASSIGN; - + else + /* Enable ASYNCIO by default. If ASYNCIO is not supported by kernel + * or hyperviosr, this flag will be ignored. + */ + ioeventfd.flags = ACRN_IOEVENTFD_FLAG_ASYNCIO; /* register ioeventfd for kick */ if (base->device_caps & (1UL << VIRTIO_F_VERSION_1)) { /* diff --git a/devicemodel/include/public/hsm_ioctl_defs.h b/devicemodel/include/public/hsm_ioctl_defs.h index 4ff753d14..75656b2e5 100644 --- a/devicemodel/include/public/hsm_ioctl_defs.h +++ b/devicemodel/include/public/hsm_ioctl_defs.h @@ -226,6 +226,7 @@ struct acrn_ioeventfd { #define ACRN_IOEVENTFD_FLAG_PIO 0x01 #define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02 #define ACRN_IOEVENTFD_FLAG_DEASSIGN 0x04 +#define ACRN_IOEVENTFD_FLAG_ASYNCIO 0x08 /** file descriptor of the eventfd of this ioeventfd */ int32_t fd; /** flag for ioeventfd ioctl */