Skip to content

Commit 94513ab

Browse files
Shuo Liulijinxia
authored andcommitted
dm: Add vhm ioeventfd and irqfd interfaces
ioeventfd and irqfd support for vhm was introduced in kernel vhm module. We provide the interfaces of them for DM users. Tracked-On: #1329 Signed-off-by: Shuo Liu <shuo.a.liu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
1 parent a189be2 commit 94513ab

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

devicemodel/core/vmmapi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,15 @@ vm_intr_monitor(struct vmctx *ctx, void *intr_buf)
657657
{
658658
return ioctl(ctx->fd, IC_VM_INTR_MONITOR, intr_buf);
659659
}
660+
661+
int
662+
vm_ioeventfd(struct vmctx *ctx, struct acrn_ioeventfd *args)
663+
{
664+
return ioctl(ctx->fd, IC_EVENT_IOEVENTFD, args);
665+
}
666+
667+
int
668+
vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args)
669+
{
670+
return ioctl(ctx->fd, IC_EVENT_IRQFD, args);
671+
}

devicemodel/include/public/vhm_ioctl_defs.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@
112112
#define VM_MEMMAP_SYSMEM 0
113113
#define VM_MMIO 1
114114

115+
/* VHM eventfd */
116+
#define IC_ID_EVENT_BASE 0x70UL
117+
#define IC_EVENT_IOEVENTFD _IC_ID(IC_ID, IC_ID_EVENT_BASE + 0x00)
118+
#define IC_EVENT_IRQFD _IC_ID(IC_ID, IC_ID_EVENT_BASE + 0x01)
119+
115120
/**
116121
* struct vm_memmap - EPT memory mapping info for guest
117122
*/
@@ -204,4 +209,22 @@ struct api_version {
204209
uint32_t minor_version;
205210
};
206211

212+
#define ACRN_IOEVENTFD_FLAG_PIO 0x01
213+
#define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02
214+
#define ACRN_IOEVENTFD_FLAG_DEASSIGN 0x04
215+
struct acrn_ioeventfd {
216+
int32_t fd;
217+
uint32_t flags;
218+
uint64_t addr;
219+
uint32_t len;
220+
uint32_t reserved;
221+
uint64_t data;
222+
};
223+
224+
#define ACRN_IRQFD_FLAG_DEASSIGN 0x01
225+
struct acrn_irqfd {
226+
int32_t fd;
227+
uint32_t flags;
228+
struct acrn_msi_entry msi;
229+
};
207230
#endif /* VHM_IOCTL_DEFS_H */

devicemodel/include/vmmapi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,7 @@ int vm_get_cpu_state(struct vmctx *ctx, void *state_buf);
155155
int vm_intr_monitor(struct vmctx *ctx, void *intr_buf);
156156
void vm_stop_watchdog(struct vmctx *ctx);
157157
void vm_reset_watchdog(struct vmctx *ctx);
158+
159+
int vm_ioeventfd(struct vmctx *ctx, struct acrn_ioeventfd *args);
160+
int vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args);
158161
#endif /* _VMMAPI_H_ */

0 commit comments

Comments
 (0)