cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From 19aac3bf72e5b3d0599da32452e72fc32be311d5 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Fri, 12 Oct 2018 07:31:11 +0200
Subject: Initial redhat build

This patch introduces redhat build structure in redhat subdirectory. In addition,
several issues are fixed in QEMU tree:

 - Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm
  - As we use qemu-kvm as name in all places, this is updated to be consistent
 - Man page renamed from qemu to qemu-kvm
  - man page is installed using make install so we have to fix it in qemu tree

This rebase includes changes up to qemu-kvm-6.0.0-28.el8

Rebase notes (3.1.0):
- added new configure options

Rebase notes (4.0.0):
- Added dependency to perl-Test-Harness (upstream)
- Added dependency to python3-sphinx (upstream)
- Change location of icons (upstream)
- Remove .desktop file (added upstream)
- Added qemu-trace-stap (added upstream)
- Removed elf2dmp (added upstream)
- Remove .buildinfo
- Added pvh.bin rom (added upstream)
- Added interop documentation files
- Use python module instead of qemu.py (upstream)

Rebase notes (4.1.0):
- Remove edk2 files generated by build
- Switch to rhel-8.1-candidate build target
- Remove specs documentation
- Switched from libssh2 to libssh
- Add rc0 tarball usage hacks
- Added BuildRequires for wget, rpm-build and python3-sphinx
- Removed new unpacked files
- Update configure line to use new options

Rebase notes (4.2.0):
- Disable iotest run during make check
- README renamed to README.rst (upstream)
- Removed ui-spice-app.so
- Added relevant changes from "505f7f4 redhat: Adding slirp to the exploded tree"
- Removed qemu-ga.8 install from spec file - installed by make
- Removed spapr-rtas.bin (upstream)
- Require newer SLOF (20191022)

Rebase notes (5.1.0):
- Use python3 for virtio_seg_max_adjust.py test
- Removed qemu-trace-stap shebang from spec file
- Added virtiofsd.1 (upstream)
- Use out-of-tree build
- New documentation structure (upstream)
- Update local build
- Removing installed qemu-storage-daemon (added upstream)
- Removing opensbi-riscv32-sifive_u-fw_jump.bin (added upstream)
- Disable iotests (moved from Enable make check commit)
- Added missing configure options
- Reorder configure options
- qemu-pr-helper moved to /usr/libexec/ (upstream)
- Added submodules for usb-redir, smartcard-reader and qxl display (upstream)
- Added setting rc version in Makefile for build
- removed --disable-vxhs configure option (removed upstream)
- bumped required libusbx-devel version to 1.0.23
- bumped libfdt version to 1.6.0

Rebase notes (5.2.0 rc0):
- Move libfdt dependency to qemu-kvm-core
- Move manpage rename from Makefile to spec file
- rename with-confsuffix configure option to with-suffix (upstream)
- Bump libusbx Requires version to 1.0.234
- Manual copy of keymaps in spec file (BZ 1875217)
- Removed /usr/share/qemu-kvm/npcm7xx_bootrom.bin, considering it
  unpackaged for now.
- Removed /usr/share/qemu-kvm/qboot.rom, considering unpackaged.
- Added build dependency for meson and ninja-build
- hw/s390/s390-pci-vfio.c hack - set NULL for g_autofree variables
- Removed Chanelog (upstream)
- Fix in directory used for docs (upstream add %name so we do not pass it in configure)
- Package various .so as part of qemu-kvm-core package.

Rebase notes (5.2.0 rc2):
- Added fix for dtrace build on RHEL 8.4.0

Rebase notes (5.2.0 rc3):
- Added man page for qemu-pr-helper
- Added new configure options
- Update qemu-kiwi patches to v4

Rebase notes (weekly-210106):
- update tracetool usage in spec file
- remove qemu-storage-daemon-qmp-ref man page

Rebase notes (weekly-210113):
- remove qemu-storage-daemon man page

Rebase notes (weekly-210120):
- Added devel documentation

Rebase notes (weeky-210127):
- do not package virtfs-proxy-helper files

Rebase notes (weekly-210203):
- Use --with-git-submodules instead of --(enable|disable)-git-update

Rebase notes (weekly-210217):
- Minor build fixes for sending upstream

Rebase notes (6.0.0 rc0):
- g_autofree initialization fixed upstream
- Updated rc information usage

