public inbox for virtio-comment@lists.linux.dev
 help / color / mirror / Atom feed
From: Sergio Lopez <slp@redhat.com>
To: virtio-comment@lists.linux.dev
Cc: mst@redhat.com, dmitry.osipenko@collabora.com, parav@nvidia.com,
	Sergio Lopez <slp@redhat.com>
Subject: [PATCH v3 2/3] transport-pci: introduce page_shift field for SHM
Date: Mon, 31 Mar 2025 17:37:10 -0400	[thread overview]
Message-ID: <20250331213711.63398-3-slp@redhat.com> (raw)
In-Reply-To: <20250331213711.63398-1-slp@redhat.com>

Borrowing 8 bits from the 16 bit padding in virtio_pci_cap to hold
a page_shift field which is used to derive the page size supported
by the device.

Signed-off-by: Sergio Lopez <slp@redhat.com>
---
 transport-pci.tex | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/transport-pci.tex b/transport-pci.tex
index a5c6719..efb174a 100644
--- a/transport-pci.tex
+++ b/transport-pci.tex
@@ -147,7 +147,8 @@ \subsection{Virtio Structure PCI Capabilities}\label{sec:Virtio Transport Option
         u8 cfg_type;    /* Identifies the structure. */
         u8 bar;         /* Where to find it. */
         u8 id;          /* Multiple capabilities of the same type */
-        u8 padding[2];  /* Pad to full dword. */
+        u8 page_shift;  /* Page shift for this shared memory region. */
+        u8 padding[1];  /* Pad to full dword. */
         le32 offset;    /* Offset within bar. */
         le32 length;    /* Length of the structure, in bytes. */
 };
@@ -222,6 +223,13 @@ \subsection{Virtio Structure PCI Capabilities}\label{sec:Virtio Transport Option
         of a certain type. If the device type does not specify the meaning of
         this field, its contents are undefined.
 
+\item[\field{page_shift}]
+        If \field{cfg_type} is set to VIRTIO_PCI_CAP_SHARED_MEMORY_CFG, the
+        device MUST provide the page shift derived from the supported page size
+        for this shared memory region. The page shift is derived from the page
+        size by using this formula:
+        $page size = 1 << (page shift + 12)$.
+        See also \ref {sec:Basic Facilities of a Virtio Device / Shared Memory Regions / Page alignment restrictions}.
 
 \item[\field{offset}]
         indicates where the structure begins relative to the base address associated
-- 
2.49.0


  parent reply	other threads:[~2025-04-01 11:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 21:37 [PATCH v3 0/3] shared-mem: introduce page alignment restrictions Sergio Lopez
2025-03-31 21:37 ` [PATCH v3 1/3] " Sergio Lopez
2025-04-01 16:42   ` Daniel Verkamp
2025-04-02  7:32   ` Michael S. Tsirkin
2025-03-31 21:37 ` Sergio Lopez [this message]
2025-03-31 21:37 ` [PATCH v3 3/3] transport-mmio: introduce SHMPageShift register Sergio Lopez
2025-04-02  7:37 ` [PATCH v3 0/3] shared-mem: introduce page alignment restrictions Michael S. Tsirkin
2025-04-02  9:18   ` Sergio Lopez Pascual
2025-04-02  9:55     ` Parav Pandit
2025-04-02 12:22       ` Sergio Lopez Pascual
2025-04-02 12:36         ` Parav Pandit
2025-04-02 14:49       ` Michael S. Tsirkin
2025-04-02 16:28         ` Sergio Lopez Pascual
2025-04-02  8:54 ` 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=20250331213711.63398-3-slp@redhat.com \
    --to=slp@redhat.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    --cc=virtio-comment@lists.linux.dev \
    /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