[PATCH] [v5] nouveau: add command-line GSP-RM registry support

Timur Tabi ttabi at nvidia.com
Mon Apr 15 16:57:51 UTC 2024


On Mon, 2024-04-15 at 16:06 +0000, Timur Tabi wrote:


+       u32 dword;                              /* TYPE_DWORD */

+       u8 binary[] __counted_by(vlen); /* TYPE_BINARY or TYPE_STRING */


NIT: Can't we put these two into a union?

Sure.

It turns out that it can't be a union:


drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1125:20: error: flexible array member in union

 1125 |                 u8 binary[] __counted_by(vlen); /* TYPE_BINARY or TYPE_STRING */

      |                    ^~~~~~


... it can't be vlen here because the value has to be '4' for dwords, and 'vlen' is 0 for dwords.


I also noticed a bug that is relevant:

+static void build_registry(struct nvkm_gsp *gsp, PACKED_REGISTRY_TABLE *registry)
+{
+ struct registry_list_entry *reg, *n;
+ size_t str_offset;
+ unsigned int i = 0;
+
+ registry->numEntries = list_count_nodes(&gsp->registry_list);
+ str_offset = struct_size(registry, entries, registry->numEntries);
+
+ list_for_each_entry_safe(reg, n, &gsp->registry_list, head) {
+ registry->entries[i].type = reg->type;
+ registry->entries[i].length = reg->klen;

This is supposed to be reg->vlen.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20240415/ccb3bcb9/attachment.htm>


More information about the Nouveau mailing list