[virtio-dev] [PATCH v12 3/3] admin: Add group member legacy register access commands

2023-07-06 Thread Parav Pandit
Introduce group member legacy common configuration and legacy device
configuration access read/write commands.

Group member legacy registers access commands enable group owner driver
software to access legacy registers on behalf of the guest virtual
machine.

Usecase:

1. A hypervisor/system needs to provide transitional
   virtio devices to the guest VM at scale of thousands,
   typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a
   vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of
   virtio device type (net/blk) and be future compatible with a
   single vfio stack using SR-IOV or other scalable device
   virtualization technology to map PCI devices to the guest VM.
   (as transitional or otherwise)

Motivation/Background:
=
The existing virtio transitional PCI device is missing support for
PCI SR-IOV based devices. Currently it does not work beyond
PCI PF, or as software emulated device in reality. Currently it
has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from
the physical-memory address space. The I/O address space consists
of 64K individually addressable 8-bit I/O ports, numbered 0 through H.

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be
aligned to a 4 KB boundary.

Overview:
=
Above usecase requirements is solved by PCI PF group owner accessing
its group member PCI VFs legacy registers using the administration
commands of the group owner PCI PF.

Two types of administration commands are added which read/write PCI VF
registers.

Software usage example:
===

1. One way to use and map to the guest VM is by using vfio driver
framework in Linux kernel.

+--+
|pci_dev_id = 0x100X   |
+---|pci_rev_id = 0x0  |-+
|vfio device|BAR0 = I/O region | |
|   |Other attributes  | |
|   +--+ |
||
+   +--+ +-+ |
|   |I/O BAR to AQ | | Other vfio  | |
|   |rd/wr mapper& | | functionalities | |
|   | forwarder| | | |
|   +--+ +-+ |
||
+--+-+---+
   | |
   Config region |
 accessDriver notifications
   | |
  +++   +++
  | +-+ |   | PCI VF device A |
  | | AQ  |-+>+-+ |
  | +-+ |   |   | | legacy regs | |
  | PCI PF device   |   |   | +-+ |
  +-+   |   +-+
|
|   +++
|   | PCI VF device N |
+>+-+ |
| | legacy regs | |
| +-+ |
+-+

2. Continue to use the virtio pci driver to bind to the
   listed device id and use it as in the host.

3. Use it in a light weight hypervisor to run bare-metal OS.

Fixes: https://github.com/oasis-tcs/virtio-spec/issues/167
Signed-off-by: Parav Pandit 
---
changelog:
v11->v12:
- added missing article the at few places
- rewrote group_member_id statements like other existing
  commands which is cleaner and shorter
- added length and alignment lines to multiple commands
- rewrote fast path to separate dedicated mechanism
- rewrote example and description para for legacy notification command
- made separate paragraph for the notify info command
- dropped citation to virtio pci capabilities for member device
- notification region changed to notification address throughout
- added description to all the fields of the info struct
- avoided union in spirit of keeping all for pci
- used single listing
- moved description to end which was in between two structs
- added 4 entry and preference description
- added conformance line for notification via mmio works same way as
  admin command
v10->v11:
- replaced tab with white spaces in read structure
- included pci fields along side other generic fields to avoid
  indirection
- merged pci conformance section
- avoid using definite in starting introduction
- replace 'all of the' with 'any of the'
- changed drivers notification normative to indicate use of
  NOTIFY_INFO command
- renamed NOTIFY_QUERY to NOTIFY_INFO name
- merged 4th patch with 3rd
- added normative line for 

[virtio-dev] [PATCH v12 1/3] admin: Split opcode table rows with a line

2023-07-06 Thread Parav Pandit
Currently all opcode appears to be in a single row.
Separate them with a line similar to other tables.

Signed-off-by: Parav Pandit 
Reviewed-by: Cornelia Huck 

---
changelog:
v2->v3:
- new patch
---
 admin.tex | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/admin.tex b/admin.tex
index 2efd4d7..e51f9e6 100644
--- a/admin.tex
+++ b/admin.tex
@@ -114,7 +114,9 @@ \subsection{Group administration commands}\label{sec:Basic 
Facilities of a Virti
 opcode & Name & Command Description \\
 \hline \hline
 0x & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands 
supported for this group type\\
+\hline
 0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used 
for this group type \\
+\hline
 0x0002 - 0x7FFF & - & Commands using \field{struct virtio_admin_cmd}\\
 \hline
 0x8000 - 0x & - & Reserved for future commands (possibly using a different 
structure)\\
-- 
2.26.2


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v11 3/3] admin: Add group member legacy register access commands

2023-07-06 Thread Parav Pandit

> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 6:36 PM

[..]

> I notice you decided to silently ignore my suggestion to document how are
> notifications performed. Repeating myself like this is despiriting for me.
I am sorry if it appeared that way,
But no, I didn’t silently ignored.

I added the description as best I could find it, but you commented about it 
being messy with mixing up the terminology.
I rewrote it in v12, it looks better now. Please check.

> Pls re-add especially since you already document it for the cfg_Write access
> method anyway.
> 
Added without citation to hypervisor etc.

> 
> also in a conformance section, document the effect of notification being the
> same as notification through legacy interface.

PCI specific things were copied from the current spec reference in the 
notification capability section.
All the changes you suggested are done.
Captured in the change log of v12.

Thanks a lot.
Since many parts are rewritten as you suggested in the thread, 
I prefer to add your Signed-off to in v13 if we need roll it or when it is 
merged, please apply if you find it appropriate.
It is at least important to me to add it yours Sign-off.


[virtio-dev] [PATCH v12 0/3] admin: Access legacy registers using admin commands

2023-07-06 Thread Parav Pandit
This short series introduces legacy registers access commands for the owner
group member access the legacy registers of the member VFs.
This short series introduces legacy region access commands by the group owner
device for its member devices.
Currently it is applicable to the PCI PF and VF devices. If in future any
SIOV devices to support legacy registers, they can be easily supported using
same commands by using the group member identifiers of the future SIOV devices.

More details as overview, motivation, use case are further described
below.

Patch summary:
--
patch-1 fix split rows of admin opcode tables by a line
patch-2 fix section numbering
patch-3 add legacy region access commands

It uses the newly introduced administration command facility with 4 new
commands and a new optional command to query the legacy notification region.

Usecase:

1. A hypervisor/system needs to provide transitional
   virtio devices to the guest VM at scale of thousands,
   typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a
   vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of
   virtio device type (net/blk) and be future compatible with a
   single vfio stack using SR-IOV or other scalable device
   virtualization technology to map PCI devices to the guest VM.
   (as transitional or otherwise)

Motivation/Background:
--
The existing virtio transitional PCI device is missing support for
PCI SR-IOV based devices. Currently it does not work beyond
PCI PF, or as software emulated device in reality. Currently it
has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from
the physical-memory address space. The I/O address space consists
of 64K individually addressable 8-bit I/O ports, numbered 0 through H.

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be
aligned to a 4 KB boundary.

Overview:
-
Above usecase requirements is solved by PCI PF group owner accessing
its group member PCI VFs legacy registers using an admin virtqueue of
the group owner PCI PF.

Two new admin virtqueue commands are added which read/write PCI VF
registers.

Software usage example:
---
One way to use and map to the guest VM is by using vfio driver
framework in Linux kernel.

+--+
|pci_dev_id = 0x100X   |
+---|pci_rev_id = 0x0  |-+
|vfio device|BAR0 = I/O region | |
|   |Other attributes  | |
|   +--+ |
||
+   +--+ +-+ |
|   |I/O BAR to AQ | | Other vfio  | |
|   |rd/wr mapper  | | functionalities | |
|   +--+ +-+ |
||
+--+-+---+
   | |
   Legacy regionDriver notification
access   |
   | |
  +++   +++
  | +-+ |   | PCI VF device A |
  | | AQ  |-+>+-+ |
  | +-+ |   |   | | legacy regs | |
  | PCI PF device   |   |   | +-+ |
  +-+   |   +-+
|
|   +++
|   | PCI VF device N |
+>+-+ |
| | legacy regs | |
| +-+ |
+-+

2. Virtio pci driver to bind to the listed device id and
   use it in the host.

3. Use it in a light weight hypervisor to run bare-metal OS.

Please review.

Alternatives considered:

1. Exposing BAR0 as MMIO BAR that follows legacy registers template
Pros:
a. Kind of works with legacy drivers as some of them have used API
   which is agnostic to MMIO vs IOBAR.
b. Does not require hypervisor intervantion
Cons:
a. Device reset is extremely hard to implement in device at scale as
   driver does not wait for device reset completion
b. Device register width related problems persist that hypervisor if
   wishes, it cannot be fixed.

2. Accessing VF registers by tunneling it through new legacy PCI capability
Pros:
a. Self contained, but cannot work with future PCI SIOV devices
Cons:
a. Equally slow as AQ access
b. Still requires new capability for notification access
c. Requires hardware to build low level registers access which is not worth
   for long term future

3. 

[virtio-dev] [PATCH v12 2/3] admin: Fix section numbering

2023-07-06 Thread Parav Pandit
Requirements are put one additional level down. Fix it.

Signed-off-by: Parav Pandit 
Reviewed-by: Cornelia Huck 
---
changelog:
v9->v10:
- addressed comments from Cornelia
- fixed requirements for administration virtqueue section
v4->v5:
- new patch
---
 admin.tex | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/admin.tex b/admin.tex
index e51f9e6..b0a1a91 100644
--- a/admin.tex
+++ b/admin.tex
@@ -286,7 +286,7 @@ \subsection{Group administration commands}\label{sec:Basic 
Facilities of a Virti
 supporting multiple group types, the list of supported commands
 might differ between different group types.
 
-\devicenormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Device groups / Group administration commands}
+\devicenormative{\subsubsection}{Group administration commands}{Basic 
Facilities of a Virtio Device / Device groups / Group administration commands}
 
 The device MUST validate \field{opcode}, \field{group_type} and
 \field{group_member_id}, and if any of these has an invalid or
@@ -378,7 +378,7 @@ \subsection{Group administration commands}\label{sec:Basic 
Facilities of a Virti
 \field{VF Enable} refer to registers within the SR-IOV Extended
 Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
 
-\drivernormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Device groups / Group administration commands}
+\drivernormative{\subsubsection}{Group administration commands}{Basic 
Facilities of a Virtio Device / Device groups / Group administration commands}
 
 The driver MAY discover whether device supports a specific group type
 by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching
