drivers/gpu/drm/xe/xe_mmio.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_mmio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_mmio.c- Extension
.c- Size
- 11444 bytes
- Lines
- 416
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xe_mmio.hlinux/delay.hlinux/io-64-nonatomic-lo-hi.hlinux/minmax.hlinux/pci.hdrm/drm_managed.hdrm/drm_print.hregs/xe_bars.hxe_device.hxe_gt_sriov_vf.hxe_sriov.hxe_trace.hxe_wa.hgenerated/xe_device_wa_oob.h
Detected Declarations
function tiles_finifunction otherfunction xe_mmio_probe_tilesfunction mmio_finifunction xe_mmio_probe_earlyfunction xe_mmio_initfunction mmio_flush_pending_writesfunction xe_mmio_read8function xe_mmio_write8function xe_mmio_read16function xe_mmio_write32function xe_mmio_read32function xe_mmio_rmw32function xe_mmio_write32_and_verifyfunction xe_mmio_in_rangefunction xe_mmio_read64_2x32function __xe_mmio_wait32function xe_mmio_wait32function xe_mmio_wait32_notfunction vf_regs_stridefunction xe_mmio_init_vf_view
Annotated Snippet
if (check) {
ret = 0;
break;
}
cur = ktime_get_raw();
if (!ktime_before(cur, end))
break;
if (ktime_after(ktime_add_us(cur, wait), end))
wait = ktime_us_delta(end, cur);
if (atomic)
udelay(wait);
else
usleep_range(wait, wait << 1);
wait <<= 1;
}
if (ret != 0) {
read = xe_mmio_read32(mmio, reg);
check = (read & mask) == val;
if (!expect_match)
check = !check;
if (check)
ret = 0;
}
if (out_val)
*out_val = read;
return ret;
}
/**
* xe_mmio_wait32() - Wait for a register to match the desired masked value
* @mmio: MMIO target
* @reg: register to read value from
* @mask: mask to be applied to the value read from the register
* @val: desired value after applying the mask
* @timeout_us: time out after this period of time. Wait logic tries to be
* smart, applying an exponential backoff until @timeout_us is reached.
* @out_val: if not NULL, points where to store the last unmasked value
* @atomic: needs to be true if calling from an atomic context
*
* This function polls for the desired masked value and returns zero on success
* or -ETIMEDOUT if timed out.
*
* Note that @timeout_us represents the minimum amount of time to wait before
* giving up. The actual time taken by this function can be a little more than
* @timeout_us for different reasons, specially in non-atomic contexts. Thus,
* it is possible that this function succeeds even after @timeout_us has passed.
*/
int xe_mmio_wait32(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u32 val, u32 timeout_us,
u32 *out_val, bool atomic)
{
return __xe_mmio_wait32(mmio, reg, mask, val, timeout_us, out_val, atomic, true);
}
/**
* xe_mmio_wait32_not() - Wait for a register to return anything other than the given masked value
* @mmio: MMIO target
* @reg: register to read value from
* @mask: mask to be applied to the value read from the register
* @val: value not to be matched after applying the mask
* @timeout_us: time out after this period of time
* @out_val: if not NULL, points where to store the last unmasked value
* @atomic: needs to be true if calling from an atomic context
*
* This function works exactly like xe_mmio_wait32() with the exception that
* @val is expected not to be matched.
*/
int xe_mmio_wait32_not(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u32 val, u32 timeout_us,
u32 *out_val, bool atomic)
{
return __xe_mmio_wait32(mmio, reg, mask, val, timeout_us, out_val, atomic, false);
}
#ifdef CONFIG_PCI_IOV
static size_t vf_regs_stride(struct xe_device *xe)
{
return GRAPHICS_VERx100(xe) > 1200 ? 0x400 : 0x1000;
}
/**
* xe_mmio_init_vf_view() - Initialize an MMIO instance for accesses like the VF
* @mmio: the target &xe_mmio to initialize as VF's view
* @base: the source &xe_mmio to initialize from
Annotation
- Immediate include surface: `xe_mmio.h`, `linux/delay.h`, `linux/io-64-nonatomic-lo-hi.h`, `linux/minmax.h`, `linux/pci.h`, `drm/drm_managed.h`, `drm/drm_print.h`, `regs/xe_bars.h`.
- Detected declarations: `function tiles_fini`, `function other`, `function xe_mmio_probe_tiles`, `function mmio_fini`, `function xe_mmio_probe_early`, `function xe_mmio_init`, `function mmio_flush_pending_writes`, `function xe_mmio_read8`, `function xe_mmio_write8`, `function xe_mmio_read16`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.