Skip to content

Commit 388431b

Browse files
Feng LiuAlex Williamson
authored andcommitted
virtio-pci: Introduce admin commands
Introduces admin commands, as follow: The "list query" command can be used by the driver to query the set of admin commands supported by the virtio device. The "list use" command is used to inform the virtio device which admin commands the driver will use. The "legacy common cfg rd/wr" commands are used to read from/write into the legacy common configuration structure. The "legacy dev cfg rd/wr" commands are used to read from/write into the legacy device configuration structure. The "notify info" command is used to query the notification region information. Signed-off-by: Feng Liu <feliu@nvidia.com> Reviewed-by: Parav Pandit <parav@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Yishai Hadas <yishaih@nvidia.com> Link: https://lore.kernel.org/r/20231219093247.170936-5-yishaih@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 92792ac commit 388431b

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

include/uapi/linux/virtio_pci.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,20 @@ struct virtio_pci_cfg_cap {
226226
/* Admin command status. */
227227
#define VIRTIO_ADMIN_STATUS_OK 0
228228

229+
/* Admin command opcode. */
230+
#define VIRTIO_ADMIN_CMD_LIST_QUERY 0x0
231+
#define VIRTIO_ADMIN_CMD_LIST_USE 0x1
232+
233+
/* Admin command group type. */
234+
#define VIRTIO_ADMIN_GROUP_TYPE_SRIOV 0x1
235+
236+
/* Transitional device admin command. */
237+
#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE 0x2
238+
#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ 0x3
239+
#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE 0x4
240+
#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ 0x5
241+
#define VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO 0x6
242+
229243
struct __packed virtio_admin_cmd_hdr {
230244
__le16 opcode;
231245
/*
@@ -245,4 +259,31 @@ struct __packed virtio_admin_cmd_status {
245259
__u8 reserved2[4];
246260
};
247261

262+
struct __packed virtio_admin_cmd_legacy_wr_data {
263+
__u8 offset; /* Starting offset of the register(s) to write. */
264+
__u8 reserved[7];
265+
__u8 registers[];
266+
};
267+
268+
struct __packed virtio_admin_cmd_legacy_rd_data {
269+
__u8 offset; /* Starting offset of the register(s) to read. */
270+
};
271+
272+
#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_END 0
273+
#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_DEV 0x1
274+
#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_MEM 0x2
275+
276+
#define VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO 4
277+
278+
struct __packed virtio_admin_cmd_notify_info_data {
279+
__u8 flags; /* 0 = end of list, 1 = owner device, 2 = member device */
280+
__u8 bar; /* BAR of the member or the owner device */
281+
__u8 padding[6];
282+
__le64 offset; /* Offset within bar. */
283+
};
284+
285+
struct virtio_admin_cmd_notify_info_result {
286+
struct virtio_admin_cmd_notify_info_data entries[VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO];
287+
};
288+
248289
#endif

0 commit comments

Comments
 (0)