drivers/irqchip/irq-gic-v3-its.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-gic-v3-its.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-gic-v3-its.c- Extension
.c- Size
- 146957 bytes
- Lines
- 5873
- Domain
- Driver Families
- Bucket
- drivers/irqchip
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/acpi.hlinux/acpi_iort.hlinux/bitfield.hlinux/bitmap.hlinux/cpu.hlinux/crash_dump.hlinux/delay.hlinux/efi.hlinux/genalloc.hlinux/interrupt.hlinux/iommu.hlinux/iopoll.hlinux/irqdomain.hlinux/list.hlinux/log2.hlinux/mem_encrypt.hlinux/memblock.hlinux/mm.hlinux/msi.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/of_pci.hlinux/of_platform.hlinux/percpu.hlinux/set_memory.hlinux/slab.hlinux/syscore_ops.hlinux/irqchip.hlinux/irqchip/arm-gic-v3.hlinux/irqchip/arm-gic-v4.hasm/cputype.h
Detected Declarations
struct its_collectionstruct its_baserstruct its_devicestruct its_nodestruct event_lpi_mapstruct its_devicestruct cpu_lpi_countstruct its_cmd_descstruct its_cmd_blockstruct lpi_rangestruct its_srat_mapfunction its_free_pagesfunction itt_free_poolfunction require_its_list_vmovpfunction rdists_support_shareablefunction get_its_listfunction list_for_each_entryfunction its_get_event_idfunction vpe_to_cpuid_lockfunction vpe_to_cpuid_unlockfunction irq_to_cpuid_lockfunction irq_to_cpuid_unlockfunction its_mask_encodefunction its_encode_cmdfunction its_encode_devidfunction its_encode_event_idfunction its_encode_phys_idfunction its_encode_sizefunction its_encode_ittfunction its_encode_validfunction its_encode_targetfunction its_encode_collectionfunction its_encode_vpeidfunction its_encode_virt_idfunction its_encode_db_phys_idfunction its_encode_db_validfunction its_encode_seq_numfunction its_encode_its_listfunction its_encode_vpt_addrfunction its_encode_vpt_sizefunction its_encode_vconf_addrfunction its_encode_allocfunction its_encode_ptzfunction its_encode_vmapp_default_dbfunction its_encode_vmovp_default_dbfunction its_encode_dbfunction its_encode_sgi_intidfunction its_encode_sgi_priority
Annotated Snippet
struct its_collection {
u64 target_address;
u16 col_id;
};
/*
* The ITS_BASER structure - contains memory information, cached
* value of BASER register configuration and ITS page size.
*/
struct its_baser {
void *base;
u64 val;
u32 order;
u32 psz;
};
struct its_device;
/*
* The ITS structure - contains most of the infrastructure, with the
* top-level MSI domain, the command queue, the collections, and the
* list of devices writing to it.
*
* dev_alloc_lock has to be taken for device allocations, while the
* spinlock must be taken to parse data structures such as the device
* list.
*/
struct its_node {
raw_spinlock_t lock;
struct mutex dev_alloc_lock;
struct list_head entry;
void __iomem *base;
void __iomem *sgir_base;
phys_addr_t phys_base;
struct its_cmd_block *cmd_base;
struct its_cmd_block *cmd_write;
struct its_baser tables[GITS_BASER_NR_REGS];
struct its_collection *collections;
struct fwnode_handle *fwnode_handle;
u64 (*get_msi_base)(struct its_device *its_dev);
u64 typer;
u64 cbaser_save;
u32 ctlr_save;
u32 mpidr;
struct list_head its_device_list;
u64 flags;
unsigned long list_nr;
int numa_node;
unsigned int msi_domain_flags;
u32 pre_its_base; /* for Socionext Synquacer */
int vlpi_redist_offset;
};
static DEFINE_PER_CPU(struct its_node *, local_4_1_its);
#define is_v4(its) (!!((its)->typer & GITS_TYPER_VLPIS))
#define is_v4_1(its) (!!((its)->typer & GITS_TYPER_VMAPP))
#define device_ids(its) (FIELD_GET(GITS_TYPER_DEVBITS, (its)->typer) + 1)
#define ITS_ITT_ALIGN SZ_256
/* The maximum number of VPEID bits supported by VLPI commands */
#define ITS_MAX_VPEID_BITS \
({ \
int nvpeid = 16; \
if (gic_rdists->has_rvpeid && \
gic_rdists->gicd_typer2 & GICD_TYPER2_VIL) \
nvpeid = 1 + (gic_rdists->gicd_typer2 & \
GICD_TYPER2_VID); \
\
nvpeid; \
})
#define ITS_MAX_VPEID (1 << (ITS_MAX_VPEID_BITS))
/* Convert page order to size in bytes */
#define PAGE_ORDER_TO_SIZE(o) (PAGE_SIZE << (o))
struct event_lpi_map {
unsigned long *lpi_map;
u16 *col_map;
irq_hw_number_t lpi_base;
int nr_lpis;
raw_spinlock_t vlpi_lock;
struct its_vm *vm;
struct its_vlpi_map *vlpi_maps;
int nr_vlpis;
};
/*
* The ITS view of a device - belongs to an ITS, owns an interrupt
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/acpi_iort.h`, `linux/bitfield.h`, `linux/bitmap.h`, `linux/cpu.h`, `linux/crash_dump.h`, `linux/delay.h`, `linux/efi.h`.
- Detected declarations: `struct its_collection`, `struct its_baser`, `struct its_device`, `struct its_node`, `struct event_lpi_map`, `struct its_device`, `struct cpu_lpi_count`, `struct its_cmd_desc`, `struct its_cmd_block`, `struct lpi_range`.
- Atlas domain: Driver Families / drivers/irqchip.
- Implementation status: source 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.