xref: /qemu/include/hw/virtio/virtio-pmem.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
1 /*
2  * Virtio PMEM device
3  *
4  * Copyright (C) 2018-2019 Red Hat, Inc.
5  *
6  * Authors:
7  *  Pankaj Gupta <pagupta@redhat.com>
8  *  David Hildenbrand <david@redhat.com>
9  *
10  * This work is licensed under the terms of the GNU GPL, version 2.
11  * See the COPYING file in the top-level directory.
12  */
13 
14 #ifndef HW_VIRTIO_PMEM_H
15 #define HW_VIRTIO_PMEM_H
16 
17 #include "hw/virtio/virtio.h"
18 #include "qapi/qapi-types-misc.h"
19 #include "qom/object.h"
20 
21 #define TYPE_VIRTIO_PMEM "virtio-pmem"
22 
23 typedef struct VirtIOPMEM VirtIOPMEM;
24 typedef struct VirtIOPMEMClass VirtIOPMEMClass;
25 #define VIRTIO_PMEM(obj) \
26         OBJECT_CHECK(VirtIOPMEM, (obj), TYPE_VIRTIO_PMEM)
27 #define VIRTIO_PMEM_CLASS(oc) \
28         OBJECT_CLASS_CHECK(VirtIOPMEMClass, (oc), TYPE_VIRTIO_PMEM)
29 #define VIRTIO_PMEM_GET_CLASS(obj) \
30         OBJECT_GET_CLASS(VirtIOPMEMClass, (obj), TYPE_VIRTIO_PMEM)
31 
32 #define VIRTIO_PMEM_ADDR_PROP "memaddr"
33 #define VIRTIO_PMEM_MEMDEV_PROP "memdev"
34 
35 struct VirtIOPMEM {
36     VirtIODevice parent_obj;
37 
38     VirtQueue *rq_vq;
39     uint64_t start;
40     HostMemoryBackend *memdev;
41 };
42 
43 struct VirtIOPMEMClass {
44     /* private */
45     VirtIODevice parent;
46 
47     /* public */
48     void (*fill_device_info)(const VirtIOPMEM *pmem, VirtioPMEMDeviceInfo *vi);
49     MemoryRegion *(*get_memory_region)(VirtIOPMEM *pmem, Error **errp);
50 };
51 
52 #endif
53