ae23c9
From 3ac4a8eb45ad35ff759a76233e9437566041dba0 Mon Sep 17 00:00:00 2001
ae23c9
From: "plai@redhat.com" <plai@redhat.com>
ae23c9
Date: Mon, 7 Jan 2019 17:02:18 +0000
ae23c9
Subject: [PATCH 17/22] configure: add libpmem support
ae23c9
ae23c9
RH-Author: plai@redhat.com
ae23c9
Message-id: <1546880543-24860-6-git-send-email-plai@redhat.com>
ae23c9
Patchwork-id: 83890
ae23c9
O-Subject: [RHEL8.0 qemu-kvm PATCH v7 05/10] configure: add libpmem support
ae23c9
Bugzilla: 1539285
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ae23c9
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
ae23c9
From: Junyan He <junyan.he@intel.com>
ae23c9
ae23c9
Add a pair of configure options --{enable,disable}-libpmem to control
ae23c9
whether QEMU is compiled with PMDK libpmem [1].
ae23c9
ae23c9
QEMU may write to the host persistent memory (e.g. in vNVDIMM label
ae23c9
emulation and live migration), so it must take the proper operations
ae23c9
to ensure the persistence of its own writes. Depending on the CPU
ae23c9
models and available instructions, the optimal operation can vary [2].
ae23c9
PMDK libpmem have already implemented those operations on multiple CPU
ae23c9
models (x86 and ARM) and the logic to select the optimal ones, so QEMU
ae23c9
can just use libpmem rather than re-implement them.
ae23c9
ae23c9
Libpem is a part of PMDK project(formerly known as NMVL).
ae23c9
The project's home page is: http://pmem.io/pmdk/
ae23c9
And the project's repository is: https://github.com/pmem/pmdk/
ae23c9
ae23c9
For more information about libpmem APIs, you can refer to the comments
ae23c9
in source code of: pmdk/src/libpmem/pmem.c, begin at line 33.
ae23c9
ae23c9
Signed-off-by: Junyan He <junyan.he@intel.com>
ae23c9
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
ae23c9
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
ae23c9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
ae23c9
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
ae23c9
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
ae23c9
(cherry picked from commit 17824406fa55b303379f2e4af715c1e876c3535f)
ae23c9
Signed-off-by: Paul Lai <plai@redhat.com>
ae23c9
ae23c9
Resolved Conflicts:
ae23c9
	configure
ae23c9
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 configure | 29 +++++++++++++++++++++++++++++
ae23c9
 1 file changed, 29 insertions(+)
ae23c9
ae23c9
diff --git a/configure b/configure
ae23c9
index 139f3c8..858b456 100755
ae23c9
--- a/configure
ae23c9
+++ b/configure
ae23c9
@@ -461,6 +461,7 @@ parallels="yes"
ae23c9
 sheepdog="yes"
ae23c9
 libxml2=""
ae23c9
 libudev="no"
ae23c9
+libpmem=""
ae23c9
 
ae23c9
 supported_cpu="no"
ae23c9
 supported_os="no"
ae23c9
@@ -1421,6 +1422,10 @@ for opt do
ae23c9
   ;;
ae23c9
   --disable-git-update) git_update=no
ae23c9
   ;;
ae23c9
+  --enable-libpmem) libpmem=yes
ae23c9
+  ;;
ae23c9
+  --disable-libpmem) libpmem=no
ae23c9
+  ;;
ae23c9
   *)
ae23c9
       echo "ERROR: unknown option $opt"
ae23c9
       echo "Try '$0 --help' for more information"
ae23c9
@@ -1687,6 +1692,7 @@ disabled with --disable-FEATURE, default is enabled if available:
ae23c9
   crypto-afalg    Linux AF_ALG crypto backend driver
ae23c9
   vhost-user      vhost-user support
ae23c9
   capstone        capstone disassembler support
ae23c9
+  libpmem         libpmem support
ae23c9
 
ae23c9
 NOTE: The object files are built at the place where configure is launched
ae23c9
 EOF
ae23c9
@@ -5458,6 +5464,24 @@ EOF
ae23c9
 fi
ae23c9
 
ae23c9
 ##########################################
ae23c9
+# check for libpmem
ae23c9
+
ae23c9
+if test "$libpmem" != "no"; then
ae23c9
+	if $pkg_config --exists "libpmem"; then
ae23c9
+		libpmem="yes"
ae23c9
+		libpmem_libs=$($pkg_config --libs libpmem)
ae23c9
+		libpmem_cflags=$($pkg_config --cflags libpmem)
ae23c9
+		libs_softmmu="$libs_softmmu $libpmem_libs"
ae23c9
+		QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags"
ae23c9
+	else
ae23c9
+		if test "$libpmem" = "yes" ; then
ae23c9
+			feature_not_found "libpmem" "Install nvml or pmdk"
ae23c9
+		fi
ae23c9
+		libpmem="no"
ae23c9
+	fi
ae23c9
+fi
ae23c9
+
ae23c9
+##########################################
ae23c9
 # End of CC checks
ae23c9
 # After here, no more $cc or $ld runs
ae23c9
 
ae23c9
@@ -5939,6 +5963,7 @@ echo "parallels support $parallels"
ae23c9
 echo "sheepdog support  $sheepdog"
ae23c9
 echo "capstone          $capstone"
ae23c9
 echo "libudev           $libudev"
ae23c9
+echo "libpmem support   $libpmem"
ae23c9
 
ae23c9
 if test "$sdl_too_old" = "yes"; then
ae23c9
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
ae23c9
@@ -6714,6 +6739,10 @@ if test "$sheepdog" = "yes" ; then
ae23c9
   echo "CONFIG_SHEEPDOG=y" >> $config_host_mak
ae23c9
 fi
ae23c9
 
ae23c9
+if test "$libpmem" = "yes" ; then
ae23c9
+  echo "CONFIG_LIBPMEM=y" >> $config_host_mak
ae23c9
+fi
ae23c9
+
ae23c9
 if test "$tcg_interpreter" = "yes"; then
ae23c9
   QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
ae23c9
 elif test "$ARCH" = "sparc64" ; then
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9