Blame SOURCES/kvm-configure-add-libpmem-support.patch

357786
From 17e8fa1ceb357d0008f651cd88a72f2630b24fc5 Mon Sep 17 00:00:00 2001
357786
From: "plai@redhat.com" <plai@redhat.com>
357786
Date: Fri, 31 Aug 2018 16:25:55 +0200
357786
Subject: [PATCH 13/29] configure: add libpmem support
357786
357786
RH-Author: plai@redhat.com
357786
Message-id: <1535732759-22481-6-git-send-email-plai@redhat.com>
357786
Patchwork-id: 82010
357786
O-Subject: [RHEL7.6 PATCH BZ 1539280 5/9] configure: add libpmem support
357786
Bugzilla: 1539280
357786
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
357786
RH-Acked-by: Pankaj Gupta <pagupta@redhat.com>
357786
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
357786
From: Junyan He <junyan.he@intel.com>
357786
357786
Add a pair of configure options --{enable,disable}-libpmem to control
357786
whether QEMU is compiled with PMDK libpmem [1].
357786
357786
QEMU may write to the host persistent memory (e.g. in vNVDIMM label
357786
emulation and live migration), so it must take the proper operations
357786
to ensure the persistence of its own writes. Depending on the CPU
357786
models and available instructions, the optimal operation can vary [2].
357786
PMDK libpmem have already implemented those operations on multiple CPU
357786
models (x86 and ARM) and the logic to select the optimal ones, so QEMU
357786
can just use libpmem rather than re-implement them.
357786
357786
Libpem is a part of PMDK project(formerly known as NMVL).
357786
The project's home page is: http://pmem.io/pmdk/
357786
And the project's repository is: https://github.com/pmem/pmdk/
357786
357786
For more information about libpmem APIs, you can refer to the comments
357786
in source code of: pmdk/src/libpmem/pmem.c, begin at line 33.
357786
357786
Signed-off-by: Junyan He <junyan.he@intel.com>
357786
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
357786
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
357786
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
357786
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
357786
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
357786
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
357786
(cherry picked from commit 17824406fa55b303379f2e4af715c1e876c3535f)
357786
Signed-off-by: Paul Lai <plai@redhat.com>
357786
357786
Resolved Conflicts:
357786
	configure
357786
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 configure | 29 +++++++++++++++++++++++++++++
357786
 1 file changed, 29 insertions(+)
357786
357786
diff --git a/configure b/configure
357786
index a869f19..f9c8365 100755
357786
--- a/configure
357786
+++ b/configure
357786
@@ -454,6 +454,7 @@ vxhs=""
357786
 libxml2=""
357786
 vtd="yes"
357786
 rhel_target="rhv"
357786
+libpmem=""
357786
 
357786
 supported_cpu="no"
357786
 supported_os="no"
357786
@@ -1387,6 +1388,10 @@ for opt do
357786
   ;;
357786
   --rhel-target=*) rhel_target="$optarg"
357786
   ;;
357786
+  --enable-libpmem) libpmem=yes
357786
+  ;;
357786
+  --disable-libpmem) libpmem=no
357786
+  ;;
357786
   *)
357786
       echo "ERROR: unknown option $opt"
357786
       echo "Try '$0 --help' for more information"
357786
@@ -1648,6 +1653,7 @@ disabled with --disable-FEATURE, default is enabled if available:
357786
   crypto-afalg    Linux AF_ALG crypto backend driver
357786
   vhost-user      vhost-user support
357786
   capstone        capstone disassembler support
357786
+  libpmem         libpmem support
357786
 
357786
 NOTE: The object files are built at the place where configure is launched
357786
 EOF
357786
@@ -5410,6 +5416,24 @@ EOF
357786
 fi
357786
 
357786
 ##########################################
357786
+# check for libpmem
357786
+
357786
+if test "$libpmem" != "no"; then
357786
+	if $pkg_config --exists "libpmem"; then
357786
+		libpmem="yes"
357786
+		libpmem_libs=$($pkg_config --libs libpmem)
357786
+		libpmem_cflags=$($pkg_config --cflags libpmem)
357786
+		libs_softmmu="$libs_softmmu $libpmem_libs"
357786
+		QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags"
357786
+	else
357786
+		if test "$libpmem" = "yes" ; then
357786
+			feature_not_found "libpmem" "Install nvml or pmdk"
357786
+		fi
357786
+		libpmem="no"
357786
+	fi
357786
+fi
357786
+
357786
+##########################################
357786
 # End of CC checks
357786
 # After here, no more $cc or $ld runs
357786
 
357786
@@ -5873,6 +5897,7 @@ echo "VxHS block device $vxhs"
357786
 echo "capstone          $capstone"
357786
 echo "VT-d emulation    $vtd"
357786
 echo "RHEL target       $rhel_target"
357786
+echo "libpmem support   $libpmem"
357786
 
357786
 if test "$sdl_too_old" = "yes"; then
357786
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
357786
@@ -6632,6 +6657,10 @@ if test "$rhel_target" = "rhv" ; then
357786
   echo "CONFIG_RHV=y" >> $config_host_mak
357786
 fi
357786
 
357786
+if test "$libpmem" = "yes" ; then
357786
+  echo "CONFIG_LIBPMEM=y" >> $config_host_mak
357786
+fi
357786
+
357786
 if test "$tcg_interpreter" = "yes"; then
357786
   QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
357786
 elif test "$ARCH" = "sparc64" ; then
357786
-- 
357786
1.8.3.1
357786