]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: Remove dead memmgr code
authorArto Merilainen <amerilainen@nvidia.com>
Mon, 24 Feb 2014 12:10:18 +0000 (14:10 +0200)
committerTerje Bergstrom <tbergstrom@nvidia.com>
Thu, 27 Feb 2014 06:37:08 +0000 (22:37 -0800)
As gk20a is currently taking care of its own memory management,
this patch removes all gk20a related code paths from the nvhost_memmgr
code.

Bug 1450489

Change-Id: I198bb9c7a6547ce70a57e13bb6d5b272b32bc4d4
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/373585
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
drivers/video/tegra/host/dmabuf.c
drivers/video/tegra/host/dmabuf.h
drivers/video/tegra/host/nvhost_memmgr.c
drivers/video/tegra/host/nvhost_memmgr.h
drivers/video/tegra/host/nvmap.c
drivers/video/tegra/host/nvmap.h

index 85a2028345fd7dda2821fa87cbc114de150f0bbc..92eec664ef728690e744f83f0032099a3495cf35 100644 (file)
@@ -37,12 +37,6 @@ static inline int to_dmabuf_fd(ulong id)
 {
        return nvhost_memmgr_id(id) >> 2;
 }
-struct mem_handle *nvhost_dmabuf_alloc(size_t size, size_t align, int flags)
-{
-       /* TODO: Add allocation via DMA Mapping API */
-       return NULL;
-}
-
 void nvhost_dmabuf_put(struct mem_handle *handle)
 {
        struct dma_buf_attachment *attach = to_dmabuf_att(handle);
@@ -109,10 +103,3 @@ struct mem_handle *nvhost_dmabuf_get(ulong id, struct platform_device *dev)
 
        return (struct mem_handle *) ((uintptr_t)h | mem_mgr_type_dmabuf);
 }
-
-int nvhost_dmabuf_get_param(struct mem_handle *handle,
-                           u32 param, u64 *result)
-{
-       /* TBD: find a way to associate size, kind, etc */
-       return -EINVAL;
-}
index 2b9170e28c3808596167c32ba549aff0219b133b..1d8ea38fb094b12f40f07f6429385f8b212fdfaf 100644 (file)
@@ -30,7 +30,6 @@ struct mem_mgr *nvhost_dmabuf_alloc_mgr(void);
 void nvhost_dmabuf_put_mgr(struct mem_mgr *mgr);
 struct mem_mgr *nvhost_dmabuf_get_mgr(struct mem_mgr *mgr);
 struct mem_mgr *nvhost_dmabuf_get_mgr_file(int fd);
-struct mem_handle *nvhost_dmabuf_alloc(size_t size, size_t align, int flags);
 void nvhost_dmabuf_put(struct mem_handle *handle);
 struct sg_table *nvhost_dmabuf_pin(struct mem_handle *handle);
 void nvhost_dmabuf_unpin(struct mem_handle *handle, struct sg_table *sgt);
@@ -42,5 +41,4 @@ void nvhost_dmabuf_kunmap(struct mem_handle *handle, unsigned int pagenum,
 struct mem_handle *nvhost_dmabuf_get(ulong id, struct platform_device *dev);
 int nvhost_dmabuf_get_param(struct mem_handle *handle,
                           u32 param, u64 *result);
-size_t nvhost_dmabuf_size(struct mem_handle *handle);
 #endif
index be490b8270fc6af8696a6bf366c002b62cf6f4dc..177fd576debe54270e50e4e293514211dc001ea1 100644 (file)
@@ -87,21 +87,6 @@ struct mem_mgr *nvhost_memmgr_get_mgr_file(int fd)
        return mgr;
 }
 
-struct mem_handle *nvhost_memmgr_alloc(size_t size, size_t align,
-                                      int flags, unsigned int heap_mask)
-{
-       struct mem_handle *h = NULL;
-#ifdef CONFIG_TEGRA_GRHOST_USE_NVMAP
-       h = nvhost_nvmap_alloc(size, align, flags, heap_mask);
-#else
-#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
-       h = nvhost_dmabuf_alloc(size, align, flags);
-#endif
-#endif
-
-       return h;
-}
-
 struct mem_handle *nvhost_memmgr_get(struct mem_mgr *mgr,
                ulong id, struct platform_device *dev)
 {
@@ -220,32 +205,6 @@ void nvhost_memmgr_munmap(struct mem_handle *handle, void *addr)
        }
 }
 