@@ -506,7 +506,7 @@ \section{Administration Virtqueues}\label{sec:Basic 
Facilities of a Virtio Devic
 tail of a structure, with the driver/device using the full
 structure without concern for versioning.
 
-\devicenormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
+\devicenormative{\subsection}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
 
 The device MUST support device-readable and device-writeable buffers
 shorter than described in this specification, by
@@ -555,7 +555,7 @@ \section{Administration Virtqueues}\label{sec:Basic 
Facilities of a Virtio Devic
 or VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOT
 have any side effects, making it safe to retry.
 
-\drivernormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
+\drivernormative{\subsection}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
 
 The driver MAY supply device-readable or device-writeable parts
 of \field{struct virtio_admin_cmd} that are longer than described in
-- 
2.26.2


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v11 0/3] admin: Access legacy registers using admin commands

2023-07-06 Thread Michael S. Tsirkin
On Fri, Jul 07, 2023 at 12:27:19AM +0300, Parav Pandit wrote:
> This short series introduces legacy registers access commands for the owner
> group member access the legacy registers of the member VFs.
> This short series introduces legacy region access commands by the group owner
> device for its member devices.
> Currently it is applicable to the PCI PF and VF devices. If in future any
> SIOV devices to support legacy registers, they can be easily supported using
> same commands by using the group member identifiers of the future SIOV 
> devices.
> 
> More details as overview, motivation, use case are further described
> below.

corneli want to apply 1,2 as editorial?

> Patch summary:
> --
> patch-1 split rows of admin opcode tables by a line
> patch-2 fix section numbering
> patch-3 add legacy region access commands
> 
> It uses the newly introduced administration command facility with 4 new
> commands and a new optional command to query the legacy notification region.
> 
> Usecase:
> 
> 1. A hypervisor/system needs to provide transitional
>virtio devices to the guest VM at scale of thousands,
>typically, one to eight devices per VM.
> 
> 2. A hypervisor/system needs to provide such devices using a
>vendor agnostic driver in the hypervisor system.
> 
> 3. A hypervisor system prefers to have single stack regardless of
>virtio device type (net/blk) and be future compatible with a
>single vfio stack using SR-IOV or other scalable device
>virtualization technology to map PCI devices to the guest VM.
>(as transitional or otherwise)
> 
> Motivation/Background:
> --
> The existing virtio transitional PCI device is missing support for
> PCI SR-IOV based devices. Currently it does not work beyond
> PCI PF, or as software emulated device in reality. Currently it
> has below cited system level limitations:
> 
> [a] PCIe spec citation:
> VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.
> 
> [b] cpu arch citiation:
> Intel 64 and IA-32 Architectures Software Developer’s Manual:
> The processor’s I/O address space is separate and distinct from
> the physical-memory address space. The I/O address space consists
> of 64K individually addressable 8-bit I/O ports, numbered 0 through H.
> 
> [c] PCIe spec citation:
> If a bridge implements an I/O address range,...I/O address range will be
> aligned to a 4 KB boundary.
> 
> Overview:
> -
> Above usecase requirements is solved by PCI PF group owner accessing
> its group member PCI VFs legacy registers using an admin virtqueue of
> the group owner PCI PF.
> 
> Two new admin virtqueue commands are added which read/write PCI VF
> registers.
> 
> Software usage example:
> ---
> One way to use and map to the guest VM is by using vfio driver
> framework in Linux kernel.
> 
> +--+
> |pci_dev_id = 0x100X   |
> +---|pci_rev_id = 0x0  |-+
> |vfio device|BAR0 = I/O region | |
> |   |Other attributes  | |
> |   +--+ |
> ||
> +   +--+ +-+ |
> |   |I/O BAR to AQ | | Other vfio  | |
> |   |rd/wr mapper  | | functionalities | |
> |   +--+ +-+ |
> ||
> +--+-+---+
>| |
>Legacy regionDriver notification
> access   |
>| |
>   +++   +++
>   | +-+ |   | PCI VF device A |
>   | | AQ  |-+>+-+ |
>   | +-+ |   |   | | legacy regs | |
>   | PCI PF device   |   |   | +-+ |
>   +-+   |   +-+
> |
> |   +++
> |   | PCI VF device N |
> +>+-+ |
> | | legacy regs | |
> | +-+ |
> +-+
> 
> 2. Virtio pci driver to bind to the listed device id and
>use it in the host.
> 
> 3. Use it in a light weight hypervisor to run bare-metal OS.
> 
> Please review.
> 
> Alternatives considered:
> 
> 1. Exposing BAR0 as MMIO BAR that follows legacy registers template
> Pros:
> a. Kind of works with legacy drivers as some of them have used API
>which is agnostic to MMIO vs IOBAR.
> b. Does not require hypervisor intervantion
> Cons:
> a. Device reset is extremely hard to implement in device at scale as
>driver does not wait for device reset completion
> b. Device register width related problems persist that hypervisor if
>wishes, it cannot be fixed.
> 
> 

[virtio-dev] Re: [PATCH v11 3/3] admin: Add group member legacy register access commands

2023-07-06 Thread Michael S. Tsirkin
On Fri, Jul 07, 2023 at 12:27:22AM +0300, Parav Pandit wrote:
> Introduce group member legacy common configuration and legacy device
> configuration access read/write commands.
> 
> Group member legacy registers access commands enable group owner driver
> software to access legacy registers on behalf of the guest virtual
> machine.
> 
> Usecase:
> 
> 1. A hypervisor/system needs to provide transitional
>virtio devices to the guest VM at scale of thousands,
>typically, one to eight devices per VM.
> 
> 2. A hypervisor/system needs to provide such devices using a
>vendor agnostic driver in the hypervisor system.
> 
> 3. A hypervisor system prefers to have single stack regardless of
>virtio device type (net/blk) and be future compatible with a
>single vfio stack using SR-IOV or other scalable device
>virtualization technology to map PCI devices to the guest VM.
>(as transitional or otherwise)
> 
> Motivation/Background:
> =
> The existing virtio transitional PCI device is missing support for
> PCI SR-IOV based devices. Currently it does not work beyond
> PCI PF, or as software emulated device in reality. Currently it
> has below cited system level limitations:
> 
> [a] PCIe spec citation:
> VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.
> 
> [b] cpu arch citiation:
> Intel 64 and IA-32 Architectures Software Developer’s Manual:
> The processor’s I/O address space is separate and distinct from
> the physical-memory address space. The I/O address space consists
> of 64K individually addressable 8-bit I/O ports, numbered 0 through H.
> 
> [c] PCIe spec citation:
> If a bridge implements an I/O address range,...I/O address range will be
> aligned to a 4 KB boundary.
> 
> Overview:
> =
> Above usecase requirements is solved by PCI PF group owner accessing
> its group member PCI VFs legacy registers using the administration
> commands of the group owner PCI PF.
> 
> Two types of administration commands are added which read/write PCI VF
> registers.
> 
> Software usage example:
> ===
> 
> 1. One way to use and map to the guest VM is by using vfio driver
> framework in Linux kernel.
> 
> +--+
> |pci_dev_id = 0x100X   |
> +---|pci_rev_id = 0x0  |-+
> |vfio device|BAR0 = I/O region | |
> |   |Other attributes  | |
> |   +--+ |
> ||
> +   +--+ +-+ |
> |   |I/O BAR to AQ | | Other vfio  | |
> |   |rd/wr mapper& | | functionalities | |
> |   | forwarder| | | |
> |   +--+ +-+ |
> ||
> +--+-+---+
>| |
>Config region |
>  accessDriver notifications
>| |
>   +++   +++
>   | +-+ |   | PCI VF device A |
>   | | AQ  |-+>+-+ |
>   | +-+ |   |   | | legacy regs | |
>   | PCI PF device   |   |   | +-+ |
>   +-+   |   +-+
> |
> |   +++
> |   | PCI VF device N |
> +>+-+ |
> | | legacy regs | |
> | +-+ |
> +-+
> 
> 2. Continue to use the virtio pci driver to bind to the
>listed device id and use it as in the host.
> 
> 3. Use it in a light weight hypervisor to run bare-metal OS.
> 
> Fixes: https://github.com/oasis-tcs/virtio-spec/issues/167
> Signed-off-by: Parav Pandit 

Some more comments.


> ---
> changelog:
> v10->v11:
> - replaced tab with white spaces in read structure
> - included pci fields along side other generic fields to avoid
>   indirection
> - merged pci conformance section
> - avoid using definite in starting introduction
> - replace 'all of the' with 'any of the'
> - changed drivers notification normative to indicate use of
>   NOTIFY_INFO command
> - renamed NOTIFY_QUERY to NOTIFY_INFO name
> - merged 4th patch with 3rd
> - added normative line for notify_info command
> - reworded notification region command description to be more verbose
> - merged flags and owner field to indicate end of list
> v9->v10:
> - added white space at end of line
> - addressed below comments from Cornelia
> - added missing articles
> - reworded description for notification query command
> - grammar fixes
> - addressed below comments from Michael
> - added description for member group id setting
> - reworded device and driver conformance statements
> - opcode table description updated
> - 

[virtio-dev] [PATCH v11 3/3] admin: Add group member legacy register access commands

2023-07-06 Thread Parav Pandit
Introduce group member legacy common configuration and legacy device
configuration access read/write commands.

Group member legacy registers access commands enable group owner driver
software to access legacy registers on behalf of the guest virtual
machine.

Usecase:

1. A hypervisor/system needs to provide transitional
   virtio devices to the guest VM at scale of thousands,
   typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a
   vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of
   virtio device type (net/blk) and be future compatible with a
   single vfio stack using SR-IOV or other scalable device
   virtualization technology to map PCI devices to the guest VM.
   (as transitional or otherwise)

Motivation/Background:
=
The existing virtio transitional PCI device is missing support for
PCI SR-IOV based devices. Currently it does not work beyond
PCI PF, or as software emulated device in reality. Currently it
has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from
the physical-memory address space. The I/O address space consists
of 64K individually addressable 8-bit I/O ports, numbered 0 through H.

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be
aligned to a 4 KB boundary.

Overview:
=
Above usecase requirements is solved by PCI PF group owner accessing
its group member PCI VFs legacy registers using the administration
commands of the group owner PCI PF.

Two types of administration commands are added which read/write PCI VF
registers.

Software usage example:
===

1. One way to use and map to the guest VM is by using vfio driver
framework in Linux kernel.

+--+
|pci_dev_id = 0x100X   |
+---|pci_rev_id = 0x0  |-+
|vfio device|BAR0 = I/O region | |
|   |Other attributes  | |
|   +--+ |
||
+   +--+ +-+ |
|   |I/O BAR to AQ | | Other vfio  | |
|   |rd/wr mapper& | | functionalities | |
|   | forwarder| | | |
|   +--+ +-+ |
||
+--+-+---+
   | |
   Config region |
 accessDriver notifications
   | |
  +++   +++
  | +-+ |   | PCI VF device A |
  | | AQ  |-+>+-+ |
  | +-+ |   |   | | legacy regs | |
  | PCI PF device   |   |   | +-+ |
  +-+   |   +-+
|
|   +++
|   | PCI VF device N |
+>+-+ |
| | legacy regs | |
| +-+ |
+-+

2. Continue to use the virtio pci driver to bind to the
   listed device id and use it as in the host.

3. Use it in a light weight hypervisor to run bare-metal OS.

Fixes: https://github.com/oasis-tcs/virtio-spec/issues/167
Signed-off-by: Parav Pandit 
---
changelog:
v10->v11:
- replaced tab with white spaces in read structure
- included pci fields along side other generic fields to avoid
  indirection
- merged pci conformance section
- avoid using definite in starting introduction
- replace 'all of the' with 'any of the'
- changed drivers notification normative to indicate use of
  NOTIFY_INFO command
- renamed NOTIFY_QUERY to NOTIFY_INFO name
- merged 4th patch with 3rd
- added normative line for notify_info command
- reworded notification region command description to be more verbose
- merged flags and owner field to indicate end of list
v9->v10:
- added white space at end of line
- addressed below comments from Cornelia
- added missing articles
- reworded description for notification query command
- grammar fixes
- addressed below comments from Michael
- added description for member group id setting
- reworded device and driver conformance statements
- opcode table description updated
- fixed label for device read command
- length alignment restriction text added
- data length described for read write commands
- notification description added and refined
- reworded text around command specific result and data field usage
v8->v9:
- add missing articles in notify query command
- replaced 'this notification' with 

[virtio-dev] [PATCH v11 1/3] admin: Split opcode table rows with a line

2023-07-06 Thread Parav Pandit
Currently all opcode appears to be in a single row.
Separate them with a line similar to other tables.

Signed-off-by: Parav Pandit 
Reviewed-by: Cornelia Huck 

---
changelog:
v2->v3:
- new patch
---
 admin.tex | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/admin.tex b/admin.tex
index 2efd4d7..e51f9e6 100644
--- a/admin.tex
+++ b/admin.tex
@@ -114,7 +114,9 @@ \subsection{Group administration commands}\label{sec:Basic 
Facilities of a Virti
 opcode & Name & Command Description \\
 \hline \hline
 0x & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands 
supported for this group type\\
+\hline
 0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used 
for this group type \\
+\hline
 0x0002 - 0x7FFF & - & Commands using \field{struct virtio_admin_cmd}\\
 \hline
 0x8000 - 0x & - & Reserved for future commands (possibly using a different 
structure)\\
-- 
2.26.2


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] [PATCH v11 2/3] admin: Fix section numbering

2023-07-06 Thread Parav Pandit
Requirements are put one additional level down. Fix it.

Signed-off-by: Parav Pandit 
Reviewed-by: Cornelia Huck 
---
changelog:
v9->v10:
- addressed comments from Cornelia
- fixed requirements for administration virtqueue section
v4->v5:
- new patch
---
 admin.tex | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/admin.tex b/admin.tex
index e51f9e6..b0a1a91 100644
--- a/admin.tex
+++ b/admin.tex
@@ -286,7 +286,7 @@ \subsection{Group administration commands}\label{sec:Basic 
Facilities of a Virti
 supporting multiple group types, the list of supported commands
 might differ between different group types.
 
-\devicenormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Device groups / Group administration commands}
+\devicenormative{\subsubsection}{Group administration commands}{Basic 
Facilities of a Virtio Device / Device groups / Group administration commands}
 
 The device MUST validate \field{opcode}, \field{group_type} and
 \field{group_member_id}, and if any of these has an invalid or
@@ -378,7 +378,7 @@ \subsection{Group administration commands}\label{sec:Basic 
Facilities of a Virti
 \field{VF Enable} refer to registers within the SR-IOV Extended
 Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
 
-\drivernormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Device groups / Group administration commands}
+\drivernormative{\subsubsection}{Group administration commands}{Basic 
Facilities of a Virtio Device / Device groups / Group administration commands}
 
 The driver MAY discover whether device supports a specific group type
 by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching
@@ -506,7 +506,7 @@ \section{Administration Virtqueues}\label{sec:Basic 
Facilities of a Virtio Devic
 tail of a structure, with the driver/device using the full
 structure without concern for versioning.
 
-\devicenormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
+\devicenormative{\subsection}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
 
 The device MUST support device-readable and device-writeable buffers
 shorter than described in this specification, by
@@ -555,7 +555,7 @@ \section{Administration Virtqueues}\label{sec:Basic 
Facilities of a Virtio Devic
 or VIRTIO_ADMIN_STATUS_ENOMEM, then the command MUST NOT
 have any side effects, making it safe to retry.
 
-\drivernormative{\paragraph}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
+\drivernormative{\subsection}{Group administration commands}{Basic Facilities 
of a Virtio Device / Administration virtqueues}
 
 The driver MAY supply device-readable or device-writeable parts
 of \field{struct virtio_admin_cmd} that are longer than described in
-- 
2.26.2


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] [PATCH v11 0/3] admin: Access legacy registers using admin commands

2023-07-06 Thread Parav Pandit
This short series introduces legacy registers access commands for the owner
group member access the legacy registers of the member VFs.
This short series introduces legacy region access commands by the group owner
device for its member devices.
Currently it is applicable to the PCI PF and VF devices. If in future any
SIOV devices to support legacy registers, they can be easily supported using
same commands by using the group member identifiers of the future SIOV devices.

More details as overview, motivation, use case are further described
below.

Patch summary:
--
patch-1 split rows of admin opcode tables by a line
patch-2 fix section numbering
patch-3 add legacy region access commands

It uses the newly introduced administration command facility with 4 new
commands and a new optional command to query the legacy notification region.

Usecase:

1. A hypervisor/system needs to provide transitional
   virtio devices to the guest VM at scale of thousands,
   typically, one to eight devices per VM.

2. A hypervisor/system needs to provide such devices using a
   vendor agnostic driver in the hypervisor system.

3. A hypervisor system prefers to have single stack regardless of
   virtio device type (net/blk) and be future compatible with a
   single vfio stack using SR-IOV or other scalable device
   virtualization technology to map PCI devices to the guest VM.
   (as transitional or otherwise)

Motivation/Background:
--
The existing virtio transitional PCI device is missing support for
PCI SR-IOV based devices. Currently it does not work beyond
PCI PF, or as software emulated device in reality. Currently it
has below cited system level limitations:

[a] PCIe spec citation:
VFs do not support I/O Space and thus VF BARs shall not indicate I/O Space.

[b] cpu arch citiation:
Intel 64 and IA-32 Architectures Software Developer’s Manual:
The processor’s I/O address space is separate and distinct from
the physical-memory address space. The I/O address space consists
of 64K individually addressable 8-bit I/O ports, numbered 0 through H.

[c] PCIe spec citation:
If a bridge implements an I/O address range,...I/O address range will be
aligned to a 4 KB boundary.

Overview:
-
Above usecase requirements is solved by PCI PF group owner accessing
its group member PCI VFs legacy registers using an admin virtqueue of
the group owner PCI PF.

Two new admin virtqueue commands are added which read/write PCI VF
registers.

Software usage example:
---
One way to use and map to the guest VM is by using vfio driver
framework in Linux kernel.

+--+
|pci_dev_id = 0x100X   |
+---|pci_rev_id = 0x0  |-+
|vfio device|BAR0 = I/O region | |
|   |Other attributes  | |
|   +--+ |
||
+   +--+ +-+ |
|   |I/O BAR to AQ | | Other vfio  | |
|   |rd/wr mapper  | | functionalities | |
|   +--+ +-+ |
||
+--+-+---+
   | |
   Legacy regionDriver notification
access   |
   | |
  +++   +++
  | +-+ |   | PCI VF device A |
  | | AQ  |-+>+-+ |
  | +-+ |   |   | | legacy regs | |
  | PCI PF device   |   |   | +-+ |
  +-+   |   +-+
|
|   +++
|   | PCI VF device N |
+>+-+ |
| | legacy regs | |
| +-+ |
+-+

2. Virtio pci driver to bind to the listed device id and
   use it in the host.

3. Use it in a light weight hypervisor to run bare-metal OS.

Please review.

Alternatives considered:

1. Exposing BAR0 as MMIO BAR that follows legacy registers template
Pros:
a. Kind of works with legacy drivers as some of them have used API
   which is agnostic to MMIO vs IOBAR.
b. Does not require hypervisor intervantion
Cons:
a. Device reset is extremely hard to implement in device at scale as
   driver does not wait for device reset completion
b. Device register width related problems persist that hypervisor if
   wishes, it cannot be fixed.

2. Accessing VF registers by tunneling it through new legacy PCI capability
Pros:
a. Self contained, but cannot work with future PCI SIOV devices
Cons:
a. Equally slow as AQ access
b. Still requires new capability for notification access
c. Requires hardware to build low level registers access which is not worth
   for long term future

3. 

[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit


> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 4:42 PM

[..]
> > Can we please avoid this over engineering?
> > Interface has the doors open for driver to make wise decision depending on
> its environment.
> 
> what if driver can access both with the same ease? this is the case that 
> bothers
> me and I think it's practical since it will be common on linux.

Then Linux can say my preference is order, so it picks member.

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 08:35:37PM +, Parav Pandit wrote:
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 4:29 PM
> > 
> > The driver has a final decision. Let's make it a SHOULD and then if driver 
> > knows
> > best then it has the choice?
> >
> 
> As you said, the driver has the final say.
> There is really no reason to complicate the spec for a narrow case where 
> device cannot judge.
> 
> > 
> > > > But I don't see any configs where leaving this to the driver's
> > > > discretion is preferable. If you see one let me know.
> > >
> > > In doesn't need to be config.
> > > It is the environment that chooses which is preferred by the driver.
> > > For example preference of accessibility over ordering.
> > 
> > 
> > what does accessibility mean exactly? I definitely see OSes where owner 
> > driver
> > can't access a member.
> Accessibility = access a member
> 
> > So in that case naturally driver will skip the entry for member even if 
> > it's first.
> > maybe there are configs where member access is possible but is very slow 
> > e.g.
> > with lots of indirect function calls?
> > OK fine, but then it will be up to the driver to test and make damn sure the
> > benefits outweight the costs.
> > 
> > IOW it's a hint for the driver. If you like you can say it explicitly even.
> > 
> Device doesnt know anything about those indirect function calls, so device 
> cannot hint about driver environment.
> 
> Can we please avoid this over engineering?
> Interface has the doors open for driver to make wise decision depending on 
> its environment.

what if driver can access both with the same ease? this is the
case that bothers me and I think it's practical since it will be
common on linux.

-- 
MST


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit


> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 4:29 PM
> 
> The driver has a final decision. Let's make it a SHOULD and then if driver 
> knows
> best then it has the choice?
>

As you said, the driver has the final say.
There is really no reason to complicate the spec for a narrow case where device 
cannot judge.

> 
> > > But I don't see any configs where leaving this to the driver's
> > > discretion is preferable. If you see one let me know.
> >
> > In doesn't need to be config.
> > It is the environment that chooses which is preferred by the driver.
> > For example preference of accessibility over ordering.
> 
> 
> what does accessibility mean exactly? I definitely see OSes where owner driver
> can't access a member.
Accessibility = access a member

> So in that case naturally driver will skip the entry for member even if it's 
> first.
> maybe there are configs where member access is possible but is very slow e.g.
> with lots of indirect function calls?
> OK fine, but then it will be up to the driver to test and make damn sure the
> benefits outweight the costs.
> 
> IOW it's a hint for the driver. If you like you can say it explicitly even.
> 
Device doesnt know anything about those indirect function calls, so device 
cannot hint about driver environment.

Can we please avoid this over engineering?
Interface has the doors open for driver to make wise decision depending on its 
environment.

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [virtio-comment] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit


> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 3:59 PM

> > Hardwaring BAR0 is in BAR area of the VF.
> > But virtio pci capabilities without this can still report bar 0 and virtio
> capabilities.
> 
> How do they do this?
>
 Device must not do it, but a broken device can report pci capabilities as 
garbage.
I will skip writing about it.

> > Ofcourse, it is a broken device.
> > But skipping this line imply that "because VF BAR0 is hardwired", this
> metadata in pci capability must not expose it.
> >
> > Why not write it extra thing instead of implying it?
> > We already wrote few duplicate things to make reader life easier.
> 
> If you really want to go ahead, but prefix it with "In consequence" and do not
> start a new paragraph, so reader knows it's not an extra requirement.
> 
> So I started writing it using correct grammar and spec terminology:
> 
>   In consequence, non of the group member devices has BAR0, and
>   in particular none of the virtio structure capabilities
>   of a member device has \field{bar} with the value of 0.
> 
> 
> However, this actually is kind of wrong (and so is your text).  Not all caps 
> have a
> RO bar value.  virtio_pci_cfg_cap has bar that is RW by driver.  So if we are 
> going
> this route we also need to explain that it's true for all caps except
> virtio_pci_cfg_cap.  And for virtio_pci_cfg_cap driver is not allowed to 
> write 0
> there.
> 
> Frankly too much trouble but if you want to, keep trying.

What I wrote still holds true because device wont have BAR0 and driver writing 
there is ignored.
But it is some weird broken device who expose PCI capabilities, so I am going 
to skip writing this.

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 08:21:13PM +, Parav Pandit wrote:
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 3:43 PM
> 
> > > > As the order is there anyway, why not just prescribe entries are used in
> > order?
> > >
> > > I don't see any value in defining any order. It is an array of entries 
> > > not a priority
> > list.
> > 
> > I think we are losing out. For example I can see how access through member
> > would be preferable for ordering reasons.
> > However device might still allow access through PF for cases where driver 
> > can't
> > access VF.
> > 
> So a driver can choose say I prefer order over accessibility over VF, so it 
> choose PF.
> Device doesn't have the knowledge anyway whether driver can/cannot access the 
> VF.
> So, device's preference vs driver's preference may be different.

The driver has a final decision. Let's make it a SHOULD and then if
driver knows best then it has the choice?


> > But I don't see any configs where leaving this to the driver's discretion is
> > preferable. If you see one let me know.
> 
> In doesn't need to be config.
> It is the environment that chooses which is preferred by the driver.
> For example preference of accessibility over ordering.


what does accessibility mean exactly? I definitely see
OSes where owner driver can't access a member.
So in that case naturally driver will skip the
entry for member even if it's first. maybe there are
configs where member access is possible but is very slow
e.g. with lots of indirect function calls?
OK fine, but then it will be up to the driver to test and
make damn sure the benefits outweight the costs.

IOW it's a hint for the driver. If you like you can say
it explicitly even.



-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit


> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 3:43 PM

> > > As the order is there anyway, why not just prescribe entries are used in
> order?
> >
> > I don't see any value in defining any order. It is an array of entries not 
> > a priority
> list.
> 
> I think we are losing out. For example I can see how access through member
> would be preferable for ordering reasons.
> However device might still allow access through PF for cases where driver 
> can't
> access VF.
> 
So a driver can choose say I prefer order over accessibility over VF, so it 
choose PF.
Device doesn't have the knowledge anyway whether driver can/cannot access the 
VF.
So, device's preference vs driver's preference may be different.

> But I don't see any configs where leaving this to the driver's discretion is
> preferable. If you see one let me know.

In doesn't need to be config.
It is the environment that chooses which is preferred by the driver.
For example preference of accessibility over ordering.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [virtio-comment] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 07:07:42PM +, Parav Pandit wrote:
> > From: virtio-comm...@lists.oasis-open.org  > open.org> On Behalf Of Michael S. Tsirkin
> > Sent: Thursday, July 6, 2023 3:01 PM
> 
> > > +\begin{lstlisting}
> > > +struct virtio_pci_legacy_notify_region {
> > > +u8 owner;  /* When set to 1, notification region is of the
> > > +owner device */
> > 
> > I propose we rename this to flags:
> > 0x0 - end of list (driver should ignore following values until end of 
> > list)
> > 0x1 - owner
> > 0x2 - member
> > other values - reserved
> >
> 
> > and prescribe that driver ignores any reserved values.
> > 
> > basically we are following how the virtio capabilities work.
> >
> Looks good. Will change it.
> 
> > > +The group owner device hardwires VF BAR0 to zero in the SR-IOV
> > > +Extended capability.
> > > +
> > > +The group member device does not use PCI BAR0 in all the Virtio PCI
> > > +capabilities listed in section \ref{sec:Virtio Transport Options / 
> > > Virtio Over
> > PCI Bus / Virtio Structure PCI Capabilities}.
> > 
> > Just drop this last one. How can they use it if there's no VF BAR0?
> >
> Hardwaring BAR0 is in BAR area of the VF.
> But virtio pci capabilities without this can still report bar 0 and virtio 
> capabilities.

How do they do this?

> Ofcourse, it is a broken device.
> But skipping this line imply that "because VF BAR0 is hardwired", this 
> metadata in pci capability must not expose it.
> 
> Why not write it extra thing instead of implying it?
> We already wrote few duplicate things to make reader life easier.

If you really want to go ahead, but prefix it with "In consequence" and
do not start a new paragraph, so reader knows it's not an extra
requirement.

So I started writing it using correct grammar and spec terminology:

In consequence, non of the group member devices has BAR0, and
in particular none of the virtio structure capabilities
of a member device has \field{bar} with the value of 0.


However, this actually is kind of wrong (and so is your text).  Not all
caps have a RO bar value.  virtio_pci_cfg_cap has bar that is RW by
driver.  So if we are going this route we also need to explain that it's
true for all caps except virtio_pci_cfg_cap.  And for virtio_pci_cfg_cap
driver is not allowed to write 0 there.

Frankly too much trouble but if you want to, keep trying.


-- 
MST


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 07:00:22PM +, Parav Pandit wrote:
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 2:57 PM
> 
> > > I am just saying to keep things simple. Let driver choose any entry it 
> > > wants to
> > use instead of device deciding on priority and hints etc.
> > 
> > Let's say driver can support both types which to choose?
> Any entry that driver likes.
> 
> > As the order is there anyway, why not just prescribe entries are used in 
> > order?
> 
> I don't see any value in defining any order. It is an array of entries not a 
> priority list.

I think we are losing out. For example I can see how
access through member would be preferable for ordering reasons.
However device might still allow access through PF for cases
where driver can't access VF.

But I don't see any configs where leaving this to the driver's
discretion is preferable. If you see one let me know.

-- 
MST


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [virtio-comment] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit
> From: virtio-comm...@lists.oasis-open.org  open.org> On Behalf Of Michael S. Tsirkin
> Sent: Thursday, July 6, 2023 3:01 PM

> > +\begin{lstlisting}
> > +struct virtio_pci_legacy_notify_region {
> > +u8 owner;  /* When set to 1, notification region is of the
> > +owner device */
> 
> I propose we rename this to flags:
>   0x0 - end of list (driver should ignore following values until end of 
> list)
>   0x1 - owner
>   0x2 - member
> other values - reserved
>

> and prescribe that driver ignores any reserved values.
> 
> basically we are following how the virtio capabilities work.
>
Looks good. Will change it.

> > +The group owner device hardwires VF BAR0 to zero in the SR-IOV
> > +Extended capability.
> > +
> > +The group member device does not use PCI BAR0 in all the Virtio PCI
> > +capabilities listed in section \ref{sec:Virtio Transport Options / Virtio 
> > Over
> PCI Bus / Virtio Structure PCI Capabilities}.
> 
> Just drop this last one. How can they use it if there's no VF BAR0?
>
Hardwaring BAR0 is in BAR area of the VF.
But virtio pci capabilities without this can still report bar 0 and virtio 
capabilities.
Ofcourse, it is a broken device.
But skipping this line imply that "because VF BAR0 is hardwired", this metadata 
in pci capability must not expose it.

Why not write it extra thing instead of implying it?
We already wrote few duplicate things to make reader life easier.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 07:17:14AM +0300, Parav Pandit wrote:
> This patch links how in a PCI transport a group owner can access group
> member (PCI VFs) legacy registers using a legacy registers access
> commands using administration virtqueue infrastructure.
> 
> Additionally it extend the PCI notification capability through which a
> PCI VF device indicates to the driver which PCI BAR region to be used
> for driver notifications.
> 
> Fixes: https://github.com/oasis-tcs/virtio-spec/issues/167
> Signed-off-by: Parav Pandit 
> ---
> changelog:
> v9->v10:
> - addressed comments from Cornelia
> - fixed errors related to article
> - hardwire to hardwires
> - replaced various to all
> - added hardwire to zero
> v7->v8:
> - addressed comments from Michael
> - made bar offset 64-bit
> - prefix legacy specific structure with _legacy
> - moved generic normative from pci to generic section
> - added link to virtio pci capabilities when referring to bar 0
> - remove 'should' from generic description
> v6->v7:
> - addressed comments from Michael
> - removed driver normative about I/O BAR emulation as it does not
>   make much sense for the spec
> - removed references to administration virtqueue
> - rewrote driver legacy region access without guest and hypervisor
>   wording
> - added normative for notification region
> - added normative for PCI IDs for device which support legacy commands
> v5->v6:
> - aligned pci capability to 4B as required by PCI spec
> - added text for the PCI capability for the group member device
> v4->v5:
> - split pci transport and generic command section to new patch
> - removed multiple references to the VF
> - written the description of the command as generic with member
>   and group device terminology
> - reflected many section names to remove VF
> v3->v4:
> - moved noted to the conformance section details in next patch
> - removed queue notify address query AQ command on Michael's suggestion,
>   though it is fine. Instead replaced with extending virtio_pci_notify_cap
>   to indicate that legacy queue notifications can be done on the
>   notification location.
> - fixed spelling errors.
> - replaced administrative virtqueue to administration virtqueue
> - added queue notification capability register to indicate legacy q
>   notification supported
> v2->v3:
> - adddressed Jason and Michael's comment to split single register
>   access command to common config and device specific commands.
> - dropped the suggetion to introduce enable/disable command as
>   admin command cap bit already covers it.
> v1->v2:
> - addressed comments from Michael
> - added theory of operation
> - grammar corrections
> - removed group fields description from individual commands as
>   it is already present in generic section
> - added endianness normative for legacy device registers region
> - renamed the file to drop vf and add legacy prefix
> 
> - added overview in commit log
> - renamed subsection to reflect command
> ---
>  admin-cmds-legacy-interface.tex |  3 ++-
>  conformance.tex |  1 +
>  transport-pci-legacy-regs.tex   | 42 +
>  transport-pci.tex   |  2 ++
>  4 files changed, 47 insertions(+), 1 deletion(-)
>  create mode 100644 transport-pci-legacy-regs.tex
> 
> diff --git a/admin-cmds-legacy-interface.tex b/admin-cmds-legacy-interface.tex
> index dd01c0a..e67632b 100644
> --- a/admin-cmds-legacy-interface.tex
> +++ b/admin-cmds-legacy-interface.tex
> @@ -187,7 +187,8 @@ \subsubsection{Legacy Interfaces}\label{sec:Basic 
> Facilities of a Virtio Device
>  by the device.
>  
>  Refer to the specific transport section for the definition of the
> -\field{data}.
> +\field{data}. For the PCI transport refer to section
> +\ref{sec:Virtio Transport Options / Virtio Over PCI Bus / Legacy Interface: 
> Group Member Device Configuration Region Access}.
>  
>  This command is currently only defined for the SR-IOV group type.
>  
> diff --git a/conformance.tex b/conformance.tex
> index dc00e84..b3f2c92 100644
> --- a/conformance.tex
> +++ b/conformance.tex
> @@ -267,6 +267,7 @@ \section{Conformance Targets}\label{sec:Conformance / 
> Conformance Targets}
>  \item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI 
> Device Layout / Legacy Interfaces: A Note on PCI Device Layout}
>  \item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / 
> PCI-specific Initialization And Device Operation / Device Initialization / 
> Virtio Device Configuration Layout Detection / Legacy Interface: A Note on 
> Device Layout Detection}
>  \item Section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / 
> PCI-specific Initialization And Device Operation / Device Initialization / 
> Virtqueue Configuration / Legacy Interface: A Note on Virtqueue Configuration}
> +\item Section \ref{devicenormative:Virtio Transport Options / Virtio Over 
> PCI Bus / Legacy Interface: Group Member Device Configuration Region Access}
>  \item 

[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit


> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 2:57 PM

> > I am just saying to keep things simple. Let driver choose any entry it 
> > wants to
> use instead of device deciding on priority and hints etc.
> 
> Let's say driver can support both types which to choose?
Any entry that driver likes.

> As the order is there anyway, why not just prescribe entries are used in 
> order?

I don't see any value in defining any order. It is an array of entries not a 
priority list.



-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 06:53:55PM +, Parav Pandit wrote:
> 
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 2:48 PM
> 
> 
> > > The driver of the owner device can send a driver notification to the
> > > member device by executing
> > VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE
> > > with the \field{offset} matching \field{Queue Notify} and the
> > > \field{data} containing the virtqueue index to be notified or by
> > > performing memory or I/O write in
> > 
> > split to two sentences please. E.g.
> > Alternatively, the driver ...
> >
> Ack.
> Moving to it dedicated para, as in this first para the notification region 
> and command is not yet introduced.
>  
> > > the any of the notification region at offset 0 supplied by the device
> > > in
> > 
> > the any is agrammatical
> > 
> > > VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO result.
> > >
> > > > Please also call out the unusual configuration where the type is
> > > > "member" and then you have the owner driver access the memory of the
> > member device.
> > > > People might be confused.
> > > >
> > > > I also think we should explain that order of entries is a hint to
> > > > driver: use the 1st entry that you can.
> > >
> > > Driver really can choose any valid entry out of the 4 that driver likes.
> > > I really don't see a need for overwriting this area as I fail to see why 
> > > one will
> > expose multiple entries from the device side in reality.
> > 
> > I do: one for owner one for member.
> Yes, I am aware of choice or multi-entry. :)
> 
> > which is best for device is device specific.
> > 
> > I don't know what do you mean by "overwriting". Explaining in detail?
> :) being too verbose than needed.
> 
> > You feel like this because you spent a lot of time thinking about the area 
> > and
> > there is a specific solution is very clear in your head.
> > First readers are not like this and second they might have a different 
> > solution.
> 
> I am just saying to keep things simple. Let driver choose any entry it wants 
> to use instead of device deciding on priority and hints etc.

Let's say driver can support both types which to choose? 
As the order is there anyway, why not just prescribe entries are
used in order?

-- 
MST


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit



> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 2:48 PM


> > The driver of the owner device can send a driver notification to the
> > member device by executing
> VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE
> > with the \field{offset} matching \field{Queue Notify} and the
> > \field{data} containing the virtqueue index to be notified or by
> > performing memory or I/O write in
> 
> split to two sentences please. E.g.
> Alternatively, the driver ...
>
Ack.
Moving to it dedicated para, as in this first para the notification region and 
command is not yet introduced.
 
> > the any of the notification region at offset 0 supplied by the device
> > in
> 
> the any is agrammatical
> 
> > VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO result.
> >
> > > Please also call out the unusual configuration where the type is
> > > "member" and then you have the owner driver access the memory of the
> member device.
> > > People might be confused.
> > >
> > > I also think we should explain that order of entries is a hint to
> > > driver: use the 1st entry that you can.
> >
> > Driver really can choose any valid entry out of the 4 that driver likes.
> > I really don't see a need for overwriting this area as I fail to see why 
> > one will
> expose multiple entries from the device side in reality.
> 
> I do: one for owner one for member.
Yes, I am aware of choice or multi-entry. :)

> which is best for device is device specific.
> 
> I don't know what do you mean by "overwriting". Explaining in detail?
:) being too verbose than needed.

