Commit b30d57cd authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

libvfio-user: include libvfio-user as a submodule with SPDK



Also add a CONFIG_VFIO_USER config flag, it's enabled by
default.

Change-Id: I18b44c024a264516a60f743d5c366a4c7f7c6785
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5000


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 5fba455d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,3 +10,6 @@
[submodule "ocf"]
	path = ocf
	url = https://github.com/Open-CAS/ocf.git
[submodule "libvfio-user"]
	path = libvfio-user
	url = https://github.com/nutanix/libvfio-user.git
+3 −0
Original line number Diff line number Diff line
@@ -117,6 +117,9 @@ CONFIG_VHOST=y
# Build vhost initiator (Virtio) driver.
CONFIG_VIRTIO=y

# Build NVMf custom vfio-user target.
CONFIG_VFIO_USER=y

# Build with PMDK backends
CONFIG_PMDK=n
CONFIG_PMDK_DIR=
+7 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ DIRS-$(CONFIG_EXAMPLES) += examples
DIRS-y += test
DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild
DIRS-$(CONFIG_ISAL) += isalbuild
DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild

.PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk \
	cc_version cxx_version .libs_only_other .ldflags ldflags install \
@@ -78,6 +79,11 @@ LIB += isalbuild
DPDK_DEPS += isalbuild
endif

ifeq ($(CONFIG_VFIO_USER),y)
VFIOUSERBUILD = vfiouserbuild
LIB += vfiouserbuild
endif

all: mk/cc.mk $(DIRS-y)
clean: $(DIRS-y)
	$(Q)rm -f include/spdk/config.h
@@ -97,7 +103,7 @@ ifneq ($(SKIP_DPDK_BUILD),1)
dpdkbuild: $(DPDK_DEPS)
endif

lib: $(DPDKBUILD)
lib: $(DPDKBUILD) $(VFIOUSERBUILD)
module: lib
shared_lib: module
app: $(LIB)
+55 −0
Original line number Diff line number Diff line
@@ -62,6 +62,8 @@ function usage()
	echo "                           No path required."
	echo " virtio                    Build vhost initiator and virtio-pci bdev modules."
	echo "                           No path required."
	echo " vfio-user                 Build NVMf custom vfio-user target."
	echo "                           No path required."
	echo " pmdk                      Build persistent memory bdev."
	echo "                           example: /usr/share/pmdk"
	echo " reduce                    Build vbdev compression module."
@@ -334,6 +336,12 @@ for i in "$@"; do
		--without-virtio)
			CONFIG[VIRTIO]=n
			;;
		--with-vfio-user)
			CONFIG[VFIO_USER]=y
			;;
		--without-vfio-user)
			CONFIG[VFIO_USER]=n
			;;
		--with-pmdk)
			CONFIG[PMDK]=y
			CONFIG[PMDK_DIR]=""
@@ -449,6 +457,53 @@ else
fi
BUILD_CMD+=(-I/usr/local/include -L/usr/local/lib)

function set_os_id_version() {
	if [[ -f /etc/os-release ]]; then
		source /etc/os-release
	fi

	OSID=$ID
	OSVERSION=$VERSION_ID

	echo "OS-ID: $OSID | OS-Version: $OSVERSION"
}

if [[ "${CONFIG[VFIO_USER]}" = "y" ]]; then
	if [[ $arch != x86_64* ]] || [[ $sys_name == "FreeBSD" ]]; then
		echo "Non x86_64 and Linux platform, disable CONFIG_VFIO_USER"
		CONFIG[VFIO_USER]="n"
		break
	fi

	set_os_id_version

	# disable tests on ubuntu16 due to lack of macro definition in pci_regs.h
	if [[ $OSID == "ubuntu" ]] && [[ $OSVERSION == "16.04" ]]; then
		echo "ubuntu16 OS, disable CONFIG_VFIO_USER"
		CONFIG[VFIO_USER]="n"
		break
	fi

	if ! hash cmake; then
		echo "cmake not installed, disable CONFIG_VFIO_USER"
		CONFIG[VFIO_USER]="n"
		break
	fi

	if [[ ! -d /usr/include/json-c ]] && [[ ! -d /usr/local/include/json-c ]]; then
		echo "json-c-devel not installed, disable CONFIG_VFIO_USER"
		CONFIG[VFIO_USER]="n"
		break
	fi

	if [[ ! -e /usr/include/cmocka.h ]] && [[ ! -e /usr/local/include/cmocka.h ]]; then
		echo "libcmocka-devel not installed, disable CONFIG_VFIO_USER"
		CONFIG[VFIO_USER]="n"
		break
	fi

fi

# IDXD uses Intel specific instructions.
if [[ "${CONFIG[IDXD]}" = "y" ]]; then
	if [ $(uname -s) == "FreeBSD" ]; then
Original line number Diff line number Diff line
Subproject commit 7a9335eb438d29bf5be8caa67bf5252bb891076f
Loading