drivers/gpu/drm/xe/xe_wopcm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_wopcm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_wopcm.c- Extension
.c- Size
- 8760 bytes
- Lines
- 283
- 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_wopcm.hlinux/fault-inject.hregs/xe_guc_regs.hxe_device.hxe_force_wake.hxe_gt_types.hxe_mmio.hxe_uc_fw.h
Detected Declarations
function contextsfunction context_reserved_sizefunction __check_layoutfunction __wopcm_regs_lockedfunction __wopcm_init_regsfunction xe_wopcm_sizefunction max_wopcm_sizefunction xe_wopcm_init
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright © 2022 Intel Corporation
*/
#include "xe_wopcm.h"
#include <linux/fault-inject.h>
#include "regs/xe_guc_regs.h"
#include "xe_device.h"
#include "xe_force_wake.h"
#include "xe_gt_types.h"
#include "xe_mmio.h"
#include "xe_uc_fw.h"
/**
* DOC: Write Once Protected Content Memory (WOPCM) Layout
*
* The layout of the WOPCM will be fixed after writing to GuC WOPCM size and
* offset registers whose values are calculated and determined by HuC/GuC
* firmware size and set of hardware requirements/restrictions as shown below:
*
* ::
*
* +=========> +====================+ <== WOPCM Top
* ^ | HW contexts RSVD |
* | +===> +====================+ <== GuC WOPCM Top
* | ^ | |
* | | | |
* | | | |
* | GuC | |
* | WOPCM | |
* | Size +--------------------+
* WOPCM | | GuC FW RSVD |
* | | +--------------------+
* | | | GuC Stack RSVD |
* | | +------------------- +
* | v | GuC WOPCM RSVD |
* | +===> +====================+ <== GuC WOPCM base
* | | WOPCM RSVD |
* | +------------------- + <== HuC Firmware Top
* v | HuC FW |
* +=========> +====================+ <== WOPCM Base
*
* GuC accessible WOPCM starts at GuC WOPCM base and ends at GuC WOPCM top.
* The top part of the WOPCM is reserved for hardware contexts (e.g. RC6
* context).
*/
/* Default WOPCM size is 2MB from Gen11, 1MB on previous platforms */
/* FIXME: Larger size require for 2 tile PVC, do a proper probe sooner or later */
#define DGFX_WOPCM_SIZE SZ_4M
/* FIXME: Larger size require for MTL, do a proper probe sooner or later */
#define MTL_WOPCM_SIZE SZ_4M
#define WOPCM_SIZE SZ_2M
/* 16KB WOPCM (RSVD WOPCM) is reserved from HuC firmware top. */
#define WOPCM_RESERVED_SIZE SZ_16K
/* 16KB reserved at the beginning of GuC WOPCM. */
#define GUC_WOPCM_RESERVED SZ_16K
/* 8KB from GUC_WOPCM_RESERVED is reserved for GuC stack. */
#define GUC_WOPCM_STACK_RESERVED SZ_8K
/* GuC WOPCM Offset value needs to be aligned to 16KB. */
#define GUC_WOPCM_OFFSET_ALIGNMENT (1UL << GUC_WOPCM_OFFSET_SHIFT)
/* 36KB WOPCM reserved at the end of WOPCM */
#define WOPCM_HW_CTX_RESERVED (SZ_32K + SZ_4K)
static inline struct xe_gt *wopcm_to_gt(struct xe_wopcm *wopcm)
{
return container_of(wopcm, struct xe_gt, uc.wopcm);
}
static inline struct xe_device *wopcm_to_xe(struct xe_wopcm *wopcm)
{
return gt_to_xe(wopcm_to_gt(wopcm));
}
static u32 context_reserved_size(void)
{
return WOPCM_HW_CTX_RESERVED;
}
static bool __check_layout(struct xe_device *xe, u32 wopcm_size,
u32 guc_wopcm_base, u32 guc_wopcm_size,
u32 guc_fw_size, u32 huc_fw_size)
{
Annotation
- Immediate include surface: `xe_wopcm.h`, `linux/fault-inject.h`, `regs/xe_guc_regs.h`, `xe_device.h`, `xe_force_wake.h`, `xe_gt_types.h`, `xe_mmio.h`, `xe_uc_fw.h`.
- Detected declarations: `function contexts`, `function context_reserved_size`, `function __check_layout`, `function __wopcm_regs_locked`, `function __wopcm_init_regs`, `function xe_wopcm_size`, `function max_wopcm_size`, `function xe_wopcm_init`.
- 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.