Rebase notes (6.0.0 rc1):
- do not package package hw-s390x-virtio-gpu-ccw.so

Rebase note (6.0.0 rc2):
- Disable new switch options

Rebase note (weekly-210505):
- Fix warning issue in block.c

Rebase note (weekly-210512):
- Download tarball from dist-git cache

Rebase note (weekly-210519):
- Removed sheepdog driver
- Added new display modules:
  - hw-display-virtio-gpu-gl.so
  - hw-display-virtio-gpu-pci-gl.so
  - hw-display-virtio-vga-gl.so

Rebase note (weekly-210623):
- sasl fix moved from ui/vnc.c to ui/vnc-auth-sasl.c

Rebase note (weekly-210714):
- Added accel-qtest-%{kvm_target} and accel-tcg-%{kvm_target}

Rebase note (6.1.0-rc0):
- Added about docs
- Use -q option for setup

Rebase note (6.1.0-rc1):
- Added hw-usb-host.so

Rebase note (6.1.0-rc4):
- Disable new options (bpf, nvmm, slirp-smbd)

Merged patches (3.1.0):
- 01f0c9f RHEL8: Add disable configure options to qemu spec file
- Spec file cleanups

Merged patches (4.0.0):
- aa4297c Add edk2 Requires to qemu-kvm
- d124ff5779 Fixing brew build target
- eb204b5 Introduce the qemu-kvm-tests rpm
- 223cf0c Load kvm module during boot (partial)

Merged patches (4.1.0):
- ebb6e97 redhat: Fix LOCALVERSION creation
- b0ab0cc redhat: enable tpmdev passthrough (not disabling tests)
- 7cb3c4a Enable libpmem to support nvdimm
- 8943607 qemu-kvm.spec: bump libseccomp >= 2.4.0
- 27b7c44 rh: set CONFIG_BOCHS_DISPLAY=y for x86 (partial)
- e1fe9fe x86_64-rh-devices: enable TPM emulation (partial)

Merged patches (4.2.0):
- 69e1fb2 enable virgla
- d4f6115 enable virgl, for real this time ...

Merged patches (5.1.0):
- 5edf6bd Add support for rh-brew-module
- f77d52d redhat: ship virtiofsd vhost-user device backend
- 63f12d4 redhat: Always use module build target for rh-brew (modified)
- 9b1e140 redhat: updating the modular target
- 44b8bd0 spec: Fix python shenigans for tests

Merged patches (5.2.0 rc0):
- 9238ce7 Add support for simpletrace
- 5797cff Remove explicit glusterfs-api dependency
- fd62478 disable virgl
- 0205018 redhat: link /etc/qemu-ga/fsfreeze-hook to /etc/qemu-kvm/
- 3645097 redhat: Make all generated so files executable (not only block-*)

Merged patches (5.2.0 rc2):
- pjw 99657 redhat: introduces disable_everything macro into the configure call
- pjw 99659 redhat: scripts/extract_build_cmd.py - Avoid listing empty lines
- pjw 99658 redhat: Fixing rh-local build
- pjw 99660 redhat: Add qemu-kiwi subpackage
- d2e59ce redhat: add (un/pre)install systemd hooks for qemu-ga

Merged patches (5.2.0 rc3):
- pjw 99887 - redhat: allow Makefile rh-prep builddep to fail
- pjw 99885 - redhat: adding rh-rpm target

Merged patches (weekly-210120):
- 5ab9954a3b spec: find system python via meson
- cd0f7db11f build-system: use b_staticpic=false
- 80d2dec42c udev-kvm-check: remove the "exceeded subscription limit" message

Merged patches (weekly-210203):
- 38959d51c0 redhat: Allow make to inherit params from parent make for rh-local

Merged patches (weekly-210210):
- 1e0cfe458f redhat: moving all documentation files to qemu-kvm-docs
- d7a594d02b redhat: makes qemu respect system's crypto profile

Merged patches (weekly-210303):
- e2bbf1572b spec: Package qemu-storage-daemon

Merged patches (6.0.0 rc0):
- 92f10993ba spec: ui-spice sub-package
- 8931e46069 spec: ui-opengl sub-package

Merged patches (weekly-210616):
- 7bb57541b3 redhat: Install the s390-netboot.img that we've built

