vhost: add fallback if linux/vfio.h is missing
On older kernels that don't have VFIO, stub out the vhost IOMMU functions. Fixes build on older distributions (e.g. CentOS 6). Change-Id: Icda9998e494c24d252511a4da93ecb56502fe5a7 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/363473 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
1573df0f27
commit
adf3cc2bc8
@ -33,6 +33,12 @@
|
|||||||
|
|
||||||
#include "spdk/stdinc.h"
|
#include "spdk/stdinc.h"
|
||||||
|
|
||||||
|
#include "vhost_iommu.h"
|
||||||
|
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
|
||||||
|
|
||||||
#include <linux/vfio.h>
|
#include <linux/vfio.h>
|
||||||
|
|
||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
@ -40,8 +46,6 @@
|
|||||||
|
|
||||||
#include "spdk_internal/log.h"
|
#include "spdk_internal/log.h"
|
||||||
|
|
||||||
#include "vhost_iommu.h"
|
|
||||||
|
|
||||||
struct vfio_map {
|
struct vfio_map {
|
||||||
uint64_t iova;
|
uint64_t iova;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
@ -303,3 +307,19 @@ int spdk_iommu_mem_unregister(uint64_t addr, uint64_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SPDK_LOG_REGISTER_TRACE_FLAG("vhost_vfio", SPDK_TRACE_VHOST_VFIO)
|
SPDK_LOG_REGISTER_TRACE_FLAG("vhost_vfio", SPDK_TRACE_VHOST_VFIO)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* linux/vfio.h not available */
|
||||||
|
|
||||||
|
int spdk_iommu_mem_register(uint64_t addr, uint64_t len)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int spdk_iommu_mem_unregister(uint64_t addr, uint64_t len)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user