public inbox for virtio-comment@lists.linux.dev
 help / color / mirror / Atom feed
From: Parav Pandit <parav@nvidia.com>
To: <virtio-comment@lists.linux.dev>, <mst@redhat.com>, <cohuck@redhat.com>
Cc: <hengqi@linux.alibaba.com>, <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: [PATCH v11 06/13] admin: Add theory of operation for device resource objects
Date: Tue, 4 Jun 2024 16:28:56 +0300	[thread overview]
Message-ID: <20240604132903.2093195-7-parav@nvidia.com> (raw)
In-Reply-To: <20240604132903.2093195-1-parav@nvidia.com>

The driver controls the device by means of device resource objects.
These operations include create, query, modify, and destroy the device
resource objects.

Fixes: https://github.com/oasis-tcs/virtio-spec/issues/179
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
changelog:
v9->v10:
- grammar corrections with article and others
- rephrase 'device resource' to 'device resource object'
- shifted description of max limit before describing the id
- renamed 'identifier' to 'id'
- rephrase around id
- rephrase from link to depend
- rephrase 'linked resource' to dependent resource
v7->v8:
- added text about administration commands execution rate behavior
---
 admin-cmds-resource-objects.tex | 69 +++++++++++++++++++++++++++++++++
 admin.tex                       |  1 +
 2 files changed, 70 insertions(+)
 create mode 100644 admin-cmds-resource-objects.tex

diff --git a/admin-cmds-resource-objects.tex b/admin-cmds-resource-objects.tex
new file mode 100644
index 0000000..a74cb3b
--- /dev/null
+++ b/admin-cmds-resource-objects.tex
@@ -0,0 +1,69 @@
+\subsubsection{Device resource objects}\label{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device resource objects}
+
+Providing certain functionality consumes limited device resources such as
+memory, processing units, buffer memory, or end-to-end credits. A device may
+support multiple types of resource objects, each controlling different device
+functionality. To manage this, virtio provides
+\field{Device resource objects} that the driver can create, modify, and
+destroy using administration commands with the self group type. Creating and
+destroying a resource object consume and release device resources, respectively.
+The device resource object query command returns the resource object as
+maintained by the device.
+
+For each resource type, the number of resource objects that can be created
+is reported by the device as part of a device capability
+\ref{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device and driver capabilities}.
+The driver reports the desired (same or lower) number of resource objects
+as part of a driver capability \ref{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device and driver capabilities}.
+For each device object type, resource object limit is defined by field
+\field{limit} using \field{Device and driver capabilities}.
+
+\begin{lstlisting}
+le32 limit; /* maximum resource id = limit - 1 */
+\end{lstlisting}
+
+Each resource object has a unique resource object ID - a driver-assigned number
+in the range of 0 to \field{limit - 1}, where the \field{limit} is the maximum
+number set by the driver for this resource object type. These resource IDs are unique within
+each resource object type. The driver assigns the resource ID when creating a
+device resource object. Once the resource object is successfully created,
+subsequent resource modification, query, and destroy commands use this
+resource object ID. No two resource objects share the same ID. Destroying a
+resource object allows for the reuse of its ID for another resource object
+of the same type.
+
+A valid resource object id is \field{limit - 1}. For example, when a device
+reports a \field{limit = 10} capability for a resource object, and drivers sets
+\field{limit = 8}, the valid resource object id range for the device and the
+driver is 0 to 7 for all the resource object commands. In this example,
+the driver can only create 8 resource objects of a specified type.
+
+A resource object of one type may depend on the resource object of another type.
+Such dependency between resource objects is established by referring to the unique
+resource ID in the administration commands. For example, a driver creates a
+resource object identified by ID A of one type, then creates another resource
+object identified by ID B of a different type, which depends on resource object
+A. This dependency establishes the lifecycle of these resource objects. The driver
+that creates the dependent resource object must destroy the resource objects in the
+exact reverse order of their creation. In this example, the driver would
+destroy resource object B before destroying resource object A.
+
+Some resource object types are generic, common across multiple devices.
+Others are specific for one device type.
+
+\begin{tabular}{|l|l|}
+\hline
+Resource object type & Description \\
+\hline \hline
+0x000-0x1ff & Generic resource object type common across all devices \\
+\hline
+0x200-0x4ff & Device type specific resource object \\
+\hline
+0x500-0xffff & Reserved for future use  \\
+\hline
+\end{tabular}
+
+When the device resets, it starts with zero resources of each type; the driver
+can create resources up to the published \field{limit}. The driver can
+destroy and recreate the resource one or multiple times. Upon device reset,
+all resource objects created by the driver are destroyed within the device.
diff --git a/admin.tex b/admin.tex
index c8b3de4..d8a19c4 100644
--- a/admin.tex
+++ b/admin.tex
@@ -317,6 +317,7 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
 
 \input{admin-cmds-legacy-interface.tex}
 \input{admin-cmds-capabilities.tex}