Merged patches (weekly-210714):
- b4a8531f41 redhat: Fix "unversioned Obsoletes" warning
- 141a1693c7 redhat: Move qemu-kvm-docs dependency to qemu-kvm
- d75f59c6f9 redhat: introducting qemu-kvm-hw-usbredir
- a934d8bf44 redhat: use the standard vhost-user JSON path

Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
 .gitignore                                 |    1 +
 .gitlab-ci.yml                             |   24 -
 .gitlab/issue_templates/bug.md             |   64 -
 .gitlab/issue_templates/feature_request.md |   32 -
 README.systemtap                           |   43 +
 configure                                  |    5 -
 hw/remote/memory.c                         |    5 +
 hw/remote/proxy.c                          |    4 +
 meson.build                                |    8 +-
 redhat/Makefile                            |   90 +
 redhat/Makefile.common                     |   50 +
 redhat/README.tests                        |   39 +
 redhat/qemu-kvm.spec.template              | 3977 ++++++++++++++++++++
 redhat/scripts/extract_build_cmd.py        |    5 +-
 redhat/scripts/process-patches.sh          |   20 +-
 redhat/scripts/tarball_checksum.sh         |    2 +-
 redhat/udev-kvm-check.c                    |   19 +-
 scripts/qemu-guest-agent/fsfreeze-hook     |    2 +-
 scripts/systemtap/conf.d/qemu_kvm.conf     |    4 +
 scripts/systemtap/script.d/qemu_kvm.stp    |    1 +
 tests/check-block.sh                       |    2 +
 ui/vnc-auth-sasl.c                         |    2 +-
 22 files changed, 4236 insertions(+), 163 deletions(-)
 delete mode 100644 .gitlab-ci.yml
 delete mode 100644 .gitlab/issue_templates/bug.md
 delete mode 100644 .gitlab/issue_templates/feature_request.md
 create mode 100644 README.systemtap
 create mode 100644 redhat/Makefile
 create mode 100644 redhat/Makefile.common
 create mode 100644 redhat/README.tests
 create mode 100644 redhat/qemu-kvm.spec.template
 create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf
 create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp

diff --git a/README.systemtap b/README.systemtap
new file mode 100644
index 0000000000..ad913fc990
--- /dev/null
+++ b/README.systemtap
@@ -0,0 +1,43 @@
+QEMU tracing using systemtap-initscript
+---------------------------------------
+
+You can capture QEMU trace data all the time using systemtap-initscript.  This
+uses SystemTap's flight recorder mode to trace all running guests to a
+fixed-size buffer on the host.  Old trace entries are overwritten by new
+entries when the buffer size wraps.
+
+1. Install the systemtap-initscript package:
+  # yum install systemtap-initscript
+
+2. Install the systemtap scripts and the conf file:
+  # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
+  # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
+
+The set of trace events to enable is given in qemu_kvm.stp.  This SystemTap
+script can be customized to add or remove trace events provided in
+/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp.
+
+SystemTap customizations can be made to qemu_kvm.conf to control the flight
+recorder buffer size and whether to store traces in memory only or disk too.
+See stap(1) for option documentation.
+
+3. Start the systemtap service.
+ # service systemtap start qemu_kvm
+
+4. Make the service start at boot time.
+ # chkconfig systemtap on
+
+5. Confirm that the service works.
+  # service systemtap status qemu_kvm
+  qemu_kvm is running...
+
+When you want to inspect the trace buffer, perform the following steps:
+
+1. Dump the trace buffer.
+  # staprun -A qemu_kvm >/tmp/trace.log
+
+2. Start the systemtap service because the preceding step stops the service.
+  # service systemtap start qemu_kvm
+
+3. Translate the trace record to readable format.
+  # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log
diff --git a/configure b/configure
index 9a79a004d7..97a815d493 100755
--- a/configure
+++ b/configure
@@ -5166,10 +5166,6 @@ if test "$skip_meson" = no; then
   mv $cross config-meson.cross
 
   rm -rf meson-private meson-info meson-logs
-  unset staticpic
-  if ! version_ge "$($meson --version)" 0.56.0; then
-    staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi)
-  fi
   NINJA=$ninja $meson setup \
         --prefix "$prefix" \
         --libdir "$libdir" \
