Re: [Nouveau] [PATCH 3/3] nouveau/gsp: add some basic registry entries.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 31, 2023 at 12:20 AM Dave Airlie <airlied@xxxxxxxxx> wrote:
>         rpc->size = sizeof(*rpc);
> -       rpc->numEntries = 1;
> -       rpc->entries[0].nameOffset = offsetof(typeof(*rpc), entries[1]);
> -       rpc->entries[0].type = 1;
> -       rpc->entries[0].data = 0;
> -       rpc->entries[0].length = 4;
> -
> -       strings = (char *)&rpc->entries[1];
> -       strings[0] = '\0';
> +       rpc->numEntries = NV_GSP_REG_NUM_ENTRIES;
> +
> +       str_offset = offsetof(typeof(*rpc), entries[NV_GSP_REG_NUM_ENTRIES]);
> +       strings = (char *)&rpc->entries[NV_GSP_REG_NUM_ENTRIES];
> +       for (i = 0; i < NV_GSP_REG_NUM_ENTRIES; i++) {
> +               int name_len = strlen(r535_registry_entries[i].name) + 1;
> +               rpc->entries[i].nameOffset = str_offset;
> +               rpc->entries[i].type = 1;
> +               rpc->entries[i].data = r535_registry_entries[i].value;
> +               rpc->entries[i].length = 4;
> +               memcpy(strings, r535_registry_entries[i].name, name_len);
> +               strings += name_len;
> +               str_offset += name_len;
> +       }

I'm working on a patch that replaces this code with a
dynamically-generated registry so that we can set registry keys via
the driver's command-line (like the Nvidia driver).  However, you have
a bug here.  rpc->size must be the total size of the RPC, including
all the PACKED_REGISTRY_ENTRY structs and the strings that follow
them.  You can see this by looking at RmPackageRegistry() and
regCountEntriesAndSize() in OpenRM.




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux