Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * irqfd: Allows an fd to be used to inject an interrupt to the guest.
4 * ioeventfd: Allow an fd to be used to receive a signal from the guest.
5 * All credit goes to kvm developers.
6 */
7
8#ifndef __LINUX_MSHV_EVENTFD_H
9#define __LINUX_MSHV_EVENTFD_H
10
11#include <linux/poll.h>
12
13#include "mshv.h"
14#include "mshv_root.h"
15
16/* struct to contain list of irqfds sharing an irq. Updates are protected by
17 * partition.irqfds.resampler_lock
18 */
19struct mshv_irqfd_resampler {
20 struct mshv_partition *rsmplr_partn;
21 struct hlist_head rsmplr_irqfd_list;
22 struct mshv_irq_ack_notifier rsmplr_notifier;
23 struct hlist_node rsmplr_hnode;
24};
25
26struct mshv_irqfd {
27 struct mshv_partition *irqfd_partn;
28 struct eventfd_ctx *irqfd_eventfd_ctx;
29 struct mshv_guest_irq_ent irqfd_girq_ent;
30 seqcount_spinlock_t irqfd_irqe_sc;
31 u32 irqfd_irqnum;
32 struct mshv_lapic_irq irqfd_lapic_irq;
33 struct hlist_node irqfd_hnode;
34 poll_table irqfd_polltbl;
35 wait_queue_head_t *irqfd_wqh;
36 wait_queue_entry_t irqfd_wait;
37 struct work_struct irqfd_shutdown;
38 struct mshv_irqfd_resampler *irqfd_resampler;
39 struct eventfd_ctx *irqfd_resamplefd;
40 struct hlist_node irqfd_resampler_hnode;
41};
42
43void mshv_eventfd_init(struct mshv_partition *partition);
44void mshv_eventfd_release(struct mshv_partition *partition);
45
46void mshv_register_irq_ack_notifier(struct mshv_partition *partition,
47 struct mshv_irq_ack_notifier *mian);
48void mshv_unregister_irq_ack_notifier(struct mshv_partition *partition,
49 struct mshv_irq_ack_notifier *mian);
50bool mshv_notify_acked_gsi(struct mshv_partition *partition, int gsi);
51
52int mshv_set_unset_irqfd(struct mshv_partition *partition,
53 struct mshv_user_irqfd *args);
54
55int mshv_irqfd_wq_init(void);
56void mshv_irqfd_wq_cleanup(void);
57
58struct mshv_ioeventfd {
59 struct hlist_node iovntfd_hnode;
60 u64 iovntfd_addr;
61 int iovntfd_length;
62 struct eventfd_ctx *iovntfd_eventfd;
63 u64 iovntfd_datamatch;
64 int iovntfd_doorbell_id;
65 bool iovntfd_wildcard;
66};
67
68int mshv_set_unset_ioeventfd(struct mshv_partition *pt,
69 struct mshv_user_ioeventfd *args);
70
71#endif /* __LINUX_MSHV_EVENTFD_H */