1 /* SPDX-License-Identifier: GPL-2.0 */
3 * virtio_pmem.h: virtio pmem Driver
5 * Discovers persistent memory range information
6 * from host and provides a virtio based flushing
10 #ifndef _LINUX_VIRTIO_PMEM_H
11 #define _LINUX_VIRTIO_PMEM_H
13 #include <linux/module.h>
14 #include <uapi/linux/virtio_pmem.h>
15 #include <linux/libnvdimm.h>
16 #include <linux/spinlock.h>
18 struct virtio_pmem_request {
19 struct virtio_pmem_req req;
20 struct virtio_pmem_resp resp;
22 /* Wait queue to process deferred work after ack from host */
23 wait_queue_head_t host_acked;
26 /* Wait queue to process deferred work after virt queue buffer avail */
27 wait_queue_head_t wq_buf;
29 struct list_head list;
33 struct virtio_device *vdev;
35 /* Virtio pmem request queue */
36 struct virtqueue *req_vq;
38 /* nvdimm bus registers virtio pmem device */
39 struct nvdimm_bus *nvdimm_bus;
40 struct nvdimm_bus_descriptor nd_desc;
42 /* List to store deferred work if virtqueue is full */
43 struct list_head req_list;
45 /* Synchronize virtqueue data */
48 /* Memory region information */
53 void virtio_pmem_host_ack(struct virtqueue *vq);
54 int async_pmem_flush(struct nd_region *nd_region, struct bio *bio);