Skip to content

Commit 082a29e

Browse files
kwachowsjlawryno
authored andcommitted
accel/ivpu: Update FW Boot API to version 3.28.3
Update firmware Boot API to 3.28.3 version and adjust driver to API changes for preemption buffers. Use new preemption buffer size fields from FW header added to firmware boot API for preemption buffers allocations, if those new fields are zeroed, use old values instead. Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com> Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Link: https://lore.kernel.org/r/20250401155817.4049220-1-maciej.falkowski@linux.intel.com
1 parent 683e9fa commit 082a29e

File tree

3 files changed

+58
-22
lines changed

3 files changed

+58
-22
lines changed

drivers/accel/ivpu/ivpu_fw.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,20 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
233233
fw->dvfs_mode = 0;
234234

235235
fw->sched_mode = ivpu_fw_sched_mode_select(vdev, fw_hdr);
236-
fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_size;
237-
fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_size;
238236
ivpu_info(vdev, "Scheduler mode: %s\n", fw->sched_mode ? "HW" : "OS");
239237

238+
if (fw_hdr->preemption_buffer_1_max_size)
239+
fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_max_size;
240+
else
241+
fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_size;
242+
243+
if (fw_hdr->preemption_buffer_2_max_size)
244+
fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_max_size;
245+
else
246+
fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_size;
247+
ivpu_dbg(vdev, FW_BOOT, "Preemption buffer sizes: primary %u, secondary %u\n",
248+
fw->primary_preempt_buf_size, fw->secondary_preempt_buf_size);
249+
240250
if (fw_hdr->ro_section_start_address && !is_within_range(fw_hdr->ro_section_start_address,
241251
fw_hdr->ro_section_size,
242252
fw_hdr->image_load_address,

drivers/accel/ivpu/vpu_boot_api.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* Minor version changes when API backward compatibility is preserved.
2727
* Resets to 0 if Major version is incremented.
2828
*/
29-
#define VPU_BOOT_API_VER_MINOR 26
29+
#define VPU_BOOT_API_VER_MINOR 28
3030

3131
/*
3232
* API header changed (field names, documentation, formatting) but API itself has not been changed
@@ -76,8 +76,15 @@ struct vpu_firmware_header {
7676
* submission queue size and device capabilities.
7777
*/
7878
u32 preemption_buffer_2_size;
79+
/*
80+
* Maximum preemption buffer size that the FW can use: no need for the host
81+
* driver to allocate more space than that specified by these fields.
82+
* A value of 0 means no declared limit.
83+
*/
84+
u32 preemption_buffer_1_max_size;
85+
u32 preemption_buffer_2_max_size;
7986
/* Space reserved for future preemption-related fields. */
80-
u32 preemption_reserved[6];
87+
u32 preemption_reserved[4];
8188
/* FW image read only section start address, 4KB aligned */
8289
u64 ro_section_start_address;
8390
/* FW image read only section size, 4KB aligned */
@@ -134,7 +141,7 @@ enum vpu_trace_destination {
134141
/*
135142
* Processor bit shifts (for loggable HW components).
136143
*/
137-
#define VPU_TRACE_PROC_BIT_ARM 0
144+
#define VPU_TRACE_PROC_BIT_RESERVED 0
138145
#define VPU_TRACE_PROC_BIT_LRT 1
139146
#define VPU_TRACE_PROC_BIT_LNN 2
140147
#define VPU_TRACE_PROC_BIT_SHV_0 3

drivers/accel/ivpu/vpu_jsm_api.h

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/*
2323
* Minor version changes when API backward compatibility is preserved.
2424
*/
25-
#define VPU_JSM_API_VER_MINOR 25
25+
#define VPU_JSM_API_VER_MINOR 29
2626

2727
/*
2828
* API header changed (field names, documentation, formatting) but API itself has not been changed
@@ -53,8 +53,7 @@
5353
* Engine indexes.
5454
*/
5555
#define VPU_ENGINE_COMPUTE 0
56-
#define VPU_ENGINE_COPY 1
57-
#define VPU_ENGINE_NB 2
56+
#define VPU_ENGINE_NB 1
5857

5958
/*
6059
* VPU status values.
@@ -126,11 +125,13 @@ enum {
126125
* When set, indicates that job queue uses native fences (as inline commands
127126
* in job queue). Such queues may also use legacy fences (as commands in batch buffers).
128127
* When cleared, indicates the job queue only uses legacy fences.
129-
* NOTE: For queues using native fences, VPU expects that all jobs in the queue
130-
* are immediately followed by an inline command object. This object is expected
131-
* to be a fence signal command in most cases, but can also be a NOP in case the host
132-
* does not need per-job fence signalling. Other inline commands objects can be
133-
* inserted between "job and inline command" pairs.
128+
* NOTES:
129+
* 1. For queues using native fences, VPU expects that all jobs in the queue
130+
* are immediately followed by an inline command object. This object is expected
131+
* to be a fence signal command in most cases, but can also be a NOP in case the host
132+
* does not need per-job fence signalling. Other inline commands objects can be
133+
* inserted between "job and inline command" pairs.
134+
* 2. Native fence queues are only supported on VPU 40xx onwards.
134135
*/
135136
VPU_JOB_QUEUE_FLAGS_USE_NATIVE_FENCE_MASK = (1 << 1U),
136137

@@ -275,6 +276,8 @@ struct vpu_inline_cmd {
275276
u64 value;
276277
/* User VA of the log buffer in which to add log entry on completion. */
277278
u64 log_buffer_va;
279+
/* NPU private data. */
280+
u64 npu_private_data;
278281
} fence;
279282
/* Other commands do not have a payload. */
280283
/* Payload definition for future inline commands can be inserted here. */
@@ -791,12 +794,22 @@ struct vpu_jsm_metric_streamer_update {
791794
/** Metric group mask that identifies metric streamer instance. */
792795
u64 metric_group_mask;
793796
/**
794-
* Address and size of the buffer where the VPU will write metric data. If
795-
* the buffer address is 0 or same as the currently used buffer the VPU will
796-
* continue writing metric data to the current buffer. In this case the
797-
* buffer size is ignored and the size of the current buffer is unchanged.
798-
* If the address is non-zero and differs from the current buffer address the
799-
* VPU will immediately switch data collection to the new buffer.
797+
* Address and size of the buffer where the VPU will write metric data.
798+
* This member dictates how the update operation should perform:
799+
* 1. client needs information about the number of collected samples and the
800+
* amount of data written to the current buffer
801+
* 2. client wants to switch to a new buffer
802+
*
803+
* Case 1. is identified by the buffer address being 0 or the same as the
804+
* currently used buffer address. In this case the buffer size is ignored and
805+
* the size of the current buffer is unchanged. The VPU will return an update
806+
* in the vpu_jsm_metric_streamer_done structure. The internal writing position
807+
* into the buffer is not changed.
808+
*
809+
* Case 2. is identified by the address being non-zero and differs from the
810+
* current buffer address. The VPU will immediately switch data collection to
811+
* the new buffer. Then the VPU will return an update in the
812+
* vpu_jsm_metric_streamer_done structure.
800813
*/
801814
u64 buffer_addr;
802815
u64 buffer_size;
@@ -934,6 +947,7 @@ struct vpu_ipc_msg_payload_hws_priority_band_setup {
934947
/*
935948
* Default quantum in 100ns units for scheduling across processes
936949
* within a priority band
950+
* Minimum value supported by NPU is 1ms (10000 in 100ns units).
937951
*/
938952
u32 process_quantum[VPU_HWS_NUM_PRIORITY_BANDS];
939953
/*
@@ -946,8 +960,10 @@ struct vpu_ipc_msg_payload_hws_priority_band_setup {
946960
* in situations when it's starved by the focus band.
947961
*/
948962
u32 normal_band_percentage;
949-
/* Reserved */
950-
u32 reserved_0;
963+
/*
964+
* TDR timeout value in milliseconds. Default value of 0 meaning no timeout.
965+
*/
966+
u32 tdr_timeout;
951967
};
952968

953969
/*
@@ -1024,7 +1040,10 @@ struct vpu_ipc_msg_payload_hws_set_context_sched_properties {
10241040
s32 in_process_priority;
10251041
/* Zero padding / Reserved */
10261042
u32 reserved_1;
1027-
/* Context quantum relative to other contexts of same priority in the same process */
1043+
/*
1044+
* Context quantum relative to other contexts of same priority in the same process
1045+
* Minimum value supported by NPU is 1ms (10000 in 100ns units).
1046+
*/
10281047
u64 context_quantum;
10291048
/* Grace period when preempting context of the same priority within the same process */
10301049
u64 grace_period_same_priority;

0 commit comments

Comments
 (0)