+\input{admin-cmds-resource-objects.tex}
 
 \devicenormative{\subsubsection}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands}
 
-- 
2.34.1


  parent reply	other threads:[~2024-06-04 13:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 13:28 [PATCH v11 00/13] flow filter using basic facilities of capability and resource objects Parav Pandit
2024-06-04 13:28 ` [PATCH v11 01/13] admin: Introduce self group Parav Pandit
2024-06-04 13:28 ` [PATCH v11 02/13] admin: Use already defined names for the legacy commands Parav Pandit
2024-06-04 13:28 ` [PATCH v11 03/13] admin: Add theory of operation for capability admin commands Parav Pandit
2024-06-04 13:28 ` [PATCH v11 04/13] admin: Prepare table for multipage listing Parav Pandit
2024-06-04 13:28 ` [PATCH v11 05/13] admin: Add capability admin commands Parav Pandit
2024-06-04 13:28 ` Parav Pandit [this message]
2024-06-04 13:28 ` [PATCH v11 07/13] admin: Add device resource objects " Parav Pandit
2024-06-04 13:28 ` [PATCH v11 08/13] virtio-net: Add theory of operation for flow filter Parav Pandit
2024-06-04 13:28 ` [PATCH v11 09/13] virtio-net: Add flow filter capability Parav Pandit
2025-11-18 22:09   ` Michael S. Tsirkin
2025-11-19  3:31     ` Parav Pandit
2024-06-04 13:29 ` [PATCH v11 10/13] virtio-net: Add flow filter group, classifier and rule resource objects Parav Pandit
2024-06-04 13:29 ` [PATCH v11 11/13] virtio-net: Add flow filter device and driver requirements Parav Pandit
2024-06-04 13:29 ` [PATCH v11 12/13] newdevice: Improve the appendix chapter heading to reflect the content Parav Pandit
2024-06-04 13:29 ` [PATCH v11 13/13] newdevice: Extend informative guidance on capability, resource objects Parav Pandit
2024-06-04 17:16 ` [EXTERNAL] [PATCH v11 00/13] flow filter using basic facilities of capability and " Satananda Burla
     [not found] ` <691016c0-b8e4-48f0-a26b-45296102f501@davidwei.uk>
2025-03-03 19:59   ` Michael S. Tsirkin
     [not found]     ` <8aafe201-db57-4ab0-868e-2216b2d03987@davidwei.uk>
2025-03-04  8:50       ` Michael S. Tsirkin
2025-03-04  3:48   ` Parav Pandit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240604132903.2093195-7-parav@nvidia.com \
    --to=parav@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=hengqi@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.hilber@opensynergy.com \
    --cc=sburla@marvell.com \
    --cc=shahafs@nvidia.com \
    --cc=si-wei.liu@oracle.com \
    --cc=virtio-comment@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox