]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/nouveau: refine the variable names in r535_gsp_rpc_push()
authorZhi Wang <zhiw@nvidia.com>
Fri, 24 Jan 2025 18:29:52 +0000 (10:29 -0800)
committerDanilo Krummrich <dakr@kernel.org>
Fri, 24 Jan 2025 23:55:10 +0000 (00:55 +0100)
The variable names in r535_gsp_rpc_push() are quite confusing and some
of them are not representing what they really are.

Update the names and explanations in the decoder section of the
kernel doc. Refine the names to align with the terms in the kernel doc.

No functional change is intended.

Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250124182958.2040494-10-zhiw@nvidia.com
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c

index 78b5dc66f9e0131603b4a00a6a74e5dee8ac2fcc..c28bb1b4f00f68303af4574556bbcc2268416133 100644 (file)
@@ -108,6 +108,9 @@ extern struct dentry *nouveau_debugfs_root;
  *
  * Terminology:
  *
+ * - gsp_msg(msg): GSP message element (element header + GSP RPC header +
+ *   payload)
+ * - gsp_rpc(rpc): GSP RPC (RPC header + payload)
  * - gsp_rpc_len: size of (GSP RPC header + payload)
  * - params_size: size of params in the payload
  * - payload_size: size of (header if exists + params) in the payload
@@ -795,30 +798,30 @@ r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *payload, bool wait,
                  u32 gsp_rpc_len)
 {
        struct nvfw_gsp_rpc *rpc = to_gsp_hdr(payload, rpc);
-       struct r535_gsp_msg *cmd = to_gsp_hdr(rpc, cmd);
-       const u32 max_msg_size = GSP_MSG_MAX_SIZE - sizeof(*cmd);
-       const u32 max_rpc_size = max_msg_size - sizeof(*rpc);
-       u32 rpc_size = rpc->length - sizeof(*rpc);
+       struct r535_gsp_msg *msg = to_gsp_hdr(rpc, msg);
+       const u32 max_rpc_size = GSP_MSG_MAX_SIZE - sizeof(*msg);
+       const u32 max_payload_size = max_rpc_size - sizeof(*rpc);
+       u32 payload_size = rpc->length - sizeof(*rpc);
        void *repv;
 
        mutex_lock(&gsp->cmdq.mutex);
-       if (rpc_size > max_rpc_size) {
+       if (payload_size > max_payload_size) {
                const u32 fn = rpc->function;
 
                /* Adjust length, and send initial RPC. */
-               rpc->length = sizeof(*rpc) + max_rpc_size;
-               cmd->checksum = rpc->length;
+               rpc->length = sizeof(*rpc) + max_payload_size;
+               msg->checksum = rpc->length;
 
                repv = r535_gsp_rpc_send(gsp, payload, false, 0);
                if (IS_ERR(repv))
                        goto done;
 
-               payload += max_rpc_size;
-               rpc_size -= max_rpc_size;
+               payload += max_payload_size;
+               payload_size -= max_payload_size;
 
                /* Remaining chunks sent as CONTINUATION_RECORD RPCs. */
-               while (rpc_size) {
-                       u32 size = min(rpc_size, max_rpc_size);
+               while (payload_size) {
+                       u32 size = min(payload_size, max_payload_size);
                        void *next;
 
                        next = r535_gsp_rpc_get(gsp, NV_VGPU_MSG_FUNCTION_CONTINUATION_RECORD, size);
@@ -834,7 +837,7 @@ r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *payload, bool wait,
                                goto done;
 
                        payload += size;
-                       rpc_size -= size;
+                       payload_size -= size;
                }
 
                /* Wait for reply. */