libvfio-user: update submodule
1. struct pxdcap.per is changed to struct pxdcap.rer Which matches the name in the nvme spec. 2. use new API return value. 3. update specification changes. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Change-Id: Ida421c4cffd1c65d550e83011ab123b321ea9dff Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8088 Reviewed-by: Jim Harris <james.r.harris@intel.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
5b532e80c8
commit
c52e700774
@ -36,30 +36,34 @@
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum vfio_user_command {
|
||||
VFIO_USER_VERSION = 1,
|
||||
VFIO_USER_DMA_MAP = 2,
|
||||
VFIO_USER_DMA_UNMAP = 3,
|
||||
VFIO_USER_DEVICE_GET_INFO = 4,
|
||||
VFIO_USER_DEVICE_GET_REGION_INFO = 5,
|
||||
VFIO_USER_DEVICE_GET_IRQ_INFO = 6,
|
||||
VFIO_USER_DEVICE_SET_IRQS = 7,
|
||||
VFIO_USER_REGION_READ = 8,
|
||||
VFIO_USER_REGION_WRITE = 9,
|
||||
VFIO_USER_DMA_READ = 10,
|
||||
VFIO_USER_DMA_WRITE = 11,
|
||||
VFIO_USER_VM_INTERRUPT = 12,
|
||||
VFIO_USER_DEVICE_GET_REGION_IO_FDS = 6,
|
||||
VFIO_USER_DEVICE_GET_IRQ_INFO = 7,
|
||||
VFIO_USER_DEVICE_SET_IRQS = 8,
|
||||
VFIO_USER_REGION_READ = 9,
|
||||
VFIO_USER_REGION_WRITE = 10,
|
||||
VFIO_USER_DMA_READ = 11,
|
||||
VFIO_USER_DMA_WRITE = 12,
|
||||
VFIO_USER_DEVICE_RESET = 13,
|
||||
VFIO_USER_DIRTY_PAGES = 14,
|
||||
VFIO_USER_MAX,
|
||||
};
|
||||
|
||||
enum vfio_user_message_type {
|
||||
VFIO_USER_MESSAGE_COMMAND = 0,
|
||||
VFIO_USER_MESSAGE_REPLY = 1,
|
||||
VFIO_USER_MESSAGE_COMMAND = 0,
|
||||
VFIO_USER_MESSAGE_REPLY = 1,
|
||||
};
|
||||
|
||||
#define VFIO_USER_FLAGS_NO_REPLY (0x1)
|
||||
#define VFIO_USER_FLAGS_NO_REPLY (0x1)
|
||||
|
||||
struct vfio_user_header {
|
||||
uint16_t msg_id;
|
||||
@ -67,8 +71,8 @@ struct vfio_user_header {
|
||||
uint32_t msg_size;
|
||||
struct {
|
||||
uint32_t type : 4;
|
||||
#define VFIO_USER_F_TYPE_COMMAND 0
|
||||
#define VFIO_USER_F_TYPE_REPLY 1
|
||||
#define VFIO_USER_F_TYPE_COMMAND 0
|
||||
#define VFIO_USER_F_TYPE_REPLY 1
|
||||
uint32_t no_reply : 1;
|
||||
uint32_t error : 1;
|
||||
uint32_t resvd : 26;
|
||||
@ -82,23 +86,48 @@ struct vfio_user_version {
|
||||
uint8_t data[];
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Similar to vfio_device_info, but without caps (yet).
|
||||
*/
|
||||
struct vfio_user_device_info {
|
||||
uint32_t argsz;
|
||||
uint32_t argsz;
|
||||
/* VFIO_DEVICE_FLAGS_* */
|
||||
uint32_t flags;
|
||||
uint32_t num_regions;
|
||||
uint32_t num_irqs;
|
||||
uint32_t flags;
|
||||
uint32_t num_regions;
|
||||
uint32_t num_irqs;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct vfio_user_dma_region {
|
||||
/* based on struct vfio_bitmap */
|
||||
struct vfio_user_bitmap {
|
||||
uint64_t pgsize;
|
||||
uint64_t size;
|
||||
char data[];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* based on struct vfio_iommu_type1_dma_map */
|
||||
struct vfio_user_dma_map {
|
||||
uint32_t argsz;
|
||||
#define VFIO_USER_F_DMA_REGION_READ (1 << 0)
|
||||
#define VFIO_USER_F_DMA_REGION_WRITE (1 << 1)
|
||||
#define VFIO_USER_F_DMA_REGION_MAPPABLE (1 << 2)
|
||||
uint32_t flags;
|
||||
uint64_t offset;
|
||||
uint64_t addr;
|
||||
uint64_t size;
|
||||
uint64_t offset;
|
||||
uint32_t prot;
|
||||
uint32_t flags;
|
||||
#define VFIO_USER_F_DMA_REGION_MAPPABLE (1 << 0)
|
||||
} __attribute__((packed));
|
||||
|
||||
/* based on struct vfio_iommu_type1_dma_unmap */
|
||||
struct vfio_user_dma_unmap {
|
||||
uint32_t argsz;
|
||||
#ifndef VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP
|
||||
#define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0)
|
||||
#endif
|
||||
uint32_t flags;
|
||||
uint64_t addr;
|
||||
uint64_t size;
|
||||
struct vfio_user_bitmap bitmap[];
|
||||
};
|
||||
|
||||
struct vfio_user_region_access {
|
||||
uint64_t offset;
|
||||
uint32_t region;
|
||||
@ -107,13 +136,25 @@ struct vfio_user_region_access {
|
||||
} __attribute__((packed));
|
||||
|
||||
struct vfio_user_dma_region_access {
|
||||
uint64_t addr;
|
||||
uint64_t count;
|
||||
uint8_t data[];
|
||||
uint64_t addr;
|
||||
uint64_t count;
|
||||
uint8_t data[];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct vfio_user_irq_info {
|
||||
uint32_t subindex;
|
||||
uint32_t subindex;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* based on struct vfio_iommu_type1_dirty_bitmap_get */
|
||||
struct vfio_user_bitmap_range {
|
||||
uint64_t iova;
|
||||
uint64_t size;
|
||||
struct vfio_user_bitmap bitmap;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -398,7 +398,7 @@ map_one(vfu_ctx_t *ctx, uint64_t addr, uint64_t len, dma_sg_t *sg, struct iovec
|
||||
assert(iov != NULL);
|
||||
|
||||
ret = vfu_addr_to_sg(ctx, (void *)(uintptr_t)addr, len, sg, 1, PROT_READ | PROT_WRITE);
|
||||
if (ret != 1) {
|
||||
if (ret < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1478,7 +1478,7 @@ vfio_user_dev_info_fill(struct nvmf_vfio_user_transport *vu_transport,
|
||||
struct pxcap pxcap = {
|
||||
.hdr.id = PCI_CAP_ID_EXP,
|
||||
.pxcaps.ver = 0x2,
|
||||
.pxdcap = {.per = 0x1, .flrc = 0x1},
|
||||
.pxdcap = {.rer = 0x1, .flrc = 0x1},
|
||||
.pxdcap2.ctds = 0x1
|
||||
};
|
||||
|
||||
|
@ -296,18 +296,26 @@ vfio_user_get_dev_info(struct vfio_device *dev, struct vfio_user_device_info *de
|
||||
int
|
||||
vfio_user_dev_dma_map_unmap(struct vfio_device *dev, struct vfio_memory_region *mr, bool map)
|
||||
{
|
||||
struct vfio_user_dma_region region = { 0 };
|
||||
struct vfio_user_dma_map dma_map = { 0 };
|
||||
struct vfio_user_dma_unmap dma_unmap = { 0 };
|
||||
|
||||
region.addr = mr->iova;
|
||||
region.size = mr->size;
|
||||
region.offset = mr->offset;
|
||||
if (map) {
|
||||
region.flags = VFIO_USER_F_DMA_REGION_MAPPABLE;
|
||||
region.prot = PROT_READ | PROT_WRITE;
|
||||
}
|
||||
dma_map.argsz = sizeof(struct vfio_user_dma_map);
|
||||
dma_map.addr = mr->iova;
|
||||
dma_map.size = mr->size;
|
||||
dma_map.offset = mr->offset;
|
||||
dma_map.flags = VFIO_USER_F_DMA_REGION_READ | VFIO_USER_F_DMA_REGION_WRITE |
|
||||
VFIO_USER_F_DMA_REGION_MAPPABLE;
|
||||
|
||||
return vfio_user_dev_send_request(dev, map ? VFIO_USER_DMA_MAP : VFIO_USER_DMA_UNMAP,
|
||||
®ion, sizeof(region), sizeof(region), &mr->fd, 1);
|
||||
return vfio_user_dev_send_request(dev, VFIO_USER_DMA_MAP,
|
||||
&dma_map, sizeof(dma_map), sizeof(dma_map), &mr->fd, 1);
|
||||
} else {
|
||||
dma_unmap.argsz = sizeof(struct vfio_user_dma_unmap);
|
||||
dma_unmap.addr = mr->iova;
|
||||
dma_unmap.size = mr->size;
|
||||
return vfio_user_dev_send_request(dev, VFIO_USER_DMA_UNMAP,
|
||||
&dma_unmap, sizeof(dma_unmap), sizeof(dma_unmap), &mr->fd, 1);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 7443fbedd1f94288fbe0d3563b72c4938aa9ff2f
|
||||
Subproject commit 8ac2360a8aefbd2dd11c65f2b2e21565c36c0ee6
|
Loading…
Reference in New Issue
Block a user