| 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-machine.h" |
| 19 | #include "qom/object.h" |
| 20 | |
| 21 | #define TYPE_VIRTIO_PMEM "virtio-pmem" |
| 22 | |
| 23 | OBJECT_DECLARE_TYPE(VirtIOPMEM, VirtIOPMEMClass, |
| 24 | VIRTIO_PMEM) |
| 25 | |
| 26 | #define VIRTIO_PMEM_ADDR_PROP "memaddr" |
| 27 | #define VIRTIO_PMEM_MEMDEV_PROP "memdev" |
| 28 | |
| 29 | struct VirtIOPMEM { |
| 30 | VirtIODevice parent_obj; |
| 31 | |
| 32 | VirtQueue *rq_vq; |
| 33 | uint64_t start; |
| 34 | HostMemoryBackend *memdev; |
| 35 | unsigned int inflight; |
| 36 | }; |
| 37 | |
| 38 | struct VirtIOPMEMClass { |
| 39 | /* private */ |
| 40 | VirtioDeviceClass parent_class; |
| 41 | |
| 42 | /* public */ |
| 43 | void (*fill_device_info)(const VirtIOPMEM *pmem, VirtioPMEMDeviceInfo *vi); |
| 44 | MemoryRegion *(*get_memory_region)(VirtIOPMEM *pmem, Error **errp); |
| 45 | }; |
| 46 | |
| 47 | #endif |