> You feel like this because you spent a lot of time thinking about the area and
> there is a specific solution is very clear in your head.
> First readers are not like this and second they might have a different 
> solution.

I am just saying to keep things simple. Let driver choose any entry it wants to 
use instead of device deciding on priority and hints etc.

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 06:16:10PM +, Parav Pandit wrote:
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 2:06 PM
> > 
> > But again even if you add it there, you can not claim it's exactly the same 
> > as
> > legacy because the address is different, the address type is different, the 
> > driver
> > is different (this is owner driver) and even the device is different.
> > 
> You drafted below, that I included,
> 
> The driver of the owner device can send a driver notification to the member
> device by executing VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE with the
> \field{offset} matching \field{Queue Notify} and the \field{data} containing
> the virtqueue index to be notified.
> 
> We extend this further by saying Queue notify notifications is sent via MMIO 
> as,
> 
> The driver of the owner device can send a driver notification to the member
> device by executing VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE with the
> \field{offset} matching \field{Queue Notify} and the \field{data} containing
> the virtqueue index to be notified or by performing memory or I/O write in

split to two sentences please. E.g.
Alternatively, the driver ...

> the any of the notification region at offset 0 supplied by the device in 

the any is agrammatical

> VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO result.
> 
> > Please also call out the unusual configuration where the type is "member" 
> > and
> > then you have the owner driver access the memory of the member device.
> > People might be confused.
> > 
> > I also think we should explain that order of entries is a hint to driver: 
> > use the 1st
> > entry that you can.
> 
> Driver really can choose any valid entry out of the 4 that driver likes.
> I really don't see a need for overwriting this area as I fail to see why one 
> will expose multiple entries from the device side in reality.

