yeahuh / rpms / qemu-kvm

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