static void ion_iommu_force_unmap(struct ion_buffer *buffer);
#endif
#ifdef CONFIG_ION_ROCKCHIP_SNAPSHOT
-extern char *rockchip_ion_snapshot_get(size_t *size);
+extern char *rockchip_ion_snapshot_get(unsigned *size);
extern int rockchip_ion_snapshot_debugfs(struct dentry* root);
static int ion_snapshot_save(struct ion_device *idev, size_t len);
#endif
void ion_buffer_destroy(struct ion_buffer *buffer)
{
- trace_ion_buffer_destroy("", (void*)buffer, buffer->size);
+ trace_ion_buffer_destroy("", (unsigned int)buffer, buffer->size);
if (WARN_ON(buffer->kmap_cnt > 0))
buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
handle = ERR_PTR(ret);
}
- trace_ion_buffer_alloc(client->display_name, (void*)buffer,
+ trace_ion_buffer_alloc(client->display_name, (unsigned int)buffer,
buffer->size);
return handle;
return;
}
mutex_unlock(&client->lock);
- trace_ion_buffer_free(client->display_name, (void*)handle->buffer,
+ trace_ion_buffer_free(client->display_name, (unsigned int)handle->buffer,
handle->buffer->size);
ion_handle_put(handle);
}
vaddr = ion_handle_kmap_get(handle);
mutex_unlock(&buffer->lock);
mutex_unlock(&client->lock);
- trace_ion_kernel_map(client->display_name, (void*)buffer,
- buffer->size, (void*)vaddr);
+ trace_ion_kernel_map(client->display_name, (unsigned int)buffer,
+ buffer->size, (unsigned int)vaddr);
return vaddr;
}
EXPORT_SYMBOL(ion_map_kernel);
mutex_lock(&client->lock);
buffer = handle->buffer;
mutex_lock(&buffer->lock);
- trace_ion_kernel_unmap(client->display_name, (void*)buffer,
+ trace_ion_kernel_unmap(client->display_name, (unsigned int)buffer,
buffer->size);
ion_handle_kmap_put(handle);
mutex_unlock(&buffer->lock);
} else if (iommu->key > entry->key) {
p = &(*p)->rb_right;
} else {
- pr_err("%s: buffer %p already has mapping for domainid %lx\n",
+ pr_err("%s: buffer %p already has mapping for domainid %x\n",
__func__,
buffer,
iommu->key);
}
static struct ion_iommu_map *ion_iommu_lookup(struct ion_buffer *buffer,
- unsigned long key)
+ uint32_t key)
{
struct rb_node **p = &buffer->iommu_maps.rb_node;
struct rb_node *parent = NULL;
return ERR_PTR(-ENOMEM);
data->buffer = buffer;
- data->key = (unsigned long)iommu_dev;
+ data->key = (uint32_t)iommu_dev;
ret = buffer->heap->ops->map_iommu(buffer, iommu_dev, data,
buffer->size, buffer->flags);
}
if (buffer->size & ~PAGE_MASK) {
- pr_debug("%s: buffer size %zu is not aligned to %lx", __func__,
+ pr_debug("%s: buffer size %x is not aligned to %lx", __func__,
buffer->size, PAGE_SIZE);
ret = -EINVAL;
goto out;
}
- iommu_map = ion_iommu_lookup(buffer, (unsigned long)iommu_dev);
+ iommu_map = ion_iommu_lookup(buffer, (uint32_t)iommu_dev);
if (!iommu_map) {
pr_debug("%s: create new map for buffer(%p)\n", __func__, buffer);
iommu_map = __ion_iommu_map(buffer, iommu_dev, iova);
pr_debug("%s: buffer(%p) already mapped\n", __func__, buffer);
if (iommu_map->mapped_size != buffer->size) {
pr_err("%s: handle %p is already mapped with length"
- " %d, trying to map with length %zu\n",
+ " %x, trying to map with length %x\n",
__func__, handle, iommu_map->mapped_size, buffer->size);
ret = -EINVAL;
} else {
if (!ret)
buffer->iommu_map_cnt++;
*size = buffer->size;
- trace_ion_iommu_map(client->display_name, (void*)buffer, buffer->size,
+ trace_ion_iommu_map(client->display_name, (unsigned int)buffer, buffer->size,
dev_name(iommu_dev), *iova, *size, buffer->iommu_map_cnt);
out:
mutex_unlock(&buffer->lock);
ref);
struct ion_buffer *buffer = map->buffer;
- trace_ion_iommu_release("", (void*)buffer, buffer->size,
+ trace_ion_iommu_release("", (unsigned int)buffer, buffer->size,
"", map->iova_addr, map->mapped_size, buffer->iommu_map_cnt);
rb_erase(&map->node, &buffer->iommu_maps);
mutex_lock(&buffer->lock);
- iommu_map = ion_iommu_lookup(buffer, (unsigned long)iommu_dev);
+ iommu_map = ion_iommu_lookup(buffer, (uint32_t)iommu_dev);
if (!iommu_map) {
WARN(1, "%s: (%p) was never mapped for %p\n", __func__,
buffer->iommu_map_cnt--;
- trace_ion_iommu_unmap(client->display_name, (void*)buffer, buffer->size,
+ trace_ion_iommu_unmap(client->display_name, (unsigned int)buffer, buffer->size,
dev_name(iommu_dev), iommu_map->iova_addr,
iommu_map->mapped_size, buffer->iommu_map_cnt);
out:
while (node != NULL) {
iommu_map = rb_entry(node, struct ion_iommu_map, node);
seq_printf(s, "%16.16s: 0x%08lx 0x%08x 0x%08x %8zuKB %4d\n",
- "<iommu>", iommu_map->iova_addr, 0, 0,
- (size_t)iommu_map->mapped_size>>10,
+ "<iommu>", iommu_map->iova_addr, 0, 0, iommu_map->mapped_size>>10,
atomic_read(&iommu_map->ref.refcount));
node = rb_next(node);
if (fd < 0)
dma_buf_put(dmabuf);
- trace_ion_buffer_share(client->display_name, (void*)handle->buffer,
+ trace_ion_buffer_share(client->display_name, (unsigned int)handle->buffer,
handle->buffer->size, fd);
return fd;
}
handle = ERR_PTR(ret);
}
- trace_ion_buffer_import(client->display_name, (void*)buffer,
+ trace_ion_buffer_import(client->display_name, (unsigned int)buffer,
buffer->size);
end:
dma_buf_put(dmabuf);
seq_printf(s, "%s Heap bitmap:\n", heap->name);
for(i = rows - 1; i>= 0; i--){
- seq_printf(s, "%.4uM@0x%lx: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
- i+1, (unsigned long)base+(i)*SZ_1M,
+ seq_printf(s, "%.4uM@0x%08x: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+ i+1, base+(i)*SZ_1M,
cma->bitmap[i*8 + 7],
cma->bitmap[i*8 + 6],
cma->bitmap[i*8 + 5],
cma->bitmap[i*8 + 1],
cma->bitmap[i*8]);
}
- seq_printf(s, "Heap size: %luM, Heap base: 0x%lx\n",
- (cma->count)>>8, (unsigned long)base);
+ seq_printf(s, "Heap size: %luM, Heap base: 0x%08x\n",
+ (cma->count)>>8, base);
return 0;
}
}
memset(seqf.buf, 0, seqf.size);
seqf.count = 0;
- pr_debug("%s: save snapshot 0x%zx@0x%lx\n", __func__, seqf.size,
- (unsigned long)__pa(seqf.buf));
+ pr_debug("%s: save snapshot 0x%x@0x%lx\n", __func__, seqf.size,
+ __pa(seqf.buf));
- seq_printf(&seqf, "call by comm: %s pid: %d, alloc: %zuKB\n",
+ seq_printf(&seqf, "call by comm: %s pid: %d, alloc: %uKB\n",
current->comm, current->pid, len>>10);
down_read(&idev->lock);
page = pfn_to_page(PFN_DOWN(heap_data->base));
size = heap_data->size;
- printk("%s: %zx@%lx\n", __func__, size, heap_data->base);
+ printk("%s: %x@%lx\n", __func__, size, heap_data->base);
ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL);
struct ion_cma_buffer_info *info = buffer->priv_virt;
data->iova_addr = rockchip_iovmm_map(iommu_dev, info->table->sgl, 0, iova_length);
- pr_debug("%s: map %lx -> %lx\n", __func__, (unsigned long)info->table->sgl->dma_address,
+ pr_debug("%s: map %x -> %lx\n", __func__, info->table->sgl->dma_address,
data->iova_addr);
if (IS_ERR_VALUE(data->iova_addr)) {
pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__, data->iova_addr);
struct sg_table *table = (struct sg_table*)buffer->priv_virt;
data->iova_addr = rockchip_iovmm_map(iommu_dev, table->sgl, 0, iova_length);
- pr_debug("%s: map %lx -> %lx\n", __func__, (unsigned long)table->sgl->dma_address,
+ pr_debug("%s: map %x -> %lx\n", __func__, table->sgl->dma_address,
data->iova_addr);
if (IS_ERR_VALUE(data->iova_addr)) {
pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__,
page = pfn_to_page(PFN_DOWN(heap_data->base));
size = heap_data->size;
- printk("%s: %zx@%lx\n", __func__, size, heap_data->base);
+ printk("%s: %x@%lx\n", __func__, size, heap_data->base);
ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL);
struct ion_iommu_map {
unsigned long iova_addr;
struct rb_node node;
- unsigned long key;
+ uint32_t key;
struct ion_buffer *buffer;
struct kref ref;
int mapped_size;
struct sg_table *table = (struct sg_table*)buffer->priv_virt;
data->iova_addr = rockchip_iovmm_map(iommu_dev, table->sgl, 0, iova_length);
- pr_debug("%s: map %lx -> %lx\n", __func__, (unsigned long)table->sgl->dma_address, data->iova_addr);
+ pr_debug("%s: map %x -> %lx\n", __func__, table->sgl->dma_address, data->iova_addr);
if (IS_ERR_VALUE(data->iova_addr)) {
pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__, data->iova_addr);
ret = data->iova_addr;
if (IS_ERR(dmabuf))
return PTR_ERR(dmabuf);
- data.id = (unsigned long)dmabuf;
+ data.id = (unsigned int)dmabuf;
// dma_buf_put(dmabuf);
if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_share_id_data)))
heap->align = be32_to_cpu(prop[2]);
}
- pr_info("ion heap(%s): base(%lx) size(%zx) align(%lx)\n", heap->name,
+ pr_info("ion heap(%s): base(%lx) size(%x) align(%lx)\n", heap->name,
heap->base, heap->size, heap->align);
return 0;
}
.read = ion_snapshot_read,
};
-char *rockchip_ion_snapshot_get(size_t *size)
+char *rockchip_ion_snapshot_get(unsigned *size)
{
*size = LOG_BUF_LEN;
return ion_snapshot_buf;
ion_snapshot_buf = last_ion_vmap(virt_to_phys(log_buf), 1 << LOG_BUF_PAGE_ORDER);
if (!ion_snapshot_buf) {
- pr_err("failed to map %d pages at 0x%lx\n", 1 << LOG_BUF_PAGE_ORDER,
- (unsigned long)virt_to_phys(log_buf));
+ pr_err("failed to map %d pages at 0x%08x\n", 1 << LOG_BUF_PAGE_ORDER, virt_to_phys(log_buf));
return 0;
}
- pr_info("0x%lx map to 0x%p and copy to 0x%p (version 0.1)\n",
- (unsigned long)virt_to_phys(log_buf), ion_snapshot_buf,
- last_ion_buf);
+ pr_info("0x%08x map to 0x%p and copy to 0x%p (version 0.1)\n",
+ virt_to_phys(log_buf), ion_snapshot_buf, last_ion_buf);
memcpy(last_ion_buf, ion_snapshot_buf, LOG_BUF_LEN);
memset(ion_snapshot_buf, 0, LOG_BUF_LEN);
#include <linux/tracepoint.h>
DECLARE_EVENT_CLASS(ion_buffer_op,
- TP_PROTO(const char* client, void* buf, unsigned int size),
+ TP_PROTO(const char* client, unsigned int buf, unsigned int size),
TP_ARGS(client, buf, size),
TP_STRUCT__entry(
__string(client, client)
- __field(void*, buf)
+ __field(unsigned int, buf)
__field(unsigned int, size)
),
TP_fast_assign(
__entry->buf = buf;
__entry->size = size;
),
- TP_printk("client=%s,buffer=%p:%d",
+ TP_printk("client=%s,buffer=%08x:%d",
__get_str(client), __entry->buf, __entry->size)
);
DEFINE_EVENT(ion_buffer_op, ion_buffer_alloc,
- TP_PROTO(const char* client, void* buffer, unsigned int size),
+ TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_buffer_free,
- TP_PROTO(const char* client, void* buffer, unsigned int size),
+ TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_buffer_import,
- TP_PROTO(const char* client, void* buffer, unsigned int size),
+ TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_buffer_destroy,
- TP_PROTO(const char* client, void* buffer, unsigned int size),
+ TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_kernel_unmap,
- TP_PROTO(const char* client, void* buffer, unsigned int size),
+ TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_ARGS(client, buffer, size));
TRACE_EVENT(ion_buffer_share,
- TP_PROTO(const char* client, void* buf, unsigned int size, int fd),
+ TP_PROTO(const char* client, unsigned int buf, unsigned int size, int fd),
TP_ARGS(client, buf, size, fd),
TP_STRUCT__entry(
__string(client, client)
- __field(void*, buf)
+ __field(unsigned int, buf)
__field(unsigned int, size)
__field(int, fd)
),
__entry->size = size;
__entry->fd = fd;
),
- TP_printk("client=%s,buffer=%p:%d,fd=%d",
+ TP_printk("client=%s,buffer=%08x:%d,fd=%d",
__get_str(client), __entry->buf, __entry->size, __entry->fd)
);
TP_ARGS(client));
DECLARE_EVENT_CLASS(ion_iommu_op,
- TP_PROTO(const char* client, void* buf, unsigned int size,
+ TP_PROTO(const char* client, unsigned int buf, unsigned int size,
const char* iommu_dev, unsigned int iommu_addr,
unsigned int iommu_size, unsigned int map_cnt),
TP_ARGS(client, buf, size, iommu_dev, iommu_addr, iommu_size, map_cnt),
TP_STRUCT__entry(
__string(client, client)
- __field(void*, buf)
+ __field(unsigned int, buf)
__field(unsigned int, size)
__string(iommu_dev, iommu_dev)
__field(unsigned int, iommu_addr)
__entry->iommu_size = iommu_size;
__entry->map_cnt = map_cnt;
),
- TP_printk("client=%s,buffer=%p:%d,iommu=%s,map=%08x:%d,map_count=%d",
+ TP_printk("client=%s,buffer=%08x:%d,iommu=%s,map=%08x:%d,map_count=%d",
__get_str(client), __entry->buf, __entry->size,
__get_str(iommu_dev), __entry->iommu_addr, __entry->iommu_size,
__entry->map_cnt)
);
DEFINE_EVENT(ion_iommu_op, ion_iommu_map,
- TP_PROTO(const char* client, void* buf, unsigned int size,
+ TP_PROTO(const char* client, unsigned int buf, unsigned int size,
const char* iommu_dev, unsigned int iommu_addr,
unsigned int iommu_size, unsigned int map_cnt),
TP_ARGS(client, buf, size, iommu_dev, iommu_addr, iommu_size, map_cnt));
DEFINE_EVENT(ion_iommu_op, ion_iommu_unmap,
- TP_PROTO(const char* client, void* buf, unsigned int size,
+ TP_PROTO(const char* client, unsigned int buf, unsigned int size,
const char* iommu_dev, unsigned int iommu_addr,
unsigned int iommu_size, unsigned int map_cnt),
TP_ARGS(client, buf, size, iommu_dev, iommu_addr, iommu_size, map_cnt));
DEFINE_EVENT(ion_iommu_op, ion_iommu_release,
- TP_PROTO(const char* client, void* buf, unsigned int size,
+ TP_PROTO(const char* client, unsigned int buf, unsigned int size,
const char* iommu_dev, unsigned int iommu_addr,
unsigned int iommu_size, unsigned int map_cnt),
TP_ARGS(client, buf, size, iommu_dev, iommu_addr, iommu_size, map_cnt));
DECLARE_EVENT_CLASS(ion_kmap_op,
- TP_PROTO(const char* client, void* buf, unsigned int size, void* kaddr),
+ TP_PROTO(const char* client, unsigned int buf, unsigned int size, unsigned int kaddr),
TP_ARGS(client, buf, size, kaddr),
TP_STRUCT__entry(
__string(client, client)
- __field(void*, buf)
+ __field(unsigned int, buf)
__field(unsigned int, size)
- __field(void*, kaddr)
+ __field(unsigned int, kaddr)
),
TP_fast_assign(
__assign_str(client, client);
__entry->size = size;
__entry->kaddr = kaddr;
),
- TP_printk("client=%s,buffer=%p:%d,kaddr=%p",
+ TP_printk("client=%s,buffer=%08x:%d,kaddr=%08x",
__get_str(client), __entry->buf, __entry->size, __entry->kaddr)
);
DEFINE_EVENT(ion_kmap_op, ion_kernel_map,
- TP_PROTO(const char* client, void* buffer, unsigned int size, void* kaddr),
+ TP_PROTO(const char* client, unsigned int buffer, unsigned int size, unsigned int kaddr),
TP_ARGS(client, buffer, size, kaddr));
DECLARE_EVENT_CLASS(ion_mmap_op,
struct ion_share_id_data {
int fd;
- unsigned long id;
+ unsigned int id;
};
#define ION_IOC_ROCKCHIP_MAGIC 'R'