I do: one for owner one for member.
which is best for device is device specific.

I don't know what do you mean by "overwriting". Explaining in detail?
You feel like this because you spent a lot of time thinking
about the area and there is a specific solution is very clear in your head.
First readers are not like this and second they might have a
different solution.

-- 
MST


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit


> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 2:06 PM
> 
> But again even if you add it there, you can not claim it's exactly the same as
> legacy because the address is different, the address type is different, the 
> driver
> is different (this is owner driver) and even the device is different.
> 
You drafted below, that I included,

The driver of the owner device can send a driver notification to the member
device by executing VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE with the
\field{offset} matching \field{Queue Notify} and the \field{data} containing
the virtqueue index to be notified.

We extend this further by saying Queue notify notifications is sent via MMIO as,

The driver of the owner device can send a driver notification to the member
device by executing VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE with the
\field{offset} matching \field{Queue Notify} and the \field{data} containing
the virtqueue index to be notified or by performing memory or I/O write in
the any of the notification region at offset 0 supplied by the device in 
VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO result.

> Please also call out the unusual configuration where the type is "member" and
> then you have the owner driver access the memory of the member device.
> People might be confused.
> 
> I also think we should explain that order of entries is a hint to driver: use 
> the 1st
> entry that you can.

Driver really can choose any valid entry out of the 4 that driver likes.
I really don't see a need for overwriting this area as I fail to see why one 
will expose multiple entries from the device side in reality.

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 05:47:08PM +, Parav Pandit wrote:
> 
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 1:34 PM
> > 
> > On Thu, Jul 06, 2023 at 04:58:51PM +, Parav Pandit wrote:
> > >
> > >
> > > > From: Michael S. Tsirkin 
> > > > Sent: Thursday, July 6, 2023 12:42 PM
> > > >
> > > > We will need to detail how notifications work though. The reason is
> > > > that the legacy notifications are received by owner driver (which is
> > > > not legacy!) and forwarded to device.
> > > > We need to explain exactly how this is done for people who don't
> > > > read minds and did not follow 3 months of mailing list debates, and
> > > > explain how this has the same effect as triggering driver notification 
> > > > through
> > the legacy interface.
> > > >
> > > I am not going to write driver implementation in the spec here.
> > > But I agree some high-level text is needed.
> > > With your suggestions
> > > 1. to merge pci and generic in one section, 2. add description to
> > > notification, 3. past rewrites provided in v9,
> > >
> > > The draft of v11, looks like below. Please see how much more verbose to 
> > > make
> > it, if at all.
> > >
> > > \paragraph{Legacy Driver Notification}\label{par:Basic Facilities of a
> > > Virtio Device / Device groups / Group administration commands / Legacy
> > > Interface / Legacy Driver Notifications}
> > >
> > > If the group owner device or the group member device support driver
> > > notifications via a memory-mapped operation or I/O operation, these
> > > notifications are sent to the device via accessing such a notification
> > > region using a memory or I/O operation instead of sending the
> > > notifications through the administration command.
> > 
> > This paragraph adds very little information - just some vague hints at how 
> > things
> > work.
> > 
> A hunk added this paragraph back.
> Going to remove it as description is duplicate of what is written below.
>
> > > The driver of the owner device can send a driver notification to the
> > > member device by executing
> > VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE
> > > with the \field{offset} matching \field{Queue Notify} and the
> > > \field{data} containing the virtqueue index to be notified.
> > >
> > > However, as many administration commands are used for slow path
> > > configuration, a separate fast path mechanism for such notifications
> > > is desired. For the SR-IOV group type, the optional command
> > > VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO
> > > addresses this need by returning to the driver one or more addresses
> > > which to be used to send such driver notifications.
> > >
> > > In one example, the driver in the hypervisor which intercepts I/O BAR
> > > accesses for the \field{Queue Notify} can access the notification area
> > > directly as memory or I/O access (depending on what the device
> > > reported) instead of slow administration command.
> > >
> Above paragraph is really more than enough for the reader to implement.
> I will merge your text of 16-bit notify vq line here.

I don't have all of the context in front of me. We'll see in v11.
Try to keep a style consistent with what we have written
for the config space.


