drivers/gpu/drm/xe/xe_memirq.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_memirq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_memirq.c- Extension
.c- Size
- 18930 bytes
- Lines
- 592
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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
drm/drm_managed.hregs/xe_guc_regs.hregs/xe_irq_regs.hxe_assert.hxe_bo.hxe_device.hxe_device_types.hxe_gt.hxe_guc.hxe_hw_engine.hxe_memirq.hxe_tile_printk.h
Detected Declarations
function hw_reports_to_instance_zerofunction hwe_max_countfunction memirq_alloc_pagesfunction memirq_set_enablefunction xe_memirq_initfunction xe_memirq_initfunction xe_memirq_initfunction xe_memirq_initfunction xe_memirq_initfunction xe_memirq_resetfunction xe_memirq_postinstallfunction __memirq_receivedfunction memirq_received_noclearfunction memirq_receivedfunction memirq_assume_receivedfunction memirq_dispatch_enginefunction memirq_dispatch_gucfunction xe_gt_sriov_vf_recovery_pendingfunction xe_memirq_hwe_handlerfunction xe_memirq_guc_sw_int_0_irq_pendingfunction memirq_dump_source_pagesfunction xe_memirq_handlerfunction for_each_gt
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright © 2023 Intel Corporation
*/
#include <drm/drm_managed.h>
#include "regs/xe_guc_regs.h"
#include "regs/xe_irq_regs.h"
#include "xe_assert.h"
#include "xe_bo.h"
#include "xe_device.h"
#include "xe_device_types.h"
#include "xe_gt.h"
#include "xe_guc.h"
#include "xe_hw_engine.h"
#include "xe_memirq.h"
#include "xe_tile_printk.h"
#define memirq_assert(m, condition) xe_tile_assert(memirq_to_tile(m), condition)
#define memirq_printk(m, _level, _fmt, ...) \
xe_tile_##_level(memirq_to_tile(m), "MEMIRQ: " _fmt, ##__VA_ARGS__)
#ifdef CONFIG_DRM_XE_DEBUG_MEMIRQ
#define memirq_debug(m, _fmt, ...) memirq_printk(m, dbg, _fmt, ##__VA_ARGS__)
#else
#define memirq_debug(...)
#endif
#define memirq_err(m, _fmt, ...) memirq_printk(m, err, _fmt, ##__VA_ARGS__)
#define memirq_err_ratelimited(m, _fmt, ...) \
memirq_printk(m, err_ratelimited, _fmt, ##__VA_ARGS__)
static struct xe_tile *memirq_to_tile(struct xe_memirq *memirq)
{
return container_of(memirq, struct xe_tile, memirq);
}
static struct xe_device *memirq_to_xe(struct xe_memirq *memirq)
{
return tile_to_xe(memirq_to_tile(memirq));
}
static const char *guc_name(struct xe_guc *guc)
{
return xe_gt_is_media_type(guc_to_gt(guc)) ? "media GuC" : "GuC";
}
/**
* DOC: Memory Based Interrupts
*
* MMIO register based interrupts infrastructure used for non-virtualized mode
* or SRIOV-8 (which supports 8 Virtual Functions) does not scale efficiently
* to allow delivering interrupts to a large number of Virtual machines or
* containers. Memory based interrupt status reporting provides an efficient
* and scalable infrastructure.
*
* For memory based interrupt status reporting hardware sequence is:
* * Engine writes the interrupt event to memory
* (Pointer to memory location is provided by SW. This memory surface must
* be mapped to system memory and must be marked as un-cacheable (UC) on
* Graphics IP Caches)
* * Engine triggers an interrupt to host.
*/
/**
* DOC: Memory Based Interrupts Page Layout
*
* `Memory Based Interrupts`_ requires three different objects, which are
* called "page" in the specs, even if they aren't page-sized or aligned.
*
* To simplify the code we allocate a single page size object and then use
* offsets to embedded "pages". The address of those "pages" are then
* programmed in the HW via LRI and LRM in the context image.
*
* - _`Interrupt Status Report Page`: this page contains the interrupt
* status vectors for each unit. Each bit in the interrupt vectors is
* converted to a byte, with the byte being set to 0xFF when an
* interrupt is triggered; interrupt vectors are 16b big so each unit
* gets 16B. One space is reserved for each bit in one of the
* GT_INTR_DWx registers, so this object needs a total of 1024B.
* This object needs to be 4KiB aligned.
*
* - _`Interrupt Source Report Page`: this is the equivalent of the
* GT_INTR_DWx registers, with each bit in those registers being
* mapped to a byte here. The offsets are the same, just bytes instead
* of bits. This object needs to be cacheline aligned.
*
* - Interrupt Mask: the HW needs a location to fetch the interrupt
Annotation
- Immediate include surface: `drm/drm_managed.h`, `regs/xe_guc_regs.h`, `regs/xe_irq_regs.h`, `xe_assert.h`, `xe_bo.h`, `xe_device.h`, `xe_device_types.h`, `xe_gt.h`.
- Detected declarations: `function hw_reports_to_instance_zero`, `function hwe_max_count`, `function memirq_alloc_pages`, `function memirq_set_enable`, `function xe_memirq_init`, `function xe_memirq_init`, `function xe_memirq_init`, `function xe_memirq_init`, `function xe_memirq_init`, `function xe_memirq_reset`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.