drivers/gpu/host1x/job.c
Source file repositories/reference/linux-study-clean/drivers/gpu/host1x/job.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/host1x/job.c- Extension
.c- Size
- 14448 bytes
- Lines
- 693
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/dma-mapping.hlinux/err.hlinux/host1x.hlinux/iommu.hlinux/kref.hlinux/module.hlinux/scatterlist.hlinux/slab.hlinux/vmalloc.htrace/events/host1x.hchannel.hdev.hjob.hsyncpt.h
Detected Declarations
struct host1x_firewallfunction Copyrightfunction job_freefunction host1x_job_putfunction host1x_job_add_gatherfunction host1x_job_add_waitfunction pin_jobfunction do_relocsfunction check_relocfunction check_registerfunction check_classfunction check_maskfunction check_incrfunction check_nonincrfunction validatefunction copy_gathersfunction host1x_job_pinfunction host1x_job_unpinfunction host1x_job_dumpexport host1x_job_allocexport host1x_job_getexport host1x_job_putexport host1x_job_add_gatherexport host1x_job_add_waitexport host1x_job_pinexport host1x_job_unpin
Annotated Snippet
struct host1x_firewall {
struct host1x_job *job;
struct device *dev;
unsigned int num_relocs;
struct host1x_reloc *reloc;
struct host1x_bo *cmdbuf;
unsigned int offset;
u32 words;
u32 class;
u32 reg;
u32 mask;
u32 count;
};
static int check_register(struct host1x_firewall *fw, unsigned long offset)
{
if (!fw->job->is_addr_reg)
return 0;
if (fw->job->is_addr_reg(fw->dev, fw->class, offset)) {
if (!fw->num_relocs)
return -EINVAL;
if (!check_reloc(fw->reloc, fw->cmdbuf, fw->offset))
return -EINVAL;
fw->num_relocs--;
fw->reloc++;
}
return 0;
}
static int check_class(struct host1x_firewall *fw, u32 class)
{
if (!fw->job->is_valid_class) {
if (fw->class != class)
return -EINVAL;
} else {
if (!fw->job->is_valid_class(fw->class))
return -EINVAL;
}
return 0;
}
static int check_mask(struct host1x_firewall *fw)
{
u32 mask = fw->mask;
u32 reg = fw->reg;
int ret;
while (mask) {
if (fw->words == 0)
return -EINVAL;
if (mask & 1) {
ret = check_register(fw, reg);
if (ret < 0)
return ret;
fw->words--;
fw->offset++;
}
mask >>= 1;
reg++;
}
return 0;
}
static int check_incr(struct host1x_firewall *fw)
{
u32 count = fw->count;
u32 reg = fw->reg;
int ret;
while (count) {
if (fw->words == 0)
return -EINVAL;
ret = check_register(fw, reg);
if (ret < 0)
return ret;
reg++;
fw->words--;
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/err.h`, `linux/host1x.h`, `linux/iommu.h`, `linux/kref.h`, `linux/module.h`, `linux/scatterlist.h`, `linux/slab.h`.
- Detected declarations: `struct host1x_firewall`, `function Copyright`, `function job_free`, `function host1x_job_put`, `function host1x_job_add_gather`, `function host1x_job_add_wait`, `function pin_job`, `function do_relocs`, `function check_reloc`, `function check_register`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.