> > > For the command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO the driver
> > sets
> > > \field{opcode} to 0x6.
> > > The driver sets \field{group_member_id} which refers to the member
> > > device to be accessed. This command does not use
> > \field{command_specific_data}.
> > >
> > > This command is currently only defined for the SR-IOV group type. When
> > > the device supports VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO command,
> > the
> > > group owner device hardwires VF BAR0 to zero in the SR-IOV Extended
> > > capability and the group member device does not use PCI BAR0 in all
> > > the Virtio PCI capabilities listed in section \ref{sec:Virtio Transport 
> > > Options /
> > Virtio Over PCI Bus / Virtio Structure PCI Capabilities}.
> > 
> > After reading this I still have no clue at how these notifications work.
> > maybe it's in some other patch. Let's see v11.
> >
> There is only one patch now in v11 other than two fixes.
> 
> > Just making a wild guess:
> > 
> > it is true that
> > to supply a driver notification to the device, it is possible for the 
> > driver
> > to write the vq index of the vq to be notified, in little endian format, 
> > using a
> > single 16 byte write at the address provided ?
> > 
> > and I am guessing that
> > the write is an IO or a memory write, depending on the
> > type of the BAR referred to?
> > 
> > then why don't we just say this?
> All this while I assume that what you wrote above is already written in 
> description for "queue notify" register in " Legacy Interfaces: A Note on PCI 
> Device Layout".
> So no need to repeat.
> 
> But I realized that base spec is totally silent on it, but still we are 
> supposed to write here.
> Ok.
> So yes, let me add above line here, without touching existing legacy 
> interface 

[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit



> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 1:34 PM
> 
> On Thu, Jul 06, 2023 at 04:58:51PM +, Parav Pandit wrote:
> >
> >
> > > From: Michael S. Tsirkin 
> > > Sent: Thursday, July 6, 2023 12:42 PM
> > >
> > > We will need to detail how notifications work though. The reason is
> > > that the legacy notifications are received by owner driver (which is
> > > not legacy!) and forwarded to device.
> > > We need to explain exactly how this is done for people who don't
> > > read minds and did not follow 3 months of mailing list debates, and
> > > explain how this has the same effect as triggering driver notification 
> > > through
> the legacy interface.
> > >
> > I am not going to write driver implementation in the spec here.
> > But I agree some high-level text is needed.
> > With your suggestions
> > 1. to merge pci and generic in one section, 2. add description to
> > notification, 3. past rewrites provided in v9,
> >
> > The draft of v11, looks like below. Please see how much more verbose to make
> it, if at all.
> >
> > \paragraph{Legacy Driver Notification}\label{par:Basic Facilities of a
> > Virtio Device / Device groups / Group administration commands / Legacy
> > Interface / Legacy Driver Notifications}
> >
> > If the group owner device or the group member device support driver
> > notifications via a memory-mapped operation or I/O operation, these
> > notifications are sent to the device via accessing such a notification
> > region using a memory or I/O operation instead of sending the
> > notifications through the administration command.
> 
> This paragraph adds very little information - just some vague hints at how 
> things
> work.
> 
A hunk added this paragraph back.
Going to remove it as description is duplicate of what is written below.

> > The driver of the owner device can send a driver notification to the
> > member device by executing
> VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE
> > with the \field{offset} matching \field{Queue Notify} and the
> > \field{data} containing the virtqueue index to be notified.
> >
> > However, as many administration commands are used for slow path
> > configuration, a separate fast path mechanism for such notifications
> > is desired. For the SR-IOV group type, the optional command
> > VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO
> > addresses this need by returning to the driver one or more addresses
> > which to be used to send such driver notifications.
> >
> > In one example, the driver in the hypervisor which intercepts I/O BAR
> > accesses for the \field{Queue Notify} can access the notification area
> > directly as memory or I/O access (depending on what the device
> > reported) instead of slow administration command.
> >
Above paragraph is really more than enough for the reader to implement.
I will merge your text of 16-bit notify vq line here.

> > For the command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO the driver
> sets
> > \field{opcode} to 0x6.
> > The driver sets \field{group_member_id} which refers to the member
> > device to be accessed. This command does not use
> \field{command_specific_data}.
> >
> > This command is currently only defined for the SR-IOV group type. When
> > the device supports VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO command,
> the
> > group owner device hardwires VF BAR0 to zero in the SR-IOV Extended
> > capability and the group member device does not use PCI BAR0 in all
> > the Virtio PCI capabilities listed in section \ref{sec:Virtio Transport 
> > Options /
> Virtio Over PCI Bus / Virtio Structure PCI Capabilities}.
> 
> After reading this I still have no clue at how these notifications work.
> maybe it's in some other patch. Let's see v11.
>
There is only one patch now in v11 other than two fixes.

> Just making a wild guess:
> 
> it is true that
>   to supply a driver notification to the device, it is possible for the 
> driver
> to write the vq index of the vq to be notified, in little endian format, 
> using a
> single 16 byte write at the address provided ?
> 
> and I am guessing that
>   the write is an IO or a memory write, depending on the
>   type of the BAR referred to?
> 
> then why don't we just say this?
All this while I assume that what you wrote above is already written in 
description for "queue notify" register in " Legacy Interfaces: A Note on PCI 
Device Layout".
So no need to repeat.

But I realized that base spec is totally silent on it, but still we are 
supposed to write here.
Ok.
So yes, let me add above line here, without touching existing legacy interface 
section.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 04:58:51PM +, Parav Pandit wrote:
> 
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 12:42 PM
> > 
> > We will need to detail how notifications work though. The reason is that the
> > legacy notifications are received by owner driver (which is not legacy!) and
> > forwarded to device.
> > We need to explain exactly how this is done for people who don't read minds
> > and did not follow 3 months of mailing list debates, and explain how this 
> > has the
> > same effect as triggering driver notification through the legacy interface.
> >
> I am not going to write driver implementation in the spec here.
> But I agree some high-level text is needed.
> With your suggestions
> 1. to merge pci and generic in one section,
> 2. add description to notification,
> 3. past rewrites provided in v9,
> 
> The draft of v11, looks like below. Please see how much more verbose to make 
> it, if at all.
> 
> \paragraph{Legacy Driver Notification}\label{par:Basic Facilities of a Virtio 
> Device / Device groups / Group administration commands / Legacy Interface / 
> Legacy Driver Notifications}
> 
> If the group owner device or the group member device support driver
> notifications via a memory-mapped operation or I/O operation, these
> notifications are sent to the device via accessing such a notification region
> using a memory or I/O operation instead of sending the notifications through
> the administration command.
> 
> The driver of the owner device can send a driver notification to the member
> device by executing VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE with the
> \field{offset} matching \field{Queue Notify} and the \field{data} containing
> the virtqueue index to be notified.
> 
> However, as many administration commands are used for slow path configuration,
> a separate fast path mechanism for such notifications is desired. For the
> SR-IOV group type, the optional command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO
> addresses this need by returning to the driver one or more addresses which to
> be used to send such driver notifications.
> 
> In one example, the driver in the hypervisor which intercepts I/O BAR accesses
> for the \field{Queue Notify} can access the notification area directly as 
> memory
> or I/O access (depending on what the device reported) instead of slow
> administration command.
> 
> For the command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO the driver sets
> \field{opcode} to 0x6.
> The driver sets \field{group_member_id} which refers to the member device to 
> be
> accessed. This command does not use \field{command_specific_data}.
> 
> This command is currently only defined for the SR-IOV group type. When the
> device supports VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO command, the group owner
> device hardwires VF BAR0 to zero in the SR-IOV Extended capability and the
> group member device does not use PCI BAR0 in all the Virtio PCI capabilities
> listed in section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / 
> Virtio Structure PCI Capabilities}.

lots of comments wrt grammar. do post v11 and i will fix.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 04:58:51PM +, Parav Pandit wrote:
> 
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 12:42 PM
> > 
> > We will need to detail how notifications work though. The reason is that the
> > legacy notifications are received by owner driver (which is not legacy!) and
> > forwarded to device.
> > We need to explain exactly how this is done for people who don't read minds
> > and did not follow 3 months of mailing list debates, and explain how this 
> > has the
> > same effect as triggering driver notification through the legacy interface.
> >
> I am not going to write driver implementation in the spec here.
> But I agree some high-level text is needed.
> With your suggestions
> 1. to merge pci and generic in one section,
> 2. add description to notification,
> 3. past rewrites provided in v9,
> 
> The draft of v11, looks like below. Please see how much more verbose to make 
> it, if at all.
> 
> \paragraph{Legacy Driver Notification}\label{par:Basic Facilities of a Virtio 
> Device / Device groups / Group administration commands / Legacy Interface / 
> Legacy Driver Notifications}
> 
> If the group owner device or the group member device support driver
> notifications via a memory-mapped operation or I/O operation, these
> notifications are sent to the device via accessing such a notification region
> using a memory or I/O operation instead of sending the notifications through
> the administration command.

This paragraph adds very little information - just some vague hints at how 
things work.

> The driver of the owner device can send a driver notification to the member
> device by executing VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE with the
> \field{offset} matching \field{Queue Notify} and the \field{data} containing
> the virtqueue index to be notified.
> 
> However, as many administration commands are used for slow path configuration,
> a separate fast path mechanism for such notifications is desired. For the
> SR-IOV group type, the optional command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO
> addresses this need by returning to the driver one or more addresses which to
> be used to send such driver notifications.
> 
> In one example, the driver in the hypervisor which intercepts I/O BAR accesses
> for the \field{Queue Notify} can access the notification area directly as 
> memory
> or I/O access (depending on what the device reported) instead of slow
> administration command.
> 
> For the command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO the driver sets
> \field{opcode} to 0x6.
> The driver sets \field{group_member_id} which refers to the member device to 
> be
> accessed. This command does not use \field{command_specific_data}.
> 
> This command is currently only defined for the SR-IOV group type. When the
> device supports VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO command, the group owner
> device hardwires VF BAR0 to zero in the SR-IOV Extended capability and the
> group member device does not use PCI BAR0 in all the Virtio PCI capabilities
> listed in section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / 
> Virtio Structure PCI Capabilities}.

After reading this I still have no clue at how these notifications work.
maybe it's in some other patch. Let's see v11.

Just making a wild guess:

it is true that
to supply a driver notification to the device, it is possible
for the driver to write the vq index of the vq to be notified, in little
endian format, using a single 16 byte write at the address provided ?

and I am guessing that
the write is an IO or a memory write, depending on the
type of the BAR referred to?

then why don't we just say this?


-- 
MST


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit



> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 12:42 PM
> 
> We will need to detail how notifications work though. The reason is that the
> legacy notifications are received by owner driver (which is not legacy!) and
> forwarded to device.
> We need to explain exactly how this is done for people who don't read minds
> and did not follow 3 months of mailing list debates, and explain how this has 
> the
> same effect as triggering driver notification through the legacy interface.
>
I am not going to write driver implementation in the spec here.
But I agree some high-level text is needed.
With your suggestions
1. to merge pci and generic in one section,
2. add description to notification,
3. past rewrites provided in v9,

The draft of v11, looks like below. Please see how much more verbose to make 
it, if at all.

\paragraph{Legacy Driver Notification}\label{par:Basic Facilities of a Virtio 
Device / Device groups / Group administration commands / Legacy Interface / 
Legacy Driver Notifications}

If the group owner device or the group member device support driver
notifications via a memory-mapped operation or I/O operation, these
notifications are sent to the device via accessing such a notification region
using a memory or I/O operation instead of sending the notifications through
the administration command.

The driver of the owner device can send a driver notification to the member
device by executing VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE with the
\field{offset} matching \field{Queue Notify} and the \field{data} containing
the virtqueue index to be notified.

However, as many administration commands are used for slow path configuration,
a separate fast path mechanism for such notifications is desired. For the
SR-IOV group type, the optional command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO
addresses this need by returning to the driver one or more addresses which to
be used to send such driver notifications.

In one example, the driver in the hypervisor which intercepts I/O BAR accesses
for the \field{Queue Notify} can access the notification area directly as memory
or I/O access (depending on what the device reported) instead of slow
administration command.

For the command VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO the driver sets
\field{opcode} to 0x6.
The driver sets \field{group_member_id} which refers to the member device to be
accessed. This command does not use \field{command_specific_data}.

This command is currently only defined for the SR-IOV group type. When the
device supports VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO command, the group owner
device hardwires VF BAR0 to zero in the SR-IOV Extended capability and the
group member device does not use PCI BAR0 in all the Virtio PCI capabilities
listed in section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / 
Virtio Structure PCI Capabilities}.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit



> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 12:51 PM


> I don't see a statement that devices MAY support
> VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY
> with entries returning just owner, just member, or both.
>
Ok. understood.
>From the driver notifications wording it didn't imply that it is related to 
>VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY.
Will rewrite as above.
 
> > Do you suggest to drop above statement?
> 
> > >
> > > > > +
> > > > > +For the SR-IOV group type, the owner device supporting
> > > > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> > > > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE,
> > > > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> > > > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE and
> > > > > +VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY
> > > > > +commands and its member device SHOULD follow the rules for the
> > > > > +PCI Device ID,
> > >
> > > what does "its" mean here? Of the group?
> > Yes, will change to the member device of the group.
> >
> > > Members of the SR-IOV group type are VFs. They can not follow the
> > > rules for the Device ID: the spec says:
> > > This field in all VFs returns h when read.
> > >
> > > Even if you somehow refer to the software it's extraneous anyway
> > > since the spec proceeds: VI software should return the Vendor ID
> > > value from the associated PF as the Vendor ID value for the VF.
> > >
> > > We'll need a separate statement for Device ID.
> > >
> > Will split the line for Device ID.
> >
> > > > > +Revision ID and Subsystem Device ID of the non-transitional
> > > > > +devices documented in section \ref{sec:Virtio Transport Options
> > > > > +/ Virtio Over PCI
> > > Bus / PCI Device Discovery}.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit



