virtio-comment

 View Only

RE: [EXT] [PATCH v9 06/13] admin-cmds-resources: Add device resources admin commands

  • 1.  RE: [EXT] [PATCH v9 06/13] admin-cmds-resources: Add device resources admin commands

    Posted 02-12-2024 03:44


    > From: Satananda Burla <sburla@marvell.com>
    > Sent: Monday, February 12, 2024 12:51 AM
    >
    > Hi Parav
    > > -----Original Message-----
    > > From: Parav Pandit <parav@nvidia.com>
    > > Sent: Tuesday, February 6, 2024 11:23 PM
    > > To: virtio-comment@lists.oasis-open.org; mst@redhat.com;
    > > cohuck@redhat.com
    > > Cc: hengqi@linux.alibaba.com; Satananda Burla <sburla@marvell.com>;
    > > shahafs@nvidia.com; si-wei.liu@oracle.com;
    > > peter.hilber@opensynergy.com; jasowang@redhat.com;
    > > xuanzhuo@linux.alibaba.com; Parav Pandit <parav@nvidia.com>
    > > Subject: [EXT] [PATCH v9 06/13] admin-cmds-resources: Add device
    > > resources admin commands
    > >
    > > External Email
    > > +
    > > +\paragraph{Device Resource Query Command}\label{par:Basic Facilities
    > > +of
    > > a Virtio Device / Device groups / Group
    > > +administration commands / Device Resources / Device Resource Query
    > > Command}
    > > +
    > > +This command reads the existing resource of \field{type} identified
    > > +by \field{rid}, which is previously created using command
    > > +VIRTIO_ADMIN_CMD_RESOURCE_CREATE.
    > > +
    > > +\begin{lstlisting}
    > > +struct virtio_admin_cmd_resource_query_data {
    > > + struct virtio_admin_cmd_resource_cmd_hdr hdr; };
    > > +\end{lstlisting}
    > > +
    > > +\begin{lstlisting}
    > > +struct virtio_admin_cmd_resource_query_result {
    > > + le16 length;
    > > + le16 reserved[6];
    > > + struct virtio_admin_cmd_resource_attr attr; };
    > > +\end{lstlisting}
    > Since this is not fixed size, what happens when the write buffer allocated for
    > this command result does not fit the result? Does device return specific error
    > code?
    It follows the standard admin infrastructure to allow device to truncated as I replied in previous email.
    This continue the backward, forward compat design already in-place.

    Returning error code would break the backward compat.
    For example, old driver with size X bytes, and new device which is capable of X+Y bytes should not fail the command.

    > > +
    > > +For the command VIRTIO_ADMIN_CMD_RESOURCE_QUERY,
    > \field{opcode} is
    > > +set
    > > to 0xc.
    > > +
    > > +\field{group_member_id} refers to the device itself to be accessed.
    > > +\field{type} refers to the device resource type.
    > > +\field{rid} identifies the existing resource of type \field{type}.
    > > +\field{length} refers to the length of the \field{attr}.
    > > +
    > > +When the command completes successfully, the resource information is
    > > returned
    > > +to the driver in \field{attr}. When the optional fields of the
    > > +\field{resource_specific_data} are valid, for each such field a
    > > respective
    > > +resource defined \field{fields_bmap} is set by the device.
    > > +
    >
    > Regards
    > Satananda