| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2018-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2018-2022 ARM Limited. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * This program is free software and is provided to you under the terms of the |
|---|
| 7 | 7 | * GNU General Public License version 2 as published by the Free Software |
|---|
| .. | .. |
|---|
| 25 | 25 | #include <linux/types.h> |
|---|
| 26 | 26 | |
|---|
| 27 | 27 | #define CSF_FIRMWARE_TRACE_ENABLE_INIT_MASK_MAX (4) |
|---|
| 28 | | -#define FW_TRACE_BUF_NAME "fwlog" |
|---|
| 28 | +#define FIRMWARE_LOG_BUF_NAME "fwlog" |
|---|
| 29 | 29 | |
|---|
| 30 | 30 | /* Forward declarations */ |
|---|
| 31 | 31 | struct firmware_trace_buffer; |
|---|
| .. | .. |
|---|
| 33 | 33 | |
|---|
| 34 | 34 | /** |
|---|
| 35 | 35 | * kbase_csf_firmware_trace_buffers_init - Initialize trace buffers |
|---|
| 36 | + * |
|---|
| 37 | + * @kbdev: Device pointer |
|---|
| 36 | 38 | * |
|---|
| 37 | 39 | * Allocate resources for trace buffers. In particular: |
|---|
| 38 | 40 | * - One memory page of GPU-readable, CPU-writable memory is used for |
|---|
| .. | .. |
|---|
| 52 | 54 | * populated with data from the firmware image parsing. |
|---|
| 53 | 55 | * |
|---|
| 54 | 56 | * Return: 0 if success, or an error code on failure. |
|---|
| 55 | | - * |
|---|
| 56 | | - * @kbdev: Device pointer |
|---|
| 57 | 57 | */ |
|---|
| 58 | 58 | int kbase_csf_firmware_trace_buffers_init(struct kbase_device *kbdev); |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | /** |
|---|
| 61 | | - * kbase_csf_firmware_trace_buffer_term - Terminate trace buffers |
|---|
| 61 | + * kbase_csf_firmware_trace_buffers_term - Terminate trace buffers |
|---|
| 62 | 62 | * |
|---|
| 63 | 63 | * @kbdev: Device pointer |
|---|
| 64 | 64 | */ |
|---|
| .. | .. |
|---|
| 67 | 67 | /** |
|---|
| 68 | 68 | * kbase_csf_firmware_parse_trace_buffer_entry - Process a "trace buffer" section |
|---|
| 69 | 69 | * |
|---|
| 70 | + * @kbdev: Kbase device structure |
|---|
| 71 | + * @entry: Pointer to the section |
|---|
| 72 | + * @size: Size (in bytes) of the section |
|---|
| 73 | + * @updatable: Indicates whether config items can be updated with FIRMWARE_CONFIG_UPDATE |
|---|
| 74 | + * |
|---|
| 70 | 75 | * Read a "trace buffer" section adding metadata for the related trace buffer |
|---|
| 71 | 76 | * to the kbase_device:csf.firmware_trace_buffers list. |
|---|
| 72 | 77 | * |
|---|
| .. | .. |
|---|
| 74 | 79 | * will not be initialized. |
|---|
| 75 | 80 | * |
|---|
| 76 | 81 | * Return: 0 if successful, negative error code on failure. |
|---|
| 77 | | - * |
|---|
| 78 | | - * @kbdev: Kbase device structure |
|---|
| 79 | | - * @entry: Pointer to the section |
|---|
| 80 | | - * @size: Size (in bytes) of the section |
|---|
| 81 | | - * @updatable: Indicates whether config items can be updated with FIRMWARE_CONFIG_UPDATE |
|---|
| 82 | 82 | */ |
|---|
| 83 | 83 | int kbase_csf_firmware_parse_trace_buffer_entry(struct kbase_device *kbdev, |
|---|
| 84 | 84 | const u32 *entry, |
|---|
| .. | .. |
|---|
| 86 | 86 | bool updatable); |
|---|
| 87 | 87 | |
|---|
| 88 | 88 | /** |
|---|
| 89 | | - * kbase_csf_firmware_reload_trace_buffers_data - |
|---|
| 90 | | - * Reload trace buffers data for firmware reboot |
|---|
| 89 | + * kbase_csf_firmware_reload_trace_buffers_data - Reload trace buffers data for firmware reboot |
|---|
| 90 | + * |
|---|
| 91 | + * @kbdev: Device pointer |
|---|
| 91 | 92 | * |
|---|
| 92 | 93 | * Helper function used when rebooting the firmware to reload the initial setup |
|---|
| 93 | 94 | * for all the trace buffers which have been previously parsed and initialized. |
|---|
| .. | .. |
|---|
| 99 | 100 | * |
|---|
| 100 | 101 | * In other words, the re-initialization done by this function will be |
|---|
| 101 | 102 | * equivalent but not necessarily identical to the original initialization. |
|---|
| 102 | | - * |
|---|
| 103 | | - * @kbdev: Device pointer |
|---|
| 104 | 103 | */ |
|---|
| 105 | 104 | void kbase_csf_firmware_reload_trace_buffers_data(struct kbase_device *kbdev); |
|---|
| 106 | 105 | |
|---|
| 107 | 106 | /** |
|---|
| 108 | 107 | * kbase_csf_firmware_get_trace_buffer - Get a trace buffer |
|---|
| 109 | 108 | * |
|---|
| 110 | | - * Return: handle to a trace buffer, given the name, or NULL if a trace buffer |
|---|
| 111 | | - * with that name couldn't be found. |
|---|
| 112 | | - * |
|---|
| 113 | 109 | * @kbdev: Device pointer |
|---|
| 114 | 110 | * @name: Name of the trace buffer to find |
|---|
| 111 | + * |
|---|
| 112 | + * Return: handle to a trace buffer, given the name, or NULL if a trace buffer |
|---|
| 113 | + * with that name couldn't be found. |
|---|
| 115 | 114 | */ |
|---|
| 116 | 115 | struct firmware_trace_buffer *kbase_csf_firmware_get_trace_buffer( |
|---|
| 117 | 116 | struct kbase_device *kbdev, const char *name); |
|---|
| 118 | 117 | |
|---|
| 119 | 118 | /** |
|---|
| 120 | | - * kbase_csf_firmware_trace_buffer_get_trace_enable_bits_count - |
|---|
| 121 | | - * Get number of trace enable bits for a trace buffer |
|---|
| 122 | | - * |
|---|
| 123 | | - * Return: Number of trace enable bits in a trace buffer. |
|---|
| 119 | + * kbase_csf_firmware_trace_buffer_get_trace_enable_bits_count - Get number of trace enable bits for a trace buffer |
|---|
| 124 | 120 | * |
|---|
| 125 | 121 | * @trace_buffer: Trace buffer handle |
|---|
| 122 | + * |
|---|
| 123 | + * Return: Number of trace enable bits in a trace buffer. |
|---|
| 126 | 124 | */ |
|---|
| 127 | 125 | unsigned int kbase_csf_firmware_trace_buffer_get_trace_enable_bits_count( |
|---|
| 128 | 126 | const struct firmware_trace_buffer *trace_buffer); |
|---|
| 129 | 127 | |
|---|
| 130 | 128 | /** |
|---|
| 131 | | - * kbase_csf_firmware_trace_buffer_update_trace_enable_bit - |
|---|
| 132 | | - * Update a trace enable bit |
|---|
| 133 | | - * |
|---|
| 134 | | - * Update the value of a given trace enable bit. |
|---|
| 129 | + * kbase_csf_firmware_trace_buffer_update_trace_enable_bit - Update a trace enable bit |
|---|
| 135 | 130 | * |
|---|
| 136 | 131 | * @trace_buffer: Trace buffer handle |
|---|
| 137 | 132 | * @bit: Bit to update |
|---|
| 138 | 133 | * @value: New value for the given bit |
|---|
| 134 | + * |
|---|
| 135 | + * Update the value of a given trace enable bit. |
|---|
| 139 | 136 | * |
|---|
| 140 | 137 | * Return: 0 if successful, negative error code on failure. |
|---|
| 141 | 138 | */ |
|---|
| .. | .. |
|---|
| 146 | 143 | /** |
|---|
| 147 | 144 | * kbase_csf_firmware_trace_buffer_is_empty - Empty trace buffer predicate |
|---|
| 148 | 145 | * |
|---|
| 149 | | - * Return: True if the trace buffer is empty, or false otherwise. |
|---|
| 150 | | - * |
|---|
| 151 | 146 | * @trace_buffer: Trace buffer handle |
|---|
| 147 | + * |
|---|
| 148 | + * Return: True if the trace buffer is empty, or false otherwise. |
|---|
| 152 | 149 | */ |
|---|
| 153 | 150 | bool kbase_csf_firmware_trace_buffer_is_empty( |
|---|
| 154 | 151 | const struct firmware_trace_buffer *trace_buffer); |
|---|
| .. | .. |
|---|
| 156 | 153 | /** |
|---|
| 157 | 154 | * kbase_csf_firmware_trace_buffer_read_data - Read data from a trace buffer |
|---|
| 158 | 155 | * |
|---|
| 156 | + * @trace_buffer: Trace buffer handle |
|---|
| 157 | + * @data: Pointer to a client-allocated where data shall be written. |
|---|
| 158 | + * @num_bytes: Maximum number of bytes to read from the trace buffer. |
|---|
| 159 | + * |
|---|
| 159 | 160 | * Read available data from a trace buffer. The client provides a data buffer |
|---|
| 160 | 161 | * of a given size and the maximum number of bytes to read. |
|---|
| 161 | 162 | * |
|---|
| 162 | 163 | * Return: Number of bytes read from the trace buffer. |
|---|
| 163 | | - * |
|---|
| 164 | | - * @trace_buffer: Trace buffer handle |
|---|
| 165 | | - * @data: Pointer to a client-allocated where data shall be written. |
|---|
| 166 | | - * @num_bytes: Maximum number of bytes to read from the trace buffer. |
|---|
| 167 | 164 | */ |
|---|
| 168 | 165 | unsigned int kbase_csf_firmware_trace_buffer_read_data( |
|---|
| 169 | 166 | struct firmware_trace_buffer *trace_buffer, u8 *data, unsigned int num_bytes); |
|---|
| 170 | 167 | |
|---|
| 171 | | -#if IS_ENABLED(CONFIG_DEBUG_FS) |
|---|
| 172 | 168 | /** |
|---|
| 173 | | - * kbase_csf_fw_trace_buffer_debugfs_init() - Add debugfs entries for setting |
|---|
| 174 | | - * enable mask and dumping the binary |
|---|
| 175 | | - * firmware trace buffer |
|---|
| 169 | + * kbase_csf_firmware_trace_buffer_get_active_mask64 - Get trace buffer active mask |
|---|
| 176 | 170 | * |
|---|
| 177 | | - * @kbdev: Pointer to the device |
|---|
| 171 | + * @tb: Trace buffer handle |
|---|
| 172 | + * |
|---|
| 173 | + * Return: Trace buffer active mask. |
|---|
| 178 | 174 | */ |
|---|
| 179 | | -void kbase_csf_firmware_trace_buffer_debugfs_init(struct kbase_device *kbdev); |
|---|
| 180 | | -#endif /* CONFIG_DEBUG_FS */ |
|---|
| 175 | +u64 kbase_csf_firmware_trace_buffer_get_active_mask64(struct firmware_trace_buffer *tb); |
|---|
| 176 | + |
|---|
| 177 | +/** |
|---|
| 178 | + * kbase_csf_firmware_trace_buffer_set_active_mask64 - Set trace buffer active mask |
|---|
| 179 | + * |
|---|
| 180 | + * @tb: Trace buffer handle |
|---|
| 181 | + * @mask: New active mask |
|---|
| 182 | + * |
|---|
| 183 | + * Return: 0 if successful, negative error code on failure. |
|---|
| 184 | + */ |
|---|
| 185 | +int kbase_csf_firmware_trace_buffer_set_active_mask64(struct firmware_trace_buffer *tb, u64 mask); |
|---|
| 181 | 186 | |
|---|
| 182 | 187 | #endif /* _KBASE_CSF_TRACE_BUFFER_H_ */ |
|---|