> From: Cornelia Huck 
> Sent: Thursday, July 6, 2023 12:47 PM
> 
> On Thu, Jul 06 2023, Parav Pandit  wrote:
> 
> >> From: Cornelia Huck 
> >> Sent: Thursday, July 6, 2023 12:28 PM
> >>
> >> On Thu, Jul 06 2023, Parav Pandit  wrote:
> >>
> >> > diff --git a/transport-pci-legacy-regs.tex
> >> > b/transport-pci-legacy-regs.tex new file mode 100644 index
> >> > 000..ceea28c
> >> > --- /dev/null
> >> > +++ b/transport-pci-legacy-regs.tex
> >> > @@ -0,0 +1,42 @@
> >> > +\subsection{Legacy Interface: Group member device Configuration
> >> > +Region Access}\label{sec:Virtio Transport Options / Virtio Over
> >> > +PCI Bus / Legacy Interface: Group Member Device Configuration
> >> > +Region Access}
> >> > +
> >> > +The PCI owner device or the member device or both support driver
> >> > +notifications using
> >>
> >> What about
> >>
> >> "The PCI owner device, the member device, or both can choose to
> support..." ?
> >>
> > Fine too.
> > Any thing wrong in having or as above, so I don't write it next time?
> > Or that in current form reads better to me.
> 
> Just a bare "support" does not really tell the reader if this is something 
> that is
> required or optional. Dropping the first "or" makes it read better for me.
>

Since this is not normative,  Iwill write it as,

The PCI owner device or the member device or both can support

 
> >
> >> > +a notification region defined in \field{struct
> >> virtio_pci_legacy_notify_region}.
> 
> (...)
> 
> >> > +The group owner device or the group member device or both MAY
> >> > +support driver notifications region.
> >>
> >> Make this "a driver notification region"?
> >>
> > Notifications are generally more than one and spec has the section "driver
> notifications", so...
> 
> I'd parse this as "a region for the purpose of notification" (and 
> "notification
> region" is used above)... but in any case, we need the article here, I think.
Ah ok. I was missing the article, I was thinking to write "driver 
notifications" vs "driver notification".
Will change to "a driver notifications region" as the article applies to region.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 04:45:50PM +, Parav Pandit wrote:
> 
> 
> > From: Michael S. Tsirkin 
> > Sent: Thursday, July 6, 2023 12:39 PM
> 
> > > > +The group owner device or the group member device or both MAY
> > > > +support driver notifications region.
> > >
> > > Make this "a driver notification region"?
> > 
> > I think in fact for conformance we can just refer to supporting the command.
> > The command can return an array of structures, each referring to the memory
> > of the owner device or the member device.
> >
> Array and referring to owner/member is already present in this patch.


I don't see a statement that devices MAY support 
VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY
with entries returning just owner, just member, or both.

> Do you suggest to drop above statement?

> > 
> > > > +
> > > > +For the SR-IOV group type, the owner device supporting
> > > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> > > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE,
> > > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> > > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE and
> > > > +VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY
> > > > +commands and its member device SHOULD follow the rules for the PCI
> > > > +Device ID,
> > 
> > what does "its" mean here? Of the group?
> Yes, will change to the member device of the group.
> 
> > Members of the SR-IOV group type are VFs. They can not follow the rules for
> > the Device ID: the spec says:
> > This field in all VFs returns h when read.
> > 
> > Even if you somehow refer to the software it's extraneous anyway since the
> > spec proceeds: VI software should return the Vendor ID value from the
> > associated PF as the Vendor ID value for the VF.
> > 
> > We'll need a separate statement for Device ID.
> >
> Will split the line for Device ID.
>  
> > > > +Revision ID and Subsystem Device ID of the non-transitional devices
> > > > +documented in section \ref{sec:Virtio Transport Options / Virtio Over 
> > > > PCI
> > Bus / PCI Device Discovery}.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [RFC PATCH] docs/interop: define STANDALONE protocol feature for vhost-user

2023-07-06 Thread Michael S. Tsirkin
On Tue, Jul 04, 2023 at 01:36:00PM +0100, Alex Bennée wrote:
> Currently QEMU has to know some details about the back-end to be able
> to setup the guest. While various parts of the setup can be delegated
> to the backend (for example config handling) this is a very piecemeal
> approach.

> This patch suggests a new feature flag (VHOST_USER_PROTOCOL_F_STANDALONE)
> which the back-end can advertise which allows a probe message to be
> sent to get all the details QEMU needs to know in one message.

The reason we do piecemeal is that these existing pieces can be reused
as others evolve or fall by wayside.

For example, I can think of instances where you want to connect
specifically to e.g. networking backend, and specify it
on command line. Reasons could be many, e.g. for debugging,
or to prevent connecting to wrong device on wrong channel
(kind of like type safety).

What is the reason to have 1 message? startup latency?
How about we allow pipelining several messages then?
Will be easier.


> 
> Signed-off-by: Alex Bennée 
> 
> ---
> Initial RFC for discussion. I intend to prototype this work with QEMU
> and one of the rust-vmm vhost-user daemons.
> ---
>  docs/interop/vhost-user.rst | 37 +
>  hw/virtio/vhost-user.c  |  8 
>  2 files changed, 45 insertions(+)
> 
> diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
> index 5a070adbc1..85b1b1583a 100644
> --- a/docs/interop/vhost-user.rst
> +++ b/docs/interop/vhost-user.rst
> @@ -275,6 +275,21 @@ Inflight description
>  
>  :queue size: a 16-bit size of virtqueues
>  
> +Backend specifications
> +^^
> +
> ++---+-+++
> +| device id | config size |   min_vqs  |   max_vqs  |
> ++---+-+++
> +
> +:device id: a 32-bit value holding the VirtIO device ID
> +
> +:config size: a 32-bit value holding the config size (see 
> ``VHOST_USER_GET_CONFIG``)
> +
> +:min_vqs: a 32-bit value holding the minimum number of vqs supported
> +
> +:max_vqs: a 32-bit value holding the maximum number of vqs supported, must 
> be >= min_vqs
> +

looks like a weird set of info.
why would we want # of vqs and not their sizes?
why config size but not config itself?




>  C structure
>  ---
>  
> @@ -296,6 +311,7 @@ In QEMU the vhost-user message is implemented with the 
> following struct:
>VhostUserConfig config;
>VhostUserVringArea area;
>VhostUserInflight inflight;
> +  VhostUserBackendSpecs specs;
>};
>} QEMU_PACKED VhostUserMsg;
>  
> @@ -316,6 +332,7 @@ replies. Here is a list of the ones that do:
>  * ``VHOST_USER_GET_VRING_BASE``
>  * ``VHOST_USER_SET_LOG_BASE`` (if ``VHOST_USER_PROTOCOL_F_LOG_SHMFD``)
>  * ``VHOST_USER_GET_INFLIGHT_FD`` (if 
> ``VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD``)
> +* ``VHOST_USER_GET_BACKEND_SPECS`` (if ``VHOST_USER_PROTOCOL_F_STANDALONE``)
>  
>  .. seealso::
>  
> @@ -885,6 +902,13 @@ Protocol features
>#define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS  15
>#define VHOST_USER_PROTOCOL_F_STATUS   16
>#define VHOST_USER_PROTOCOL_F_XEN_MMAP 17
> +  #define VHOST_USER_PROTOCOL_F_STANDALONE   18
> +
> +Some features are only valid in the presence of other supporting
> +features. In the case of ``VHOST_USER_PROTOCOL_F_STANDALONE`` the
> +backend must also support ``VHOST_USER_PROTOCOL_F_CONFIG`` and
> +``VHOST_USER_PROTOCOL_F_STATUS``.
> +
>  
>  Front-end message types
>  ---
> @@ -1440,6 +1464,19 @@ Front-end message types
>query the back-end for its device status as defined in the Virtio
>specification.
>  
> +``VHOST_USER_GET_BACKEND_SPECS``
> +  :id: 41
> +  :request payload: N/A
> +  :reply payload: ``Backend specifications``
> +
> +  When the ``VHOST_USER_PROTOCOL_F_STANDALONE`` protocol feature has been
> +  successfully negotiated, this message is submitted by the front-end to
> +  query the back-end for its capabilities. This is intended to remove
> +  the need for the front-end to know ahead of time what the VirtIO
> +  device the backend emulates is.
> +
> +  The reply contains the device id, size of the config space and the
> +  range of VirtQueues the backend supports.
>  
>  Back-end message types
>  --
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index c4e0cbd702..28b021d5d3 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -202,6 +202,13 @@ typedef struct VhostUserInflight {
>  uint16_t queue_size;
>  } VhostUserInflight;
>  
> +typedef struct VhostUserBackendSpecs {
> +uint32_t device_id;
> +uint32_t config_size;
> +uint32_t min_vqs;
> +uint32_t max_vqs;
> +} VhostUserBackendSpecs;
> +
>  typedef struct {
>  VhostUserRequest request;
>  
> @@ -226,6 +233,7 @@ typedef union {
>  VhostUserCryptoSession session;
>  VhostUserVringArea area;

[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Cornelia Huck
On Thu, Jul 06 2023, Parav Pandit  wrote:

>> From: Cornelia Huck 
>> Sent: Thursday, July 6, 2023 12:28 PM
>> 
>> On Thu, Jul 06 2023, Parav Pandit  wrote:
>> 
>> > diff --git a/transport-pci-legacy-regs.tex
>> > b/transport-pci-legacy-regs.tex new file mode 100644 index
>> > 000..ceea28c
>> > --- /dev/null
>> > +++ b/transport-pci-legacy-regs.tex
>> > @@ -0,0 +1,42 @@
>> > +\subsection{Legacy Interface: Group member device Configuration
>> > +Region Access}\label{sec:Virtio Transport Options / Virtio Over PCI
>> > +Bus / Legacy Interface: Group Member Device Configuration Region
>> > +Access}
>> > +
>> > +The PCI owner device or the member device or both support driver
>> > +notifications using
>> 
>> What about
>> 
>> "The PCI owner device, the member device, or both can choose to support..." ?
>>
> Fine too.
> Any thing wrong in having or as above, so I don't write it next time?
> Or that in current form reads better to me.

Just a bare "support" does not really tell the reader if this is
something that is required or optional. Dropping the first "or" makes it
read better for me.

>  
>> > +a notification region defined in \field{struct
>> virtio_pci_legacy_notify_region}.

(...)

>> > +The group owner device or the group member device or both MAY support
>> > +driver notifications region.
>> 
>> Make this "a driver notification region"?
>>
> Notifications are generally more than one and spec has the section "driver 
> notifications", so...

I'd parse this as "a region for the purpose of notification" (and
"notification region" is used above)... but in any case, we need the
article here, I think.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit



> From: Michael S. Tsirkin 
> Sent: Thursday, July 6, 2023 12:39 PM

> > > +The group owner device or the group member device or both MAY
> > > +support driver notifications region.
> >
> > Make this "a driver notification region"?
> 
> I think in fact for conformance we can just refer to supporting the command.
> The command can return an array of structures, each referring to the memory
> of the owner device or the member device.
>
Array and referring to owner/member is already present in this patch.

Do you suggest to drop above statement?
 
> 
> > > +
> > > +For the SR-IOV group type, the owner device supporting
> > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE,
> > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE and
> > > +VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY
> > > +commands and its member device SHOULD follow the rules for the PCI
> > > +Device ID,
> 
> what does "its" mean here? Of the group?
Yes, will change to the member device of the group.

> Members of the SR-IOV group type are VFs. They can not follow the rules for
> the Device ID: the spec says:
> This field in all VFs returns h when read.
> 
> Even if you somehow refer to the software it's extraneous anyway since the
> spec proceeds: VI software should return the Vendor ID value from the
> associated PF as the Vendor ID value for the VF.
> 
> We'll need a separate statement for Device ID.
>
Will split the line for Device ID.
 
> > > +Revision ID and Subsystem Device ID of the non-transitional devices
> > > +documented in section \ref{sec:Virtio Transport Options / Virtio Over PCI
> Bus / PCI Device Discovery}.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 04:33:01PM +, Parav Pandit wrote:
> 
> 
> > From: Cornelia Huck 
> > Sent: Thursday, July 6, 2023 12:28 PM
> > 
> > On Thu, Jul 06 2023, Parav Pandit  wrote:
> > 
> > > diff --git a/transport-pci-legacy-regs.tex
> > > b/transport-pci-legacy-regs.tex new file mode 100644 index
> > > 000..ceea28c
> > > --- /dev/null
> > > +++ b/transport-pci-legacy-regs.tex
> > > @@ -0,0 +1,42 @@
> > > +\subsection{Legacy Interface: Group member device Configuration
> > > +Region Access}\label{sec:Virtio Transport Options / Virtio Over PCI
> > > +Bus / Legacy Interface: Group Member Device Configuration Region
> > > +Access}
> > > +
> > > +The PCI owner device or the member device or both support driver
> > > +notifications using
> > 
> > What about
> > 
> > "The PCI owner device, the member device, or both can choose to support..." 
> > ?
> >
> Fine too.
> Any thing wrong in having or as above, so I don't write it next time?
> Or that in current form reads better to me.
>  
> > > +a notification region defined in \field{struct
> > virtio_pci_legacy_notify_region}.
> > > +
> > > +In \field{struct virtio_virtio_admin_cmd_legacy_notify_query_entry},
> > > +\field{region_data} is defined as following:
> > > +
> > > +\begin{lstlisting}
> > > +struct virtio_pci_legacy_notify_region {
> > > +u8 owner;  /* When set to 1, notification region is of the owner 
> > > device
> > */
> > > +u8 bar;/* BAR of the member or owner device */
> > > +u8 padding[6];
> > > +le64 offset; /* Offset within bar. */ }; \end{lstlisting}
> > > +
> > > +The group owner device hardwires VF BAR0 to zero in the SR-IOV
> > > +Extended capability.
> > > +
> > > +The group member device does not use PCI BAR0 in all the Virtio PCI
> > > +capabilities
> > 
> > "in [or for?] any of the...", I guess?
> Will change to "Any of the ".
> 
> > 
> > > +listed in section \ref{sec:Virtio Transport Options / Virtio Over PCI 
> > > Bus /
> > Virtio Structure PCI Capabilities}.
> > > +
> > > +\devicenormative{\subsubsection}{Legacy Interface: Group Member
> > > +Device Legacy Configuration Region Access}{Virtio Transport Options /
> > > +Virtio Over PCI Bus / Legacy Interface: Group Member Device
> > > +Configuration Region Access}
> > > +
> > > +When a PCI SR-IOV group owner device supports
> > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> > > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE,
> > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> > > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE commands, the group
> > owner
> > > +device MUST hardwire VF BAR0 to zero in the SR-IOV Extended
> > > +capability and the group memberi
> > 
> > s/memberi/member/
> >
> Yes, already changed in my v11 where patch 3 and 4 content is merged to 
> single generic section.
> 
>  
> > > +device MUST NOT use BAR0 in any of the Virtio Structure PCI Capabilities.
> > > +
> > > +The group owner device or the group member device or both MAY support
> > > +driver notifications region.
> > 
> > Make this "a driver notification region"?
> >
> Notifications are generally more than one and spec has the section "driver 
> notifications", so...
>  

We will need to detail how notifications work though. The reason
is that the legacy notifications are received by owner driver
(which is not legacy!) and forwarded to device.
We need to explain exactly how this is done for people who
don't read minds and did not follow 3 months of mailing list
debates, and explain how this has the same effect as
triggering driver notification through the legacy
interface.





-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 06:28:21PM +0200, Cornelia Huck wrote:
> On Thu, Jul 06 2023, Parav Pandit  wrote:
> 
> > diff --git a/transport-pci-legacy-regs.tex b/transport-pci-legacy-regs.tex
> > new file mode 100644
> > index 000..ceea28c
> > --- /dev/null
> > +++ b/transport-pci-legacy-regs.tex
> > @@ -0,0 +1,42 @@
> > +\subsection{Legacy Interface: Group member device Configuration Region 
> > Access}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / Legacy 
> > Interface: Group Member Device Configuration Region Access}
> > +
> > +The PCI owner device or the member device or both support driver 
> > notifications using
> 
> What about
> 
> "The PCI owner device, the member device, or both can choose to
> support..." ?
> 
> > +a notification region defined in \field{struct 
> > virtio_pci_legacy_notify_region}.
> > +
> > +In \field{struct virtio_virtio_admin_cmd_legacy_notify_query_entry},
> > +\field{region_data} is defined as following:
> > +
> > +\begin{lstlisting}
> > +struct virtio_pci_legacy_notify_region {
> > +u8 owner;  /* When set to 1, notification region is of the owner 
> > device */
> > +u8 bar;/* BAR of the member or owner device */
> > +u8 padding[6];
> > +le64 offset; /* Offset within bar. */
> > +};
> > +\end{lstlisting}
> > +
> > +The group owner device hardwires VF BAR0 to zero in the SR-IOV Extended
> > +capability.
> > +
> > +The group member device does not use PCI BAR0 in all the Virtio PCI 
> > capabilities
> 
> "in [or for?] any of the...", I guess?
> 
> > +listed in section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus 
> > / Virtio Structure PCI Capabilities}.
> > +
> > +\devicenormative{\subsubsection}{Legacy Interface: Group Member Device 
> > Legacy Configuration Region Access}{Virtio Transport Options / Virtio Over 
> > PCI Bus / Legacy Interface: Group Member Device Configuration Region Access}
> > +
> > +When a PCI SR-IOV group owner device supports
> > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE, 
> > VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE commands, the group owner device MUST
> > +hardwire VF BAR0 to zero in the SR-IOV Extended capability and the group 
> > memberi
> 
> s/memberi/member/
> 
> > +device MUST NOT use BAR0 in any of the Virtio Structure PCI Capabilities.
> > +
> > +The group owner device or the group member device or both MAY support 
> > driver
> > +notifications region.
> 
> Make this "a driver notification region"?

