mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 16:57:20 +00:00
dm: add iothread support in virtio framework
Add ioeventfd and iothread to virtio framework. When a virtio device claim to support iothread, virtio framework will register a ioeventfd and add it to iothread's epoll. After that, the new notify will come through the iothread instead of the vcpu thread. The notify handler will be called to process the request. Tracked-On: #7940 Signed-off-by: Conghui <conghui.chen@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
@@ -132,6 +132,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "timer.h"
|
||||
#include "iothread.h"
|
||||
|
||||
/**
|
||||
* @brief virtio API
|
||||
@@ -345,6 +346,7 @@ struct virtio_vq_info;
|
||||
struct virtio_base {
|
||||
struct virtio_ops *vops; /**< virtio operations */
|
||||
int flags; /**< VIRTIO_* flags from above */
|
||||
bool iothread;
|
||||
pthread_mutex_t *mtx; /**< POSIX mutex, if any */
|
||||
struct pci_vdev *dev; /**< PCI device instance */
|
||||
uint64_t negotiated_caps; /**< negotiated capabilities */
|
||||
@@ -420,6 +422,15 @@ struct virtio_ops {
|
||||
* (but more easily) computable, and this time we'll compute them:
|
||||
* they're just XX_ring[N].
|
||||
*/
|
||||
struct virtio_iothread {
|
||||
struct virtio_base *base;
|
||||
int idx;
|
||||
int kick_fd;
|
||||
bool ioevent_started;
|
||||
struct iothread_mevent iomvt;
|
||||
void (*iothread_run)(void *, struct virtio_vq_info *);
|
||||
};
|
||||
|
||||
struct virtio_vq_info {
|
||||
uint16_t qsize; /**< size of this queue (a power of 2) */
|
||||
void (*notify)(void *, struct virtio_vq_info *);
|
||||
@@ -435,6 +446,7 @@ struct virtio_vq_info {
|
||||
uint16_t msix_idx; /**< MSI-X index, or VIRTIO_MSI_NO_VECTOR */
|
||||
|
||||
uint32_t pfn; /**< PFN of virt queue (not shifted!) */
|
||||
struct virtio_iothread viothrd;
|
||||
|
||||
volatile struct vring_desc *desc;
|
||||
/**< descriptor array */
|
||||
@@ -764,4 +776,5 @@ uint32_t virtio_device_cfg_read(
|
||||
int virtio_set_modern_pio_bar(
|
||||
struct virtio_base *base, int barnum);
|
||||
|
||||
int virtio_register_ioeventfd(struct virtio_base *base, int idx, bool is_register);
|
||||
#endif /* _VIRTIO_H_ */
|
||||
|
Reference in New Issue
Block a user