History

Merge tag 'vfio-v6.8-rc1' of https://github.com/awilliam/linux-vfio

Pull VFIO updates from Alex Williamson: - Add debugfs support, initially used for reporting device migration state (Longfang Liu) - Fixes and support for migration dirty tracking across multiple IOVA regions in the pds-vfio-pci driver (Brett Creeley) - Improved IOMMU allocation accounting visibility (Pasha Tatashin) - Virtio infrastructure and a new virtio-vfio-pci variant driver, which provides emulation of a legacy virtio interfaces on modern virtio hardware for virtio-net VF devices where the PF driver exposes support for legacy admin queues, ie. an emulated IO BAR on an SR-IOV VF to provide driver ABI compatibility to legacy devices (Yishai Hadas & Feng Liu) - Migration fixes for the hisi-acc-vfio-pci variant driver (Shameer Kolothum) - Kconfig dependency fix for new virtio-vfio-pci variant driver (Arnd Bergmann) * tag 'vfio-v6.8-rc1' of https://github.com/awilliam/linux-vfio: (22 commits) vfio/virtio: fix virtio-pci dependency hisi_acc_vfio_pci: Update migration data pointer correctly on saving/resume vfio/virtio: Declare virtiovf_pci_aer_reset_done() static vfio/virtio: Introduce a vfio driver over virtio devices vfio/pci: Expose vfio_pci_core_iowrite/read##size() vfio/pci: Expose vfio_pci_core_setup_barmap() virtio-pci: Introduce APIs to execute legacy IO admin commands virtio-pci: Initialize the supported admin commands virtio-pci: Introduce admin commands virtio-pci: Introduce admin command sending function virtio-pci: Introduce admin virtqueue virtio: Define feature bit for administration virtqueue vfio/type1: account iommu allocations vfio/pds: Add multi-region support vfio/pds: Move seq/ack bitmaps into region struct vfio/pds: Pass region info to relevant functions vfio/pds: Move and rename region specific info vfio/pds: Only use a single SGL for both seq and ack vfio/pds: Fix calculations in pds_vfio_dirty_sync MAINTAINERS: Add vfio debugfs interface doc link ...

Linus Torvalds committed 2 years ago

Commit 244aefb2 parents 86c4d58 78f70c034 files · +1754 −164Browse files

Showing the changes to include/uapi (3 of 34 files). Show all

Unified · Split

3 files
  1. include/uapi/linux/vfio.h +1 −0
  2. include/uapi/linux/virtio_config.h +7 −1
  3. include/uapi/linux/virtio_pci.h +68 −0
include/uapi/linux/vfio.h+1−0
@@ -1219,6 +1219,7 @@ enum vfio_device_mig_state { · 1218 unmodified lines
12191219 VFIO_DEVICE_STATE_RUNNING_P2P = 5,
12201220 VFIO_DEVICE_STATE_PRE_COPY = 6,
12211221 VFIO_DEVICE_STATE_PRE_COPY_P2P = 7,
1222+ VFIO_DEVICE_STATE_NR,
12221223 };
12231224
12241225 /**
include/uapi/linux/virtio_config.h+7−1
@@ -52,7 +52,7 @@ · 51 unmodified lines
5252 * rest are per-device feature bits.
5353 */
5454 #define VIRTIO_TRANSPORT_F_START 28
55−#define VIRTIO_TRANSPORT_F_END 41
55+#define VIRTIO_TRANSPORT_F_END 42
5656
5757 #ifndef VIRTIO_CONFIG_NO_LEGACY
5858 /* Do we get callbacks when the ring is completely used, even if we've
@@ -114,4 +114,10 @@ · 55 unmodified lines
114114 * This feature indicates that the driver can reset a queue individually.
115115 */
116116 #define VIRTIO_F_RING_RESET 40
117+
118+/*
119+ * This feature indicates that the device support administration virtqueues.
120+ */
121+#define VIRTIO_F_ADMIN_VQ 41
122+
117123 #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
include/uapi/linux/virtio_pci.h+68−0
@@ -175,6 +175,9 @@ struct virtio_pci_modern_common_cfg { · 174 unmodified lines
175175
176176 __le16 queue_notify_data; /* read-write */
177177 __le16 queue_reset; /* read-write */
178+
179+ __le16 admin_queue_index; /* read-only */
180+ __le16 admin_queue_num; /* read-only */
178181 };
179182
180183 /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */
@@ -215,7 +218,72 @@ struct virtio_pci_cfg_cap { · 34 unmodified lines
215218 #define VIRTIO_PCI_COMMON_Q_USEDHI 52
216219 #define VIRTIO_PCI_COMMON_Q_NDATA 56
217220 #define VIRTIO_PCI_COMMON_Q_RESET 58
221+#define VIRTIO_PCI_COMMON_ADM_Q_IDX 60
222+#define VIRTIO_PCI_COMMON_ADM_Q_NUM 62
218223
219224 #endif /* VIRTIO_PCI_NO_MODERN */
220225
226+/* Admin command status. */
227+#define VIRTIO_ADMIN_STATUS_OK 0
228+
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+
243+struct __packed virtio_admin_cmd_hdr {
244+ __le16 opcode;
245+ /*
246+ * 1 - SR-IOV
247+ * 2-65535 - reserved
248+ */
249+ __le16 group_type;
250+ /* Unused, reserved for future extensions. */
251+ __u8 reserved1[12];
252+ __le64 group_member_id;
253+};
254+
255+struct __packed virtio_admin_cmd_status {
256+ __le16 status;
257+ __le16 status_qualifier;
258+ /* Unused, reserved for future extensions. */
259+ __u8 reserved2[4];
260+};
261+
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+
221289 #endif