-int nvhost_memmgr_get_param(struct mem_handle *mem_handle,
-                           u32 param, u64 *result)
-{
-#ifndef CONFIG_ARM64
-       switch (nvhost_memmgr_type((u32)mem_handle)) {
-#else
-       switch (nvhost_memmgr_type((u32)((uintptr_t)mem_handle))) {
-#endif
-#ifdef CONFIG_TEGRA_GRHOST_USE_NVMAP
-       case mem_mgr_type_nvmap:
-               return nvhost_nvmap_get_param(mem_handle,
-                                             param, result);
-               break;
-#endif
-#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
-       case mem_mgr_type_dmabuf:
-               return nvhost_dmabuf_get_param(mem_handle,
-                                              param, result);
-               break;
-#endif
-       default:
-               break;
-       }
-       return -EINVAL;
-}
-
 void *nvhost_memmgr_kmap(struct mem_handle *handle, unsigned int pagenum)
 {
        switch (nvhost_memmgr_type((u32)((uintptr_t)handle))) {
@@ -284,93 +243,6 @@ void nvhost_memmgr_kunmap(struct mem_handle *handle, unsigned int pagenum,
        }
 }
 
-size_t nvhost_memmgr_size(struct mem_handle *handle)
-{
-       switch (nvhost_memmgr_type((u32)((uintptr_t)handle))) {
-#ifdef CONFIG_TEGRA_GRHOST_USE_NVMAP
-       case mem_mgr_type_nvmap:
-               return nvhost_nvmap_size(handle);
-               break;
-#endif
-#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
-       case mem_mgr_type_dmabuf:
-               return nvhost_dmabuf_size(handle);
-               break;
-#endif
-       default:
-               return 0;
-       }
-
-}
-
-struct sg_table *nvhost_memmgr_sg_table(struct mem_mgr *mgr,
-               struct mem_handle *handle)
-{
-       switch (nvhost_memmgr_type((ulong)handle)) {
-#ifdef CONFIG_TEGRA_GRHOST_USE_NVMAP
-       case mem_mgr_type_nvmap:
-               return nvmap_dmabuf_sg_table((struct dma_buf *)handle);
-               break;
-#endif
-#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
-       case mem_mgr_type_dmabuf:
-               WARN_ON(1);
-               break;
-#endif
-       default:
-               break;
-       }
-
-       return NULL;
-
-}
-
-void nvhost_memmgr_free_sg_table(struct mem_mgr *mgr,
-               struct mem_handle *handle, struct sg_table *sgt)
-{
-       switch (nvhost_memmgr_type((ulong)handle)) {
-#ifdef CONFIG_TEGRA_GRHOST_USE_NVMAP
-       case mem_mgr_type_nvmap:
-               return nvmap_dmabuf_free_sg_table(
-                                       (struct dma_buf *)handle, sgt);
-               break;
-#endif
-#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
-       case mem_mgr_type_dmabuf:
-               WARN_ON(1);
-               break;
-#endif
-       default:
-               break;
-       }
-       return;
-}
-
-void nvhost_memmgr_get_comptags(struct device *dev,
-                               struct mem_handle *mem,
-                               struct nvhost_comptags *comptags)
-{
-#ifdef CONFIG_TEGRA_GRHOST_USE_NVMAP
-       return nvhost_nvmap_get_comptags(dev, mem, comptags);
-#endif
-#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
-       WARN_ON(1);
-#endif
-}
-
-int nvhost_memmgr_alloc_comptags(struct device *dev,
-                                struct mem_handle *mem,
-                                struct nvhost_allocator *allocator,
-                                int lines)
-{
-#ifdef CONFIG_TEGRA_GRHOST_USE_NVMAP
-       return nvhost_nvmap_alloc_comptags(dev, mem, allocator, lines);
-#endif
-#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
-       WARN_ON(1);
-#endif
-}
-
 int nvhost_memmgr_init(struct nvhost_chip_support *chip)
 {
        return 0;
index 764694198321f497a5fe81cd847275a455ba9ee5..23b9930e1d2316b89b4384337dac8110a9c81c2e 100644 (file)
@@ -31,11 +31,6 @@ struct platform_device;
 struct device;
 struct nvhost_allocator;
 
-struct nvhost_comptags {
-       u32 offset;
-       u32 lines;
-};
-
 enum mem_mgr_flag {
        mem_mgr_flag_uncacheable = 0,
        mem_mgr_flag_write_combine = 1,
@@ -60,8 +55,6 @@ struct mem_mgr *nvhost_memmgr_alloc_mgr(void);
 void nvhost_memmgr_put_mgr(struct mem_mgr *);
 struct mem_mgr *nvhost_memmgr_get_mgr(struct mem_mgr *);
 struct mem_mgr *nvhost_memmgr_get_mgr_file(int fd);
-struct mem_handle *nvhost_memmgr_alloc(size_t size, size_t align,
-                                      int flags, unsigned int heap_mask);
 struct mem_handle *nvhost_memmgr_get(struct mem_mgr *,
                ulong id, struct platform_device *dev);
 void nvhost_memmgr_put(struct mem_mgr *mgr, struct mem_handle *handle);
@@ -77,25 +70,9 @@ void nvhost_memmgr_munmap(struct mem_handle *handle, void *addr);
 void *nvhost_memmgr_kmap(struct mem_handle *handle, unsigned int pagenum);
 void nvhost_memmgr_kunmap(struct mem_handle *handle, unsigned int pagenum,
                void *addr);
-struct sg_table *nvhost_memmgr_sg_table(struct mem_mgr *mgr,
-               struct mem_handle *handle);
-void nvhost_memmgr_free_sg_table(struct mem_mgr *mgr,
-               struct mem_handle *handle, struct sg_table *sgt);
 static inline int nvhost_memmgr_type(ulong id) { return id & MEMMGR_TYPE_MASK; }
 static inline int nvhost_memmgr_id(ulong id) { return id & MEMMGR_ID_MASK; }
 
-int nvhost_memmgr_get_param(struct mem_handle *mem_handle,
-                           u32 param, u64 *result);
-
-void nvhost_memmgr_get_comptags(struct device *dev,
-                               struct mem_handle *mem,
-                               struct nvhost_comptags *comptags);
-int nvhost_memmgr_alloc_comptags(struct device *dev,
-                                struct mem_handle *mem,
-                                struct nvhost_allocator *allocator,
-                                int lines);
-size_t nvhost_memmgr_size(struct mem_handle *handle);
-
 #ifdef CONFIG_TEGRA_IOMMU_SMMU
 int nvhost_memmgr_smmu_map(struct sg_table *sgt, size_t size,
                           struct device *dev);
index 118379b648decd72a162a1b1449a9b793c982f36..5d4dabf005bbca31ec4cf073ac53e2bf754535a4 100644 (file)
@@ -44,8 +44,6 @@ struct nvhost_nvmap_as_data {
 struct nvhost_nvmap_data {
        struct mutex lock;
        struct nvhost_nvmap_as_data *as[TEGRA_IOMMU_NUM_ASIDS];
-       struct nvhost_comptags comptags;
-       struct nvhost_allocator *comptag_allocator;
 };
 
 struct mem_mgr *nvhost_nvmap_alloc_mgr(void)
@@ -67,13 +65,6 @@ struct mem_mgr *nvhost_nvmap_get_mgr_file(int fd)
        return (struct mem_mgr *)0x1;
 }
 
-struct mem_handle *nvhost_nvmap_alloc(size_t size, size_t align,
-                                     int flags, unsigned int heap_mask)
-{
-       return (struct mem_handle *)nvmap_alloc_dmabuf(
-                       size, align, flags, heap_mask);
-}
-
 void nvhost_nvmap_put(struct mem_mgr *mgr, struct mem_handle *handle)
 {
        if (!handle)
@@ -93,21 +84,9 @@ void delete_priv(void *_priv)
                        nvmap_dmabuf_free_sg_table(NULL, as->sgt);
                kfree(as);
        }
-       if (priv->comptags.lines) {
-               BUG_ON(!priv->comptag_allocator);
-               priv->comptag_allocator->free(priv->comptag_allocator,
-                                             priv->comptags.offset,
-                                             priv->comptags.lines);
-       }
        kfree(priv);
 }
 
-size_t nvhost_nvmap_size(struct mem_handle *handle)
-{
-       struct dma_buf *dmabuf = (struct dma_buf *)handle;
-       return dmabuf->size;
-}
-
 struct sg_table *nvhost_nvmap_pin(struct mem_mgr *mgr,
                struct mem_handle *handle,
                struct device *dev,
@@ -265,56 +244,3 @@ struct mem_handle *nvhost_nvmap_get(struct mem_mgr *mgr,
 {
        return (struct mem_handle *)dma_buf_get(id);
 }
-
-int nvhost_nvmap_get_param(struct mem_handle *handle,
-                          u32 param, u64 *result)
-{
-       return nvmap_get_dmabuf_param(
-                       (struct dma_buf *)handle,
-                       param, result);
-}
-
-void nvhost_nvmap_get_comptags(struct device *dev,
-                              struct mem_handle *mem,
-                              struct nvhost_comptags *comptags)
-{
-       struct nvhost_nvmap_data *priv;
-
-       priv = dma_buf_get_drvdata((struct dma_buf *)mem, dev);
-
-       BUG_ON(!comptags);
-
-       if (!priv) {
-               comptags->lines = 0;
-               comptags->offset = 0;
-               return;
-       }
-
-       *comptags = priv->comptags;
-}
-
-int nvhost_nvmap_alloc_comptags(struct device *dev,
-                               struct mem_handle *mem,
-                               struct nvhost_allocator *allocator,
-                               int lines)
-{
-       int err;
-       u32 offset = 0;
-       struct nvhost_nvmap_data *priv;
-
-       priv = dma_buf_get_drvdata((struct dma_buf *)mem, dev);
-
-       if (!priv)
-               return -ENOSYS;
-
-       BUG_ON(!lines);
-
-       /* store the allocator so we can use it when we free the ctags */
-       priv->comptag_allocator = allocator;
-       err = allocator->alloc(allocator, &offset, lines);
-       if (!err) {
-               priv->comptags.lines = lines;
-               priv->comptags.offset = offset;
-       }
-       return err;
-}
index f96643e21dd5df478f124785e85c84ad29c17ad4..8ed04c2b0991798ae17b7b263082d6ee8f0fe0c2 100644 (file)
@@ -31,8 +31,6 @@ struct mem_mgr *nvhost_nvmap_alloc_mgr(void);
 void nvhost_nvmap_put_mgr(struct mem_mgr *mgr);
 struct mem_mgr *nvhost_nvmap_get_mgr(struct mem_mgr *mgr);
 struct mem_mgr *nvhost_nvmap_get_mgr_file(int fd);
-struct mem_handle *nvhost_nvmap_alloc(size_t size, size_t align,
-                                     int flags, unsigned int heap_flags);
 void nvhost_nvmap_put(struct mem_mgr *mgr, struct mem_handle *handle);
 struct sg_table *nvhost_nvmap_pin(struct mem_mgr *mgr,
                struct mem_handle *handle, struct device *dev, int rw_flag);
@@ -45,16 +43,8 @@ void nvhost_nvmap_kunmap(struct mem_handle *handle, unsigned int pagenum,
                void *addr);
 struct mem_handle *nvhost_nvmap_get(struct mem_mgr *mgr,
                ulong id, struct platform_device *dev);
-int nvhost_nvmap_get_param(struct mem_handle *handle,
-                          u32 param, u64 *result);
 phys_addr_t nvhost_nvmap_get_addr_from_id(ulong id);
 
 void nvhost_nvmap_unpin_id(struct mem_mgr *mgr, ulong id);
-void nvhost_nvmap_get_comptags(struct device *dev, struct mem_handle *mem,
-                              struct nvhost_comptags *comptags);
-int nvhost_nvmap_alloc_comptags(struct device *dev, struct mem_handle *mem,
-                               struct nvhost_allocator *allocator,
-                               int lines);
-size_t nvhost_nvmap_size(struct mem_handle *handle);
 
 #endif