[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [PATCH v1 5/8] admin: Add requirements of device migration commands
Add device and driver side requirements for the device migration commands. Fixes: https://github.com/oasis-tcs/virtio-spec/issues/176 Signed-off-by: Parav Pandit <parav@nvidia.com> --- admin-cmds-device-migration.tex | 102 ++++++++++++++++++++++++++++++++ admin.tex | 14 ++++- 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/admin-cmds-device-migration.tex b/admin-cmds-device-migration.tex index b7bfc09..88e1af9 100644 --- a/admin-cmds-device-migration.tex +++ b/admin-cmds-device-migration.tex @@ -291,3 +291,105 @@ \subsubsection{Device Migration}\label{sec:Basic Facilities of a Virtio Device / the device returns new device context entry. Once the device context is discarded, subsequent VIRTIO_ADMIN_CMD_DEV_CTX_WRITE command writes a new device context. + +\devicenormative{\paragraph}{Device Migration}{Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device Migration} + +A device MUST either support all of, or none of +VIRTIO_ADMIN_CMD_DEV_MODE_GET, +VIRTIO_ADMIN_CMD_DEV_MODE_SET, +VIRTIO_ADMIN_CMD_DEV_CTX_SIZE_GET, +VIRTIO_ADMIN_CMD_DEV_READ, +VIRTIO_ADMIN_CMD_DEV_WRITE and +VIRTIO_ADMIN_CMD_DEV_CTX_DISCARD commands. + +When the device \field{mode} supplied in the command +VIRTIO_ADMIN_CMD_DEV_MODE_SET is same as what the mode in the device, the device +MUST complete the command successfully. + +The device MUST fail the command VIRTIO_ADMIN_CMD_DEV_MODE_SET when the \field{mode} +is other than \field{Active} or \field{Stop} or \field{Freeze}. + +When changing the device mode using the command VIRTIO_ADMIN_CMD_DEV_MODE_SET, +if the command fails, the device MUST retain the current device mode. + +The device MUST fail VIRTIO_ADMIN_CMD_DEV_MODE_SET command when \field{mode} +is set to \field{Active} or \field{Stop} and if the device context is +partially read or written using VIRTIO_ADMIN_CMD_DEV_CTX_READ and +VIRTIO_ADMIN_CMD_DEV_CTX_WRITE commands respectively. + +When VIRTIO_ADMIN_CMD_DEV_CTX_READ command is received multiple times +in a given mode, and when the complete device context is already read by the +driver, on subsequent reception of command VIRTIO_ADMIN_CMD_DEV_CTX_READ, +the device MUST complete the command successfully with +\field{context_len} set to zero. + +The device MUST support reading the device context when the device is +in any mode \field{Active} or \field{Stop} or \field{Freeze} using command +VIRTIO_ADMIN_CMD_DEV_CTX_READ. + +When the device is in any of the mode, and if the device context is read +partially using VIRTIO_ADMIN_CMD_DEV_CTX_READ command, the device MUST discard +the device context when VIRTIO_ADMIN_CMD_DEV_CTX_DISCARD command is executed; +In subsequent execution of VIRTIO_ADMIN_CMD_DEV_CTX_READ and +VIRTIO_ADMIN_CMD_DEV_CTX_SIZE_GET, the device MUST return the remaining +estimated device context size and the device context respectively for the +current mode as if VIRTIO_ADMIN_CMD_DEV_CTX_READ was never received by the +device for the current device mode. + +The device MUST support writing the complete device context multiple times +by the command VIRTIO_ADMIN_CMD_DEV_CTX_WRITE. + +The device MUST fail VIRTIO_ADMIN_CMD_DEV_CTX_WRITE command when the device +mode is not \field{Freeze}. + +When the device is in \field{Freeze} mode, and if any device context is +written partially by VIRTIO_ADMIN_CMD_DEV_CTX_WRITE, the device MUST discard +the device context when VIRTIO_ADMIN_CMD_DEV_CTX_DISCARD +command is executed, i.e. the device functions as if the command +VIRTIO_ADMIN_CMD_DEV_CTX_WRITE was never received. + +For the SR-IOV group type, when the device context is read using +VIRTIO_ADMIN_CMD_DEV_CTX_READ from one device and written to the anoother device +using VIRTIO_ADMIN_CMD_DEV_CTX_WRITE, the driver MUST read and write +device context only if the device PCI subsystem vendor id and device id +match for both the devices. + +For the SR-IOV group type, a function level reset(FLR) operation MUST set the +device mode to \field{Active}. + +For the SR-IOV group type, when the device is in \field{Freeze} mode, any +write access to configuration space MUST not update any fields and any +configuration space read MAY return any value. + +For the SR-IOV group type, regardless of the membe device \field{mode}, all +the PCI transport level registers MUST be always accessible and the member device +MUST function the same way for all the PCI transport level registers +regardless of the member device mode. + +For the SR-IOV group type, for the VIRTIO_PCI_CAP_PCI_CFG capability area, +the device MUST ignore writes when the device mode is set to \field{Freeze} +and on receiving the reads, the device MUST function same regardless of the +device mode is \field{Active} or \field{Stop} or \field{Freeze}. + +\drivernormative{\paragraph}{Device Migration}{Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device Migration} + +The driver SHOULD read the complete device context using one or multiple +VIRTIO_ADMIN_CMD_DEV_CTX_READ commands. + +The driver MAY write the device context before changing the device mode from +\field{Freeze} to \field{Stop} or from \field{Freeze} to \field{Active}; +the driver MUST write a complete device context using one or multiple +VIRTIO_ADMIN_CMD_DEV_CTX_WRITE commands. + +The driver MUST NOT change the device mode to \field{Stop} or \field{Active} +in the command VIRTIO_ADMIN_CMD_DEV_MODE_SET when device context is +partially written. + +For the SR-IOV group type, the driver SHOULD NOT access device configuration +space described in section +\ref{sec:Basic Facilities of a Virtio Device / Device Configuration Space} +when the device mode is set to \field{Freeze}. + +For the SR-IOV group type, the driver MUST NOT write into the +VIRTIO_PCI_CAP_PCI_CFG capability area when the device mode is set to +\field{Freeze}. diff --git a/admin.tex b/admin.tex index c86813d..3429c4e 100644 --- a/admin.tex +++ b/admin.tex @@ -126,7 +126,19 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti \hline 0x0006 & VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO & Query the notification region information \\ \hline -0x0007 - 0x7FFF & - & Commands using \field{struct virtio_admin_cmd} \\ +0x0007 & VIRTIO_ADMIN_CMD_DEV_MODE_GET & Query the device mode \\ +\hline +0x0008 & VIRTIO_ADMIN_CMD_DEV_MODE_SET & Set the device mode \\ +\hline +0x0009 & VIRTIO_ADMIN_CMD_DEV_CTX_SIZE_GET & Query the device context size \\ +\hline +0x000a & VIRTIO_ADMIN_CMD_DEV_CTX_READ & Read the device context data \\ +\hline +0x000b & VIRTIO_ADMIN_CMD_DEV_CTX_WRITE & Write the device context data \\ +\hline +0x000c & VIRTIO_ADMIN_CMD_DEV_CTX_DISCARD & Clear the device context data \\ +\hline +0x000d - 0x7FFF & - & Commands using \field{struct virtio_admin_cmd} \\ \hline 0x8000 - 0xFFFF & - & Reserved for future commands (possibly using a different structure) \\ \hline -- 2.34.1
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]