Skip to contentSkip to conversation

accel/ivpu: Document why full JSM message size is always used

PATCH In review Karol Wachowski 2 participants 3 messages May 22 – May 25

Subsystems (2)
lore
Share & tools
lore

Karol Wachowski

author maintainer
#0 lore raw

PATCH 1/1 accel/ivpu: Document why full JSM message size is always used

Firmware expects IPC messages to always carry the full fixed sizeof(struct vpu_jsm_msg) size. Sending the full struct also ensures unused fields are zeroed, which maintains compatibility when existing commands are extended with new fields in the future.

Replace the misleading TODO comment with an explanation of the actual intent.

---
 drivers/accel/ivpu/ivpu_ipc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_ipc.c +5 -1
index f47df092bb0d..9f1ba0c57442 100644
@@ -97,7 +97,11 @@ ivpu_ipc_tx_prepare(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
 
 	memset(tx_buf, 0, sizeof(*tx_buf));
 	tx_buf->ipc.data_addr = jsm_vpu_addr;
-	/* TODO: Set data_size to actual JSM message size, not union of all messages */
+	/*
+	 * Firmware expects full JSM message size regardless of the payload size.
+	 * Unused fields must be zeroed to allow future extensions of existing
+	 * commands without breaking compatibility.
+	 */
 	tx_buf->ipc.data_size = sizeof(*req);
 	tx_buf->ipc.channel = cons->channel;
 	tx_buf->ipc.src_node = 0;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Karol Wachowski

Firmware expects IPC messages to always carry the full fixed sizeof(struct vpu_jsm_msg) size. Sending the full struct also ensures unused fields are zeroed, which maintains compatibility when existing commands are extended with new fields in the future.

Replace the misleading TODO comment with an explanation of the actual intent.

Quoted 21 lines
---
  drivers/accel/ivpu/ivpu_ipc.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_ipc.c +5 -1
index f47df092bb0d..9f1ba0c57442 100644
@@ -97,7 +97,11 @@ ivpu_ipc_tx_prepare(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
 
  	memset(tx_buf, 0, sizeof(*tx_buf));
  	tx_buf->ipc.data_addr = jsm_vpu_addr;
-	/* TODO: Set data_size to actual JSM message size, not union of all messages */
+	/*
+	 * Firmware expects full JSM message size regardless of the payload size.
+	 * Unused fields must be zeroed to allow future extensions of existing
+	 * commands without breaking compatibility.
+	 */
  	tx_buf->ipc.data_size = sizeof(*req);
  	tx_buf->ipc.channel = cons->channel;
  	tx_buf->ipc.src_node = 0;
author maintainer Applied
#2 lore raw
Quoted 6 lines · Dawid Osuchowski
Quoted 5 lines · Karol Wachowski

Firmware expects IPC messages to always carry the full fixed sizeof(struct vpu_jsm_msg) size. Sending the full struct also ensures unused fields are zeroed, which maintains compatibility when existing commands are extended with new fields in the future.

Quoted 6 lines
Quoted 4 lines

Replace the misleading TODO comment with an explanation of the actual intent.

Thanks, applied to drm-misc-next.

Quoted 26 lines
Quoted 25 lines

---
  drivers/accel/ivpu/ivpu_ipc.c | 6 +++++-

  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_ipc.c +0 -1
index f47df092bb0d..9f1ba0c57442 100644
@@ -97,7 +97,11 @@ ivpu_ipc_tx_prepare(struct ivpu_device *vdev, 
 struct ivpu_ipc_consumer *cons,
       memset(tx_buf, 0, sizeof(*tx_buf));
       tx_buf->ipc.data_addr = jsm_vpu_addr;
-    /* TODO: Set data_size to actual JSM message size, not union of 

all messages */
+    /*
+     * Firmware expects full JSM message size regardless of the payload size.
+     * Unused fields must be zeroed to allow future extensions of existing
+     * commands without breaking compatibility.
+     */
      tx_buf->ipc.data_size = sizeof(*req); tx_buf->ipc.channel = cons->channel; tx_buf->ipc.src_node = 0;