diff options
author | Swapnil Ingle <swapnil.ingle@nutanix.com> | 2021-05-11 13:05:34 -0400 |
---|---|---|
committer | Swapnil Ingle <swapnil.ingle@nutanix.com> | 2021-05-11 13:13:16 -0400 |
commit | bae04bf12dd153161a8adf08a56d8485b3a13260 (patch) | |
tree | f5cce198987c791070e896cddda96b301f1cffaf | |
parent | f8f9200b5ff8d85bcff717111a85405439ace4d4 (diff) | |
download | libvfio-user-bae04bf12dd153161a8adf08a56d8485b3a13260.zip libvfio-user-bae04bf12dd153161a8adf08a56d8485b3a13260.tar.gz libvfio-user-bae04bf12dd153161a8adf08a56d8485b3a13260.tar.bz2 |
Use defines from linux-headers/linux/vfio.h
Instead of having local copy use the defines from
linux-headers/linux/vfio.h.
Same as how Qemu does.
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/vfio-user.h | 61 |
2 files changed, 1 insertions, 61 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8715625..768d1a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(JSON REQUIRED json-c) include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_SOURCE_DIR}/linux-headers/) include_directories(${CMAKE_SOURCE_DIR}/lib) include_directories(${JSON_INCLUDE_DIRS}) diff --git a/include/vfio-user.h b/include/vfio-user.h index 053ead2..09a756e 100644 --- a/include/vfio-user.h +++ b/include/vfio-user.h @@ -133,67 +133,6 @@ struct vfio_user_irq_info { uint32_t subindex; } __attribute__((packed)); -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) - -/* copied from <linux/vfio.h> */ - -#define VFIO_DEVICE_STATE_STOP (0) -#define VFIO_DEVICE_STATE_RUNNING (1 << 0) -#define VFIO_DEVICE_STATE_SAVING (1 << 1) -#define VFIO_DEVICE_STATE_RESUMING (1 << 2) -#define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_RUNNING | \ - VFIO_DEVICE_STATE_SAVING | \ - VFIO_DEVICE_STATE_RESUMING) - -#define VFIO_DEVICE_STATE_VALID(state) \ - (state & VFIO_DEVICE_STATE_RESUMING ? \ - (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_RESUMING : 1) - -#define VFIO_DEVICE_STATE_IS_ERROR(state) \ - ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_SAVING | \ - VFIO_DEVICE_STATE_RESUMING)) - -#define VFIO_DEVICE_STATE_SET_ERROR(state) \ - ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_SATE_SAVING | \ - VFIO_DEVICE_STATE_RESUMING) - -/* RHEL kernels have some of it backported */ -#ifndef VFIO_REGION_TYPE_MIGRATION /* not a RHEL kernel */ -#define VFIO_REGION_TYPE_MIGRATION (3) -#define VFIO_REGION_SUBTYPE_MIGRATION (1) - -struct vfio_device_migration_info { - __u32 device_state; /* VFIO device state */ - __u32 reserved; - __u64 pending_bytes; - __u64 data_offset; - __u64 data_size; -}; -#endif /* not a RHEL kernel */ - -struct vfio_bitmap { - __u64 pgsize; /* page size for bitmap in bytes */ - __u64 size; /* in bytes */ - __u64 *data; /* one bit per page */ -}; - -struct vfio_iommu_type1_dirty_bitmap { - __u32 argsz; - __u32 flags; -#define VFIO_IOMMU_DIRTY_PAGES_FLAG_START (1 << 0) -#define VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP (1 << 1) -#define VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP (1 << 2) - __u8 data[]; -}; - -struct vfio_iommu_type1_dirty_bitmap_get { - __u64 iova; /* IO virtual address */ - __u64 size; /* Size of iova range */ - struct vfio_bitmap bitmap; -}; - -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) */ - #ifdef __cplusplus } #endif |