rk: ion: show client's buffer info

This commit is contained in:
CMY 2014-03-07 19:59:26 +08:00
parent a696dfc813
commit b4a4ee458f
2 changed files with 35 additions and 12 deletions

View File

@ -673,6 +673,29 @@ void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle)
}
EXPORT_SYMBOL(ion_unmap_kernel);
static int ion_debug_client_show_buffer(struct seq_file *s, void *unused)
{
struct ion_client *client = s->private;
struct rb_node *n;
ion_phys_addr_t addr;
size_t len;
seq_printf(s, "----------------------------------------------------\n");
mutex_lock(&client->lock);
for (n = rb_first(&client->handles); n; n = rb_next(n)) {
struct ion_handle *handle = rb_entry(n, struct ion_handle, node);
struct ion_buffer *buffer = handle->buffer;
if (buffer->heap->ops->phys) {
buffer->heap->ops->phys(buffer->heap, buffer, &addr, &len);
seq_printf(s, "%16.16s: 0x%08lX %8zuKB %d\n",
buffer->heap->name, addr, len>>10, buffer->handle_count);
}
}
mutex_unlock(&client->lock);
return 0;
}
static int ion_debug_client_show(struct seq_file *s, void *unused)
{
struct ion_client *client = s->private;
@ -699,6 +722,7 @@ static int ion_debug_client_show(struct seq_file *s, void *unused)
continue;
seq_printf(s, "%16.16s: %16zu\n", names[i], sizes[i]);
}
ion_debug_client_show_buffer(s, unused);
return 0;
}

View File

@ -145,7 +145,7 @@ static struct ion_platform_data *rockchip_ion_parse_dt(
// rockchip_ion_get_heap_adjacent(node, &pdata->heaps[idx]);
pdata->heaps[idx].priv = dev;
pr_info("%d: %d %d %s 0x%08X\n", idx, pdata->heaps[idx].type, pdata->heaps[idx].id, pdata->heaps[idx].name, pdata->heaps[idx].size);
pr_info("%d: %d %d %s 0x%p\n", idx, pdata->heaps[idx].type, pdata->heaps[idx].id, pdata->heaps[idx].name, pdata->heaps[idx].priv);
++idx;
}
@ -173,22 +173,20 @@ struct ion_cma_heap {
static int ion_cma_heap_debug_show(struct ion_heap *heap, struct seq_file *s,
void *unused)
{
struct ion_cma_heap *cma_heap = container_of(heap,
struct ion_cma_heap,
heap);
struct device *dev = cma_heap->dev;
struct cma *cma = dev_get_cma_area(dev);
unsigned long bit_nr;
int i;
int rows = cma->count/(SZ_1M >> PAGE_SHIFT);
phys_addr_t base = __pfn_to_phys(cma->base_pfn);
dev_dbg(dev, "%s: %p(%d,%d,%p)\n", __func__, cma, cma->base_pfn, cma->count, cma->bitmap);
seq_printf(s, "Heap bitmap:\n");
bit_nr = (cma->count/sizeof(unsigned long))>>3;
for(i = (bit_nr>>3) - 1; i>= 0; i--){
seq_printf(s, "%.3uM> Bits[%.3d - %.3d]: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
i+1, i*8 + 7, i*8,
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,
cma->bitmap[i*8 + 7],
cma->bitmap[i*8 + 6],
cma->bitmap[i*8 + 5],
@ -198,7 +196,8 @@ static int ion_cma_heap_debug_show(struct ion_heap *heap, struct seq_file *s,
cma->bitmap[i*8 + 1],
cma->bitmap[i*8]);
}
seq_printf(s, "Heap size: %luM, heap base: 0x%lx\n", (cma->count)>>8, cma->base_pfn);
seq_printf(s, "Heap size: %luM, Heap base: 0x%08X\n",
(cma->count)>>8, base);
return 0;
}
@ -212,7 +211,7 @@ EXPORT_SYMBOL(rockchip_ion_client_create);
static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
unsigned long arg)
{
pr_info("[%s %d] cmd=%X\n", __func__, __LINE__, cmd);
pr_debug("[%s %d] cmd=%X\n", __func__, __LINE__, cmd);
switch (cmd) {
case ION_IOC_CLEAN_CACHES:
@ -234,7 +233,7 @@ static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
return PTR_ERR(handle);
ret = ion_phys(client, handle, &data.phys, (size_t *)&data.size);
pr_info("ret=%d, phys=0x%X\n", ret, data.phys);
pr_debug("ret=%d, phys=0x%lX\n", ret, data.phys);
ion_handle_put(handle);
if(ret < 0)
return ret;