[SPDK] Can I use spdk_pci_hook_device to implement a virtual NVMe device?
oscar.huang at microchip.com
| Newsgroups | dev.linux.lists.spdk |
|---|---|
| Message-ID | <[email protected]> |
I'd like to create a virtual NVMe device and use SPDK NVMe APIs to operate it. It looks like spdk_pci_hook_device() can add a virtual PCI device to SPDK PCI system:
void spdk_pci_hook_device(struct spdk_pci_driver *drv, struct spdk_pci_device *dev);
But the struct spdk_pci_device only contains the following callbacks:
int (*map_bar)(struct spdk_pci_device *dev, uint32_t bar,
void **mapped_addr, uint64_t *phys_addr, uint64_t *size);
int (*unmap_bar)(struct spdk_pci_device *dev, uint32_t bar,
void *addr);
int (*cfg_read)(struct spdk_pci_device *dev, void *value,
uint32_t len, uint32_t offset);
int (*cfg_write)(struct spdk_pci_device *dev, void *value,
uint32_t len, uint32_t offset);
void (*detach)(struct spdk_pci_device *dev);
It does not have mmio callbacks. When applications write a device memory, sometimes it needs to trigger some actions on the device. Without mmio callbacks, how to make a useful virtual device with spdk_pci_hook_device? Pls suggest. Much appreciated!