All of lore.kernel.org
 help / color / mirror / Atom feed
From: tstark@linux.microsoft.com
To: virtio-comment@lists.oasis-open.org
Cc: grahamwo@microsoft.com, benhill@microsoft.com, mst@redhat.com,
	pankaj.gupta@ionos.com, tstark@microsoft.com, david@redhat.com,
	cohuck@redhat.com
Subject: [PATCH v2 1/1] virtio-pmem: Support describing pmem as shared memory region
Date: Mon, 26 Jul 2021 21:29:07 -0700	[thread overview]
Message-ID: <20210727042907.24315-2-tstark@linux.microsoft.com> (raw)
In-Reply-To: <20210727042907.24315-1-tstark@linux.microsoft.com>

From: Taylor Stark <tstark@microsoft.com>

Update the virtio-pmem RFC spec to add support for describing the pmem region
as a shared memory window. This is required to support virtio-pmem in Hyper-V,
since Hyper-V only allows PCI devices to operate on memory ranges defined via
BARs. When using the virtio PCI transport, shared memory regions are described
via PCI BARs.

Signed-off-by: Taylor Stark <tstark@microsoft.com>
---
 conformance.tex |  1 +
 virtio-pmem.tex | 30 +++++++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/conformance.tex b/conformance.tex
index 33fdac9..8e414eb 100644
--- a/conformance.tex
+++ b/conformance.tex
@@ -201,6 +201,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 
 \begin{itemize}
 \item \ref{devicenormative:Device Types / PMEM Device / Device Initialization}
+\item \ref{drivernormative:Device Types / PMEM Driver / Driver Initialization}
 \item \ref{drivernormative:Device Types / PMEM Driver / Driver Initialization / Direct access}
 \item \ref{drivernormative:Device Types / PMEM Driver / Driver Initialization / Virtio flush}
 \item \ref{drivernormative:Device Types / PMEM Driver / Driver Operation / Virtqueue command}
diff --git a/virtio-pmem.tex b/virtio-pmem.tex
index 04e07bb..9f25664 100644
--- a/virtio-pmem.tex
+++ b/virtio-pmem.tex
@@ -19,7 +19,10 @@ \subsection{Virtqueues}\label{sec:Device Types / PMEM Device / Virtqueues}
 
 \subsection{Feature bits}\label{sec:Device Types / PMEM Device / Feature bits}
 
-There are currently no feature bits defined for this device.
+\begin{description}
+\item[VIRTIO_PMEM_F_SHMEM_REGION (0)] The guest physical address range will be
+indicated as a shared memory region.
+\end{description}
 
 \subsection{Device configuration layout}\label{sec:Device Types / PMEM Device / Device configuration layout}
 
@@ -38,11 +41,11 @@ \subsection{Device configuration layout}\label{sec:Device Types / PMEM Device /
 \subsection{Device Initialization}\label{sec:Device Types / PMEM Device / Device Initialization}
 
 Device hotplugs physical memory to guest address space. Persistent memory device
-is emulated with file backed memory at host side.
-
+is emulated with file backed memory at host side. The device indicates the guest
+physical address to the driver in one of two ways:
 \begin{enumerate}
-\item Guest vpmem start is read from \field{start}.
-\item Guest vpmem end is read from \field{size}.
+\item As a guest absolute address.
+\item As a shared memory region.
 \end{enumerate}
 
 \devicenormative{\subsubsection}{Device Initialization}{Device Types / PMEM Device / Device Initialization}
@@ -50,12 +53,29 @@ \subsection{Device Initialization}\label{sec:Device Types / PMEM Device / Device
 File backed memory SHOULD be memory mapped to guest address space with SHARED
 memory mapping.
 
+If VIRTIO_PMEM_F_SHMEM_REGION has been negotiated, the device MUST indicate the
+guest physical address as a shared memory region. The device MUST use shared
+memory region ID 0. The device SHOULD set \field{start} and \field{size} to zero.
+
+If VIRTIO_PMEM_F_SHMEM_REGION has not been negotiated, the device MUST indicate
+the guest physical address as a guest absolute address. The device MUST set
+\field{start} to the absolute address and \field{size} to the size of the
+address range, in bytes.
+
 \subsection{Driver Initialization}\label{sec:Device Types / PMEM Driver / Driver Initialization}
 
 Driver hotplugs the physical memory and registers associated
 region with the pmem API. Also, configures a flush callback
 function with the corresponding region.
 
+\drivernormative{\subsubsection}{Driver Initialization}{Device Types / PMEM Driver / Driver Initialization}
+
+The driver SHOULD query the physical address ranges where the pmem was mapped.
+If VIRTIO_PMEM_F_SHMEM_REGION has been negotiated, the driver SHOULD query
+shared memory ID 0 for the physical address ranges and MUST NOT use \field{start}
+or \field{size}. Else, the driver SHOULD read the physical address ranges from
+\field{start} and \field{size}.
+
 \drivernormative{\subsubsection}{Driver Initialization: Filesystem direct access}{Device Types / PMEM Driver / Driver Initialization / Direct access}
 
 Driver SHOULD enable filesystem direct access operations for
-- 
2.32.0


  reply	other threads:[~2021-07-27  4:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  4:29 [PATCH v2 0/1] virtio-pmem: Support describing pmem as shared memory region tstark
2021-07-27  4:29 ` tstark [this message]
2021-07-27 15:06   ` [virtio-comment] Re: [PATCH v2 1/1] " Cornelia Huck
2021-07-29  5:04     ` Taylor Stark

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=20210727042907.24315-2-tstark@linux.microsoft.com \
    --to=tstark@linux.microsoft.com \
    --cc=benhill@microsoft.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=grahamwo@microsoft.com \
    --cc=mst@redhat.com \
    --cc=pankaj.gupta@ionos.com \
    --cc=tstark@microsoft.com \
    --cc=virtio-comment@lists.oasis-open.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.