drm/nouveau: support handling the return of large GSP message
authorZhi Wang <zhiw@nvidia.com>
Fri, 24 Jan 2025 18:29:57 +0000 (10:29 -0800)
committerDanilo Krummrich <dakr@kernel.org>
Fri, 24 Jan 2025 23:55:10 +0000 (00:55 +0100)
commit50f290053d79e3b1d108f181c0ba6b8e30ca94c9
tree0b417d95827627fb77e04087ccff8d33eb761e34
parent3c48ecb38a736bf457233dc6869e305aee6d52f9
drm/nouveau: support handling the return of large GSP message

The max GSP message element size is 16 pages (including the headers). To
send a message larger than 16 pages, nvkm should split it into multiple
and send them accordingly. The first element has the expected function
number, while the rest are sent with function number as
NV_VGPU_MSG_FUNCTION_CONTINUATION_RECORD. GSP consumes the elements from
the cmdq and always writes the result back to the msgq. The result is also
formed as split elements.

However, nvkm is able to split the large GSP message and send them, but
totally not aware of handling the return of the large GSP message, which
are the split elements in the msgq. Thus, it keeps dumping the unknown RPC
messages from msgq, which is actually CONTINUATION_RECORD message,
discard them unexpectedly. Thus, the caller will not be able to consume
the result from GSP.

Introduce the handling of the return of large GSP message on the msgq path.
Slightly re-factor the low-level part of msg receiving routines. Merge the
split elements back into a large element before handling it to the upper
level. Thus, the upper-level of GSP RPC APIs don't need to be heavily
changed.

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-15-zhiw@nvidia.com
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c