Merge tag 'mm-hotfixes-stable-2024-06-26-17-28' of git://git.kernel.org/pub/scm/linux...
[linux.git] / drivers / nvdimm / virtio_pmem.h
blob0dddefe594c46ad7e0c0557f73ffcdc20bbe9c1c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * virtio_pmem.h: virtio pmem Driver
5 * Discovers persistent memory range information
6 * from host and provides a virtio based flushing
7 * interface.
8 **/
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;
24 bool done;
26 /* Wait queue to process deferred work after virt queue buffer avail */
27 wait_queue_head_t wq_buf;
28 bool wq_buf_avail;
29 struct list_head list;
32 struct virtio_pmem {
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 */
46 spinlock_t pmem_lock;
48 /* Memory region information */
49 __u64 start;
50 __u64 size;
53 void virtio_pmem_host_ack(struct virtqueue *vq);
54 int async_pmem_flush(struct nd_region *nd_region, struct bio *bio);
55 #endif