if (!vm->enable_ctag)
bfr.ctag_lines = 0;
- nvhost_memmgr_get_comptags(r, &comptags);
+ nvhost_memmgr_get_comptags(d, r, &comptags);
if (bfr.ctag_lines && !comptags.lines) {
/* allocate compression resources if needed */
- err = nvhost_memmgr_alloc_comptags(r,
+ err = nvhost_memmgr_alloc_comptags(d, r,
ctag_allocator, bfr.ctag_lines);
if (err) {
/* ok to fall back here if we ran out */
bfr.ctag_lines = bfr.ctag_offset = 0;
bfr.kind_v = bfr.uc_kind_v;
} else {
- nvhost_memmgr_get_comptags(r, &comptags);
+ nvhost_memmgr_get_comptags(d, r, &comptags);
/* init/clear the ctag buffer */
g->ops.ltc.clear_comptags(g,
return;
}
-void nvhost_memmgr_get_comptags(struct mem_handle *mem,
+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(mem, comptags);
+ 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 mem_handle *mem,
+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(mem, allocator, lines);
+ return nvhost_nvmap_alloc_comptags(dev, mem, allocator, lines);
#endif
#ifdef CONFIG_TEGRA_GRHOST_USE_DMABUF
WARN_ON(1);
struct mem_handle *mem_handle,
u32 param, u64 *result);
-void nvhost_memmgr_get_comptags(struct mem_handle *mem,
+void nvhost_memmgr_get_comptags(struct device *dev,
+ struct mem_handle *mem,
struct nvhost_comptags *comptags);
-int nvhost_memmgr_alloc_comptags(struct mem_handle *mem,
+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);
static DEFINE_MUTEX(priv_lock);
/* create the nvhost priv if needed */
- priv = nvmap_get_dmabuf_private(dmabuf);
+ priv = dma_buf_get_drvdata(dmabuf, dev);
if (!priv) {
mutex_lock(&priv_lock);
- priv = nvmap_get_dmabuf_private(dmabuf);
+ priv = dma_buf_get_drvdata(dmabuf, dev);
if (priv)
goto priv_exist_or_err;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
goto priv_exist_or_err;
}
mutex_init(&priv->lock);
- nvmap_set_dmabuf_private(dmabuf, priv, delete_priv);
+ dma_buf_set_drvdata(dmabuf, dev, priv, delete_priv);
priv_exist_or_err:
mutex_unlock(&priv_lock);
}
struct device *dev, struct sg_table *sgt)
{
struct dma_buf *dmabuf = (struct dma_buf *)handle;
- struct nvhost_nvmap_data *priv = nvmap_get_dmabuf_private(dmabuf);
+ struct nvhost_nvmap_data *priv =
+ dma_buf_get_drvdata(dmabuf, dev);
struct nvhost_nvmap_as_data *as_priv;
dma_addr_t dma_addr;
param, result);
}
-void nvhost_nvmap_get_comptags(struct mem_handle *mem,
+void nvhost_nvmap_get_comptags(struct device *dev,
+ struct mem_handle *mem,
struct nvhost_comptags *comptags)
{
struct nvhost_nvmap_data *priv;
- priv = nvmap_get_dmabuf_private((struct dma_buf *)mem);
+ priv = dma_buf_get_drvdata((struct dma_buf *)mem, dev);
- BUG_ON(!priv || !comptags);
+ BUG_ON(!comptags);
+
+ if (!priv) {
+ comptags->lines = 0;
+ comptags->offset = 0;
+ return;
+ }
*comptags = priv->comptags;
}
-int nvhost_nvmap_alloc_comptags(struct mem_handle *mem,
+int nvhost_nvmap_alloc_comptags(struct device *dev,
+ struct mem_handle *mem,
struct nvhost_allocator *allocator,
int lines)
{
u32 offset = 0;
struct nvhost_nvmap_data *priv;
- priv = nvmap_get_dmabuf_private((struct dma_buf *)mem);
+ priv = dma_buf_get_drvdata((struct dma_buf *)mem, dev);
+
+ if (!priv)
+ return -ENOSYS;
- BUG_ON(!priv);
BUG_ON(!lines);
/* store the allocator so we can use it when we free the ctags */
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 mem_handle *mem,
+void nvhost_nvmap_get_comptags(struct device *dev, struct mem_handle *mem,
struct nvhost_comptags *comptags);
-int nvhost_nvmap_alloc_comptags(struct mem_handle *mem,
+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);