Re: [PATCH 2/2] gpu: nova-core: add fwctl driver for firmware control interface
From: Joel Fernandes
Date: Mon Mar 30 2026 - 13:46:38 EST
On 3/30/2026 8:58 AM, Jason Gunthorpe wrote:
> On Thu, Mar 05, 2026 at 07:09:36PM +0000, Zhi Wang wrote:
>> + let rm_cmd = match cmd {
>> + uapi::fwctl_cmd_nova_core_FWCTL_CMD_NOVA_CORE_UPLOAD_VGPU_TYPE => {
>> + RmControlMsgFunction::VgpuMgrInternalPgpuAddVgpuType
>> + }
>> + _ => return Err(EINVAL),
>> + };
>
> fwctl drivers should not be changing the commands as they flow
> through, the idea is to put the raw command mailbox directly into the
> FW, and only access control them. So userspace should be setting the
> NV2080_CTRL_CMD_VGPU_MGR_INTERNAL_PGPU_ADD_VGPU_TYPE constant directly
> and it should be ABI stable.
Just trying to confirm my understanding: Doesn't that mean
NV2080_CTRL_CMD_VGPU_MGR_INTERNAL_PGPU_ADD_VGPU_TYPE becomes a part of UAPI
then? On the one hand, there is the argument that userspace should not deal with
GSP-RM specific commands directly (lest they change in the future or get removed
or whatever, and nova-core is the abstraction. On the other hand, I think idea
behind fwctl is as Jason put it above. So which path is correct and makes sense
for nova-core?
>> +/**
>> + * struct fwctl_rpc_nova_core_request_hdr - ioctl(FWCTL_RPC) input header
>> + * @cmd: Command identifier from &enum fwctl_cmd_nova_core.
>> + * @mctp_header: MCTP transport header (packed u32).
>> + * @nvdm_header: NVDM vendor-defined message header (packed u32).
>> + *
>> + * Placed at &struct fwctl_rpc.in with total length &struct fwctl_rpc.in_len.
>> + * The access scope is specified through &struct fwctl_rpc.scope.
>> + * Followed by command-specific input parameters.
>> + */
>> +struct fwctl_rpc_nova_core_request_hdr {
>> + __u32 mctp_header;
>> + __u32 nvdm_header;
>> + __u32 cmd;
>> +};
>> +
>> +/**
>> + * struct fwctl_rpc_nova_core_resp_hdr - ioctl(FWCTL_RPC) output header
>> + * @mctp_header: MCTP transport header (packed u32).
>> + * @nvdm_header: NVDM vendor-defined message header (packed u32).
>> + *
>> + * Placed at &struct fwctl_rpc.out with total length &struct fwctl_rpc.out_len.
>> + * Followed by command-specific output parameters.
>> + */
>> +struct fwctl_rpc_nova_core_resp_hdr {
>> + __u32 mctp_header;
>> + __u32 nvdm_header;
>> +};
>
> I'm also confused what this is about, are these headers words from the
> FW definition?
These are transport-layer headers for the GSP RPC message queue, MCTP provides
packet framing (it is a standard protocol like networking protocols) and NVDM is
NVIDIA specific header carried inside MCTP. IMO they are internal to the
nova-core <-> GSP transport and should be filled in by the kernel driver, not
exposed to userspace.
Thanks.