1 /* 2 * Copyright (C) 2018-2022 Intel Corporation. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 /* Shared data structure between VBS-U and VBS-K */ 9 10 #ifndef _VBS_COMMON_IF_H_ 11 #define _VBS_COMMON_IF_H_ 12 13 #include "types.h" 14 15 #define VBS_MAX_VQ_CNT 10 16 #define VBS_NAME_LEN 32 17 struct vbs_vq_info { 18 uint16_t qsize; /* size of this queue (a power of 2) */ 19 uint32_t pfn; /* PFN of virt queue (not shifted!) */ 20 uint16_t msix_idx; /* MSI-X index, or VIRTIO_MSI_NO_VECTOR */ 21 uint64_t msix_addr; 22 uint32_t msix_data; 23 }; 24 25 struct vbs_vqs_info { 26 uint32_t nvq; /* number of virtqueues */ 27 struct vbs_vq_info vqs[VBS_MAX_VQ_CNT]; 28 /* array of struct vbs_vq_info */ 29 }; 30 31 struct vbs_dev_info { 32 char name[VBS_NAME_LEN];/* VBS name */ 33 int vmid; /* VMID this device belongs to */ 34 int nvq; /* virtqueue # */ 35 uint32_t negotiated_features; 36 /* features after VIRTIO_CONFIG_S_DRIVER_OK */ 37 uint64_t pio_range_start; 38 uint64_t pio_range_len; /* PIO bar address initialized by guest OS */ 39 }; 40 41 /* reuse vhost ioctl index */ 42 #define VBS_K_IOCTL 0xAF 43 44 #define VBS_K_SET_DEV _IOW(VBS_K_IOCTL, 0x00, struct vbs_dev_info) 45 #define VBS_K_SET_VQ _IOW(VBS_K_IOCTL, 0x01, struct vbs_vqs_info) 46 #define VBS_K_RESET_DEV _IO(VBS_K_IOCTL, 0x02) 47 48 #endif /* _VBS_COMMON_IF_H_ */ 49