I think in fact for conformance we can just refer to supporting the command.
The command can return an array of structures, each referring to
the memory of the owner device or the member device.


> > +
> > +For the SR-IOV group type, the owner device supporting
> > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE, 
> > VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE and 
> > VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY
> > +commands and its member device SHOULD follow the rules for the PCI Device 
> > ID,

what does "its" mean here? Of the group?
Members of the SR-IOV group type are VFs. They can not follow
the rules for the Device ID: the spec says:
This field in all VFs returns h when read.

Even if you somehow refer to the software it's extraneous anyway
since the spec proceeds: VI software should return the Vendor ID value
from the associated PF as the Vendor ID value for the VF.

We'll need a separate statement for Device ID.

> > +Revision ID and Subsystem Device ID of the non-transitional devices 
> > documented in
> > +section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI 
> > Device Discovery}.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Parav Pandit



> From: Cornelia Huck 
> Sent: Thursday, July 6, 2023 12:28 PM
> 
> On Thu, Jul 06 2023, Parav Pandit  wrote:
> 
> > diff --git a/transport-pci-legacy-regs.tex
> > b/transport-pci-legacy-regs.tex new file mode 100644 index
> > 000..ceea28c
> > --- /dev/null
> > +++ b/transport-pci-legacy-regs.tex
> > @@ -0,0 +1,42 @@
> > +\subsection{Legacy Interface: Group member device Configuration
> > +Region Access}\label{sec:Virtio Transport Options / Virtio Over PCI
> > +Bus / Legacy Interface: Group Member Device Configuration Region
> > +Access}
> > +
> > +The PCI owner device or the member device or both support driver
> > +notifications using
> 
> What about
> 
> "The PCI owner device, the member device, or both can choose to support..." ?
>
Fine too.
Any thing wrong in having or as above, so I don't write it next time?
Or that in current form reads better to me.
 
> > +a notification region defined in \field{struct
> virtio_pci_legacy_notify_region}.
> > +
> > +In \field{struct virtio_virtio_admin_cmd_legacy_notify_query_entry},
> > +\field{region_data} is defined as following:
> > +
> > +\begin{lstlisting}
> > +struct virtio_pci_legacy_notify_region {
> > +u8 owner;  /* When set to 1, notification region is of the owner 
> > device
> */
> > +u8 bar;/* BAR of the member or owner device */
> > +u8 padding[6];
> > +le64 offset; /* Offset within bar. */ }; \end{lstlisting}
> > +
> > +The group owner device hardwires VF BAR0 to zero in the SR-IOV
> > +Extended capability.
> > +
> > +The group member device does not use PCI BAR0 in all the Virtio PCI
> > +capabilities
> 
> "in [or for?] any of the...", I guess?
Will change to "Any of the ".

> 
> > +listed in section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus /
> Virtio Structure PCI Capabilities}.
> > +
> > +\devicenormative{\subsubsection}{Legacy Interface: Group Member
> > +Device Legacy Configuration Region Access}{Virtio Transport Options /
> > +Virtio Over PCI Bus / Legacy Interface: Group Member Device
> > +Configuration Region Access}
> > +
> > +When a PCI SR-IOV group owner device supports
> > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> > +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE,
> > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> > +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE commands, the group
> owner
> > +device MUST hardwire VF BAR0 to zero in the SR-IOV Extended
> > +capability and the group memberi
> 
> s/memberi/member/
>
Yes, already changed in my v11 where patch 3 and 4 content is merged to single 
generic section.

 
> > +device MUST NOT use BAR0 in any of the Virtio Structure PCI Capabilities.
> > +
> > +The group owner device or the group member device or both MAY support
> > +driver notifications region.
> 
> Make this "a driver notification region"?
>
Notifications are generally more than one and spec has the section "driver 
notifications", so...
 

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [RFC PATCH] docs/interop: define STANDALONE protocol feature for vhost-user

2023-07-06 Thread Alex Bennée


Alex Bennée  writes:

> Currently QEMU has to know some details about the back-end to be able
> to setup the guest. While various parts of the setup can be delegated
> to the backend (for example config handling) this is a very piecemeal
> approach.
>
> This patch suggests a new feature flag (VHOST_USER_PROTOCOL_F_STANDALONE)
> which the back-end can advertise which allows a probe message to be
> sent to get all the details QEMU needs to know in one message.
>
> Signed-off-by: Alex Bennée 
>
> ---
> Initial RFC for discussion. I intend to prototype this work with QEMU
> and one of the rust-vmm vhost-user daemons.
> ---
>  docs/interop/vhost-user.rst | 37 +
>  hw/virtio/vhost-user.c  |  8 
>  2 files changed, 45 insertions(+)
>
> diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
> index 5a070adbc1..85b1b1583a 100644
> --- a/docs/interop/vhost-user.rst
> +++ b/docs/interop/vhost-user.rst
> @@ -275,6 +275,21 @@ Inflight description
>  
>  :queue size: a 16-bit size of virtqueues
>  
> +Backend specifications
> +^^
> +
> ++---+-+++
> +| device id | config size |   min_vqs  |   max_vqs  |
> ++---+-+++
> +
> +:device id: a 32-bit value holding the VirtIO device ID
> +
> +:config size: a 32-bit value holding the config size (see 
> ``VHOST_USER_GET_CONFIG``)
> +
> +:min_vqs: a 32-bit value holding the minimum number of vqs supported
> +
> +:max_vqs: a 32-bit value holding the maximum number of vqs supported, must 
> be >= min_vqs
> +
>  C structure
>  ---
>  
> @@ -296,6 +311,7 @@ In QEMU the vhost-user message is implemented with the 
> following struct:
>VhostUserConfig config;
>VhostUserVringArea area;
>VhostUserInflight inflight;
> +  VhostUserBackendSpecs specs;
>};
>} QEMU_PACKED VhostUserMsg;
>  
> @@ -316,6 +332,7 @@ replies. Here is a list of the ones that do:
>  * ``VHOST_USER_GET_VRING_BASE``
>  * ``VHOST_USER_SET_LOG_BASE`` (if ``VHOST_USER_PROTOCOL_F_LOG_SHMFD``)
>  * ``VHOST_USER_GET_INFLIGHT_FD`` (if 
> ``VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD``)
> +* ``VHOST_USER_GET_BACKEND_SPECS`` (if ``VHOST_USER_PROTOCOL_F_STANDALONE``)
>  
>  .. seealso::
>  
> @@ -885,6 +902,13 @@ Protocol features
>#define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS  15
>#define VHOST_USER_PROTOCOL_F_STATUS   16
>#define VHOST_USER_PROTOCOL_F_XEN_MMAP 17
> +  #define VHOST_USER_PROTOCOL_F_STANDALONE   18
> +
> +Some features are only valid in the presence of other supporting
> +features. In the case of ``VHOST_USER_PROTOCOL_F_STANDALONE`` the
> +backend must also support ``VHOST_USER_PROTOCOL_F_CONFIG`` and
> +``VHOST_USER_PROTOCOL_F_STATUS``.
> +

This is too tight a restriction as not all VirtIO backends manage a
config space. So I suggest the following:

  Some features are only valid in the presence of other supporting
  features. In the case of ``VHOST_USER_PROTOCOL_F_STANDALONE`` the
  backend must also support ``VHOST_USER_PROTOCOL_F_STATUS`` and
  optionally ``VHOST_USER_PROTOCOL_F_CONFIG`` (if there is a config space).

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 4/4] transport-pci: Introduce group legacy group member config region access

2023-07-06 Thread Cornelia Huck
On Thu, Jul 06 2023, Parav Pandit  wrote:

> diff --git a/transport-pci-legacy-regs.tex b/transport-pci-legacy-regs.tex
> new file mode 100644
> index 000..ceea28c
> --- /dev/null
> +++ b/transport-pci-legacy-regs.tex
> @@ -0,0 +1,42 @@
> +\subsection{Legacy Interface: Group member device Configuration Region 
> Access}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / Legacy 
> Interface: Group Member Device Configuration Region Access}
> +
> +The PCI owner device or the member device or both support driver 
> notifications using

What about

"The PCI owner device, the member device, or both can choose to
support..." ?

> +a notification region defined in \field{struct 
> virtio_pci_legacy_notify_region}.
> +
> +In \field{struct virtio_virtio_admin_cmd_legacy_notify_query_entry},
> +\field{region_data} is defined as following:
> +
> +\begin{lstlisting}
> +struct virtio_pci_legacy_notify_region {
> +u8 owner;  /* When set to 1, notification region is of the owner 
> device */
> +u8 bar;/* BAR of the member or owner device */
> +u8 padding[6];
> +le64 offset; /* Offset within bar. */
> +};
> +\end{lstlisting}
> +
> +The group owner device hardwires VF BAR0 to zero in the SR-IOV Extended
> +capability.
> +
> +The group member device does not use PCI BAR0 in all the Virtio PCI 
> capabilities

"in [or for?] any of the...", I guess?

> +listed in section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / 
> Virtio Structure PCI Capabilities}.
> +
> +\devicenormative{\subsubsection}{Legacy Interface: Group Member Device 
> Legacy Configuration Region Access}{Virtio Transport Options / Virtio Over 
> PCI Bus / Legacy Interface: Group Member Device Configuration Region Access}
> +
> +When a PCI SR-IOV group owner device supports
> +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE, 
> VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE commands, the group owner device MUST
> +hardwire VF BAR0 to zero in the SR-IOV Extended capability and the group 
> memberi

