drivers/gpu/drm/etnaviv/etnaviv_flop_reset.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/etnaviv/etnaviv_flop_reset.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/etnaviv/etnaviv_flop_reset.c- Extension
.c- Size
- 6852 bytes
- Lines
- 224
- 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.
- 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/errno.hlinux/dev_printk.hlinux/string.hlinux/types.hetnaviv_buffer.hetnaviv_cmdbuf.hetnaviv_gpu.hstate_3d.xml.hetnaviv_flop_reset.h
Detected Declarations
function etnaviv_emit_flop_reset_state_ppufunction etnaviv_flop_reset_ppu_fill_inputfunction etnaviv_flop_reset_ppu_set_shaderfunction etnaviv_flop_reset_ppu_requirefunction etnaviv_flop_reset_ppu_initfunction etnaviv_flop_reset_ppu_run
Annotated Snippet
if (!(chip_id->features & chipFeatures_PIPE_3D)) {
pr_warn("Etnaviv: model: 0x%04x, revision: 0x%04x does not support PIPE_3D\n",
chip_id->model, chip_id->revision);
pr_warn("Request to force PPU flop reset ignored.\n");
return false;
}
pr_info("Force PPU flop reset for model: 0x%04x, revision: 0x%04x\n",
chip_id->model, chip_id->revision);
return true;
}
return false;
}
static const u32 image_data_size = PPU_IMAGE_STRIDE * PPU_IMAGE_YSIZE;
static const u32 output_offset = ALIGN(image_data_size, 64);
static const u32 shader_offset = ALIGN(output_offset + image_data_size, 64);
static const u32 shader_size = PPU_FLOP_RESET_INSTR_DWORD_COUNT * sizeof(u32);
static const u32 shader_register_count = 3;
static const u32 buffer_size = shader_offset + shader_size;
int etnaviv_flop_reset_ppu_init(struct etnaviv_drm_private *priv)
{
/* Get some space from the ring buffer to put the payload
* (input and output image, and shader), we keep this buffer
* for the whole life time the driver is bound
*/
priv->flop_reset_data_ppu = kzalloc_obj(*priv->flop_reset_data_ppu);
if (!priv->flop_reset_data_ppu)
return -ENOMEM;
int ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc,
priv->flop_reset_data_ppu, buffer_size);
if (ret) {
kfree(priv->flop_reset_data_ppu);
return ret;
}
void *buffer_base = priv->flop_reset_data_ppu->vaddr;
u32 *input_data = (u32 *)buffer_base;
u8 *shader_data = (u8 *)buffer_base + shader_offset;
etnaviv_flop_reset_ppu_fill_input(input_data, image_data_size);
etnaviv_flop_reset_ppu_set_shader(shader_data);
return 0;
}
void etnaviv_flop_reset_ppu_run(struct etnaviv_gpu *gpu)
{
struct etnaviv_drm_private *priv = gpu->drm->dev_private;
if (!priv->flop_reset_data_ppu) {
dev_err(gpu->dev,
"Oops: Flop reset data was not initialized, skipping\n");
return;
}
u32 buffer_base = etnaviv_cmdbuf_get_va(priv->flop_reset_data_ppu,
&gpu->mmu_context->cmdbuf_mapping);
etnaviv_emit_flop_reset_state_ppu(&gpu->buffer, buffer_base, 0,
output_offset, shader_offset,
shader_size, shader_register_count);
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/dev_printk.h`, `linux/string.h`, `linux/types.h`, `etnaviv_buffer.h`, `etnaviv_cmdbuf.h`, `etnaviv_gpu.h`, `state_3d.xml.h`.
- Detected declarations: `function etnaviv_emit_flop_reset_state_ppu`, `function etnaviv_flop_reset_ppu_fill_input`, `function etnaviv_flop_reset_ppu_set_shader`, `function etnaviv_flop_reset_ppu_require`, `function etnaviv_flop_reset_ppu_init`, `function etnaviv_flop_reset_ppu_run`.
- 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.