drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c- Extension
.c- Size
- 5205 bytes
- Lines
- 203
- 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
subdev/bar/gf100.hcore/mm.hsubdev/fb.hsubdev/gsp.hsubdev/instmem.hsubdev/mmu/vmm.hnvrm/bar.hnvrm/rpcfn.h
Detected Declarations
function filesfunction r535_bar_bar2_waitfunction r535_bar_bar2_finifunction r535_bar_bar2_initfunction r535_bar_bar1_waitfunction r535_bar_dtorfunction r535_bar_new_
Annotated Snippet
if (ret == 0) {
ret = nvkm_memory_kmap(fbZero, &bar->flushFBZero);
nvkm_memory_unref(&fbZero);
}
WARN_ON(ret);
}
bar->bar2 = true;
bar->flushBAR2 = nvkm_kmap(bar->flushFBZero);
WARN_ON(!bar->flushBAR2);
}
static void
r535_bar_bar1_wait(struct nvkm_bar *base)
{
}
static void
r535_bar_bar1_fini(struct nvkm_bar *base)
{
}
static void
r535_bar_bar1_init(struct nvkm_bar *bar)
{
struct nvkm_device *device = bar->subdev.device;
struct nvkm_gsp *gsp = device->gsp;
struct nvkm_vmm *vmm = gf100_bar(bar)->bar[1].vmm;
struct nvkm_memory *pd3;
int ret;
ret = nvkm_ram_wrap(device, gsp->bar.rm_bar1_pdb, 0x1000, &pd3);
if (WARN_ON(ret))
return;
nvkm_memory_unref(&vmm->pd->pt[0]->memory);
ret = nvkm_memory_kmap(pd3, &vmm->pd->pt[0]->memory);
nvkm_memory_unref(&pd3);
if (WARN_ON(ret))
return;
vmm->pd->pt[0]->addr = nvkm_memory_addr(vmm->pd->pt[0]->memory);
}
static void *
r535_bar_dtor(struct nvkm_bar *bar)
{
void *data = gf100_bar_dtor(bar);
nvkm_memory_unref(&bar->flushFBZero);
if (bar->flushBAR2PhysMode)
iounmap(bar->flushBAR2PhysMode);
kfree(bar->func);
return data;
}
int
r535_bar_new_(const struct nvkm_bar_func *hw, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_bar **pbar)
{
struct nvkm_bar_func *rm;
struct nvkm_bar *bar;
int ret;
if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_bar_dtor;
rm->oneinit = hw->oneinit;
rm->bar1.init = r535_bar_bar1_init;
rm->bar1.fini = r535_bar_bar1_fini;
rm->bar1.wait = r535_bar_bar1_wait;
rm->bar1.vmm = hw->bar1.vmm;
rm->bar2.init = r535_bar_bar2_init;
rm->bar2.fini = r535_bar_bar2_fini;
rm->bar2.wait = r535_bar_bar2_wait;
rm->bar2.vmm = hw->bar2.vmm;
rm->flush = r535_bar_flush;
ret = gf100_bar_new_(rm, device, type, inst, &bar);
if (ret) {
kfree(rm);
return ret;
}
*pbar = bar;
bar->flushBAR2PhysMode = ioremap(device->func->resource_addr(device, NVKM_BAR2_INST), PAGE_SIZE);
Annotation
- Immediate include surface: `subdev/bar/gf100.h`, `core/mm.h`, `subdev/fb.h`, `subdev/gsp.h`, `subdev/instmem.h`, `subdev/mmu/vmm.h`, `nvrm/bar.h`, `nvrm/rpcfn.h`.
- Detected declarations: `function files`, `function r535_bar_bar2_wait`, `function r535_bar_bar2_fini`, `function r535_bar_bar2_init`, `function r535_bar_bar1_wait`, `function r535_bar_dtor`, `function r535_bar_new_`.
- 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.