search for: nvkm_memory

Displaying 20 results from an estimated 52 matches for "nvkm_memory".

2015 Nov 11
2
[PATCH] instmem/gk20a: use DMA API CPU mapping
...using vaddr? */ + u32 use_cpt; + /* will point to the higher half of pages */ dma_addr_t *dma_addrs; /* array of base.mem->size pages (+ dma_addr_ts) */ @@ -109,8 +110,6 @@ struct gk20a_instmem { /* Only used by DMA API */ struct dma_attrs attrs; - - void __iomem * (*cpu_map)(struct nvkm_memory *); }; #define gk20a_instmem(p) container_of((p), struct gk20a_instmem, base) @@ -132,46 +131,19 @@ gk20a_instobj_size(struct nvkm_memory *memory) return (u64)gk20a_instobj(memory)->mem.size << 12; } -static void __iomem * -gk20a_instobj_cpu_map_dma(struct nvkm_memory *memory) -{...
2015 Nov 11
0
[PATCH] instmem/gk20a: use DMA API CPU mapping
...ill point to the higher half of pages */ > dma_addr_t *dma_addrs; > /* array of base.mem->size pages (+ dma_addr_ts) */ > @@ -109,8 +110,6 @@ struct gk20a_instmem { > > /* Only used by DMA API */ > struct dma_attrs attrs; > - > - void __iomem * (*cpu_map)(struct nvkm_memory *); > }; > #define gk20a_instmem(p) container_of((p), struct gk20a_instmem, base) > > @@ -132,46 +131,19 @@ gk20a_instobj_size(struct nvkm_memory *memory) > return (u64)gk20a_instobj(memory)->mem.size << 12; > } > > -static void __iomem * > -gk20a_instob...
2017 Jan 30
2
[PATCH] drm/nouveau: gk20a: Turn instmem lock into mutex
...nvkm/subdev/instmem/gk20a.c @@ -94,7 +94,7 @@ struct gk20a_instmem { struct nvkm_instmem base; /* protects vaddr_* and gk20a_instobj::vaddr* */ - spinlock_t lock; + struct mutex lock; /* CPU mappings LRU */ unsigned int vaddr_use; @@ -184,11 +184,10 @@ gk20a_instobj_acquire_iommu(struct nvkm_memory *memory) struct gk20a_instmem *imem = node->base.imem; struct nvkm_ltc *ltc = imem->base.subdev.device->ltc; const u64 size = nvkm_memory_size(memory); - unsigned long flags; nvkm_ltc_flush(ltc); - spin_lock_irqsave(&imem->lock, flags); + mutex_lock(&imem->lock);...
2015 Oct 26
2
[PATCH] instmem/gk20a: exclusively acquire instobjs
...stmem/gk20a.c +++ b/drm/nouveau/nvkm/subdev/instmem/gk20a.c @@ -92,6 +92,7 @@ struct gk20a_instmem { /* protects vaddr_* and gk20a_instobj::vaddr* */ spinlock_t lock; + unsigned long flags; /* CPU mappings LRU */ unsigned int vaddr_use; @@ -188,12 +189,11 @@ gk20a_instobj_acquire(struct nvkm_memory *memory) struct gk20a_instobj *node = gk20a_instobj(memory); struct gk20a_instmem *imem = node->imem; struct nvkm_ltc *ltc = imem->base.subdev.device->ltc; - const u64 size = nvkm_memory_size(memory); - unsigned long flags; + u64 size; nvkm_ltc_flush(ltc); - spin_lock_irqsave(&...
2017 Feb 24
1
[PATCH] drm/nouveau: gk20a: Turn instmem lock into mutex
...struct nvkm_instmem base; >> >> /* protects vaddr_* and gk20a_instobj::vaddr* */ >> - spinlock_t lock; >> + struct mutex lock; >> >> /* CPU mappings LRU */ >> unsigned int vaddr_use; >> @@ -184,11 +184,10 @@ gk20a_instobj_acquire_iommu(struct nvkm_memory *memory) >> struct gk20a_instmem *imem = node->base.imem; >> struct nvkm_ltc *ltc = imem->base.subdev.device->ltc; >> const u64 size = nvkm_memory_size(memory); >> - unsigned long flags; >> >> nvkm_ltc_flush(ltc); >> >> - spin_lock_ir...
2023 Dec 08
1
[PATCH] drm/nouveau: Fixup gk20a instobj hierarchy
From: Thierry Reding <treding at nvidia.com> Commit 12c9b05da918 ("drm/nouveau/imem: support allocations not preserved across suspend") uses container_of() to cast from struct nvkm_memory to struct nvkm_instobj, assuming that all instance objects are derived from struct nvkm_instobj. For the gk20a family that's not the case and they are derived from struct nvkm_memory instead. This causes some subtle data corruption (nvkm_instobj.preserve ends up mapping to gk20a_instobj.vaddr)...
2023 Dec 14
1
[PATCH] drm/nouveau: Fixup gk20a instobj hierarchy
On 08/12/2023 10:46, Thierry Reding wrote: > From: Thierry Reding <treding at nvidia.com> > > Commit 12c9b05da918 ("drm/nouveau/imem: support allocations not > preserved across suspend") uses container_of() to cast from struct > nvkm_memory to struct nvkm_instobj, assuming that all instance objects > are derived from struct nvkm_instobj. For the gk20a family that's not > the case and they are derived from struct nvkm_memory instead. This > causes some subtle data corruption (nvkm_instobj.preserve ends up > mapping to g...
2017 Feb 23
0
[PATCH] drm/nouveau: gk20a: Turn instmem lock into mutex
...struct gk20a_instmem { > struct nvkm_instmem base; > > /* protects vaddr_* and gk20a_instobj::vaddr* */ > - spinlock_t lock; > + struct mutex lock; > > /* CPU mappings LRU */ > unsigned int vaddr_use; > @@ -184,11 +184,10 @@ gk20a_instobj_acquire_iommu(struct nvkm_memory *memory) > struct gk20a_instmem *imem = node->base.imem; > struct nvkm_ltc *ltc = imem->base.subdev.device->ltc; > const u64 size = nvkm_memory_size(memory); > - unsigned long flags; > > nvkm_ltc_flush(ltc); > > - spin_lock_irqsave(&imem->lock, fl...
2015 Nov 09
2
[PATCH] instmem/gk20a: fix race conditions
...@@ -57,6 +57,8 @@ struct gk20a_instobj { /* CPU mapping */ u32 *vaddr; struct list_head vaddr_node; + /* How many clients are using vaddr? */ + u32 use_cpt; }; #define gk20a_instobj(p) container_of((p), struct gk20a_instobj, memory) @@ -158,27 +160,35 @@ gk20a_instobj_cpu_map_iommu(struct nvkm_memory *memory) } /* - * Must be called while holding gk20a_instmem_lock + * Recycle the vaddr of obj. Must be called with gk20a_instmem::lock held. + */ +static void +gk20a_instobj_recycle_vaddr(struct gk20a_instobj *obj) +{ + struct gk20a_instmem *imem = obj->imem; + /* there should not be any us...
2015 Nov 04
0
[PATCH] instmem/gk20a: exclusively acquire instobjs
...nstmem/gk20a.c > @@ -92,6 +92,7 @@ struct gk20a_instmem { > > /* protects vaddr_* and gk20a_instobj::vaddr* */ > spinlock_t lock; > + unsigned long flags; > > /* CPU mappings LRU */ > unsigned int vaddr_use; > @@ -188,12 +189,11 @@ gk20a_instobj_acquire(struct nvkm_memory *memory) > struct gk20a_instobj *node = gk20a_instobj(memory); > struct gk20a_instmem *imem = node->imem; > struct nvkm_ltc *ltc = imem->base.subdev.device->ltc; > - const u64 size = nvkm_memory_size(memory); > - unsigned long flags; > + u64 size; > > nvkm...
2019 Sep 16
0
[PATCH 1/2] drm/nouveau: tegra: Fix NULL pointer dereference
...uveau/nvkm/subdev/instmem/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c index 985f2990ab0d..b0493f8df1fe 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c @@ -261,6 +261,34 @@ gk20a_instobj_release_iommu(struct nvkm_memory *memory) nvkm_ltc_invalidate(ltc); } +static u64 +gk20a_instobj_bar2_dma(struct nvkm_memory *memory) +{ + struct gk20a_instobj_dma *iobj = gk20a_instobj_dma(memory); + u64 addr = ~0ULL; + + if (gk20a_instobj_acquire_dma(&iobj->base.memory)) + addr = gk20a_instobj_addr(&iobj->bas...
2015 Nov 11
0
[PATCH] instmem/gk20a: fix race conditions
.../* CPU mapping */ > u32 *vaddr; > struct list_head vaddr_node; > + /* How many clients are using vaddr? */ > + u32 use_cpt; > }; > #define gk20a_instobj(p) container_of((p), struct gk20a_instobj, memory) > > @@ -158,27 +160,35 @@ gk20a_instobj_cpu_map_iommu(struct nvkm_memory *memory) > } > > /* > - * Must be called while holding gk20a_instmem_lock > + * Recycle the vaddr of obj. Must be called with gk20a_instmem::lock held. > + */ > +static void > +gk20a_instobj_recycle_vaddr(struct gk20a_instobj *obj) > +{ > + struct gk20a_instmem *im...
2019 Sep 16
6
[PATCH 0/2] drm/nouveau: Two more fixes
From: Thierry Reding <treding at nvidia.com> Hi Ben, I messed up the ordering of patches in my tree a bit, so these two fixes got separated from the others. I don't consider these particularily urgent because the crash that the first one fixes only happens on gp10b which we don't enable by default yet and the second patch fixes a crash that only happens on module unload (or driver
2019 Sep 16
9
[PATCH 0/6] drm/nouveau: Preparatory work for GV11B support
...if somebody could give this set a quick spin on a dGPU to confirm that these don't break. Thierry Thierry Reding (6): drm/nouveau: fault: Store aperture in fault information drm/nouveau: fault: Widen engine field drm/nouveau: Remove bogus gk20a aperture callback drm/nouveau: Implement nvkm_memory_aperture() drm/nouveau: Remove unused nvkm_vmm_func->aper() implementations drm/nouveau: Program aperture field where necessary .../drm/nouveau/include/nvkm/core/memory.h | 28 +++++++++++++++++++ .../drm/nouveau/include/nvkm/subdev/fault.h | 1 + .../gpu/drm/nouveau/nvkm/engine/fifo...
2017 Dec 08
3
[PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
...s/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c index 1ba7289684aa..db48a1daca0c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c @@ -249,7 +249,7 @@ nv50_instobj_acquire(struct nvkm_memory *memory) iobj->base.memory.ptrs = &nv50_instobj_fast; else iobj->base.memory.ptrs = &nv50_instobj_slow; - refcount_inc(&iobj->maps); + refcount_set(&iobj->maps, 1); } mutex_unlock(&imem->subdev.mutex); -- 2.11.0
2019 Nov 08
1
[PATCH] RFC: drm/nouveau: Make BAR1 support optional
...longer need to go via BAR1 to ensure that. Functionally the same can be done by just writing to the memory via the CPU's virtual mapping. So this patch implement basically a second variant of the FIFO channel which, instead of taking a physical address and then ioremapping that, takes a struct nvkm_memory object. This seems to work, though since I'm not really doing much yet (firmware loading fails, etc.) I wouldn't call this "done" just yet. In fact there are a few things that I'm not happy about. For example I think we'll eventually need to have barriers to ensure that t...
2016 Mar 01
1
[PATCH 1/2] fifo/gf100: take runlist target into account
...f100.c b/drm/nouveau/nvkm/engine/fifo/gf100.c index 36a39c7fd8d2..3cac5ebd0a4b 100644 --- a/drm/nouveau/nvkm/engine/fifo/gf100.c +++ b/drm/nouveau/nvkm/engine/fifo/gf100.c @@ -54,6 +54,7 @@ gf100_fifo_runlist_commit(struct gf100_fifo *fifo) struct nvkm_device *device = subdev->device; struct nvkm_memory *cur; int nr = 0; + int target; mutex_lock(&subdev->mutex); cur = fifo->runlist.mem[fifo->runlist.active]; @@ -67,7 +68,10 @@ gf100_fifo_runlist_commit(struct gf100_fifo *fifo) } nvkm_done(cur); - nvkm_wr32(device, 0x002270, nvkm_memory_addr(cur) >> 12); + target =...
2023 Jul 14
2
[PATCH] drm/nouveau/fifo:Fix Nineteen occurrences of the gk104.c error: ERROR: : trailing statements should be on next line
...reak; + case NVKM_ENGINE_VIC: + ptr0 = 0x0280; break; + case NVKM_ENGINE_MSENC: + ptr0 = 0x0290; + break; + case NVKM_ENGINE_NVDEC: ptr1 = 0x0270; ptr0 = 0x0210; break; @@ -435,8 +449,12 @@ gk104_runl_commit(struct nvkm_runl *runl, struct nvkm_memory *memory, u32 start, int target; switch (nvkm_memory_target(memory)) { - case NVKM_MEM_TARGET_VRAM: target = 0; break; - case NVKM_MEM_TARGET_NCOH: target = 3; break; + case NVKM_MEM_TARGET_VRAM: + target = 0; + break; + case NVKM_MEM_TARGET_NCOH: + targ...
2019 Dec 17
1
[PATCH] drm/nouveau: Add correct turing page kinds
...d9eb8e1ea 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgf100.c @@ -247,7 +247,7 @@ gf100_vmm_valid(struct nvkm_vmm *vmm, void *argv, u32 argc, } *args = argv; struct nvkm_device *device = vmm->mmu->subdev.device; struct nvkm_memory *memory = map->memory; - u8 kind, priv, ro, vol; + u8 kind, kind_inv, priv, ro, vol; int kindn, aper, ret = -ENOSYS; const u8 *kindm; @@ -274,8 +274,8 @@ gf100_vmm_valid(struct nvkm_vmm *vmm, void *argv, u32 argc, if (WARN_ON(aper < 0)) return aper; - kindm = vmm->mmu->fu...
2017 Dec 18
1
[PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
...50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c > > index 1ba7289684aa..db48a1daca0c 100644 > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c > > @@ -249,7 +249,7 @@ nv50_instobj_acquire(struct nvkm_memory *memory) > > iobj->base.memory.ptrs = &nv50_instobj_fast; > > else > > iobj->base.memory.ptrs = &nv50_instobj_slow; > > - refcount_inc(&iobj->maps); > > + r...