* [SPDK] Re: Can I use spdk_pci_hook_device to implement a virtual NVMe device?
@ 2020-04-26 7:08 oscar.huang
0 siblings, 0 replies; 2+ messages in thread
From: oscar.huang @ 2020-04-26 7:08 UTC (permalink / raw)
To: spdk
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
Hi, Jim,
I haven't. I have no experience on creating code to trap memory access. I googled a little bit. It looks like I can use mprotect to set memory access properties so that certain signal can be triggered when the memory area is read or written. Will give it a try.
Thanks for your suggestion, Jim.
-Oscar
^ permalink raw reply [flat|nested] 2+ messages in thread
* [SPDK] Re: Can I use spdk_pci_hook_device to implement a virtual NVMe device?
@ 2020-04-24 14:02 Harris, James R
0 siblings, 0 replies; 2+ messages in thread
From: Harris, James R @ 2020-04-24 14:02 UTC (permalink / raw)
To: spdk
[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]
Hi Oscar,
Have you tried a signal handler to trap writes to the virtual BAR? Then your handler can get the fault address and do whatever actions it needs.
-Jim
On 4/23/20, 6:30 PM, "oscar.huang(a)microchip.com" <oscar.huang(a)microchip.com> wrote:
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!
_______________________________________________
SPDK mailing list -- spdk(a)lists.01.org
To unsubscribe send an email to spdk-leave(a)lists.01.org
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-26 7:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 7:08 [SPDK] Re: Can I use spdk_pci_hook_device to implement a virtual NVMe device? oscar.huang
-- strict thread matches above, loose matches on Subject: below --
2020-04-24 14:02 Harris, James R
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.