diff options
Diffstat (limited to 'mali_kbase/mali_kbase_trace_gpu_mem.c')
-rw-r--r-- | mali_kbase/mali_kbase_trace_gpu_mem.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/mali_kbase/mali_kbase_trace_gpu_mem.c b/mali_kbase/mali_kbase_trace_gpu_mem.c index 5f50749..15e1f6f 100644 --- a/mali_kbase/mali_kbase_trace_gpu_mem.c +++ b/mali_kbase/mali_kbase_trace_gpu_mem.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note /* * - * (C) COPYRIGHT 2020-2022 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2020-2023 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -54,8 +54,7 @@ struct kbase_dma_buf { * * Return: true on success. */ -static bool kbase_delete_dma_buf_mapping(struct kbase_context *kctx, - struct dma_buf *dma_buf, +static bool kbase_delete_dma_buf_mapping(struct kbase_context *kctx, struct dma_buf *dma_buf, struct rb_root *tree) { struct kbase_dma_buf *buf_node = NULL; @@ -105,8 +104,7 @@ static bool kbase_delete_dma_buf_mapping(struct kbase_context *kctx, * * Return: true on success */ -static bool kbase_capture_dma_buf_mapping(struct kbase_context *kctx, - struct dma_buf *dma_buf, +static bool kbase_capture_dma_buf_mapping(struct kbase_context *kctx, struct dma_buf *dma_buf, struct rb_root *root) { struct kbase_dma_buf *buf_node = NULL; @@ -130,8 +128,7 @@ static bool kbase_capture_dma_buf_mapping(struct kbase_context *kctx, } if (unique_buf_imported) { - struct kbase_dma_buf *new_buf_node = - kzalloc(sizeof(*new_buf_node), GFP_KERNEL); + struct kbase_dma_buf *new_buf_node = kzalloc(sizeof(*new_buf_node), GFP_KERNEL); if (new_buf_node == NULL) { dev_err(kctx->kbdev->dev, "Error allocating memory for kbase_dma_buf\n"); @@ -146,8 +143,7 @@ static bool kbase_capture_dma_buf_mapping(struct kbase_context *kctx, struct kbase_dma_buf *new_node; parent = *new; - new_node = rb_entry(parent, struct kbase_dma_buf, - dma_buf_node); + new_node = rb_entry(parent, struct kbase_dma_buf, dma_buf_node); if (dma_buf < new_node->dma_buf) new = &(*new)->rb_left; else @@ -163,19 +159,18 @@ static bool kbase_capture_dma_buf_mapping(struct kbase_context *kctx, return unique_buf_imported; } -void kbase_remove_dma_buf_usage(struct kbase_context *kctx, - struct kbase_mem_phy_alloc *alloc) +void kbase_remove_dma_buf_usage(struct kbase_context *kctx, struct kbase_mem_phy_alloc *alloc) { struct kbase_device *kbdev = kctx->kbdev; bool dev_mapping_removed, prcs_mapping_removed; mutex_lock(&kbdev->dma_buf_lock); - dev_mapping_removed = kbase_delete_dma_buf_mapping( - kctx, alloc->imported.umm.dma_buf, &kbdev->dma_buf_root); + dev_mapping_removed = kbase_delete_dma_buf_mapping(kctx, alloc->imported.umm.dma_buf, + &kbdev->dma_buf_root); - prcs_mapping_removed = kbase_delete_dma_buf_mapping( - kctx, alloc->imported.umm.dma_buf, &kctx->kprcs->dma_buf_root); + prcs_mapping_removed = kbase_delete_dma_buf_mapping(kctx, alloc->imported.umm.dma_buf, + &kctx->kprcs->dma_buf_root); WARN_ON(dev_mapping_removed && !prcs_mapping_removed); @@ -197,8 +192,7 @@ void kbase_remove_dma_buf_usage(struct kbase_context *kctx, mutex_unlock(&kbdev->dma_buf_lock); } -void kbase_add_dma_buf_usage(struct kbase_context *kctx, - struct kbase_mem_phy_alloc *alloc) +void kbase_add_dma_buf_usage(struct kbase_context *kctx, struct kbase_mem_phy_alloc *alloc) { struct kbase_device *kbdev = kctx->kbdev; bool unique_dev_dmabuf, unique_prcs_dmabuf; @@ -206,11 +200,11 @@ void kbase_add_dma_buf_usage(struct kbase_context *kctx, mutex_lock(&kbdev->dma_buf_lock); /* add dma_buf to device and process. */ - unique_dev_dmabuf = kbase_capture_dma_buf_mapping( - kctx, alloc->imported.umm.dma_buf, &kbdev->dma_buf_root); + unique_dev_dmabuf = kbase_capture_dma_buf_mapping(kctx, alloc->imported.umm.dma_buf, + &kbdev->dma_buf_root); - unique_prcs_dmabuf = kbase_capture_dma_buf_mapping( - kctx, alloc->imported.umm.dma_buf, &kctx->kprcs->dma_buf_root); + unique_prcs_dmabuf = kbase_capture_dma_buf_mapping(kctx, alloc->imported.umm.dma_buf, + &kctx->kprcs->dma_buf_root); WARN_ON(unique_dev_dmabuf && !unique_prcs_dmabuf); |