19fbe302bSMichael S. Tsirkin /*
29fbe302bSMichael S. Tsirkin  * Virtio PCI driver
39fbe302bSMichael S. Tsirkin  *
49fbe302bSMichael S. Tsirkin  * This module allows virtio devices to be used over a virtual PCI device.
59fbe302bSMichael S. Tsirkin  * This can be used with QEMU based VMMs like KVM or Xen.
69fbe302bSMichael S. Tsirkin  *
79fbe302bSMichael S. Tsirkin  * Copyright IBM Corp. 2007
89fbe302bSMichael S. Tsirkin  *
99fbe302bSMichael S. Tsirkin  * Authors:
109fbe302bSMichael S. Tsirkin  *  Anthony Liguori  <aliguori@us.ibm.com>
119fbe302bSMichael S. Tsirkin  *
129fbe302bSMichael S. Tsirkin  * This header is BSD licensed so anyone can use the definitions to implement
139fbe302bSMichael S. Tsirkin  * compatible drivers/servers.
149fbe302bSMichael S. Tsirkin  *
159fbe302bSMichael S. Tsirkin  * Redistribution and use in source and binary forms, with or without
169fbe302bSMichael S. Tsirkin  * modification, are permitted provided that the following conditions
179fbe302bSMichael S. Tsirkin  * are met:
189fbe302bSMichael S. Tsirkin  * 1. Redistributions of source code must retain the above copyright
199fbe302bSMichael S. Tsirkin  *    notice, this list of conditions and the following disclaimer.
209fbe302bSMichael S. Tsirkin  * 2. Redistributions in binary form must reproduce the above copyright
219fbe302bSMichael S. Tsirkin  *    notice, this list of conditions and the following disclaimer in the
229fbe302bSMichael S. Tsirkin  *    documentation and/or other materials provided with the distribution.
239fbe302bSMichael S. Tsirkin  * 3. Neither the name of IBM nor the names of its contributors
249fbe302bSMichael S. Tsirkin  *    may be used to endorse or promote products derived from this software
259fbe302bSMichael S. Tsirkin  *    without specific prior written permission.
269fbe302bSMichael S. Tsirkin  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
279fbe302bSMichael S. Tsirkin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
289fbe302bSMichael S. Tsirkin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
299fbe302bSMichael S. Tsirkin  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
309fbe302bSMichael S. Tsirkin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
319fbe302bSMichael S. Tsirkin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
329fbe302bSMichael S. Tsirkin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
339fbe302bSMichael S. Tsirkin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
349fbe302bSMichael S. Tsirkin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
359fbe302bSMichael S. Tsirkin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
369fbe302bSMichael S. Tsirkin  * SUCH DAMAGE.
379fbe302bSMichael S. Tsirkin  */
389fbe302bSMichael S. Tsirkin 
399fbe302bSMichael S. Tsirkin #ifndef _LINUX_VIRTIO_PCI_H
409fbe302bSMichael S. Tsirkin #define _LINUX_VIRTIO_PCI_H
419fbe302bSMichael S. Tsirkin 
429fbe302bSMichael S. Tsirkin #include "standard-headers/linux/types.h"
439fbe302bSMichael S. Tsirkin 
449fbe302bSMichael S. Tsirkin #ifndef VIRTIO_PCI_NO_LEGACY
459fbe302bSMichael S. Tsirkin 
469fbe302bSMichael S. Tsirkin /* A 32-bit r/o bitmask of the features supported by the host */
479fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_HOST_FEATURES	0
489fbe302bSMichael S. Tsirkin 
499fbe302bSMichael S. Tsirkin /* A 32-bit r/w bitmask of features activated by the guest */
509fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_GUEST_FEATURES	4
519fbe302bSMichael S. Tsirkin 
529fbe302bSMichael S. Tsirkin /* A 32-bit r/w PFN for the currently selected queue */
539fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_QUEUE_PFN		8
549fbe302bSMichael S. Tsirkin 
559fbe302bSMichael S. Tsirkin /* A 16-bit r/o queue size for the currently selected queue */
569fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_QUEUE_NUM		12
579fbe302bSMichael S. Tsirkin 
589fbe302bSMichael S. Tsirkin /* A 16-bit r/w queue selector */
599fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_QUEUE_SEL		14
609fbe302bSMichael S. Tsirkin 
619fbe302bSMichael S. Tsirkin /* A 16-bit r/w queue notifier */
629fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_QUEUE_NOTIFY		16
639fbe302bSMichael S. Tsirkin 
649fbe302bSMichael S. Tsirkin /* An 8-bit device status register.  */
659fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_STATUS		18
669fbe302bSMichael S. Tsirkin 
679fbe302bSMichael S. Tsirkin /* An 8-bit r/o interrupt status register.  Reading the value will return the
689fbe302bSMichael S. Tsirkin  * current contents of the ISR and will also clear it.  This is effectively
699fbe302bSMichael S. Tsirkin  * a read-and-acknowledge. */
709fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_ISR			19
719fbe302bSMichael S. Tsirkin 
729fbe302bSMichael S. Tsirkin /* MSI-X registers: only enabled if MSI-X is enabled. */
739fbe302bSMichael S. Tsirkin /* A 16-bit vector for configuration changes. */
749fbe302bSMichael S. Tsirkin #define VIRTIO_MSI_CONFIG_VECTOR        20
759fbe302bSMichael S. Tsirkin /* A 16-bit vector for selected queue notifications. */
769fbe302bSMichael S. Tsirkin #define VIRTIO_MSI_QUEUE_VECTOR         22
779fbe302bSMichael S. Tsirkin 
789fbe302bSMichael S. Tsirkin /* The remaining space is defined by each driver as the per-driver
799fbe302bSMichael S. Tsirkin  * configuration space */
809fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CONFIG_OFF(msix_enabled)	((msix_enabled) ? 24 : 20)
819fbe302bSMichael S. Tsirkin /* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */
829fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CONFIG(dev)	VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)
839fbe302bSMichael S. Tsirkin 
849fbe302bSMichael S. Tsirkin /* Virtio ABI version, this must match exactly */
859fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_ABI_VERSION		0
869fbe302bSMichael S. Tsirkin 
879fbe302bSMichael S. Tsirkin /* How many bits to shift physical queue address written to QUEUE_PFN.
889fbe302bSMichael S. Tsirkin  * 12 is historical, and due to x86 page size. */
899fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_QUEUE_ADDR_SHIFT	12
909fbe302bSMichael S. Tsirkin 
919fbe302bSMichael S. Tsirkin /* The alignment to use between consumer and producer parts of vring.
929fbe302bSMichael S. Tsirkin  * x86 pagesize again. */
939fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_VRING_ALIGN		4096
949fbe302bSMichael S. Tsirkin 
959fbe302bSMichael S. Tsirkin #endif /* VIRTIO_PCI_NO_LEGACY */
969fbe302bSMichael S. Tsirkin 
979fbe302bSMichael S. Tsirkin /* The bit of the ISR which indicates a device configuration change. */
989fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_ISR_CONFIG		0x2
999fbe302bSMichael S. Tsirkin /* Vector value used to disable MSI for queue */
1009fbe302bSMichael S. Tsirkin #define VIRTIO_MSI_NO_VECTOR            0xffff
1019fbe302bSMichael S. Tsirkin 
1029fbe302bSMichael S. Tsirkin #ifndef VIRTIO_PCI_NO_MODERN
1039fbe302bSMichael S. Tsirkin 
1049fbe302bSMichael S. Tsirkin /* IDs for different capabilities.  Must all exist. */
1059fbe302bSMichael S. Tsirkin 
1069fbe302bSMichael S. Tsirkin /* Common configuration */
1079fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_COMMON_CFG	1
1089fbe302bSMichael S. Tsirkin /* Notifications */
1099fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_NOTIFY_CFG	2
1109fbe302bSMichael S. Tsirkin /* ISR access */
1119fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_ISR_CFG		3
1129fbe302bSMichael S. Tsirkin /* Device specific configuration */
1139fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_DEVICE_CFG	4
1149fbe302bSMichael S. Tsirkin /* PCI configuration access */
1159fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_PCI_CFG		5
11653ba2eeeSMatthew Rosato /* Additional shared memory capability */
11753ba2eeeSMatthew Rosato #define VIRTIO_PCI_CAP_SHARED_MEMORY_CFG 8
1189fbe302bSMichael S. Tsirkin 
1199fbe302bSMichael S. Tsirkin /* This is the PCI capability header: */
1209fbe302bSMichael S. Tsirkin struct virtio_pci_cap {
1219fbe302bSMichael S. Tsirkin 	uint8_t cap_vndr;		/* Generic PCI field: PCI_CAP_ID_VNDR */
1229fbe302bSMichael S. Tsirkin 	uint8_t cap_next;		/* Generic PCI field: next ptr. */
1239fbe302bSMichael S. Tsirkin 	uint8_t cap_len;		/* Generic PCI field: capability length */
1249fbe302bSMichael S. Tsirkin 	uint8_t cfg_type;		/* Identifies the structure. */
1259fbe302bSMichael S. Tsirkin 	uint8_t bar;		/* Where to find it. */
12653ba2eeeSMatthew Rosato 	uint8_t id;		/* Multiple capabilities of the same type */
12753ba2eeeSMatthew Rosato 	uint8_t padding[2];	/* Pad to full dword. */
1289fbe302bSMichael S. Tsirkin 	uint32_t offset;		/* Offset within bar. */
1299fbe302bSMichael S. Tsirkin 	uint32_t length;		/* Length of the structure, in bytes. */
1309fbe302bSMichael S. Tsirkin };
1319fbe302bSMichael S. Tsirkin 
13253ba2eeeSMatthew Rosato struct virtio_pci_cap64 {
13353ba2eeeSMatthew Rosato 	struct virtio_pci_cap cap;
13453ba2eeeSMatthew Rosato 	uint32_t offset_hi;             /* Most sig 32 bits of offset */
13553ba2eeeSMatthew Rosato 	uint32_t length_hi;             /* Most sig 32 bits of length */
13653ba2eeeSMatthew Rosato };
13753ba2eeeSMatthew Rosato 
1389fbe302bSMichael S. Tsirkin struct virtio_pci_notify_cap {
1399fbe302bSMichael S. Tsirkin 	struct virtio_pci_cap cap;
1409fbe302bSMichael S. Tsirkin 	uint32_t notify_off_multiplier;	/* Multiplier for queue_notify_off. */
1419fbe302bSMichael S. Tsirkin };
1429fbe302bSMichael S. Tsirkin 
1439fbe302bSMichael S. Tsirkin /* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */
1449fbe302bSMichael S. Tsirkin struct virtio_pci_common_cfg {
1459fbe302bSMichael S. Tsirkin 	/* About the whole device. */
1469fbe302bSMichael S. Tsirkin 	uint32_t device_feature_select;	/* read-write */
1479fbe302bSMichael S. Tsirkin 	uint32_t device_feature;		/* read-only */
1489fbe302bSMichael S. Tsirkin 	uint32_t guest_feature_select;	/* read-write */
1499fbe302bSMichael S. Tsirkin 	uint32_t guest_feature;		/* read-write */
1509fbe302bSMichael S. Tsirkin 	uint16_t msix_config;		/* read-write */
1519fbe302bSMichael S. Tsirkin 	uint16_t num_queues;		/* read-only */
1529fbe302bSMichael S. Tsirkin 	uint8_t device_status;		/* read-write */
1539fbe302bSMichael S. Tsirkin 	uint8_t config_generation;		/* read-only */
1549fbe302bSMichael S. Tsirkin 
1559fbe302bSMichael S. Tsirkin 	/* About a specific virtqueue. */
1569fbe302bSMichael S. Tsirkin 	uint16_t queue_select;		/* read-write */
1579fbe302bSMichael S. Tsirkin 	uint16_t queue_size;		/* read-write, power of 2. */
1589fbe302bSMichael S. Tsirkin 	uint16_t queue_msix_vector;	/* read-write */
1599fbe302bSMichael S. Tsirkin 	uint16_t queue_enable;		/* read-write */
1609fbe302bSMichael S. Tsirkin 	uint16_t queue_notify_off;	/* read-only */
1619fbe302bSMichael S. Tsirkin 	uint32_t queue_desc_lo;		/* read-write */
1629fbe302bSMichael S. Tsirkin 	uint32_t queue_desc_hi;		/* read-write */
1639fbe302bSMichael S. Tsirkin 	uint32_t queue_avail_lo;		/* read-write */
1649fbe302bSMichael S. Tsirkin 	uint32_t queue_avail_hi;		/* read-write */
1659fbe302bSMichael S. Tsirkin 	uint32_t queue_used_lo;		/* read-write */
1669fbe302bSMichael S. Tsirkin 	uint32_t queue_used_hi;		/* read-write */
1679fbe302bSMichael S. Tsirkin };
1689fbe302bSMichael S. Tsirkin 
169efb91426SDaniel Henrique Barboza /*
170efb91426SDaniel Henrique Barboza  * Warning: do not use sizeof on this: use offsetofend for
171efb91426SDaniel Henrique Barboza  * specific fields you need.
172efb91426SDaniel Henrique Barboza  */
173efb91426SDaniel Henrique Barboza struct virtio_pci_modern_common_cfg {
174efb91426SDaniel Henrique Barboza 	struct virtio_pci_common_cfg cfg;
175efb91426SDaniel Henrique Barboza 
176efb91426SDaniel Henrique Barboza 	uint16_t queue_notify_data;	/* read-write */
177efb91426SDaniel Henrique Barboza 	uint16_t queue_reset;		/* read-write */
1786a02465fSDaniel Henrique Barboza 
1796a02465fSDaniel Henrique Barboza 	uint16_t admin_queue_index;	/* read-only */
1806a02465fSDaniel Henrique Barboza 	uint16_t admin_queue_num;		/* read-only */
181efb91426SDaniel Henrique Barboza };
182efb91426SDaniel Henrique Barboza 
183c36f24a2SMichael S. Tsirkin /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */
184c36f24a2SMichael S. Tsirkin struct virtio_pci_cfg_cap {
185c36f24a2SMichael S. Tsirkin 	struct virtio_pci_cap cap;
186c36f24a2SMichael S. Tsirkin 	uint8_t pci_cfg_data[4]; /* Data for BAR access. */
187c36f24a2SMichael S. Tsirkin };
188c36f24a2SMichael S. Tsirkin 
1899fbe302bSMichael S. Tsirkin /* Macro versions of offsets for the Old Timers! */
1909fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_VNDR		0
1919fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_NEXT		1
1929fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_LEN		2
1939fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_CFG_TYPE		3
1949fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_BAR		4
1959fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_OFFSET		8
1969fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_CAP_LENGTH		12
1979fbe302bSMichael S. Tsirkin 
1989fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_NOTIFY_CAP_MULT	16
1999fbe302bSMichael S. Tsirkin 
2009fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_DFSELECT	0
2019fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_DF		4
2029fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_GFSELECT	8
2039fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_GF		12
2049fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_MSIX		16
2059fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_NUMQ		18
2069fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_STATUS	20
2079fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_CFGGENERATION	21
2089fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_SELECT	22
2099fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_SIZE	24
2109fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_MSIX	26
2119fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_ENABLE	28
2129fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_NOFF	30
2139fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_DESCLO	32
2149fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_DESCHI	36
2159fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_AVAILLO	40
2169fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_AVAILHI	44
2179fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_USEDLO	48
2189fbe302bSMichael S. Tsirkin #define VIRTIO_PCI_COMMON_Q_USEDHI	52
219d525f73fSChenyi Qiang #define VIRTIO_PCI_COMMON_Q_NDATA	56
220d525f73fSChenyi Qiang #define VIRTIO_PCI_COMMON_Q_RESET	58
2216a02465fSDaniel Henrique Barboza #define VIRTIO_PCI_COMMON_ADM_Q_IDX	60
2226a02465fSDaniel Henrique Barboza #define VIRTIO_PCI_COMMON_ADM_Q_NUM	62
2239fbe302bSMichael S. Tsirkin 
2249fbe302bSMichael S. Tsirkin #endif /* VIRTIO_PCI_NO_MODERN */
2259fbe302bSMichael S. Tsirkin 
2266a02465fSDaniel Henrique Barboza /* Admin command status. */
2276a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_STATUS_OK		0
2286a02465fSDaniel Henrique Barboza 
2296a02465fSDaniel Henrique Barboza /* Admin command opcode. */
2306a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_LIST_QUERY	0x0
2316a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_LIST_USE	0x1
2326a02465fSDaniel Henrique Barboza 
2336a02465fSDaniel Henrique Barboza /* Admin command group type. */
2346a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_GROUP_TYPE_SRIOV	0x1
2356a02465fSDaniel Henrique Barboza 
2366a02465fSDaniel Henrique Barboza /* Transitional device admin command. */
2376a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE	0x2
2386a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ		0x3
2396a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE		0x4
2406a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ		0x5
2416a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO		0x6
2426a02465fSDaniel Henrique Barboza 
243*ab0c7fb2SPaolo Bonzini struct virtio_admin_cmd_hdr {
2446a02465fSDaniel Henrique Barboza 	uint16_t opcode;
2456a02465fSDaniel Henrique Barboza 	/*
2466a02465fSDaniel Henrique Barboza 	 * 1 - SR-IOV
2476a02465fSDaniel Henrique Barboza 	 * 2-65535 - reserved
2486a02465fSDaniel Henrique Barboza 	 */
2496a02465fSDaniel Henrique Barboza 	uint16_t group_type;
2506a02465fSDaniel Henrique Barboza 	/* Unused, reserved for future extensions. */
2516a02465fSDaniel Henrique Barboza 	uint8_t reserved1[12];
2526a02465fSDaniel Henrique Barboza 	uint64_t group_member_id;
2536a02465fSDaniel Henrique Barboza };
2546a02465fSDaniel Henrique Barboza 
255*ab0c7fb2SPaolo Bonzini struct virtio_admin_cmd_status {
2566a02465fSDaniel Henrique Barboza 	uint16_t status;
2576a02465fSDaniel Henrique Barboza 	uint16_t status_qualifier;
2586a02465fSDaniel Henrique Barboza 	/* Unused, reserved for future extensions. */
2596a02465fSDaniel Henrique Barboza 	uint8_t reserved2[4];
2606a02465fSDaniel Henrique Barboza };
2616a02465fSDaniel Henrique Barboza 
262*ab0c7fb2SPaolo Bonzini struct virtio_admin_cmd_legacy_wr_data {
2636a02465fSDaniel Henrique Barboza 	uint8_t offset; /* Starting offset of the register(s) to write. */
2646a02465fSDaniel Henrique Barboza 	uint8_t reserved[7];
2656a02465fSDaniel Henrique Barboza 	uint8_t registers[];
2666a02465fSDaniel Henrique Barboza };
2676a02465fSDaniel Henrique Barboza 
268*ab0c7fb2SPaolo Bonzini struct virtio_admin_cmd_legacy_rd_data {
2696a02465fSDaniel Henrique Barboza 	uint8_t offset; /* Starting offset of the register(s) to read. */
2706a02465fSDaniel Henrique Barboza };
2716a02465fSDaniel Henrique Barboza 
2726a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_END 0
2736a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_DEV 0x1
2746a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_MEM 0x2
2756a02465fSDaniel Henrique Barboza 
2766a02465fSDaniel Henrique Barboza #define VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO 4
2776a02465fSDaniel Henrique Barboza 
278*ab0c7fb2SPaolo Bonzini struct virtio_admin_cmd_notify_info_data {
2796a02465fSDaniel Henrique Barboza 	uint8_t flags; /* 0 = end of list, 1 = owner device, 2 = member device */
2806a02465fSDaniel Henrique Barboza 	uint8_t bar; /* BAR of the member or the owner device */
2816a02465fSDaniel Henrique Barboza 	uint8_t padding[6];
2826a02465fSDaniel Henrique Barboza 	uint64_t offset; /* Offset within bar. */
2836a02465fSDaniel Henrique Barboza };
2846a02465fSDaniel Henrique Barboza 
2856a02465fSDaniel Henrique Barboza struct virtio_admin_cmd_notify_info_result {
2866a02465fSDaniel Henrique Barboza 	struct virtio_admin_cmd_notify_info_data entries[VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO];
2876a02465fSDaniel Henrique Barboza };
2886a02465fSDaniel Henrique Barboza 
2899fbe302bSMichael S. Tsirkin #endif
290