@@ -5189,7 +5185,6 @@ if test "$skip_meson" = no; then
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
         -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-        ${staticpic:+-Db_staticpic=$staticpic} \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
         -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
         -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
diff --git a/hw/remote/memory.c b/hw/remote/memory.c
index 6e21ab1a45..1188680ca0 100644
--- a/hw/remote/memory.c
+++ b/hw/remote/memory.c
@@ -41,8 +41,13 @@ void remote_sysmem_reconfig(MPQemuMsg *msg, Error **errp)
 
     remote_sysmem_reset();
 
+<<<<<<< HEAD
     for (region = 0; region < msg->num_fds; region++, suffix++) {
         g_autofree char *name = g_strdup_printf("remote-mem-%u", suffix);
+=======
+    for (region = 0; region < msg->num_fds; region++) {
+        g_autofree char *name = NULL;
+>>>>>>> e0233e3bb3... Initial redhat build
         subregion = g_new(MemoryRegion, 1);
         memory_region_init_ram_from_fd(subregion, NULL,
                                        name, sysmem_info->sizes[region],
diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c
index 6dda705fc2..bb6636be7d 100644
--- a/hw/remote/proxy.c
+++ b/hw/remote/proxy.c
@@ -347,7 +347,11 @@ static void probe_pci_info(PCIDevice *dev, Error **errp)
                    PCI_BASE_ADDRESS_SPACE_IO : PCI_BASE_ADDRESS_SPACE_MEMORY;
 
         if (size) {
+<<<<<<< HEAD
             g_autofree char *name = g_strdup_printf("bar-region-%d", i);
+=======
+            g_autofree char *name = NULL;
+>>>>>>> e0233e3bb3... Initial redhat build
             pdev->region[i].dev = pdev;
             pdev->region[i].present = true;
             if (type == PCI_BASE_ADDRESS_SPACE_MEMORY) {
diff --git a/meson.build b/meson.build
index b3e7ec0e92..f626ed9c14 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
 project('qemu', ['c'], meson_version: '>=0.55.0',
-        default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto'] +
-                         (meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []),
+        default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
+                          'b_staticpic=false' ],
         version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
 
 not_found = dependency('', required: false)
@@ -1790,7 +1790,9 @@ if capstone_opt == 'internal'
     # Include all configuration defines via a header file, which will wind up
     # as a dependency on the object file, and thus changes here will result
     # in a rebuild.
-    '-include', 'capstone-defs.h'
+    '-include', 'capstone-defs.h',
+
+    '-Wp,-D_GLIBCXX_ASSERTIONS',
   ]
 
   libcapstone = static_library('capstone',
diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook
index 13aafd4845..e9b84ec028 100755
--- a/scripts/qemu-guest-agent/fsfreeze-hook
+++ b/scripts/qemu-guest-agent/fsfreeze-hook
@@ -8,7 +8,7 @@
 # request, it is issued with "thaw" argument after filesystem is thawed.
 
 LOGFILE=/var/log/qga-fsfreeze-hook.log
-FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d
+FSFREEZE_D=$(dirname -- "$(realpath $0)")/fsfreeze-hook.d
 
 # Check whether file $1 is a backup or rpm-generated file and should be ignored
 is_ignored_file() {
diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf
new file mode 100644
index 0000000000..372d8160a4
--- /dev/null
+++ b/scripts/systemtap/conf.d/qemu_kvm.conf
@@ -0,0 +1,4 @@
+# Force load uprobes (see BZ#1118352)
+stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true
+
+qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes
diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp
new file mode 100644
index 0000000000..c04abf9449
--- /dev/null
+++ b/scripts/systemtap/script.d/qemu_kvm.stp
@@ -0,0 +1 @@
+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {}
diff --git a/tests/check-block.sh b/tests/check-block.sh
index f86cb863de..6d38340d49 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -69,6 +69,8 @@ else
     fi
 fi
 
+exit 0
+
 cd tests/qemu-iotests
 
 # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 47fdae5b21..2a950caa2a 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -42,7 +42,7 @@
 
 bool vnc_sasl_server_init(Error **errp)
 {
-    int saslErr = sasl_server_init(NULL, "qemu");
+    int saslErr = sasl_server_init(NULL, "qemu-kvm");
 
     if (saslErr != SASL_OK) {
         error_setg(errp, "Failed to initialize SASL auth: %s",
-- 
2.31.1