All of lore.kernel.org
 help / color / mirror / Atom feed
* [virtio-comment] proposal: use admin command (and aq) of the device to query config space
@ 2023-08-01  7:09 Parav Pandit
  2023-08-02  4:20 ` [virtio-comment] " Michael S. Tsirkin
  2023-08-02  8:53 ` [virtio-comment] " Jason Wang
  0 siblings, 2 replies; 25+ messages in thread
From: Parav Pandit @ 2023-08-01  7:09 UTC (permalink / raw)
  To: virtio@lists.oasis-open.org, virtio-comment@lists.oasis-open.org
  Cc: Shahaf Shuler, Xuan Zhuo, Michael S. Tsirkin,
	hengqi@linux.alibaba.com

One line proposal: 
Let's use new admin command and admin q for all device types to query device config space for new fields. (always).

Details below.

Query of device capabilities and configuration using DMA interface.
Need: 
Currently device configuration space is exposed as read only registers. It is growing rapidly.
Some devices may be even multi-functionality device in coming future such as net + clock + rdma device.
For a PCI transport implementing such ever-growing capabilities, configuration is burdensome as plain registers.
Hence, it is required for the driver to query capabilities and configuration using a DMA interface.

Interface requirements:
1. Maintain backward compatibility for existing defined configuration fields to stay as registers.
2. Any new field added must be accessed via DMA interface, regardless of device implementation (hw/sw etc).
Results in single driver code regardless of device implementation.
3. A device must be able to choose, starting from which field driver must query 
such configuration via DMA interface. This field offset must be greater than currently defined configuration field.
4. Any driver to device query operation must not be mandated to be
mediated by the owner device for PCI VFs or SIOV or SF devices. Driver must be able to
communicate query capabilities and configuration fields directly to
the device regardless of device type being PCI PF, VF, SF/SIOV device uniformly.
5. When having multi-functionality device in future, it is desired to not always
query all the configuration but may be able to query per-functionality configurations.
For example, query only steering capabilities, query only rdma capabilities or query only clock capabilities.
6. The driver should be able to query config/capabilities without
polling for the DMA completion, in other words, the driver should be able to get
notification from the device when DMA command completes.
7. The driver should be able to utilize existing interrupt vector and/or
virtqueue for query and set operation without demanding
additional interrupt vector whenever possible.

There are multiple options for DMA interface.
Some of these options are listed below that we would like to consider fulfilling above requirements.

Option_1:
New DMA interface registers.
New registers which allows single outstanding DMA command per device.
Such as,
struct pci_dma_cmd_mmio_registers {
	le64 cmd_addr; /* rw */
	le32 cmd_len;	/* rw: ordered write to it after cmd_addr, this triggers cmd to device */
	le32 start_offset_cfg_space; /* fields below this offset are not available as register, dma is must */
};

struct pci_config_access_cmd {
	u8 opcode; /* 0 = get config, 1 to N set dev specific config */
	u8 reserved;
	le16 msix_vector_index;
	le64 rsp_addr; /* points to struct pci_config_access_rsp */
	le32 rsp_len;
};
struct pci_config_access_rsp {
	u8 status;
	u8 debug_field;
	u8 cmd_specific_data[];
};

Cons:
1. Duplication of a VQ interface which can do same work and vq is purposed for "bulk data transfer" in spec already like this use case.
2. Some devices already have CVQ that can easily fulfil this role, which is not utilized.
3. Requires per device additional 16 bytes of register space.
4. Requires an extra msix interrupt vector to differentiate from config change interrupts.

Option_2:
Use admin vq for all the device types regardless of its transport such as PCI PF, PCI VF, PCI SIOV.
In this method a new admin command is issued on the admin vq of the device itself.
Pros:
1. Requirements 1 to 7 are fulfilled.
2. Driver can reuse the same vector with CVQ that addresses requirement #7.
Cons:
1. Requires per device unique admin queue number and count.
Still better than dedicated dma interface of #1, as it requires only 4 additional bytes as opposed to 12 bytes.

Option_3:
Use control VQ for the devices that already has CVQ.
In this method an existing CVQ of the device is used to query device config space.
Pros:
1. All 7 requirements are fulfilled.
2. Does not need 4 bytes of admin queue registers.
3. Save MSI-X vectors of the AQ.
4. Superior to option_2 as it doesn't require extra AQ.
5. Most efficient of all 3 options.
Cons:
1. Those devices which does not have CVQ, may need to add it if at all they are growing.

d. Any other option?

This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-08-03 10:13 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01  7:09 [virtio-comment] proposal: use admin command (and aq) of the device to query config space Parav Pandit
2023-08-02  4:20 ` [virtio-comment] " Michael S. Tsirkin
2023-08-02  4:33   ` [virtio-comment] " Parav Pandit
2023-08-02  8:45   ` [virtio-comment] " Zhu, Lingshan
2023-08-02  8:59     ` [virtio-comment] " Parav Pandit
2023-08-02  9:40       ` [virtio-comment] " Zhu, Lingshan
2023-08-02 10:00         ` [virtio-comment] " Parav Pandit
2023-08-02 11:35           ` [virtio-comment] " Michael S. Tsirkin
2023-08-02 11:51             ` [virtio-comment] " Parav Pandit
2023-08-02 11:53               ` [virtio-comment] " Michael S. Tsirkin
2023-08-02 11:58                 ` [virtio-comment] " Parav Pandit
2023-08-02 12:10                   ` [virtio-comment] " Michael S. Tsirkin
2023-08-02  8:53 ` [virtio-comment] " Jason Wang
2023-08-02  9:07   ` Parav Pandit
2023-08-02  9:32     ` [virtio-comment] Re: [virtio] " Jason Wang
2023-08-02  9:57       ` [virtio-comment] " Parav Pandit
2023-08-02 11:25         ` [virtio-comment] " Michael S. Tsirkin
2023-08-02 11:29           ` [virtio-comment] " Parav Pandit
2023-08-02 11:39             ` [virtio-comment] " Michael S. Tsirkin
2023-08-02 11:44               ` Parav Pandit
2023-08-02 11:50                 ` Michael S. Tsirkin
2023-08-02 11:56                   ` Parav Pandit
2023-08-02 12:09                     ` Michael S. Tsirkin
2023-08-03  2:55         ` Jason Wang
2023-08-03 10:13           ` [virtio-comment] " Parav Pandit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.