rk: ion: fix compilation error on arm64

Conflicts:

	drivers/staging/android/ion/rockchip/rockchip_ion.c
	include/linux/rockchip_ion.h
This commit is contained in:
CMY
2014-10-24 14:12:22 +08:00
parent 72dca47db4
commit ee0b7b6a50
9 changed files with 63 additions and 60 deletions

View File

@@ -123,7 +123,7 @@ struct ion_handle {
static void ion_iommu_force_unmap(struct ion_buffer *buffer);
#endif
#ifdef CONFIG_ION_ROCKCHIP_SNAPSHOT
extern char *rockchip_ion_snapshot_get(unsigned *size);
extern char *rockchip_ion_snapshot_get(size_t *size);
extern int rockchip_ion_snapshot_debugfs(struct dentry* root);
static int ion_snapshot_save(struct ion_device *idev, size_t len);
#endif
@@ -285,7 +285,7 @@ err2:
void ion_buffer_destroy(struct ion_buffer *buffer)
{
trace_ion_buffer_destroy("", (unsigned int)buffer, buffer->size);
trace_ion_buffer_destroy("", (void*)buffer, buffer->size);
if (WARN_ON(buffer->kmap_cnt > 0))
buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
@@ -551,7 +551,7 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
handle = ERR_PTR(ret);
}
trace_ion_buffer_alloc(client->display_name, (unsigned int)buffer,
trace_ion_buffer_alloc(client->display_name, (void*)buffer,
buffer->size);
return handle;
@@ -573,7 +573,7 @@ void ion_free(struct ion_client *client, struct ion_handle *handle)
return;
}
mutex_unlock(&client->lock);
trace_ion_buffer_free(client->display_name, (unsigned int)handle->buffer,
trace_ion_buffer_free(client->display_name, (void*)handle->buffer,
handle->buffer->size);
ion_handle_put(handle);
}
@@ -684,8 +684,8 @@ void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle)
vaddr = ion_handle_kmap_get(handle);
mutex_unlock(&buffer->lock);
mutex_unlock(&client->lock);
trace_ion_kernel_map(client->display_name, (unsigned int)buffer,
buffer->size, (unsigned int)vaddr);
trace_ion_kernel_map(client->display_name, (void*)buffer,
buffer->size, (void*)vaddr);
return vaddr;
}
EXPORT_SYMBOL(ion_map_kernel);
@@ -697,7 +697,7 @@ void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle)
mutex_lock(&client->lock);
buffer = handle->buffer;
mutex_lock(&buffer->lock);
trace_ion_kernel_unmap(client->display_name, (unsigned int)buffer,
trace_ion_kernel_unmap(client->display_name, (void*)buffer,
buffer->size);
ion_handle_kmap_put(handle);
mutex_unlock(&buffer->lock);
@@ -722,7 +722,7 @@ static void ion_iommu_add(struct ion_buffer *buffer,
} else if (iommu->key > entry->key) {
p = &(*p)->rb_right;
} else {
pr_err("%s: buffer %p already has mapping for domainid %x\n",
pr_err("%s: buffer %p already has mapping for domainid %lx\n",
__func__,
buffer,
iommu->key);
@@ -735,7 +735,7 @@ static void ion_iommu_add(struct ion_buffer *buffer,
}
static struct ion_iommu_map *ion_iommu_lookup(struct ion_buffer *buffer,
uint32_t key)
unsigned long key)
{
struct rb_node **p = &buffer->iommu_maps.rb_node;
struct rb_node *parent = NULL;
@@ -768,7 +768,7 @@ static struct ion_iommu_map *__ion_iommu_map(struct ion_buffer *buffer,
return ERR_PTR(-ENOMEM);
data->buffer = buffer;
data->key = (uint32_t)iommu_dev;
data->key = (unsigned long)iommu_dev;
ret = buffer->heap->ops->map_iommu(buffer, iommu_dev, data,
buffer->size, buffer->flags);
@@ -821,13 +821,13 @@ int ion_map_iommu(struct device *iommu_dev, struct ion_client *client,
}
if (buffer->size & ~PAGE_MASK) {
pr_debug("%s: buffer size %x is not aligned to %lx", __func__,
pr_debug("%s: buffer size %zu is not aligned to %lx", __func__,
buffer->size, PAGE_SIZE);
ret = -EINVAL;
goto out;
}
iommu_map = ion_iommu_lookup(buffer, (uint32_t)iommu_dev);
iommu_map = ion_iommu_lookup(buffer, (unsigned long)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);
@@ -837,7 +837,7 @@ int ion_map_iommu(struct device *iommu_dev, struct ion_client *client,
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"
" %x, trying to map with length %x\n",
" %d, trying to map with length %zu\n",
__func__, handle, iommu_map->mapped_size, buffer->size);
ret = -EINVAL;
} else {
@@ -848,7 +848,7 @@ int ion_map_iommu(struct device *iommu_dev, struct ion_client *client,
if (!ret)
buffer->iommu_map_cnt++;
*size = buffer->size;
trace_ion_iommu_map(client->display_name, (unsigned int)buffer, buffer->size,
trace_ion_iommu_map(client->display_name, (void*)buffer, buffer->size,
dev_name(iommu_dev), *iova, *size, buffer->iommu_map_cnt);
out:
mutex_unlock(&buffer->lock);
@@ -863,7 +863,7 @@ static void ion_iommu_release(struct kref *kref)
ref);
struct ion_buffer *buffer = map->buffer;
trace_ion_iommu_release("", (unsigned int)buffer, buffer->size,
trace_ion_iommu_release("", (void*)buffer, buffer->size,
"", map->iova_addr, map->mapped_size, buffer->iommu_map_cnt);
rb_erase(&map->node, &buffer->iommu_maps);
@@ -906,7 +906,7 @@ void ion_unmap_iommu(struct device *iommu_dev, struct ion_client *client,
mutex_lock(&buffer->lock);
iommu_map = ion_iommu_lookup(buffer, (uint32_t)iommu_dev);
iommu_map = ion_iommu_lookup(buffer, (unsigned long)iommu_dev);
if (!iommu_map) {
WARN(1, "%s: (%p) was never mapped for %p\n", __func__,
@@ -918,7 +918,7 @@ void ion_unmap_iommu(struct device *iommu_dev, struct ion_client *client,
buffer->iommu_map_cnt--;
trace_ion_iommu_unmap(client->display_name, (unsigned int)buffer, buffer->size,
trace_ion_iommu_unmap(client->display_name, (void*)buffer, buffer->size,
dev_name(iommu_dev), iommu_map->iova_addr,
iommu_map->mapped_size, buffer->iommu_map_cnt);
out:
@@ -942,7 +942,8 @@ static int ion_debug_client_show_buffer_map(struct seq_file *s, struct ion_buffe
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, iommu_map->mapped_size>>10,
"<iommu>", iommu_map->iova_addr, 0, 0,
(size_t)iommu_map->mapped_size>>10,
atomic_read(&iommu_map->ref.refcount));
node = rb_next(node);
@@ -1481,7 +1482,7 @@ int ion_share_dma_buf_fd(struct ion_client *client, struct ion_handle *handle)
if (fd < 0)
dma_buf_put(dmabuf);
trace_ion_buffer_share(client->display_name, (unsigned int)handle->buffer,
trace_ion_buffer_share(client->display_name, (void*)handle->buffer,
handle->buffer->size, fd);
return fd;
}
@@ -1529,7 +1530,7 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd)
handle = ERR_PTR(ret);
}
trace_ion_buffer_import(client->display_name, (unsigned int)buffer,
trace_ion_buffer_import(client->display_name, (void*)buffer,
buffer->size);
end:
dma_buf_put(dmabuf);
@@ -1870,8 +1871,8 @@ static int ion_cma_heap_debug_show(struct seq_file *s, void *unused)
seq_printf(s, "%s Heap bitmap:\n", heap->name);
for(i = rows - 1; i>= 0; i--){
seq_printf(s, "%.4uM@0x%08x: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
i+1, base+(i)*SZ_1M,
seq_printf(s, "%.4uM@0x%lx: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
i+1, (unsigned long)base+(i)*SZ_1M,
cma->bitmap[i*8 + 7],
cma->bitmap[i*8 + 6],
cma->bitmap[i*8 + 5],
@@ -1881,8 +1882,8 @@ static int ion_cma_heap_debug_show(struct seq_file *s, void *unused)
cma->bitmap[i*8 + 1],
cma->bitmap[i*8]);
}
seq_printf(s, "Heap size: %luM, Heap base: 0x%08x\n",
(cma->count)>>8, base);
seq_printf(s, "Heap size: %luM, Heap base: 0x%lx\n",
(cma->count)>>8, (unsigned long)base);
return 0;
}
@@ -2112,10 +2113,10 @@ static int ion_snapshot_save(struct ion_device *idev, size_t len)
}
memset(seqf.buf, 0, seqf.size);
seqf.count = 0;
pr_debug("%s: save snapshot 0x%x@0x%lx\n", __func__, seqf.size,
__pa(seqf.buf));
pr_debug("%s: save snapshot 0x%zx@0x%lx\n", __func__, seqf.size,
(unsigned long)__pa(seqf.buf));
seq_printf(&seqf, "call by comm: %s pid: %d, alloc: %uKB\n",
seq_printf(&seqf, "call by comm: %s pid: %d, alloc: %zuKB\n",
current->comm, current->pid, len>>10);
down_read(&idev->lock);

View File

@@ -158,7 +158,7 @@ struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data)
page = pfn_to_page(PFN_DOWN(heap_data->base));
size = heap_data->size;
printk("%s: %x@%lx\n", __func__, size, heap_data->base);
printk("%s: %zx@%lx\n", __func__, size, heap_data->base);
ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL);

View File

@@ -205,7 +205,7 @@ static int ion_cma_map_iommu(struct ion_buffer *buffer,
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 %x -> %lx\n", __func__, info->table->sgl->dma_address,
pr_debug("%s: map %lx -> %lx\n", __func__, (unsigned long)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);

View File

@@ -174,7 +174,7 @@ static int ion_drm_heap_map_iommu(struct ion_buffer *buffer,
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 %x -> %lx\n", __func__, table->sgl->dma_address,
pr_debug("%s: map %lx -> %lx\n", __func__, (unsigned long)table->sgl->dma_address,
data->iova_addr);
if (IS_ERR_VALUE(data->iova_addr)) {
pr_err("%s: rockchip_iovmm_map() failed: %lx\n", __func__,
@@ -226,7 +226,7 @@ struct ion_heap *ion_drm_heap_create(struct ion_platform_heap *heap_data)
page = pfn_to_page(PFN_DOWN(heap_data->base));
size = heap_data->size;
printk("%s: %x@%lx\n", __func__, size, heap_data->base);
printk("%s: %zx@%lx\n", __func__, size, heap_data->base);
ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL);

View File

@@ -49,7 +49,7 @@ struct ion_buffer *ion_handle_buffer(struct ion_handle *handle);
struct ion_iommu_map {
unsigned long iova_addr;
struct rb_node node;
uint32_t key;
unsigned long key;
struct ion_buffer *buffer;
struct kref ref;
int mapped_size;

View File

@@ -261,7 +261,7 @@ static int ion_system_map_iommu(struct ion_buffer *buffer,
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 %x -> %lx\n", __func__, table->sgl->dma_address, data->iova_addr);
pr_debug("%s: map %lx -> %lx\n", __func__, (unsigned long)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;

View File

@@ -248,7 +248,7 @@ int __init rockchip_ion_find_heap(unsigned long node, const char *uname,
heap->align = be32_to_cpu(prop[2]);
}
pr_info("ion heap(%s): base(%lx) size(%x) align(%lx)\n", heap->name,
pr_info("ion heap(%s): base(%lx) size(%zx) align(%lx)\n", heap->name,
heap->base, heap->size, heap->align);
return 0;
}

View File

@@ -68,7 +68,7 @@ static const struct file_operations ion_snapshot_fops = {
.read = ion_snapshot_read,
};
char *rockchip_ion_snapshot_get(unsigned *size)
char *rockchip_ion_snapshot_get(size_t *size)
{
*size = LOG_BUF_LEN;
return ion_snapshot_buf;
@@ -127,12 +127,14 @@ static int __init rockchip_ion_snapshot_init(void)
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%08x\n", 1 << LOG_BUF_PAGE_ORDER, virt_to_phys(log_buf));
pr_err("failed to map %d pages at 0x%lx\n", 1 << LOG_BUF_PAGE_ORDER,
(unsigned long)virt_to_phys(log_buf));
return 0;
}
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);
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);
memcpy(last_ion_buf, ion_snapshot_buf, LOG_BUF_LEN);
memset(ion_snapshot_buf, 0, LOG_BUF_LEN);

View File

@@ -8,11 +8,11 @@
#include <linux/tracepoint.h>
DECLARE_EVENT_CLASS(ion_buffer_op,
TP_PROTO(const char* client, unsigned int buf, unsigned int size),
TP_PROTO(const char* client, void* buf, unsigned int size),
TP_ARGS(client, buf, size),
TP_STRUCT__entry(
__string(client, client)
__field(unsigned int, buf)
__field(void*, buf)
__field(unsigned int, size)
),
TP_fast_assign(
@@ -20,35 +20,35 @@ DECLARE_EVENT_CLASS(ion_buffer_op,
__entry->buf = buf;
__entry->size = size;
),
TP_printk("client=%s,buffer=%08x:%d",
TP_printk("client=%s,buffer=%p:%d",
__get_str(client), __entry->buf, __entry->size)
);
DEFINE_EVENT(ion_buffer_op, ion_buffer_alloc,
TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_PROTO(const char* client, void* buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_buffer_free,
TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_PROTO(const char* client, void* buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_buffer_import,
TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_PROTO(const char* client, void* buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_buffer_destroy,
TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_PROTO(const char* client, void* buffer, unsigned int size),
TP_ARGS(client, buffer, size));
DEFINE_EVENT(ion_buffer_op, ion_kernel_unmap,
TP_PROTO(const char* client, unsigned int buffer, unsigned int size),
TP_PROTO(const char* client, void* buffer, unsigned int size),
TP_ARGS(client, buffer, size));
TRACE_EVENT(ion_buffer_share,
TP_PROTO(const char* client, unsigned int buf, unsigned int size, int fd),
TP_PROTO(const char* client, void* buf, unsigned int size, int fd),
TP_ARGS(client, buf, size, fd),
TP_STRUCT__entry(
__string(client, client)
__field(unsigned int, buf)
__field(void*, buf)
__field(unsigned int, size)
__field(int, fd)
),
@@ -58,7 +58,7 @@ TRACE_EVENT(ion_buffer_share,
__entry->size = size;
__entry->fd = fd;
),
TP_printk("client=%s,buffer=%08x:%d,fd=%d",
TP_printk("client=%s,buffer=%p:%d,fd=%d",
__get_str(client), __entry->buf, __entry->size, __entry->fd)
);
@@ -81,13 +81,13 @@ DEFINE_EVENT(ion_client_op, ion_client_destroy,
TP_ARGS(client));
DECLARE_EVENT_CLASS(ion_iommu_op,
TP_PROTO(const char* client, unsigned int buf, unsigned int size,
TP_PROTO(const char* client, void* 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(unsigned int, buf)
__field(void*, buf)
__field(unsigned int, size)
__string(iommu_dev, iommu_dev)
__field(unsigned int, iommu_addr)
@@ -103,35 +103,35 @@ DECLARE_EVENT_CLASS(ion_iommu_op,
__entry->iommu_size = iommu_size;
__entry->map_cnt = map_cnt;
),
TP_printk("client=%s,buffer=%08x:%d,iommu=%s,map=%08x:%d,map_count=%d",
TP_printk("client=%s,buffer=%p:%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, unsigned int buf, unsigned int size,
TP_PROTO(const char* client, void* 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, unsigned int buf, unsigned int size,
TP_PROTO(const char* client, void* 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, unsigned int buf, unsigned int size,
TP_PROTO(const char* client, void* 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, unsigned int buf, unsigned int size, unsigned int kaddr),
TP_PROTO(const char* client, void* buf, unsigned int size, void* kaddr),
TP_ARGS(client, buf, size, kaddr),
TP_STRUCT__entry(
__string(client, client)
__field(unsigned int, buf)
__field(void*, buf)
__field(unsigned int, size)
__field(unsigned int, kaddr)
__field(void*, kaddr)
),
TP_fast_assign(
__assign_str(client, client);
@@ -139,11 +139,11 @@ DECLARE_EVENT_CLASS(ion_kmap_op,
__entry->size = size;
__entry->kaddr = kaddr;
),
TP_printk("client=%s,buffer=%08x:%d,kaddr=%08x",
TP_printk("client=%s,buffer=%p:%d,kaddr=%p",
__get_str(client), __entry->buf, __entry->size, __entry->kaddr)
);
DEFINE_EVENT(ion_kmap_op, ion_kernel_map,
TP_PROTO(const char* client, unsigned int buffer, unsigned int size, unsigned int kaddr),
TP_PROTO(const char* client, void* buffer, unsigned int size, void* kaddr),
TP_ARGS(client, buffer, size, kaddr));
DECLARE_EVENT_CLASS(ion_mmap_op,