drivers/xen/events/events_base.c
Source file repositories/reference/linux-study-clean/drivers/xen/events/events_base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/xen/events/events_base.c- Extension
.c- Size
- 55157 bytes
- Lines
- 2335
- Domain
- Driver Families
- Bucket
- drivers/xen
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/linkage.hlinux/interrupt.hlinux/irq.hlinux/moduleparam.hlinux/string.hlinux/memblock.hlinux/slab.hlinux/irqnr.hlinux/pci.hlinux/rcupdate.hlinux/spinlock.hlinux/cpuhotplug.hlinux/atomic.hlinux/ktime.hasm/cpuid/api.hasm/desc.hasm/ptrace.hasm/idtentry.hasm/irq.hasm/io_apic.hasm/i8259.hasm/xen/cpuid.hasm/xen/pci.hasm/sync_bitops.hasm/xen/hypercall.hasm/xen/hypervisor.hxen/page.hxen/xen.hxen/hvm.hxen/xen-ops.hxen/events.hxen/interface/xen.h
Detected Declarations
struct irq_infostruct lateeoi_workstruct evtchn_loop_ctrlenum xen_irq_typefunction clear_evtchn_to_irq_rowfunction clear_evtchn_to_irq_allfunction set_evtchn_to_irqfunction set_info_for_irqfunction channels_on_cpu_decfunction channels_on_cpu_incfunction xen_irq_free_descfunction delayed_free_irqfunction xen_irq_info_common_setupfunction xen_irq_info_evtchn_setupfunction xen_irq_info_ipi_setupfunction xen_irq_info_virq_setupfunction xen_irq_info_pirq_setupfunction xen_irq_info_cleanupfunction evtchn_from_irqfunction irq_from_evtchnfunction irq_evtchn_from_virqfunction ipi_from_irqfunction virq_from_irqfunction pirq_from_irqfunction cpu_from_evtchnfunction do_maskfunction do_unmaskfunction pirq_check_eoi_mapfunction pirq_needs_eoi_flagfunction bind_evtchn_to_cpufunction notify_remote_via_evtchnfunction lateeoi_list_delfunction lateeoi_list_addfunction list_for_each_entry_reversefunction xen_irq_lateeoi_lockedfunction xen_irq_lateeoi_workerfunction xen_cpu_init_eoifunction xen_irq_lateeoifunction xen_free_irqfunction event_handler_exitfunction pirq_query_unmaskfunction do_eoi_pirqfunction eoi_pirqfunction do_disable_dynirqfunction disable_dynirqfunction mask_ack_pirqfunction __startup_pirqfunction startup_pirq
Annotated Snippet
struct irq_info {
struct list_head list;
struct list_head eoi_list;
struct rcu_work rwork;
short refcnt;
u8 spurious_cnt;
u8 is_accounted;
short type; /* type: IRQT_* */
u8 mask_reason; /* Why is event channel masked */
#define EVT_MASK_REASON_EXPLICIT 0x01
#define EVT_MASK_REASON_TEMPORARY 0x02
#define EVT_MASK_REASON_EOI_PENDING 0x04
u8 is_active; /* Is event just being handled? */
unsigned irq;
evtchn_port_t evtchn; /* event channel */
unsigned short cpu; /* cpu bound */
unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */
unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
u64 eoi_time; /* Time in jiffies when to EOI. */
raw_spinlock_t lock;
bool is_static; /* Is event channel static */
union {
unsigned short virq;
enum ipi_vector ipi;
struct {
unsigned short pirq;
unsigned short gsi;
unsigned char vector;
unsigned char flags;
uint16_t domid;
} pirq;
struct xenbus_device *interdomain;
} u;
};
#define PIRQ_NEEDS_EOI (1 << 0)
#define PIRQ_SHAREABLE (1 << 1)
#define PIRQ_MSI_GROUP (1 << 2)
static uint __read_mostly event_loop_timeout = 2;
module_param(event_loop_timeout, uint, 0644);
static uint __read_mostly event_eoi_delay = 10;
module_param(event_eoi_delay, uint, 0644);
const struct evtchn_ops *evtchn_ops;
/*
* This lock protects updates to the following mapping and reference-count
* arrays. The lock does not need to be acquired to read the mapping tables.
*/
static DEFINE_MUTEX(irq_mapping_update_lock);
/*
* Lock hierarchy:
*
* irq_mapping_update_lock
* IRQ-desc lock
* percpu eoi_list_lock
* irq_info->lock
*/
static LIST_HEAD(xen_irq_list_head);
/* IRQ <-> VIRQ mapping. */
static DEFINE_PER_CPU(int [NR_VIRQS], virq_to_irq) = {[0 ... NR_VIRQS-1] = -1};
/* IRQ <-> IPI mapping */
static DEFINE_PER_CPU(int [XEN_NR_IPIS], ipi_to_irq) = {[0 ... XEN_NR_IPIS-1] = -1};
/* Cache for IPI event channels - needed for hot cpu unplug (avoid RCU usage). */
static DEFINE_PER_CPU(evtchn_port_t [XEN_NR_IPIS], ipi_to_evtchn) = {[0 ... XEN_NR_IPIS-1] = 0};
/* Event channel distribution data */
static atomic_t channels_on_cpu[NR_CPUS];
static int **evtchn_to_irq;
#ifdef CONFIG_X86
static unsigned long *pirq_eoi_map;
#endif
static bool (*pirq_needs_eoi)(struct irq_info *info);
#define EVTCHN_ROW(e) (e / (PAGE_SIZE/sizeof(**evtchn_to_irq)))
#define EVTCHN_COL(e) (e % (PAGE_SIZE/sizeof(**evtchn_to_irq)))
#define EVTCHN_PER_ROW (PAGE_SIZE / sizeof(**evtchn_to_irq))
/* Xen will never allocate port zero for any purpose. */
#define VALID_EVTCHN(chn) ((chn) != 0)
static struct irq_info *legacy_info_ptrs[NR_IRQS_LEGACY];
Annotation
- Immediate include surface: `linux/linkage.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/moduleparam.h`, `linux/string.h`, `linux/memblock.h`, `linux/slab.h`, `linux/irqnr.h`.
- Detected declarations: `struct irq_info`, `struct lateeoi_work`, `struct evtchn_loop_ctrl`, `enum xen_irq_type`, `function clear_evtchn_to_irq_row`, `function clear_evtchn_to_irq_all`, `function set_evtchn_to_irq`, `function set_info_for_irq`, `function channels_on_cpu_dec`, `function channels_on_cpu_inc`.
- Atlas domain: Driver Families / drivers/xen.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.