File Index
Files and directories
Sign in
FILE

mshv_eventfd.h

File preview with syntax highlighting.

linux-6.19.14/drivers/hv/mshv_eventfd.h C
 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_entry_t		     irqfd_wait;
36	struct work_struct		     irqfd_shutdown;
37	struct mshv_irqfd_resampler	    *irqfd_resampler;
38	struct eventfd_ctx		    *irqfd_resamplefd;
39	struct hlist_node		     irqfd_resampler_hnode;
40};
41
42void mshv_eventfd_init(struct mshv_partition *partition);
43void mshv_eventfd_release(struct mshv_partition *partition);
44
45void mshv_register_irq_ack_notifier(struct mshv_partition *partition,
46				    struct mshv_irq_ack_notifier *mian);
47void mshv_unregister_irq_ack_notifier(struct mshv_partition *partition,
48				      struct mshv_irq_ack_notifier *mian);
49bool mshv_notify_acked_gsi(struct mshv_partition *partition, int gsi);
50
51int mshv_set_unset_irqfd(struct mshv_partition *partition,
52			 struct mshv_user_irqfd *args);
53
54int mshv_irqfd_wq_init(void);
55void mshv_irqfd_wq_cleanup(void);
56
57struct mshv_ioeventfd {
58	struct hlist_node    iovntfd_hnode;
59	u64		     iovntfd_addr;
60	int		     iovntfd_length;
61	struct eventfd_ctx  *iovntfd_eventfd;
62	u64		     iovntfd_datamatch;
63	int		     iovntfd_doorbell_id;
64	bool		     iovntfd_wildcard;
65};
66
67int mshv_set_unset_ioeventfd(struct mshv_partition *pt,
68			     struct mshv_user_ioeventfd *args);
69
70#endif /* __LINUX_MSHV_EVENTFD_H */
~/ Read-only file preview.