diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2017-10-31 20:56:19 +0300 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2017-11-02 06:32:22 +0300 |
commit | 997a89003c2d950466bc289147ffb823c0c51fb0 (patch) | |
tree | 39b19313da06136b74e3868000ffd5efca9c0414 /drivers/gpu/drm/nouveau/include | |
parent | 2c9c4910f8b126d18fa2a08087f3ae1553e706bc (diff) | |
download | linux-997a89003c2d950466bc289147ffb823c0c51fb0.tar.xz |
drm/nouveau/core/memory: add reference counting
We need to be able to prevent memory from being freed while it's still
mapped in a GPU's address-space.
Will be used by upcoming MMU changes.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/include')
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/core/memory.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/memory.h b/drivers/gpu/drm/nouveau/include/nvkm/core/memory.h index a0bfc37b96db..9c9c400bea98 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/memory.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/memory.h @@ -20,6 +20,7 @@ enum nvkm_memory_target { struct nvkm_memory { const struct nvkm_memory_func *func; const struct nvkm_memory_ptrs *ptrs; + struct kref kref; struct nvkm_tags *tags; }; @@ -44,7 +45,8 @@ struct nvkm_memory_ptrs { void nvkm_memory_ctor(const struct nvkm_memory_func *, struct nvkm_memory *); int nvkm_memory_new(struct nvkm_device *, enum nvkm_memory_target, u64 size, u32 align, bool zero, struct nvkm_memory **); -void nvkm_memory_del(struct nvkm_memory **); +struct nvkm_memory *nvkm_memory_ref(struct nvkm_memory *); +void nvkm_memory_unref(struct nvkm_memory **); int nvkm_memory_tags_get(struct nvkm_memory *, struct nvkm_device *, u32 tags, void (*clear)(struct nvkm_device *, u32, u32), struct nvkm_tags **); |