Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * virtio_pmem.h: virtio pmem Driver
0004  *
0005  * Discovers persistent memory range information
0006  * from host and provides a virtio based flushing
0007  * interface.
0008  **/
0009 
0010 #ifndef _LINUX_VIRTIO_PMEM_H
0011 #define _LINUX_VIRTIO_PMEM_H
0012 
0013 #include <linux/module.h>
0014 #include <uapi/linux/virtio_pmem.h>
0015 #include <linux/libnvdimm.h>
0016 #include <linux/spinlock.h>
0017 
0018 struct virtio_pmem_request {
0019     struct virtio_pmem_req req;
0020     struct virtio_pmem_resp resp;
0021 
0022     /* Wait queue to process deferred work after ack from host */
0023     wait_queue_head_t host_acked;
0024     bool done;
0025 
0026     /* Wait queue to process deferred work after virt queue buffer avail */
0027     wait_queue_head_t wq_buf;
0028     bool wq_buf_avail;
0029     struct list_head list;
0030 };
0031 
0032 struct virtio_pmem {
0033     struct virtio_device *vdev;
0034 
0035     /* Virtio pmem request queue */
0036     struct virtqueue *req_vq;
0037 
0038     /* nvdimm bus registers virtio pmem device */
0039     struct nvdimm_bus *nvdimm_bus;
0040     struct nvdimm_bus_descriptor nd_desc;
0041 
0042     /* List to store deferred work if virtqueue is full */
0043     struct list_head req_list;
0044 
0045     /* Synchronize virtqueue data */
0046     spinlock_t pmem_lock;
0047 
0048     /* Memory region information */
0049     __u64 start;
0050     __u64 size;
0051 };
0052 
0053 void virtio_pmem_host_ack(struct virtqueue *vq);
0054 int async_pmem_flush(struct nd_region *nd_region, struct bio *bio);
0055 #endif