s/memberi/member/

> +device MUST NOT use BAR0 in any of the Virtio Structure PCI Capabilities.
> +
> +The group owner device or the group member device or both MAY support driver
> +notifications region.

Make this "a driver notification region"?

> +
> +For the SR-IOV group type, the owner device supporting
> +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
> +VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE, 
> VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
> +VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE and 
> VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_QUERY
> +commands and its member device SHOULD follow the rules for the PCI Device ID,
> +Revision ID and Subsystem Device ID of the non-transitional devices 
> documented in
> +section \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device 
> Discovery}.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] RE: [PATCH v10 3/4] admin: Add group member legacy register access commands

2023-07-06 Thread Parav Pandit


> From: Cornelia Huck 
> Sent: Thursday, July 6, 2023 12:12 PM


> > +In some systems, there is a need to support utilizing the legacy
> > +driver with the device that do not directly support the legacy
> > +interface. In such scenarios,
> 
> Please use either Michael's or my suggestion from v9 here, using definite
> articles here isn't a good idea.

Yes, working on it.
I am taking, below suggested version.

In some systems, there is a need to support utilizing a legacy driver 
with
a device that does not directly support the legacy interface.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 3/4] admin: Add group member legacy register access commands

2023-07-06 Thread Cornelia Huck
On Thu, Jul 06 2023, Parav Pandit  wrote:

> diff --git a/admin-cmds-legacy-interface.tex b/admin-cmds-legacy-interface.tex
> new file mode 100644
> index 000..dd01c0a
> --- /dev/null
> +++ b/admin-cmds-legacy-interface.tex
> @@ -0,0 +1,261 @@
> +\subsubsection{Legacy Interfaces}\label{sec:Basic Facilities of a Virtio 
> Device / Device groups / Group
> +administration commands / Legacy Interface}
> +
> +In some systems, there is a need to support utilizing the legacy driver with
> +the device that do not directly support the legacy interface. In such 
> scenarios,

Please use either Michael's or my suggestion from v9 here, using
definite articles here isn't a good idea.

> +a group owner device can provide the legacy interface functionality for the
> +group member devices. The driver of an owner device can then access the 
> legacy
> +interface of a member device on behalf of the legacy member device driver.


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [PATCH v10 2/4] admin: Fix section numbering

2023-07-06 Thread Cornelia Huck
On Thu, Jul 06 2023, Parav Pandit  wrote:

> Requirements are put one additional level down. Fix it.
>
> Signed-off-by: Parav Pandit 
> ---
> changelog:
> v9->v10:
> - addressed comments from Cornelia
> - fixed requirements for administration virtqueue section
> v4->v5:
> - new patch
> ---
>  admin.tex | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Cornelia Huck 


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



Re: [virtio-dev] Re: [VIRTIO GPU PATCH 1/1] virtio-gpu: Add new feature flag VIRTIO_GPU_F_FREEZING

2023-07-06 Thread Chen, Jiqian
Hi Gerd Hoffmann,

Thank you for your review and suggestions.

On 2023/7/6 19:54, Gerd Hoffmann wrote:
>   Hi,
> 
>> +\item[VIRTIO_GPU_CMD_STATUS_FREEZING]
>> +Notify freezing status through controlq.
>> +Request data is \field{struct virtio_gpu_status_freezing}.
>> +Response type is VIRTIO_GPU_RESP_OK_NODATA.
>> +
>> +Guest notifies QEMU if virtio-gpu is in freezing status or not in 
>> \field{freezing}.
>> +zero means it is not in freezing status, none-zero is the opposite.
>> +When guest is in freezing status, QEMU will not destroy resources.
> 
> This should be more clear which resources are meant here.  Just
> resources created by VIRTIO_GPU_CMD_RESOURCE_CREATE_* commands?
> Or all objects (including cursors, scanouts, 3D contexts, ...)?
> Or some other set?

Yes, you are right, it should be clearer about resource here. I will elaborate 
on the types of resources in the next version.

> 
> I've seen on the (code) patch discussion the topic of different
> suspend modes (s3/s4) came up.
> What was the conclusion there?
> Should a note about this be added to the spec too?

My modification was originally to support xen's s3 function, but I will try s4 
locally, if s4 does not work, I will add instructions here.

> 
> take care,
>   Gerd
> 
> 
> -
> To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org
> 

-- 
Best regards,
Jiqian Chen.


[virtio-dev] Re: [VIRTIO GPU PATCH 1/1] virtio-gpu: Add new feature flag VIRTIO_GPU_F_FREEZING

2023-07-06 Thread Gerd Hoffmann
  Hi,

> +\item[VIRTIO_GPU_CMD_STATUS_FREEZING]
> +Notify freezing status through controlq.
> +Request data is \field{struct virtio_gpu_status_freezing}.
> +Response type is VIRTIO_GPU_RESP_OK_NODATA.
> +
> +Guest notifies QEMU if virtio-gpu is in freezing status or not in 
> \field{freezing}.
> +zero means it is not in freezing status, none-zero is the opposite.
> +When guest is in freezing status, QEMU will not destroy resources.

This should be more clear which resources are meant here.  Just
resources created by VIRTIO_GPU_CMD_RESOURCE_CREATE_* commands?
Or all objects (including cursors, scanouts, 3D contexts, ...)?
Or some other set?

I've seen on the (code) patch discussion the topic of different
suspend modes (s3/s4) came up.
What was the conclusion there?
Should a note about this be added to the spec too?

take care,
  Gerd


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: virtio-v4l2 specification draft

2023-07-06 Thread Albert Esteve
Hi Alex,

Sorry for the late reply. I think this is a nice solution, specially for
the host-guest
memory management part. I was intrigued with how would you solve this, as
the v4l2 struct memory fields can't be directly used.

In that sense, sending a field that is going to be ignored by both driver
and device,
feels like kindof a waste. But I guess there is not a good solution to that.
Have you considered avoiding using struct v4l2_buffer for QBUF and DQBUF
ioctls,
and having virtio-v4l2 specific struct for them? The device would have the
burden to
copy the all the fields and leave the `m` field out, so it may have its own
downsides.

In any case, the specs are short and clear to follow. Great work!

I just have a couple comments/questions:

- The text in `0.1.6.3` and `0.1.6.3.1` is saying the same thing twice (?).
Maybe would be
  clearer to unify?

- If I understood correctly, the `stream_id` is assigned by the device
after receiving
  a VIRTIO_V4L2_CMD_OPEN? Is it supposed to be a correlative natural number
(1, 2, etc.)?
  I assume that after (successfully) closing the stream, its stream_id can
be reused?

- For section `0.1.6.7` I think it would be good to refer (again) to the
section `0.1.6.5` so that
  we can quickly navigate to the section that explains the memory fields in
the presented events.

Best regards,
Albert

On Wed, May 31, 2023 at 8:08 AM Michael S. Tsirkin  wrote:

> On Wed, May 31, 2023 at 03:02:04PM +0900, Alexandre Courbot wrote:
> > Hello everyone,
> >
> > With the virtio-video call taking place soon, I thought it would help
> > everyone understand both proposals if I sent a more formal
> > specification of what virtio-v4l2 looks like. Please find it attached
> > to this email.
> >
> > I apologize for not finishing and sending this earlier, but hopefully
> > at 7 and a half pages it should be rather quick to skim through. :)
> >
> > Despite its short size, this spec is capable of supporting camera and
> > image processor devices (on top of decoder/encoders), and also allows
> > for another kind of memory backing for buffers (host-managed) that is
> > not supported by virtio-video.
> >
> > For convenience I have made use of clickable links to the relevant
> > parts of the V4L2 documentation, since it is supposed to be used
> > alongside this spec.
> >
> > Looking forward to a fruitful discussion tomorrow!
> >
> > Cheers,
> > Alex.
>
>
> Can you please post patch with tex source inline as opposed as
> pdf as an attachment? Thanks!
>
> --
> MST
>
>


[virtio-dev] Re: [virtio-comment] [PATCH v9 0/4] admin: Access legacy registers using admin commands

2023-07-06 Thread Michael S. Tsirkin
On Thu, Jul 06, 2023 at 04:20:03AM +, Parav Pandit wrote:
> 
> 
> > From: Michael S. Tsirkin 
> > Sent: Wednesday, July 5, 2023 7:09 AM
> 
> > OK I sent a bunch of comments. Pls try to address, unfortunately I didn't 
> > go in
> > depth over the last patch, but I feel it should be squashed into the generic
> > legacy command sections avoiding need for indirection, so rewriting it now
> > wouldn't be efficient.
> 
> I address all your comments and of Cornelia.
> PCI part I still prefer to be separate so kept it.
> 
> Thanks a lot.

I clarified some questions you asked about. Maybe v11 is justified
in view of my answers. Let me know before I review again.

-- 
MST


-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



[virtio-dev] Re: [virtio-comment] [PATCH v9 3/4] admin: Add group member legacy register access commands

2023-07-06 Thread Michael S. Tsirkin
On Wed, Jul 05, 2023 at 06:26:13PM +, Parav Pandit wrote:
> 
> 
> > From: Michael S. Tsirkin 
> > Sent: Wednesday, July 5, 2023 7:05 AM
> 
> 
> > > +These commands are currently only defined for the PCI SR-IOV group
> > > +type and
> > 
> > We call it SR-IOV group type not PCI SR-IOV group type. Please be 
> > consistent.
> >
> Ack.
>  
> > > +have, generally, the same effect as member device accesses through a
> > > +legacy interface listed in section \ref{sec:Virtio Transport Options / 
> > > Virtio
> > Over PCI Bus / PCI Device Layout / Legacy Interfaces: A Note on PCI Device
> > Layout}.
> > > +
> > > +\paragraph{Legacy Common Configuration Write Command}\label{par:Basic
> > > +Facilities of a Virtio Device / Device groups / Group administration
> > > +commands / Legacy Interface / Common Configuration Write Command}
> > 
> > Fix label.
> > 
> It is already under the tree of Legacy interface so dropped making it further 
> longer.
> But than I kept the Legacy in the actual name...
> Will add Legacy in the label.
> 
> > > +
> > > +This command has the same effect as writing into the virtio common
> > > +configuration structure through the legacy interface.
> > > +\field{command_specific_data} has the following structure:
> > > +
> > > +\begin{lstlisting}
> > > +struct virtio_admin_cmd_legacy_common_cfg_wr_data {
> > > +u8 offset; /* Starting byte offset within the common 
> > > configuration
> > structure to write */
> > > +u8 reserved[7];
> > > +u8 region_data[];
> > 
> > I am all for something more specific than offset/data but region seems 
> > pointless.
> > And why apply just to data not offset?
> > How about legacy_offset/legacy_data?
> >
> Structure name already has legacy, so no point in repeating legacy_ prefix 
> again in all the fields inside.
> I will drop region_ and just keep offset,data.
>  
> > > +};
> > > +\end{lstlisting}
> > > +
> > > +The driver sets command \field{opcode} to
> > VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE.
> > > +The driver sets valid \field{offset} and associated
> > > +\field{region_data} bytes to write to the common configuration region.
> > > +
> > > +This command does not use \field{command_specific_result}.
> > > +
> > 
> > Let's make this consistent with other commands, even if it means we repeat
> > ourselves a bit. And length is not documented and has to be:
> > 
> Ah yes, I missed the length documentation.
> Will add it.
> 
> Not sure what part you want to make consistent with other commands?
> Do you mean to repeat ourselves for the opcode number? If so, than we should 
> be avoiding it.
> In fact we should remove that repetition in other commands too. We have table 
> to describe it clearly.

Then "set opcode to XXX" would be redundant too.

> > 
> > >>>
> > 
> > For the command VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE
> > \field{opcode} is set to 0x2.
> > The \field{group_member_id} refers to the member device to be accessed.
> Yeah, there is certainly  no point in repeating all of these again.
> 
> In previous patch when I repeated where it says it uses the struct 
> virtio_admin_cmd, you asked to drop for the right reason.
> But here you ask to repeat other things...
> Not good.
> 
> All above is crystal clear in opcode table and in generic description already.
> Reader has less text to read to understand it.

I actually think it's helpful - whoever is writing a driver
then has a single place to read.
it does not matter if we repeat ourselves a bit - readers are
not compilers.


> > The \field{command_specific_data} is in the format \field{struct
> > virtio_admin_cmd_legacy_common_cfg_wr_data} describing the access to be
> > performed.
> > 
> > Within \field{struct virtio_admin_cmd_legacy_common_cfg_wr_data}:
> > The \field{offset} refers to the offset to write within the virtio common
> > configuration structure, and excluding the device-specific configuration. 
> "virtio common configuration structure" is self-explanatory that doesnt need 
> to add the exclusion part.
> Hence it was not added in v9 too.

Again readers are not compilers. It's not 100% clear whether it's legal
to access device specific through this or not.


> > For the
> > SR-IOV group type, the layout used refers to the one used for the legacy
> > interface as listed in section \ref{sec:Virtio Transport Options / Virtio 
> > Over PCI
> > Bus / PCI Device Layout / Legacy Interfaces: A Note on PCI Device Layout},
> > except that little endian format is assumed unconditionally.
> > The length of the data to write is simply the length of \field{region_data}.
> > 
> > No length or alignment restrictions are placed on the value of the 
> > \field{offset}
> > and the length of the \field{region_data}, except that the resulting access 
> > refers
> > to a single field and is completely within the virtio common configuration
> > structure, excluding the device-specific configuration.
> > 
> > This command has no command specific result.
> > 
> > 
> > Try to apply