diff options
author | Sidath Senanayake <sidaths@google.com> | 2021-09-09 14:20:11 +0100 |
---|---|---|
committer | Sidath Senanayake <sidaths@google.com> | 2021-09-09 14:20:11 +0100 |
commit | 71310b5be68bb0508ebd78c4f29c76d3a8552845 (patch) | |
tree | 1da01eacb8184be20f13e24d72ec6fdc48d5f55b | |
parent | 7a365af1110f82473cb73706f5d52f1ad7960fe9 (diff) | |
parent | bbbb1cf6bb211bb2094dd66656966277c326867f (diff) | |
download | gpu-71310b5be68bb0508ebd78c4f29c76d3a8552845.tar.gz |
Merge r32p1-beta4 from upstream into android-gs-pixel-5.10
This commit updates the Mali KMD to version r32p1-beta4 from
commit bbbb1cf6bb211bb2094dd66656966277c326867f
Bug: 191976359
Signed-off-by: Sidath Senanayake <sidaths@google.com>
Change-Id: I6f18cbf8a48bf7ca4bccdaf08ce5e97586fff793
38 files changed, 292 insertions, 168 deletions
diff --git a/common/include/linux/memory_group_manager.h b/common/include/linux/memory_group_manager.h index c0e808b..78cd098 100644 --- a/common/include/linux/memory_group_manager.h +++ b/common/include/linux/memory_group_manager.h @@ -46,7 +46,7 @@ struct memory_group_manager_import_data; * @mgm_vmf_insert_pfn_prot: Callback to map a physical memory page for the CPU */ struct memory_group_manager_ops { - /** + /* * mgm_alloc_page - Allocate a physical memory page in a group * * @mgm_dev: The memory group manager through which the request is @@ -65,7 +65,7 @@ struct memory_group_manager_ops { struct memory_group_manager_device *mgm_dev, int group_id, gfp_t gfp_mask, unsigned int order); - /** + /* * mgm_free_page - Free a physical memory page in a group * * @mgm_dev: The memory group manager through which the request @@ -84,7 +84,7 @@ struct memory_group_manager_ops { struct memory_group_manager_device *mgm_dev, int group_id, struct page *page, unsigned int order); - /** + /* * mgm_get_import_memory_id - Get the physical memory group ID for the * imported memory * @@ -103,7 +103,7 @@ struct memory_group_manager_ops { struct memory_group_manager_device *mgm_dev, struct memory_group_manager_import_data *import_data); - /** + /* * mgm_update_gpu_pte - Modify a GPU page table entry for a memory group * * @mgm_dev: The memory group manager through which the request @@ -127,7 +127,7 @@ struct memory_group_manager_ops { u64 (*mgm_update_gpu_pte)(struct memory_group_manager_device *mgm_dev, int group_id, int mmu_level, u64 pte); - /** + /* * mgm_vmf_insert_pfn_prot - Map a physical page in a group for the CPU * * @mgm_dev: The memory group manager through which the request @@ -158,8 +158,9 @@ struct memory_group_manager_ops { * struct memory_group_manager_device - Device structure for a memory group * manager * - * @ops - Callbacks associated with this device - * @data - Pointer to device private data + * @ops: Callbacks associated with this device + * @data: Pointer to device private data + * @owner: pointer to owning module * * In order for a systems integrator to provide custom behaviors for memory * operations performed by the kbase module (controller driver), they must @@ -183,8 +184,8 @@ enum memory_group_manager_import_type { * struct memory_group_manager_import_data - Structure describing the imported * memory * - * @type - type of imported memory - * @u - Union describing the imported memory + * @type: - type of imported memory + * @u: - Union describing the imported memory * */ struct memory_group_manager_import_data { diff --git a/common/include/linux/priority_control_manager.h b/common/include/linux/priority_control_manager.h index 002e78b..a6b1519 100644 --- a/common/include/linux/priority_control_manager.h +++ b/common/include/linux/priority_control_manager.h @@ -34,7 +34,7 @@ struct priority_control_manager_device; * @pcm_scheduler_priority_check: Callback to check if scheduling priority level can be requested */ struct priority_control_manager_ops { - /** + /* * pcm_scheduler_priority_check: This function can be used to check what priority its work * would be treated as based on the requested_priority value. * diff --git a/common/include/linux/protected_memory_allocator.h b/common/include/linux/protected_memory_allocator.h index 1e05bb8..825af48 100644 --- a/common/include/linux/protected_memory_allocator.h +++ b/common/include/linux/protected_memory_allocator.h @@ -46,7 +46,7 @@ struct protected_memory_allocator_device; * @pma_free_page: Callback to free protected memory */ struct protected_memory_allocator_ops { - /** + /* * pma_alloc_page - Allocate protected memory pages * * @pma_dev: The protected memory allocator the request is being made @@ -59,7 +59,7 @@ struct protected_memory_allocator_ops { struct protected_memory_allocator_device *pma_dev, unsigned int order); - /** + /* * pma_get_phys_addr - Get the physical address of the protected memory * allocation * @@ -74,7 +74,7 @@ struct protected_memory_allocator_ops { struct protected_memory_allocator_device *pma_dev, struct protected_memory_allocation *pma); - /** + /* * pma_free_page - Free a page of memory * * @pma_dev: The protected memory allocator the request is being made diff --git a/common/include/linux/protected_mode_switcher.h b/common/include/linux/protected_mode_switcher.h index 1a3c5f7..0f1e6ab 100644 --- a/common/include/linux/protected_mode_switcher.h +++ b/common/include/linux/protected_mode_switcher.h @@ -31,7 +31,7 @@ struct protected_mode_device; * @protected_mode_disable: Callback to disable protected mode for device */ struct protected_mode_ops { - /** + /* * protected_mode_enable() - Enable protected mode on device * @dev: The struct device * @@ -40,7 +40,7 @@ struct protected_mode_ops { int (*protected_mode_enable)( struct protected_mode_device *protected_dev); - /** + /* * protected_mode_disable() - Disable protected mode on device, and * reset device * @dev: The struct device @@ -54,8 +54,8 @@ struct protected_mode_ops { /** * struct protected_mode_device - Device structure for protected mode devices * - * @ops - Callbacks associated with this device - * @data - Pointer to device private data + * @ops: Callbacks associated with this device + * @data: Pointer to device private data * * This structure should be registered with the platform device using * platform_set_drvdata(). diff --git a/common/include/uapi/gpu/arm/midgard/csf/mali_base_csf_kernel.h b/common/include/uapi/gpu/arm/midgard/csf/mali_base_csf_kernel.h index 72572e5..78c328c 100644 --- a/common/include/uapi/gpu/arm/midgard/csf/mali_base_csf_kernel.h +++ b/common/include/uapi/gpu/arm/midgard/csf/mali_base_csf_kernel.h @@ -317,7 +317,6 @@ typedef __u32 base_context_create_flags; * @BASE_KCPU_COMMAND_TYPE_JIT_FREE: jit_free, * @BASE_KCPU_COMMAND_TYPE_GROUP_SUSPEND: group_suspend, * @BASE_KCPU_COMMAND_TYPE_ERROR_BARRIER: error_barrier, - * @BASE_KCPU_COMMAND_TYPE_SAMPLE_TIME: sample_time, */ enum base_kcpu_command_type { BASE_KCPU_COMMAND_TYPE_FENCE_SIGNAL, @@ -426,7 +425,7 @@ struct base_kcpu_command_cqs_set_info { }; /** - * basep_cqs_data_type - Enumeration of CQS Data Types + * typedef basep_cqs_data_type - Enumeration of CQS Data Types * * @BASEP_CQS_DATA_TYPE_U32: The Data Type of a CQS Object's value * is an unsigned 32-bit integer @@ -439,7 +438,7 @@ typedef enum PACKED { } basep_cqs_data_type; /** - * basep_cqs_wait_operation_op - Enumeration of CQS Object Wait + * typedef basep_cqs_wait_operation_op - Enumeration of CQS Object Wait * Operation conditions * * @BASEP_CQS_WAIT_OPERATION_LE: CQS Wait Operation indicating that a @@ -480,7 +479,7 @@ struct base_kcpu_command_cqs_wait_operation_info { }; /** - * basep_cqs_set_operation_op - Enumeration of CQS Set Operations + * typedef basep_cqs_set_operation_op - Enumeration of CQS Set Operations * * @BASEP_CQS_SET_OPERATION_ADD: CQS Set operation for adding a value * to a synchronization object diff --git a/mali_kbase/Kbuild b/mali_kbase/Kbuild index bf1a92d..76d6094 100644 --- a/mali_kbase/Kbuild +++ b/mali_kbase/Kbuild @@ -67,7 +67,7 @@ endif # # Driver version string which is returned to userspace via an ioctl -MALI_RELEASE_NAME ?= '"r32p1-00pxl0"' +MALI_RELEASE_NAME ?= '"r32p1-00pxl1"' # We are building for Pixel CONFIG_MALI_PLATFORM_NAME="pixel" diff --git a/mali_kbase/arbitration/Kconfig b/mali_kbase/arbitration/Kconfig index 6f2f0dc..95125f9 100644 --- a/mali_kbase/arbitration/Kconfig +++ b/mali_kbase/arbitration/Kconfig @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note # -# (C) COPYRIGHT 2021 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2012-2021 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 @@ -17,3 +17,23 @@ # http://www.gnu.org/licenses/gpl-2.0.html. # # + +config MALI_XEN + bool "Enable Xen Interface reference code" + depends on MALI_ARBITRATION && XEN + default n + help + Enables the build of xen interface modules used in the reference + virtualization setup for Mali + If unsure, say N. + +config MALI_KUTF_ARBITRATION_TEST + bool "Enable Arbitration Test reference code" + depends on MALI_KUTF && MALI_ARBITRATION + default n + help + Enables the build of test modules used in the reference + virtualization setup for Mali + If unsure, say N. + +source "drivers/gpu/arm/midgard/arbitration/ptm/Kconfig" diff --git a/mali_kbase/arbitration/ptm/Kconfig b/mali_kbase/arbitration/ptm/Kconfig new file mode 100644 index 0000000..e11e674 --- /dev/null +++ b/mali_kbase/arbitration/ptm/Kconfig @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note OR MIT +# +# (C) COPYRIGHT 2021 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 +# Foundation, and any use by you of this program is subject to the terms +# of such GNU license. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, you can access it online at +# http://www.gnu.org/licenses/gpl-2.0.html. +# +# + +config MALI_PARTITION_MANAGER + bool "Enable compilation of partition manager modules" + depends on MALI_ARBITRATION + default n + help + This option enables the compilation of the partition manager + modules used to configure the Mali-G78AE GPU. + diff --git a/mali_kbase/backend/gpu/mali_kbase_devfreq.c b/mali_kbase/backend/gpu/mali_kbase_devfreq.c index 8c31499..b117e57 100644 --- a/mali_kbase/backend/gpu/mali_kbase_devfreq.c +++ b/mali_kbase/backend/gpu/mali_kbase_devfreq.c @@ -32,6 +32,7 @@ #include <linux/version.h> #include <linux/pm_opp.h> +#include "mali_kbase_devfreq.h" /** * get_voltage() - Get the voltage value corresponding to the nominal frequency diff --git a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h index 2671ce5..66cda8c 100644 --- a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h +++ b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h @@ -40,4 +40,8 @@ void kbase_synchronize_irqs(struct kbase_device *kbdev); int kbasep_common_test_interrupt_handlers( struct kbase_device * const kbdev); +irqreturn_t kbase_gpu_irq_test_handler(int irq, void *data, u32 val); +int kbase_set_custom_irq_handler(struct kbase_device *kbdev, + irq_handler_t custom_handler, int irq_type); + #endif /* _KBASE_IRQ_INTERNAL_H_ */ diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c index b81f231..b475d79 100644 --- a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c +++ b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c @@ -1452,10 +1452,10 @@ bool kbase_backend_soft_hard_stop_slot(struct kbase_device *kbdev, else katom_idx1_valid = false; } else { - katom_idx0_valid = (katom_idx0 && - (!kctx || katom_idx0->kctx == kctx)); - katom_idx1_valid = (katom_idx1 && - (!kctx || katom_idx1->kctx == kctx)); + katom_idx0_valid = + (katom_idx0 && (!kctx || katom_idx0->kctx == kctx)); + katom_idx1_valid = + (katom_idx1 && (!kctx || katom_idx1->kctx == kctx)); } if (katom_idx0_valid) diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h index f26aaa5..9f84e73 100644 --- a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h +++ b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h @@ -570,7 +570,7 @@ struct kbase_pm_policy { */ bool (*get_core_active)(struct kbase_device *kbdev); - /** + /* * Function called when a power event occurs * * @kbdev: The kbase device structure for the device (must be a diff --git a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c index e23d681..a62cafa 100644 --- a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c +++ b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c @@ -146,8 +146,12 @@ static int apply_select_config(struct kbase_device *kbdev, u64 *select) ret = wait_status(kbdev, STATUS_COMMAND_ACTIVE); - if (!ret) + if (!ret) { kbase_reg_write(kbdev, IPA_CONTROL_REG(COMMAND), COMMAND_APPLY); + ret = wait_status(kbdev, STATUS_COMMAND_ACTIVE); + } else { + dev_err(kbdev->dev, "Wait for the pending command failed"); + } return ret; } @@ -215,6 +219,17 @@ static void build_select_config(struct kbase_ipa_control *ipa_ctrl, } } +static int update_select_registers(struct kbase_device *kbdev) +{ + u64 select_config[KBASE_IPA_CORE_TYPE_NUM]; + + lockdep_assert_held(&kbdev->csf.ipa_control.lock); + + build_select_config(&kbdev->csf.ipa_control, select_config); + + return apply_select_config(kbdev, select_config); +} + static inline void calc_prfcnt_delta(struct kbase_device *kbdev, struct kbase_ipa_control_prfcnt *prfcnt, bool gpu_ready) @@ -377,6 +392,110 @@ void kbase_ipa_control_term(struct kbase_device *kbdev) } KBASE_EXPORT_TEST_API(kbase_ipa_control_term); +/** session_read_raw_values - Read latest raw values for a sessions + * @kbdev: Pointer to kbase device. + * @session: Pointer to the session whose performance counters shall be read. + * + * Read and update the latest raw values of all the performance counters + * belonging to a given session. + */ +static void session_read_raw_values(struct kbase_device *kbdev, + struct kbase_ipa_control_session *session) +{ + size_t i; + + lockdep_assert_held(&kbdev->csf.ipa_control.lock); + + for (i = 0; i < session->num_prfcnts; i++) { + struct kbase_ipa_control_prfcnt *prfcnt = &session->prfcnts[i]; + u64 raw_value = read_value_cnt(kbdev, (u8)prfcnt->type, + prfcnt->select_idx); + + prfcnt->latest_raw_value = raw_value; + } +} + +/** session_gpu_start - Start one or all sessions + * @kbdev: Pointer to kbase device. + * @ipa_ctrl: Pointer to IPA_CONTROL descriptor. + * @session: Pointer to the session to initialize, or NULL to initialize + * all sessions. + * + * This function starts one or all sessions by capturing a manual sample, + * reading the latest raw value of performance counters and possibly enabling + * the timer for automatic sampling if necessary. + * + * If a single session is given, it is assumed to be active, regardless of + * the number of active sessions. The number of performance counters belonging + * to the session shall be set in advance. + * + * If no session is given, the function shall start all sessions. + * The function does nothing if there are no active sessions. + * + * Return: 0 on success, or error code on failure. + */ +static int session_gpu_start(struct kbase_device *kbdev, + struct kbase_ipa_control *ipa_ctrl, + struct kbase_ipa_control_session *session) +{ + bool first_start = + (session != NULL) && (ipa_ctrl->num_active_sessions == 0); + int ret = 0; + + lockdep_assert_held(&kbdev->csf.ipa_control.lock); + + /* + * Exit immediately if the caller intends to start all sessions + * but there are no active sessions. It's important that no operation + * is done on the IPA_CONTROL interface in that case. + */ + if (!session && ipa_ctrl->num_active_sessions == 0) + return ret; + + /* + * Take a manual sample unconditionally if the caller intends + * to start all sessions. Otherwise, only take a manual sample + * if this is the first session to be initialized, for accumulator + * registers are empty and no timer has been configured for automatic + * sampling. + */ + if (!session || first_start) { + kbase_reg_write(kbdev, IPA_CONTROL_REG(COMMAND), + COMMAND_SAMPLE); + ret = wait_status(kbdev, STATUS_COMMAND_ACTIVE); + if (ret) + dev_err(kbdev->dev, "%s: failed to sample new counters", + __func__); + kbase_reg_write(kbdev, IPA_CONTROL_REG(TIMER), + timer_value(ipa_ctrl->cur_gpu_rate)); + } + + /* + * Read current raw value to start the session. + * This is necessary to put the first query in condition + * to generate a correct value by calculating the difference + * from the beginning of the session. This consideration + * is true regardless of the number of sessions the caller + * intends to start. + */ + if (!ret) { + if (session) { + session_read_raw_values(kbdev, session); + } else { + size_t session_idx; + + for (session_idx = 0; + session_idx < ipa_ctrl->num_active_sessions; + session_idx++) + session_read_raw_values( + kbdev, + &ipa_ctrl->sessions[session_idx]); + } + } + + return ret; +} + int kbase_ipa_control_register( struct kbase_device *kbdev, const struct kbase_ipa_control_perf_counter *perf_counters, @@ -539,56 +658,22 @@ int kbase_ipa_control_register( * before applying the new configuration. */ if (new_config) { - u64 select_config[KBASE_IPA_CORE_TYPE_NUM]; - - build_select_config(ipa_ctrl, select_config); - ret = apply_select_config(kbdev, select_config); + ret = update_select_registers(kbdev); if (ret) dev_err(kbdev->dev, - "%s: failed to apply SELECT configuration", + "%s: failed to apply new SELECT configuration", __func__); } if (!ret) { - /* Accumulator registers don't contain any sample if the timer - * has not been enabled first. Take a sample manually before - * enabling the timer. - */ - if (ipa_ctrl->num_active_sessions == 0) { - kbase_reg_write(kbdev, IPA_CONTROL_REG(COMMAND), - COMMAND_SAMPLE); - ret = wait_status(kbdev, STATUS_COMMAND_ACTIVE); - if (!ret) { - kbase_reg_write( - kbdev, IPA_CONTROL_REG(TIMER), - timer_value(ipa_ctrl->cur_gpu_rate)); - } else { - dev_err(kbdev->dev, - "%s: failed to sample new counters", - __func__); - } - } + session->num_prfcnts = num_counters; + ret = session_gpu_start(kbdev, ipa_ctrl, session); } if (!ret) { - session->num_prfcnts = num_counters; session->active = true; ipa_ctrl->num_active_sessions++; *client = session; - - /* - * Read current raw value to initialize the session. - * This is necessary to put the first query in condition - * to generate a correct value by calculating the difference - * from the beginning of the session. - */ - for (i = 0; i < session->num_prfcnts; i++) { - struct kbase_ipa_control_prfcnt *prfcnt = - &session->prfcnts[i]; - u64 raw_value = read_value_cnt(kbdev, (u8)prfcnt->type, - prfcnt->select_idx); - prfcnt->latest_raw_value = raw_value; - } } exit: @@ -662,10 +747,7 @@ int kbase_ipa_control_unregister(struct kbase_device *kbdev, const void *client) } if (new_config) { - u64 select_config[KBASE_IPA_CORE_TYPE_NUM]; - - build_select_config(ipa_ctrl, select_config); - ret = apply_select_config(kbdev, select_config); + ret = update_select_registers(kbdev); if (ret) dev_err(kbdev->dev, "%s: failed to apply SELECT configuration", @@ -808,18 +890,16 @@ void kbase_ipa_control_handle_gpu_power_on(struct kbase_device *kbdev) /* Interrupts are already disabled and interrupt state is also saved */ spin_lock(&ipa_ctrl->lock); - /* Re-issue the APPLY command, this is actually needed only for CSHW */ - kbase_reg_write(kbdev, IPA_CONTROL_REG(COMMAND), COMMAND_APPLY); - ret = wait_status(kbdev, STATUS_COMMAND_ACTIVE); + ret = update_select_registers(kbdev); if (ret) { dev_err(kbdev->dev, - "Wait for the completion of apply command failed: %d", - ret); + "Failed to reconfigure the select registers: %d", ret); } - /* Re-enable the timer for periodic sampling */ - kbase_reg_write(kbdev, IPA_CONTROL_REG(TIMER), - timer_value(ipa_ctrl->cur_gpu_rate)); + /* Accumulator registers would not contain any sample after GPU power + * cycle if the timer has not been enabled first. Initialize all sessions. + */ + ret = session_gpu_start(kbdev, ipa_ctrl, NULL); spin_unlock(&ipa_ctrl->lock); } diff --git a/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c b/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c index ae2ad33..33ae3f7 100644 --- a/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c +++ b/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c @@ -117,15 +117,6 @@ static inline void input_page_write(u32 *const input, const u32 offset, input[offset / sizeof(u32)] = value; } -static inline void input_page_partial_write(u32 *const input, const u32 offset, - u32 value, u32 mask) -{ - WARN_ON(offset % sizeof(u32)); - - input[offset / sizeof(u32)] = - (input_page_read(input, offset) & ~mask) | (value & mask); -} - static inline u32 output_page_read(const u32 *const output, const u32 offset) { WARN_ON(offset % sizeof(u32)); diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu.h b/mali_kbase/csf/mali_kbase_csf_kcpu.h index 2f6da55..9964f20 100644 --- a/mali_kbase/csf/mali_kbase_csf_kcpu.h +++ b/mali_kbase/csf/mali_kbase_csf_kcpu.h @@ -117,6 +117,8 @@ struct kbase_kcpu_command_cqs_set_operation_info { * @signaled: Bit array used to report the status of the CQS wait objects. * 1 is signaled, 0 otherwise. * @nr_objs: Number of CQS objects in the array. + * @inherit_err_flags: Bit-pattern for CQSs in the array who's error field is to + * be used as the source to import into the queue's error-state */ struct kbase_kcpu_command_cqs_wait_operation_info { struct base_cqs_wait_operation_info *objs; diff --git a/mali_kbase/csf/mali_kbase_csf_scheduler.c b/mali_kbase/csf/mali_kbase_csf_scheduler.c index 5b795d6..8109570 100644 --- a/mali_kbase/csf/mali_kbase_csf_scheduler.c +++ b/mali_kbase/csf/mali_kbase_csf_scheduler.c @@ -4103,7 +4103,7 @@ static int suspend_active_queue_groups_on_reset(struct kbase_device *kbdev) * groups when reset is done during * protected mode execution. * - * @group: Pointer to the device. + * @kbdev: Pointer to the device. * * This function is called at the time of GPU reset, before the suspension of * queue groups, to handle the case when the reset is getting performed whilst diff --git a/mali_kbase/ipa/mali_kbase_ipa.c b/mali_kbase/ipa/mali_kbase_ipa.c index 24d7b06..8b05e68 100644 --- a/mali_kbase/ipa/mali_kbase_ipa.c +++ b/mali_kbase/ipa/mali_kbase_ipa.c @@ -396,7 +396,7 @@ static u32 kbase_scale_dynamic_power(const u32 c, const u32 freq, * * Return: Power consumption, in mW. Range: 0 < p < 2^13 (0W to ~8W) */ -u32 kbase_scale_static_power(const u32 c, const u32 voltage) +static u32 kbase_scale_static_power(const u32 c, const u32 voltage) { /* Range: 2^8 < v2 < 2^16 m(V^2) */ const u32 v2 = (voltage * voltage) / 1000; diff --git a/mali_kbase/mali_kbase_core_linux.c b/mali_kbase/mali_kbase_core_linux.c index 7c4b448..be35c95 100644 --- a/mali_kbase/mali_kbase_core_linux.c +++ b/mali_kbase/mali_kbase_core_linux.c @@ -2996,7 +2996,7 @@ struct kbasep_debug_command { kbasep_debug_command_func *func; }; -void kbasep_ktrace_dump_wrapper(struct kbase_device *kbdev) +static void kbasep_ktrace_dump_wrapper(struct kbase_device *kbdev) { KBASE_KTRACE_DUMP(kbdev); } diff --git a/mali_kbase/mali_kbase_hwaccess_instr.h b/mali_kbase/mali_kbase_hwaccess_instr.h index f836953..819ca13 100644 --- a/mali_kbase/mali_kbase_hwaccess_instr.h +++ b/mali_kbase/mali_kbase_hwaccess_instr.h @@ -128,7 +128,7 @@ int kbase_instr_hwcnt_clear(struct kbase_context *kctx); int kbase_instr_backend_init(struct kbase_device *kbdev); /** - * kbase_instr_backend_init() - Terminate the instrumentation backend + * kbase_instr_backend_term() - Terminate the instrumentation backend * @kbdev: Kbase device * * This function should be called during driver termination. diff --git a/mali_kbase/mali_kbase_hwcnt_accumulator.h b/mali_kbase/mali_kbase_hwcnt_accumulator.h index 4887eaa..af542ea 100644 --- a/mali_kbase/mali_kbase_hwcnt_accumulator.h +++ b/mali_kbase/mali_kbase_hwcnt_accumulator.h @@ -19,7 +19,7 @@ * */ -/** +/* * Hardware counter accumulator API. */ diff --git a/mali_kbase/mali_kbase_hwcnt_backend.h b/mali_kbase/mali_kbase_hwcnt_backend.h index 0b5a188..b069fc1 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend.h +++ b/mali_kbase/mali_kbase_hwcnt_backend.h @@ -56,8 +56,8 @@ struct kbase_hwcnt_backend; * * Return: Non-NULL pointer to immutable hardware counter metadata. */ -typedef const struct kbase_hwcnt_metadata * -kbase_hwcnt_backend_metadata_fn(const struct kbase_hwcnt_backend_info *info); +typedef const struct kbase_hwcnt_metadata *kbase_hwcnt_backend_metadata_fn( + const struct kbase_hwcnt_backend_info *info); /** * typedef kbase_hwcnt_backend_init_fn - Initialise a counter backend. @@ -69,9 +69,9 @@ kbase_hwcnt_backend_metadata_fn(const struct kbase_hwcnt_backend_info *info); * * Return: 0 on success, else error code. */ -typedef int -kbase_hwcnt_backend_init_fn(const struct kbase_hwcnt_backend_info *info, - struct kbase_hwcnt_backend **out_backend); +typedef int kbase_hwcnt_backend_init_fn( + const struct kbase_hwcnt_backend_info *info, + struct kbase_hwcnt_backend **out_backend); /** * typedef kbase_hwcnt_backend_term_fn - Terminate a counter backend. @@ -86,8 +86,8 @@ typedef void kbase_hwcnt_backend_term_fn(struct kbase_hwcnt_backend *backend); * * Return: Backend timestamp in nanoseconds. */ -typedef u64 -kbase_hwcnt_backend_timestamp_ns_fn(struct kbase_hwcnt_backend *backend); +typedef u64 kbase_hwcnt_backend_timestamp_ns_fn( + struct kbase_hwcnt_backend *backend); /** * typedef kbase_hwcnt_backend_dump_enable_fn - Start counter dumping with the @@ -130,8 +130,8 @@ typedef int kbase_hwcnt_backend_dump_enable_nolock_fn( * If the backend is already disabled, does nothing. * Any undumped counter values since the last dump get will be lost. */ -typedef void -kbase_hwcnt_backend_dump_disable_fn(struct kbase_hwcnt_backend *backend); +typedef void kbase_hwcnt_backend_dump_disable_fn( + struct kbase_hwcnt_backend *backend); /** * typedef kbase_hwcnt_backend_dump_clear_fn - Reset all the current undumped @@ -142,8 +142,8 @@ kbase_hwcnt_backend_dump_disable_fn(struct kbase_hwcnt_backend *backend); * * Return: 0 on success, else error code. */ -typedef int -kbase_hwcnt_backend_dump_clear_fn(struct kbase_hwcnt_backend *backend); +typedef int kbase_hwcnt_backend_dump_clear_fn( + struct kbase_hwcnt_backend *backend); /** * typedef kbase_hwcnt_backend_dump_request_fn - Request an asynchronous counter @@ -157,9 +157,9 @@ kbase_hwcnt_backend_dump_clear_fn(struct kbase_hwcnt_backend *backend); * * Return: 0 on success, else error code. */ -typedef int -kbase_hwcnt_backend_dump_request_fn(struct kbase_hwcnt_backend *backend, - u64 *dump_time_ns); +typedef int kbase_hwcnt_backend_dump_request_fn( + struct kbase_hwcnt_backend *backend, + u64 *dump_time_ns); /** * typedef kbase_hwcnt_backend_dump_wait_fn - Wait until the last requested @@ -170,8 +170,8 @@ kbase_hwcnt_backend_dump_request_fn(struct kbase_hwcnt_backend *backend, * * Return: 0 on success, else error code. */ -typedef int -kbase_hwcnt_backend_dump_wait_fn(struct kbase_hwcnt_backend *backend); +typedef int kbase_hwcnt_backend_dump_wait_fn( + struct kbase_hwcnt_backend *backend); /** * typedef kbase_hwcnt_backend_dump_get_fn - Copy or accumulate enable the @@ -189,11 +189,11 @@ kbase_hwcnt_backend_dump_wait_fn(struct kbase_hwcnt_backend *backend); * * Return: 0 on success, else error code. */ -typedef int -kbase_hwcnt_backend_dump_get_fn(struct kbase_hwcnt_backend *backend, - struct kbase_hwcnt_dump_buffer *dump_buffer, - const struct kbase_hwcnt_enable_map *enable_map, - bool accumulate); +typedef int kbase_hwcnt_backend_dump_get_fn( + struct kbase_hwcnt_backend *backend, + struct kbase_hwcnt_dump_buffer *dump_buffer, + const struct kbase_hwcnt_enable_map *enable_map, + bool accumulate); /** * struct kbase_hwcnt_backend_interface - Hardware counter backend virtual diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf.h b/mali_kbase/mali_kbase_hwcnt_backend_csf.h index ce1af9a..bfdf140 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf.h +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf.h @@ -19,7 +19,7 @@ * */ -/** +/* * Concrete implementation of mali_kbase_hwcnt_backend interface for CSF * backend. */ diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h b/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h index f6387c2..9c4fef5 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h @@ -28,16 +28,8 @@ #include <linux/types.h> -/** - * struct kbase_hwcnt_backend_csf_if_ctx - Opaque pointer to a CSF interface - * context. - */ struct kbase_hwcnt_backend_csf_if_ctx; -/** - * struct kbase_hwcnt_backend_csf_if_ring_buf - Opaque pointer to a CSF - * interface ring buffer. - */ struct kbase_hwcnt_backend_csf_if_ring_buf; /** @@ -63,14 +55,14 @@ struct kbase_hwcnt_backend_csf_if_enable { /** * struct kbase_hwcnt_backend_csf_if_prfcnt_info - Performance counter * information. - * @dump_bytes: Bytes of GPU memory required to perform a performance - * counter dump. - * @prfcnt_block_size Bytes of each performance counter block. - * @l2_count: The MMU L2 cache count. - * @core_mask: Shader core mask. - * @clk_cnt: Clock domain count in the system. - * @clearing_samples: Indicates whether counters are cleared after each sample - * is taken. + * @dump_bytes: Bytes of GPU memory required to perform a performance + * counter dump. + * @prfcnt_block_size: Bytes of each performance counter block. + * @l2_count: The MMU L2 cache count. + * @core_mask: Shader core mask. + * @clk_cnt: Clock domain count in the system. + * @clearing_samples: Indicates whether counters are cleared after each sample + * is taken. */ struct kbase_hwcnt_backend_csf_if_prfcnt_info { size_t dump_bytes; @@ -97,9 +89,9 @@ typedef void kbase_hwcnt_backend_csf_if_assert_lock_held_fn( * @flags: Pointer to the memory location that would store the previous * interrupt state. */ -typedef void -kbase_hwcnt_backend_csf_if_lock_fn(struct kbase_hwcnt_backend_csf_if_ctx *ctx, - unsigned long *flags); +typedef void kbase_hwcnt_backend_csf_if_lock_fn( + struct kbase_hwcnt_backend_csf_if_ctx *ctx, + unsigned long *flags); /** * typedef kbase_hwcnt_backend_csf_if_unlock_fn - Release backend spinlock. @@ -108,9 +100,9 @@ kbase_hwcnt_backend_csf_if_lock_fn(struct kbase_hwcnt_backend_csf_if_ctx *ctx, * @flags: Previously stored interrupt state when Scheduler interrupt * spinlock was acquired. */ -typedef void -kbase_hwcnt_backend_csf_if_unlock_fn(struct kbase_hwcnt_backend_csf_if_ctx *ctx, - unsigned long flags); +typedef void kbase_hwcnt_backend_csf_if_unlock_fn( + struct kbase_hwcnt_backend_csf_if_ctx *ctx, + unsigned long flags); /** * typedef kbase_hwcnt_backend_csf_if_get_prfcnt_info_fn - Get performance diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c index 979299f..78a8dc0 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c +++ b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c @@ -683,7 +683,7 @@ static void kbasep_hwcnt_backend_csf_if_fw_get_gpu_cycle_count( } /** - * kbasep_hwcnt_backedn_csf_if_fw_cts_destroy() - Destroy a CSF FW interface context. + * kbasep_hwcnt_backend_csf_if_fw_ctx_destroy() - Destroy a CSF FW interface context. * * @fw_ctx: Pointer to context to destroy. */ diff --git a/mali_kbase/mali_kbase_hwcnt_backend_jm.h b/mali_kbase/mali_kbase_hwcnt_backend_jm.h index 5319516..1bc3906 100644 --- a/mali_kbase/mali_kbase_hwcnt_backend_jm.h +++ b/mali_kbase/mali_kbase_hwcnt_backend_jm.h @@ -19,7 +19,7 @@ * */ -/** +/* * Concrete implementation of mali_kbase_hwcnt_backend interface for JM * backend. */ diff --git a/mali_kbase/mali_kbase_hwcnt_context.h b/mali_kbase/mali_kbase_hwcnt_context.h index 1adf2ef..34423d1 100644 --- a/mali_kbase/mali_kbase_hwcnt_context.h +++ b/mali_kbase/mali_kbase_hwcnt_context.h @@ -19,7 +19,7 @@ * */ -/** +/* * Hardware counter context API. */ diff --git a/mali_kbase/mali_kbase_hwcnt_legacy.h b/mali_kbase/mali_kbase_hwcnt_legacy.h index 36ff44d..163ae8d 100644 --- a/mali_kbase/mali_kbase_hwcnt_legacy.h +++ b/mali_kbase/mali_kbase_hwcnt_legacy.h @@ -19,7 +19,7 @@ * */ -/** +/* * Legacy hardware counter interface, giving userspace clients simple, * synchronous access to hardware counters. * diff --git a/mali_kbase/mali_kbase_hwcnt_types.h b/mali_kbase/mali_kbase_hwcnt_types.h index da12952..6b7985b 100644 --- a/mali_kbase/mali_kbase_hwcnt_types.h +++ b/mali_kbase/mali_kbase_hwcnt_types.h @@ -19,7 +19,7 @@ * */ -/** +/* * Hardware counter types. * Contains structures for describing the physical layout of hardware counter * dump buffers and enable maps within a system. @@ -593,8 +593,8 @@ static inline void kbase_hwcnt_enable_map_block_enable_all( } /** - * kbase_hwcnt_enable_map_block_enable_all() - Enable all values in an enable - * map. + * kbase_hwcnt_enable_map_enable_all() - Enable all values in an enable + * map. * @dst: Non-NULL pointer to enable map. */ static inline void kbase_hwcnt_enable_map_enable_all( @@ -1134,7 +1134,7 @@ static inline void kbase_hwcnt_dump_buffer_block_accumulate_strict( } } -/** +/* * Iterate over each clock domain in the metadata. * * @md: Non-NULL pointer to metadata. diff --git a/mali_kbase/mali_kbase_hwcnt_virtualizer.h b/mali_kbase/mali_kbase_hwcnt_virtualizer.h index e3a8137..08e8e9f 100644 --- a/mali_kbase/mali_kbase_hwcnt_virtualizer.h +++ b/mali_kbase/mali_kbase_hwcnt_virtualizer.h @@ -19,7 +19,7 @@ * */ -/** +/* * Hardware counter virtualizer API. * * Virtualizes a hardware counter context, so multiple clients can access diff --git a/mali_kbase/mali_kbase_jd_debugfs.c b/mali_kbase/mali_kbase_jd_debugfs.c index 67d1bd9..6378931 100644 --- a/mali_kbase/mali_kbase_jd_debugfs.c +++ b/mali_kbase/mali_kbase_jd_debugfs.c @@ -74,8 +74,10 @@ static void kbase_jd_debugfs_fence_info(struct kbase_jd_atom *atom, seq_printf(sfile, #if (KERNEL_VERSION(4, 8, 0) > LINUX_VERSION_CODE) "Sd(%u#%u: %s) ", -#else +#elif (KERNEL_VERSION(5, 1, 0) > LINUX_VERSION_CODE) "Sd(%llu#%u: %s) ", +#else + "Sd(%llu#%llu: %s) ", #endif fence->context, fence->seqno, dma_fence_is_signaled(fence) ? "signaled" : @@ -93,8 +95,10 @@ static void kbase_jd_debugfs_fence_info(struct kbase_jd_atom *atom, seq_printf(sfile, #if (KERNEL_VERSION(4, 8, 0) > LINUX_VERSION_CODE) "Wd(%u#%u: %s) ", -#else +#elif (KERNEL_VERSION(5, 1, 0) > LINUX_VERSION_CODE) "Wd(%llu#%u: %s) ", +#else + "Wd(%llu#%llu: %s) ", #endif fence->context, fence->seqno, dma_fence_is_signaled(fence) ? "signaled" : diff --git a/mali_kbase/mali_kbase_mipe_gen_header.h b/mali_kbase/mali_kbase_mipe_gen_header.h index f0b385e..edd44bf 100644 --- a/mali_kbase/mali_kbase_mipe_gen_header.h +++ b/mali_kbase/mali_kbase_mipe_gen_header.h @@ -27,7 +27,7 @@ #include "mali_kbase_mipe_proto.h" -/** +/* * This header generates MIPE tracepoint declaration BLOB at * compile time. * @@ -57,7 +57,7 @@ #define MIPE_HEADER_BLOB_VAR_ATTRIBUTE #endif -/** +/* * A compiler attribute for packing structures * * e.g. __packed @@ -68,7 +68,7 @@ #define MIPE_HEADER_PACKED_ATTRIBUTE __attribute__((__packed__)) #endif -/** +/* * MIPE stream id. * * See enum tl_stream_id. @@ -140,7 +140,7 @@ #define MIPE_HEADER_ENUM_LIST #endif -/** +/* * The MIPE tracepoint declaration BLOB. */ const struct diff --git a/mali_kbase/mali_kbase_reset_gpu.h b/mali_kbase/mali_kbase_reset_gpu.h index 292a29c..897b732 100644 --- a/mali_kbase/mali_kbase_reset_gpu.h +++ b/mali_kbase/mali_kbase_reset_gpu.h @@ -168,7 +168,7 @@ bool kbase_prepare_to_reset_gpu_locked(struct kbase_device *kbdev, * kbase_prepare_to_reset_gpu - Prepare for resetting the GPU. * @kbdev: Device pointer * @flags: Bitfield indicating impact of reset (see flag defines) - + * * Return: a boolean which should be interpreted as follows: * - true - Prepared for reset, kbase_reset_gpu should be called. * - false - Another thread is performing a reset, kbase_reset_gpu should diff --git a/mali_kbase/mali_kbase_vinstr.c b/mali_kbase/mali_kbase_vinstr.c index 64405af..d00bc00 100644 --- a/mali_kbase/mali_kbase_vinstr.c +++ b/mali_kbase/mali_kbase_vinstr.c @@ -930,7 +930,8 @@ static long kbasep_vinstr_hwcnt_reader_ioctl_get_hwver( } /** - * The hwcnt reader's ioctl command - get API version. + * kbasep_vinstr_hwcnt_reader_ioctl_get_api_version() - get API version ioctl + * command. * @cli: The non-NULL pointer to the client * @arg: Command's argument. * @size: Size of arg. diff --git a/mali_kbase/mmu/mali_kbase_mmu.c b/mali_kbase/mmu/mali_kbase_mmu.c index 85e2d88..e3c5b15 100644 --- a/mali_kbase/mmu/mali_kbase_mmu.c +++ b/mali_kbase/mmu/mali_kbase_mmu.c @@ -1861,12 +1861,6 @@ KBASE_EXPORT_TEST_API(kbase_mmu_teardown_pages); /** * kbase_mmu_update_pages_no_flush() - Update page table entries on the GPU * - * This will update page table entries that already exist on the GPU based on - * the new flags that are passed. It is used as a response to the changes of - * the memory attributes - * - * The caller is responsible for validating the memory attributes - * * @kctx: Kbase context * @vpfn: Virtual PFN (Page Frame Number) of the first page to update * @phys: Tagged physical addresses of the physical pages to replace the @@ -1875,6 +1869,12 @@ KBASE_EXPORT_TEST_API(kbase_mmu_teardown_pages); * @flags: Flags * @group_id: The physical memory group in which the page was allocated. * Valid range is 0..(MEMORY_GROUP_MANAGER_NR_GROUPS-1). + * + * This will update page table entries that already exist on the GPU based on + * the new flags that are passed. It is used as a response to the changes of + * the memory attributes + * + * The caller is responsible for validating the memory attributes */ static int kbase_mmu_update_pages_no_flush(struct kbase_context *kctx, u64 vpfn, struct tagged_addr *phys, size_t nr, diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c index f9410a5..5e9a2e7 100644 --- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c +++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c @@ -613,7 +613,7 @@ static int kutf_clk_trace_do_nack_response(struct kutf_context *context, * 3). If the GPU active transition occurs following 2), there * must be rate change event from tracing. */ -void kutf_clk_trace_barebone_check(struct kutf_context *context) +static void kutf_clk_trace_barebone_check(struct kutf_context *context) { struct kutf_clk_rate_trace_fixture_data *data = context->fixture; struct kbase_device *kbdev = data->kbdev; @@ -691,7 +691,7 @@ static bool kutf_clk_trace_end_of_stream(struct clk_trace_portal_input *cmd) return (cmd->named_val_err == -EBUSY); } -void kutf_clk_trace_no_clks_dummy(struct kutf_context *context) +static void kutf_clk_trace_no_clks_dummy(struct kutf_context *context) { struct clk_trace_portal_input cmd; unsigned long timeout = jiffies + HZ * 2; @@ -897,7 +897,7 @@ static void mali_kutf_clk_rate_trace_remove_fixture( /** * mali_kutf_clk_rate_trace_test_module_init() - Entry point for test mdoule. */ -int mali_kutf_clk_rate_trace_test_module_init(void) +static int __init mali_kutf_clk_rate_trace_test_module_init(void) { struct kutf_suite *suite; unsigned int filters; @@ -943,7 +943,7 @@ int mali_kutf_clk_rate_trace_test_module_init(void) * mali_kutf_clk_rate_trace_test_module_exit() - Module exit point for this * test. */ -void mali_kutf_clk_rate_trace_test_module_exit(void) +static void __exit mali_kutf_clk_rate_trace_test_module_exit(void) { pr_debug("Exit start\n"); kutf_destroy_application(kutf_app); diff --git a/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c b/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c index fdc5437..7799a68 100644 --- a/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c +++ b/mali_kbase/tests/mali_kutf_irq_test/mali_kutf_irq_test_main.c @@ -26,6 +26,7 @@ #include "mali_kbase.h" #include <device/mali_kbase_device.h> #include <backend/gpu/mali_kbase_pm_internal.h> +#include <backend/gpu/mali_kbase_irq_internal.h> #include <kutf/kutf_suite.h> #include <kutf/kutf_utils.h> @@ -235,7 +236,7 @@ static void mali_kutf_irq_latency(struct kutf_context *context) /** * Module entry point for this test. */ -int mali_kutf_irq_test_main_init(void) +static int __init mali_kutf_irq_test_main_init(void) { struct kutf_suite *suite; @@ -264,7 +265,7 @@ int mali_kutf_irq_test_main_init(void) /** * Module exit point for this test. */ -void mali_kutf_irq_test_main_exit(void) +static void __exit mali_kutf_irq_test_main_exit(void) { kutf_destroy_application(irq_app); } diff --git a/mali_kbase/tl/mali_kbase_timeline_io.c b/mali_kbase/tl/mali_kbase_timeline_io.c index eff30a0..23e42ad 100644 --- a/mali_kbase/tl/mali_kbase_timeline_io.c +++ b/mali_kbase/tl/mali_kbase_timeline_io.c @@ -140,7 +140,7 @@ static inline int copy_stream_header(char __user *buffer, size_t size, } /** - * kbasep_timeline_copy_header - copy timeline headers to the user + * kbasep_timeline_copy_headers - copy timeline headers to the user * * @timeline: Timeline instance * @buffer: Pointer to the buffer provided by user diff --git a/mali_kbase/tl/mali_kbase_tlstream.c b/mali_kbase/tl/mali_kbase_tlstream.c index 0275bad..47059de 100644 --- a/mali_kbase/tl/mali_kbase_tlstream.c +++ b/mali_kbase/tl/mali_kbase_tlstream.c @@ -180,7 +180,7 @@ void kbase_tlstream_term(struct kbase_tlstream *stream) } /** - * kbase_tlstream_msgbuf_submit - submit packet to user space + * kbasep_tlstream_msgbuf_submit - submit packet to user space * @stream: Pointer to the stream structure * @wb_idx_raw: Write buffer index * @wb_size: Length of data stored in the current buffer |