rk: ion: revise client debug info

This commit is contained in:
CMY
2014-04-09 15:48:17 +08:00
parent ade9cca99e
commit d307ec0171

View File

@@ -891,53 +891,55 @@ out:
mutex_unlock(&client->lock);
}
EXPORT_SYMBOL(ion_unmap_iommu);
#endif
static int ion_debug_client_show_buffer_map(struct seq_file *s, struct ion_buffer *buffer)
{
struct ion_iommu_map *iommu_map;
struct rb_node *node;
const struct rb_root *rb = &(buffer->iommu_maps);
struct rb_node *node = rb_first(rb);
pr_debug("%s: (%p)\n", __func__, buffer);
pr_debug("%s: buffer(%p)\n", __func__, buffer);
mutex_lock(&buffer->lock);
while ((node = rb_first(rb)) != 0) {
while (node != NULL) {
iommu_map = rb_entry(node, struct ion_iommu_map, node);
/* set ref count to 1 to force release */
seq_printf(s, "\t%08x@%08lx : %d\n", iommu_map->mapped_size,
iommu_map->iova_addr,
atomic_read(&iommu_map->ref.refcount));
seq_printf(s, "%16.16s: 0x%08lx 0x%08lx %8zuKB %4d\n",
"<iommu>", iommu_map->iova_addr, 0, iommu_map->mapped_size>>10,
atomic_read(&iommu_map->ref.refcount));
node = rb_next(node);
}
mutex_unlock(&buffer->lock);
return 0;
}
#endif
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");
seq_printf(s, "%16.s: %12.s %8.s %4.s %4.s %4.s\n", "heap_name", "addr",
seq_printf(s, "%16.s: %12.s %12.s %10.s %4.s %4.s %4.s\n", "heap_name", "VA", "PA",
"size", "HC", "IBR", "IHR");
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 %4d %4d %4d\n",
buffer->heap->name, addr, len>>10, buffer->handle_count,
atomic_read(&buffer->ref.refcount),
atomic_read(&handle->ref.refcount));
}
ion_phys_addr_t pa = 0;
size_t len = buffer->size;
if (buffer->heap->ops->phys)
buffer->heap->ops->phys(buffer->heap, buffer, &pa, &len);
seq_printf(s, "%16.16s: 0x%08lx 0x%08lx %8zuKB %4d %4d %4d\n",
buffer->heap->name, buffer->vaddr, pa, len>>10, buffer->handle_count,
atomic_read(&buffer->ref.refcount), atomic_read(&handle->ref.refcount));
#ifdef CONFIG_ROCKCHIP_IOMMU
ion_debug_client_show_buffer_map(s, buffer);
#endif
}
mutex_unlock(&client->lock);