From patchwork Wed Dec 12 00:53:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Peethambaran X-Patchwork-Id: 13483 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7F60D23FE4 for ; Wed, 12 Dec 2012 00:53:32 +0000 (UTC) Received: from mail-ie0-f171.google.com (mail-ie0-f171.google.com [209.85.223.171]) by fiordland.canonical.com (Postfix) with ESMTP id F120BA18574 for ; Wed, 12 Dec 2012 00:53:31 +0000 (UTC) Received: by mail-ie0-f171.google.com with SMTP id 17so387995iea.16 for ; Tue, 11 Dec 2012 16:53:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:mime-version:date:message-id:from:to:subject :x-beenthere:x-mailman-version:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=GipRyw7FdyAqfE92Pf3ib3W1FkFBYk5giCMB3nHIA9w=; b=W7AcINKtNDs7QjjdTikVdwigkv5pV41QQ++5s+X1TBK5tDOz7fnhmpHv/5veefcNjJ 5BrXNA8fHwQCw+2AZk6fMDGm2jia0q8fXaURSRHcKO8q2WXVGVGczv9i5JKXhy8+CmTQ XpdK652PqYrgujVZLpFqAxD6kIophesHPZZZAbG0GwyfZvyrXokxvEBkZw79teI3cBEV JRqI5Ke5muq8rga/JJEB1ZXdczTdwLf8qyv40lMMBOaf0SYGyh2+dFcUTNHcMSX1F+ev jsotFcBmlTy8G42X02r/UGePlopNQrZIzsEvX7hpsYS29MvKbo3bc0EDfkccGyvhPlGX /EBA== Received: by 10.50.161.169 with SMTP id xt9mr11641500igb.62.1355273611423; Tue, 11 Dec 2012 16:53:31 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp167540igt; Tue, 11 Dec 2012 16:53:30 -0800 (PST) Received: by 10.14.198.67 with SMTP id u43mr109318een.7.1355273609615; Tue, 11 Dec 2012 16:53:29 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id k48si59026827een.110.2012.12.11.16.53.26; Tue, 11 Dec 2012 16:53:29 -0800 (PST) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TiaZg-0006MK-3e; Wed, 12 Dec 2012 00:53:24 +0000 Received: from mail-ie0-f169.google.com ([209.85.223.169]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TiaZd-0006Lu-Pu for linaro-mm-sig@lists.linaro.org; Wed, 12 Dec 2012 00:53:22 +0000 Received: by mail-ie0-f169.google.com with SMTP id c14so364821ieb.14 for ; Tue, 11 Dec 2012 16:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=l1kPCMu9DkEUzvQreJ1wZRQ4kJaHdCjSDcznIc/l/W8=; b=g6XFI7r2Bvv2ThnTHrUbjMXwbcBZBZqaVlBaexh2DSqa1bLuNC9CkO1VJcHhU1a78q wS4QiAoCRkKC3b5A/zUvuGveuFNNG8M/OE3Hlsg1JIxgM9RxNx2wAVdh1RKrKXlm/Zj6 PjqdCh3Z0/ugqxUU5Dml4swBS7zKNBiZb3EjnU1nfcLUQCq+vJ+mqjQ55ed60rj8CYfr k1IyU4TaOgc0avrzU4mPVfHoofK3aj1O8EDBivoBE8WBB44gsyFn5nR02gWF/6OR2Wo4 XZJxJ0Pdivcws9fLVuq7927X6GLSiLwf8/h7DSsvPWIOK8Ia0Ihr7w+2OTFgsdgHBkI9 dIhQ== MIME-Version: 1.0 Received: by 10.50.219.233 with SMTP id pr9mr12012688igc.19.1355273600833; Tue, 11 Dec 2012 16:53:20 -0800 (PST) Received: by 10.64.34.170 with HTTP; Tue, 11 Dec 2012 16:53:20 -0800 (PST) Date: Wed, 12 Dec 2012 06:23:20 +0530 Message-ID: From: Nishanth Peethambaran To: linaro-mm-sig@lists.linaro.org, Rebecca Zavin Subject: [Linaro-mm-sig] [PATCH] gpu: ion: Use heap->id as the identifier instead of heap->type X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQl2vMv/JSJi4GbQVSD1tyx8/BhAmyfxM0BW/dNBgWMvAc2WIT8CtF8TDAbeGhdJIGO5Bynr The heap mask used during client create was a bitmask of heap types and the heap mask used during buffer allocation was a bitmask of heap ids. Now, both of them assume a bitmask of heap ids. The debugfs show functions for client and heap were showing info for the heap type instead of showing info of the individual heap. Change-Id: I9c2c142a63865f3d4250cd681dc5cde9638ca09f Signed-off-by: Nishanth Peethambaran --- drivers/gpu/ion/ion.c | 26 +++++++++++++------------- include/linux/ion.h | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) * to this allocation diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 6aa817a..b808972 100644 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -62,7 +62,7 @@ struct ion_device { * @dev: backpointer to ion device * @handles: an rb tree of all the handles in this client * @lock: lock protecting the tree of handles - * @heap_mask: mask of all supported heaps + * @heap_mask: mask of all supported heap ids * @name: used for debugging * @task: used for debugging * @@ -398,7 +398,7 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len, align, heap_mask, flags); /* * traverse the list of heaps available in this system in priority - * order. If the heap type is supported by the client, and matches the + * order. If the heap id is supported by the client, and matches the * request of the caller allocate from it. Repeat until allocate has * succeeded or all heaps have been tried */ @@ -410,10 +410,10 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len, down_read(&dev->lock); for (n = rb_first(&dev->heaps); n != NULL; n = rb_next(n)) { struct ion_heap *heap = rb_entry(n, struct ion_heap, node); - /* if the client doesn't support this heap type */ - if (!((1 << heap->type) & client->heap_mask)) + /* if the client doesn't support this heap id */ + if (!((1 << heap->id) & client->heap_mask)) continue; - /* if the caller didn't specify this heap type */ + /* if the caller didn't specify this heap id */ if (!((1 << heap->id) & heap_mask)) continue; buffer = ion_buffer_create(heap, dev, len, align, flags); @@ -597,11 +597,11 @@ static int ion_debug_client_show(struct seq_file *s, void *unused) for (n = rb_first(&client->handles); n; n = rb_next(n)) { struct ion_handle *handle = rb_entry(n, struct ion_handle, node); - enum ion_heap_type type = handle->buffer->heap->type; + int id = handle->buffer->heap->id; - if (!names[type]) - names[type] = handle->buffer->heap->name; - sizes[type] += handle->buffer->size; + if (!names[id]) + names[id] = handle->buffer->heap->name; + sizes[id] += handle->buffer->size; } mutex_unlock(&client->lock); @@ -1176,7 +1176,7 @@ static const struct file_operations ion_fops = { }; static size_t ion_debug_heap_total(struct ion_client *client, - enum ion_heap_type type) + int id) { size_t size = 0; struct rb_node *n; @@ -1186,7 +1186,7 @@ static size_t ion_debug_heap_total(struct ion_client *client, struct ion_handle *handle = rb_entry(n, struct ion_handle, node); - if (handle->buffer->heap->type == type) + if (handle->buffer->heap->id == id) size += handle->buffer->size; } mutex_unlock(&client->lock); @@ -1207,7 +1207,7 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused) for (n = rb_first(&dev->clients); n; n = rb_next(n)) { struct ion_client *client = rb_entry(n, struct ion_client, node); - size_t size = ion_debug_heap_total(client, heap->type); + size_t size = ion_debug_heap_total(client, heap->id); if (!size) continue; if (client->task) { @@ -1228,7 +1228,7 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused) for (n = rb_first(&dev->buffers); n; n = rb_next(n)) { struct ion_buffer *buffer = rb_entry(n, struct ion_buffer, node); - if (buffer->heap->type != heap->type) + if (buffer->heap->id != heap->id) continue; total_size += buffer->size; if (!buffer->handle_count) { diff --git a/include/linux/ion.h b/include/linux/ion.h index a7d399c..f0399ae 100644 --- a/include/linux/ion.h +++ b/include/linux/ion.h @@ -72,7 +72,7 @@ struct ion_buffer; /** * struct ion_platform_heap - defines a heap in the given platform * @type: type of the heap from ion_heap_type enum - * @id: unique identifier for heap. When allocating (lower numbers + * @id: unique identifier for heap. When allocating (lower numbers * will be allocated from first) * @name: used for debug purposes * @base: base address of heap in physical memory if applicable @@ -114,7 +114,7 @@ void ion_reserve(struct ion_platform_data *data); /** * ion_client_create() - allocate a client and returns it * @dev: the global ion device - * @heap_mask: mask of heaps this client can allocate from + * @heap_mask: mask of heap ids this client can allocate from * @name: used for debugging */ struct ion_client *ion_client_create(struct ion_device *dev, @@ -135,7 +135,7 @@ void ion_client_destroy(struct ion_client *client); * @len: size of the allocation * @align: requested allocation alignment, lots of hardware blocks have * alignment requirements of some kind - * @heap_mask: mask of heaps to allocate from, if multiple bits are set + * @heap_mask: mask of heap ids to allocate from, if multiple bits are set * heaps will be tried in order from lowest to highest order bit * @flags: heap flags, the low 16 bits are consumed by ion, the high 16 * bits are passed on to the respective heap and can be heap @@ -236,7 +236,7 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd); * struct ion_allocation_data - metadata passed from userspace for allocations * @len: size of the allocation * @align: required alignment of the allocation - * @heap_mask: mask of heaps to allocate from + * @heap_mask: mask of heap ids to allocate from * @flags: flags passed to heap * @handle: pointer that will be populated with a cookie to use to refer