Blame view

include/linux/kvm_irqfd.h 2 KB
2504ba9f5   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-only */
166c9775f   Eric Auger   KVM: create kvm_i...
2
  /*
166c9775f   Eric Auger   KVM: create kvm_i...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
   *
   * irqfd: Allows an fd to be used to inject an interrupt to the guest
   * Credit goes to Avi Kivity for the original idea.
   */
  
  #ifndef __LINUX_KVM_IRQFD_H
  #define __LINUX_KVM_IRQFD_H
  
  #include <linux/kvm_host.h>
  #include <linux/poll.h>
  
  /*
   * Resampling irqfds are a special variety of irqfds used to emulate
   * level triggered interrupts.  The interrupt is asserted on eventfd
   * trigger.  On acknowledgment through the irq ack notifier, the
   * interrupt is de-asserted and userspace is notified through the
   * resamplefd.  All resamplers on the same gsi are de-asserted
   * together, so we don't need to track the state of each individual
   * user.  We can also therefore share the same irq source ID.
   */
  struct kvm_kernel_irqfd_resampler {
  	struct kvm *kvm;
  	/*
  	 * List of resampling struct _irqfd objects sharing this gsi.
  	 * RCU list modified under kvm->irqfds.resampler_lock
  	 */
  	struct list_head list;
  	struct kvm_irq_ack_notifier notifier;
  	/*
  	 * Entry in list of kvm->irqfd.resampler_list.  Use for sharing
  	 * resamplers among irqfds on the same gsi.
  	 * Accessed and modified under kvm->irqfds.resampler_lock
  	 */
  	struct list_head link;
  };
  
  struct kvm_kernel_irqfd {
  	/* Used for MSI fast-path */
  	struct kvm *kvm;
ac6424b98   Ingo Molnar   sched/wait: Renam...
42
  	wait_queue_entry_t wait;
166c9775f   Eric Auger   KVM: create kvm_i...
43
44
  	/* Update side is protected by irqfds.lock */
  	struct kvm_kernel_irq_routing_entry irq_entry;
5c73b9a2b   Ahmed S. Darwish   kvm/eventfd: Use ...
45
  	seqcount_spinlock_t irq_entry_sc;
166c9775f   Eric Auger   KVM: create kvm_i...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  	/* Used for level IRQ fast-path */
  	int gsi;
  	struct work_struct inject;
  	/* The resampler used by this irqfd (resampler-only) */
  	struct kvm_kernel_irqfd_resampler *resampler;
  	/* Eventfd notified on resample (resampler-only) */
  	struct eventfd_ctx *resamplefd;
  	/* Entry in list of irqfds for a resampler (resampler-only) */
  	struct list_head resampler_link;
  	/* Used for setup/shutdown */
  	struct eventfd_ctx *eventfd;
  	struct list_head list;
  	poll_table pt;
  	struct work_struct shutdown;
9016cfb57   Eric Auger   KVM: eventfd: add...
60
61
  	struct irq_bypass_consumer consumer;
  	struct irq_bypass_producer *producer;
166c9775f   Eric Auger   KVM: create kvm_i...
62
63
64
  };
  
  #endif /* __LINUX_KVM_IRQFD_H */