drivers/irqchip/irq-gic-v5-its.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-gic-v5-its.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-gic-v5-its.c- Extension
.c- Size
- 36143 bytes
- Lines
- 1344
- 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.
- 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/bitmap.hlinux/iommu.hlinux/init.hlinux/kernel.hlinux/msi.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/slab.hlinux/irqchip.hlinux/irqchip/arm-gic-v5.hlinux/irqchip/irq-msi-lib.hirq-gic-its-msi-parent.h
Detected Declarations
struct gicv5_its_chip_datastruct gicv5_its_devfunction its_readl_relaxedfunction its_writel_relaxedfunction its_writeq_relaxedfunction gicv5_its_dcache_cleanfunction its_write_table_entryfunction gicv5_its_cache_syncfunction gicv5_its_syncrfunction gicv5_its_l2sz_to_l2_bitsfunction gicv5_its_itt_cache_invfunction gicv5_its_free_itt_linearfunction gicv5_its_free_itt_two_levelfunction gicv5_its_free_ittfunction gicv5_its_create_itt_linearfunction gicv5_its_create_itt_two_levelfunction gicv5_its_l2sz_two_levelfunction gicv5_its_device_cache_invfunction gicv5_its_alloc_l2_devtabfunction gicv5_its_device_registerfunction gicv5_its_device_unregisterfunction gicv5_its_alloc_devtab_linearfunction gicv5_its_alloc_devtab_two_levelfunction gicv5_its_init_devtabfunction gicv5_its_deinit_devtabfunction gicv5_its_compose_msi_msgfunction gicv5_its_msi_preparefunction gicv5_its_msi_teardownfunction gicv5_its_map_eventfunction gicv5_its_unmap_eventfunction gicv5_its_alloc_eventidfunction gicv5_its_free_eventidfunction gicv5_its_irq_domain_allocfunction gicv5_its_irq_domain_freefunction gicv5_its_irq_domain_activatefunction gicv5_its_irq_domain_deactivatefunction gicv5_its_write_cr0function gicv5_its_enablefunction gicv5_its_disablefunction gicv5_its_print_infofunction gicv5_its_init_domainfunction gicv5_its_init_basesfunction gicv5_its_initfunction gicv5_its_of_probefunction for_each_available_child_of_nodefunction gic_acpi_parse_madt_its_translatefunction gic_acpi_free_madt_its_translatefunction gic_acpi_parse_madt_its
Annotated Snippet
struct gicv5_its_chip_data {
struct xarray its_devices;
struct mutex dev_alloc_lock;
struct fwnode_handle *fwnode;
struct gicv5_its_devtab_cfg devtab_cfgr;
void __iomem *its_base;
u32 flags;
unsigned int msi_domain_flags;
};
struct gicv5_its_dev {
struct gicv5_its_chip_data *its_node;
struct gicv5_its_itt_cfg itt_cfg;
unsigned long *event_map;
u32 device_id;
u32 num_events;
phys_addr_t its_trans_phys_base;
};
static u32 its_readl_relaxed(struct gicv5_its_chip_data *its_node, const u32 reg_offset)
{
return readl_relaxed(its_node->its_base + reg_offset);
}
static void its_writel_relaxed(struct gicv5_its_chip_data *its_node, const u32 val,
const u32 reg_offset)
{
writel_relaxed(val, its_node->its_base + reg_offset);
}
static void its_writeq_relaxed(struct gicv5_its_chip_data *its_node, const u64 val,
const u32 reg_offset)
{
writeq_relaxed(val, its_node->its_base + reg_offset);
}
static void gicv5_its_dcache_clean(struct gicv5_its_chip_data *its, void *start,
size_t sz)
{
void *end = start + sz;
if (its->flags & ITS_FLAGS_NON_COHERENT)
dcache_clean_inval_poc((unsigned long)start, (unsigned long)end);
else
dsb(ishst);
}
static void its_write_table_entry(struct gicv5_its_chip_data *its, __le64 *entry,
u64 val)
{
WRITE_ONCE(*entry, cpu_to_le64(val));
gicv5_its_dcache_clean(its, entry, sizeof(*entry));
}
#define devtab_cfgr_field(its, f) \
FIELD_GET(GICV5_ITS_DT_CFGR_##f, (its)->devtab_cfgr.cfgr)
static int gicv5_its_cache_sync(struct gicv5_its_chip_data *its)
{
return gicv5_wait_for_op_atomic(its->its_base, GICV5_ITS_STATUSR,
GICV5_ITS_STATUSR_IDLE, NULL);
}
static void gicv5_its_syncr(struct gicv5_its_chip_data *its,
struct gicv5_its_dev *its_dev)
{
u64 syncr;
syncr = FIELD_PREP(GICV5_ITS_SYNCR_SYNC, 1) |
FIELD_PREP(GICV5_ITS_SYNCR_DEVICEID, its_dev->device_id);
its_writeq_relaxed(its, syncr, GICV5_ITS_SYNCR);
gicv5_wait_for_op(its->its_base, GICV5_ITS_SYNC_STATUSR, GICV5_ITS_SYNC_STATUSR_IDLE);
}
/* Number of bits required for each L2 {device/interrupt translation} table size */
#define ITS_L2SZ_64K_L2_BITS 13
#define ITS_L2SZ_16K_L2_BITS 11
#define ITS_L2SZ_4K_L2_BITS 9
static unsigned int gicv5_its_l2sz_to_l2_bits(unsigned int sz)
{
switch (sz) {
case GICV5_ITS_DT_ITT_CFGR_L2SZ_64k:
return ITS_L2SZ_64K_L2_BITS;
case GICV5_ITS_DT_ITT_CFGR_L2SZ_16k:
return ITS_L2SZ_16K_L2_BITS;
case GICV5_ITS_DT_ITT_CFGR_L2SZ_4k:
default:
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/acpi_iort.h`, `linux/bitmap.h`, `linux/iommu.h`, `linux/init.h`, `linux/kernel.h`, `linux/msi.h`, `linux/of.h`.
- Detected declarations: `struct gicv5_its_chip_data`, `struct gicv5_its_dev`, `function its_readl_relaxed`, `function its_writel_relaxed`, `function its_writeq_relaxed`, `function gicv5_its_dcache_clean`, `function its_write_table_entry`, `function gicv5_its_cache_sync`, `function gicv5_its_syncr`, `function gicv5_its_l2sz_to_l2_bits`.
- Atlas domain: Driver Families / drivers/irqchip.
- Implementation status: source implementation candidate.
- 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.