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

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