Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package qemu for openSUSE:Factory checked in 
at 2022-04-02 18:20:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qemu (Old)
 and      /work/SRC/openSUSE:Factory/.qemu.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qemu"

Sat Apr  2 18:20:40 2022 rev:224 rq:966257 version:unknown

Changes:
--------
--- /work/SRC/openSUSE:Factory/qemu/qemu.changes        2022-03-28 
16:58:08.472772122 +0200
+++ /work/SRC/openSUSE:Factory/.qemu.new.1900/qemu.changes      2022-04-02 
18:20:53.378039995 +0200
@@ -1,0 +2,64 @@
+Thu Mar 31 10:35:44 UTC 2022 - Li Zhang <li.zh...@suse.com>
+
+- Support the SGX feature (bsc#1197807) 
+* Patches added:
+  doc-Add-the-SGX-numa-description.patch
+  numa-Enable-numa-for-SGX-EPC-sections.patch
+  numa-Support-SGX-numa-in-the-monitor-and.patch
+
+-------------------------------------------------------------------
+Tue Mar 29 14:58:37 UTC 2022 - Li Zhang <li.zh...@suse.com>
+
+- Backport CVE-2021-3929 (bsc#1193880)
+* Patches added:
+  hw-nvme-fix-CVE-2021-3929.patch
+
+-------------------------------------------------------------------
+Tue Mar 29 10:16:18 UTC 2022 - Li Zhang <li.zh...@suse.com>
+
+- The patches from upstream cause testsuit failures (bsc#1197150 bsc#1197528)
+* Patches added:
+  Revert-python-iotests-replace-qmp-with-a.patch
+  Revert-python-machine-add-instance-disam.patch
+  Revert-python-machine-add-sock_dir-prope.patch
+  Revert-python-machine-handle-fast-QEMU-t.patch
+  Revert-python-machine-move-more-variable.patch
+  Revert-python-machine-remove-_remove_mon.patch
+
+-------------------------------------------------------------------
+Tue Mar 29 09:36:34 UTC 2022 - Dario Faggioli <dfaggi...@suse.com>
+
+- Add missing patch from a PTFs (bsc#1194938)
+* Patches added:
+  scsi-generic-check-for-additional-SG_IO-.patch
+
+-------------------------------------------------------------------
+Fri Mar 25 18:44:04 UTC 2022 - Dario Faggioli <dfaggi...@suse.com>
+
+- Kill downstream patches around bifmt handling that makes
+  cumbersome to run multi-arch containers, and switch to the
+  upstream behavior, which is well documented and valid on
+  all other distros. This is possible thanks to Linux kernel
+  commit 2347961b11d4 and QEMU commit 6e1c0d7b951e19c53 (so
+  it can only work on Leap/SLE 15.4 and higher). (bsc#1197298)
+* Patches dropped:
+  qemu-binfmt-conf.sh-allow-overriding-SUS.patch
+  qemu-binfmt-conf-use-qemu-ARCH-binfmt.patch
+
+-------------------------------------------------------------------
+Fri Mar 25 17:44:06 UTC 2022 - Dario Faggioli <dfaggi...@suse.com>
+
+- Fix update_git.sh wiping all the package file of the local
+  checkout while cloning the git repository on demand (in case they
+  don't exist and the user as to do so).
+
+-------------------------------------------------------------------
+Thu Mar 24 11:18:54 UTC 2022 - Li Zhang <li.zh...@suse.com>
+
+- Improve test reliability
+* Patches added:
+  Fix-the-module-building-problem-for-s390.patch
+  tests-qemu-iotests-040-Skip-TestCommitWi.patch
+  tests-qemu-iotests-testrunner-Quote-case.patch
+
+-------------------------------------------------------------------
@@ -21 +85,2 @@
-Fix bsc#1189702 CVE-2021-3713
+
+- Proactive fix

Old:
----
  qemu-binfmt-conf-use-qemu-ARCH-binfmt.patch
  qemu-binfmt-conf.sh-allow-overriding-SUS.patch

New:
----
  Fix-the-module-building-problem-for-s390.patch
  Revert-python-iotests-replace-qmp-with-a.patch
  Revert-python-machine-add-instance-disam.patch
  Revert-python-machine-add-sock_dir-prope.patch
  Revert-python-machine-handle-fast-QEMU-t.patch
  Revert-python-machine-move-more-variable.patch
  Revert-python-machine-remove-_remove_mon.patch
  doc-Add-the-SGX-numa-description.patch
  hw-nvme-fix-CVE-2021-3929.patch
  numa-Enable-numa-for-SGX-EPC-sections.patch
  numa-Support-SGX-numa-in-the-monitor-and.patch
  scsi-generic-check-for-additional-SG_IO-.patch
  tests-qemu-iotests-040-Skip-TestCommitWi.patch
  tests-qemu-iotests-testrunner-Quote-case.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qemu.spec ++++++
--- /var/tmp/diff_new_pack.deiCRh/_old  2022-04-02 18:20:55.510016064 +0200
+++ /var/tmp/diff_new_pack.deiCRh/_new  2022-04-02 18:20:55.514016019 +0200
@@ -158,66 +158,78 @@
 Patch00012:     AIO-Reduce-number-of-threads-for-32bit-h.patch
 Patch00013:     xen_disk-Add-suse-specific-flush-disable.patch
 Patch00014:     qemu-bridge-helper-reduce-security-profi.patch
-Patch00015:     qemu-binfmt-conf-use-qemu-ARCH-binfmt.patch
-Patch00016:     roms-Makefile-pass-a-packaging-timestamp.patch
-Patch00017:     Raise-soft-address-space-limit-to-hard-l.patch
-Patch00018:     increase-x86_64-physical-bits-to-42.patch
-Patch00019:     i8254-Fix-migration-from-SLE11-SP2.patch
-Patch00020:     acpi_piix4-Fix-migration-from-SLE11-SP2.patch
-Patch00021:     Make-installed-scripts-explicitly-python.patch
-Patch00022:     hw-smbios-handle-both-file-formats-regar.patch
-Patch00023:     xen-add-block-resize-support-for-xen-dis.patch
-Patch00024:     tests-qemu-iotests-Triple-timeout-of-i-o.patch
-Patch00025:     tests-Fix-block-tests-to-be-compatible-w.patch
-Patch00026:     xen-ignore-live-parameter-from-xen-save-.patch
-Patch00027:     tests-change-error-message-in-test-162.patch
-Patch00028:     hw-intc-exynos4210_gic-provide-more-room.patch
-Patch00029:     configure-only-populate-roms-if-softmmu.patch
-Patch00030:     pc-bios-s390-ccw-net-avoid-warning-about.patch
-Patch00031:     roms-change-cross-compiler-naming-to-be-.patch
-Patch00032:     test-add-mapping-from-arch-of-i686-to-qe.patch
-Patch00033:     configure-remove-pkgversion-from-CONFIG_.patch
-Patch00034:     Revert-qht-constify-qht_statistics_init.patch
-Patch00035:     qht-Revert-some-constification-in-qht.c.patch
-Patch00036:     meson-install-ivshmem-client-and-ivshmem.patch
-Patch00037:     Revert-roms-efirom-tests-uefi-test-tools.patch
-Patch00038:     Makefile-Don-t-check-pc-bios-as-pre-requ.patch
-Patch00039:     roms-Makefile-add-cross-file-to-qboot-me.patch
-Patch00040:     usb-Help-compiler-out-to-avoid-a-warning.patch
-Patch00041:     qom-handle-case-of-chardev-spice-module-.patch
-Patch00042:     doc-add-our-support-doc-to-the-main-proj.patch
-Patch00043:     qemu-binfmt-conf.sh-should-use-F-as-shor.patch
-Patch00044:     modules-quick-fix-a-fundamental-error-in.patch
-Patch00045:     qemu-binfmt-conf.sh-allow-overriding-SUS.patch
-Patch00046:     scsi-generic-replace-logical-block-count.patch
-Patch00047:     meson-build-all-modules-by-default.patch
-Patch00048:     acpi-validate-hotplug-selector-on-access.patch
-Patch00049:     tests-qemu-iotests-Fix-051-for-binaries-.patch
-Patch00050:     iotests-MRCE-Write-data-to-source.patch
-Patch00051:     iotests.py-img_info_log-rename-imgopts-a.patch
-Patch00052:     iotests.py-implement-unsupported_imgopts.patch
-Patch00053:     iotests-specify-some-unsupported_imgopts.patch
-Patch00054:     iotests.py-qemu_img-create-support-IMGOP.patch
-Patch00055:     iotests-drop-qemu_img_verbose-helper.patch
-Patch00056:     iotests.py-rewrite-default-luks-support-.patch
-Patch00057:     iotest-303-explicit-compression-type.patch
-Patch00058:     iotest-065-explicit-compression-type.patch
-Patch00059:     iotests.py-filter-out-successful-output-.patch
-Patch00060:     iotest-302-use-img_info_log-helper.patch
-Patch00061:     qcow2-simple-case-support-for-downgradin.patch
-Patch00062:     iotests-common.rc-introduce-_qcow2_dump_.patch
-Patch00063:     iotests-massive-use-_qcow2_dump_header.patch
-Patch00064:     iotest-39-use-_qcow2_dump_header.patch
-Patch00065:     iotests-bash-tests-filter-compression-ty.patch
-Patch00066:     iotests-60-more-accurate-set-dirty-bit-i.patch
-Patch00067:     iotest-214-explicit-compression-type.patch
-Patch00068:     iotests-declare-lack-of-support-for-comp.patch
-Patch00069:     block-backend-Retain-permissions-after-m.patch
-Patch00070:     virtiofsd-Drop-membership-of-all-supplem.patch
-Patch00071:     hw-scsi-megasas-check-for-NULL-frame-in-.patch
-Patch00072:     hw-nvram-at24-return-0xff-if-1-byte-addr.patch
-Patch00073:     hw-i386-amd_iommu-Fix-maybe-uninitialize.patch
-Patch00074:     tools-virtiofsd-Add-rseq-syscall-to-the-.patch
+Patch00015:     roms-Makefile-pass-a-packaging-timestamp.patch
+Patch00016:     Raise-soft-address-space-limit-to-hard-l.patch
+Patch00017:     increase-x86_64-physical-bits-to-42.patch
+Patch00018:     i8254-Fix-migration-from-SLE11-SP2.patch
+Patch00019:     acpi_piix4-Fix-migration-from-SLE11-SP2.patch
+Patch00020:     Make-installed-scripts-explicitly-python.patch
+Patch00021:     hw-smbios-handle-both-file-formats-regar.patch
+Patch00022:     xen-add-block-resize-support-for-xen-dis.patch
+Patch00023:     tests-qemu-iotests-Triple-timeout-of-i-o.patch
+Patch00024:     tests-Fix-block-tests-to-be-compatible-w.patch
+Patch00025:     xen-ignore-live-parameter-from-xen-save-.patch
+Patch00026:     tests-change-error-message-in-test-162.patch
+Patch00027:     hw-intc-exynos4210_gic-provide-more-room.patch
+Patch00028:     configure-only-populate-roms-if-softmmu.patch
+Patch00029:     pc-bios-s390-ccw-net-avoid-warning-about.patch
+Patch00030:     roms-change-cross-compiler-naming-to-be-.patch
+Patch00031:     test-add-mapping-from-arch-of-i686-to-qe.patch
+Patch00032:     configure-remove-pkgversion-from-CONFIG_.patch
+Patch00033:     Revert-qht-constify-qht_statistics_init.patch
+Patch00034:     qht-Revert-some-constification-in-qht.c.patch
+Patch00035:     meson-install-ivshmem-client-and-ivshmem.patch
+Patch00036:     Revert-roms-efirom-tests-uefi-test-tools.patch
+Patch00037:     Makefile-Don-t-check-pc-bios-as-pre-requ.patch
+Patch00038:     roms-Makefile-add-cross-file-to-qboot-me.patch
+Patch00039:     usb-Help-compiler-out-to-avoid-a-warning.patch
+Patch00040:     qom-handle-case-of-chardev-spice-module-.patch
+Patch00041:     doc-add-our-support-doc-to-the-main-proj.patch
+Patch00042:     qemu-binfmt-conf.sh-should-use-F-as-shor.patch
+Patch00043:     modules-quick-fix-a-fundamental-error-in.patch
+Patch00044:     scsi-generic-replace-logical-block-count.patch
+Patch00045:     meson-build-all-modules-by-default.patch
+Patch00046:     acpi-validate-hotplug-selector-on-access.patch
+Patch00047:     tests-qemu-iotests-Fix-051-for-binaries-.patch
+Patch00048:     iotests-MRCE-Write-data-to-source.patch
+Patch00049:     iotests.py-img_info_log-rename-imgopts-a.patch
+Patch00050:     iotests.py-implement-unsupported_imgopts.patch
+Patch00051:     iotests-specify-some-unsupported_imgopts.patch
+Patch00052:     iotests.py-qemu_img-create-support-IMGOP.patch
+Patch00053:     iotests-drop-qemu_img_verbose-helper.patch
+Patch00054:     iotests.py-rewrite-default-luks-support-.patch
+Patch00055:     iotest-303-explicit-compression-type.patch
+Patch00056:     iotest-065-explicit-compression-type.patch
+Patch00057:     iotests.py-filter-out-successful-output-.patch
+Patch00058:     iotest-302-use-img_info_log-helper.patch
+Patch00059:     qcow2-simple-case-support-for-downgradin.patch
+Patch00060:     iotests-common.rc-introduce-_qcow2_dump_.patch
+Patch00061:     iotests-massive-use-_qcow2_dump_header.patch
+Patch00062:     iotest-39-use-_qcow2_dump_header.patch
+Patch00063:     iotests-bash-tests-filter-compression-ty.patch
+Patch00064:     iotests-60-more-accurate-set-dirty-bit-i.patch
+Patch00065:     iotest-214-explicit-compression-type.patch
+Patch00066:     iotests-declare-lack-of-support-for-comp.patch
+Patch00067:     block-backend-Retain-permissions-after-m.patch
+Patch00068:     virtiofsd-Drop-membership-of-all-supplem.patch
+Patch00069:     hw-scsi-megasas-check-for-NULL-frame-in-.patch
+Patch00070:     hw-nvram-at24-return-0xff-if-1-byte-addr.patch
+Patch00071:     hw-i386-amd_iommu-Fix-maybe-uninitialize.patch
+Patch00072:     tools-virtiofsd-Add-rseq-syscall-to-the-.patch
+Patch00073:     tests-qemu-iotests-040-Skip-TestCommitWi.patch
+Patch00074:     tests-qemu-iotests-testrunner-Quote-case.patch
+Patch00075:     Fix-the-module-building-problem-for-s390.patch
+Patch00076:     scsi-generic-check-for-additional-SG_IO-.patch
+Patch00077:     Revert-python-machine-handle-fast-QEMU-t.patch
+Patch00078:     Revert-python-machine-move-more-variable.patch
+Patch00079:     Revert-python-machine-add-instance-disam.patch
+Patch00080:     Revert-python-machine-remove-_remove_mon.patch
+Patch00081:     Revert-python-machine-add-sock_dir-prope.patch
+Patch00082:     Revert-python-iotests-replace-qmp-with-a.patch
+Patch00083:     hw-nvme-fix-CVE-2021-3929.patch
+Patch00084:     numa-Enable-numa-for-SGX-EPC-sections.patch
+Patch00085:     numa-Support-SGX-numa-in-the-monitor-and.patch
+Patch00086:     doc-Add-the-SGX-numa-description.patch
 # Patches applied in roms/seabios/:
 Patch01000:     seabios-use-python2-explicitly-as-needed.patch
 Patch01001:     seabios-switch-to-python3-as-needed.patch
@@ -1172,17 +1184,17 @@
 %patch00035 -p1
 %patch00036 -p1
 %patch00037 -p1
-%patch00038 -p1
 %ifarch aarch64
-%patch00039 -p1
+%patch00038 -p1
 %endif
 %ifarch %arm %ix86 ppc
-%patch00040 -p1
+%patch00039 -p1
 %endif
-%patch00041 -p1
+%patch00040 -p1
 %if %{legacy_qemu_kvm}
-%patch00042 -p1
+%patch00041 -p1
 %endif
+%patch00042 -p1
 %patch00043 -p1
 %patch00044 -p1
 %patch00045 -p1
@@ -1215,6 +1227,18 @@
 %patch00072 -p1
 %patch00073 -p1
 %patch00074 -p1
+%patch00075 -p1
+%patch00076 -p1
+%patch00077 -p1
+%patch00078 -p1
+%patch00079 -p1
+%patch00080 -p1
+%patch00081 -p1
+%patch00082 -p1
+%patch00083 -p1
+%patch00084 -p1
+%patch00085 -p1
+%patch00086 -p1
 %patch01000 -p1
 %patch01001 -p1
 %patch01002 -p1

++++++ Fix-the-module-building-problem-for-s390.patch ++++++
From: Li Zhang <lizh...@suse.de>
Date: Thu, 24 Mar 2022 11:47:08 +0100
Subject: Fix the module building problem for s390

When building the testsuit for s390, it reports errors as the following:

hw-display-virtio-gpu.so: undefined symbol: virtio_vmstate_info
hw-display-virtio-gpu-gl.so: undefined symbol: virtio_gpu_ctrl_response
hw-display-virtio-gpu-pci.so: undefined symbol: virtio_pci_types_register
hw-display-virtio-gpu-pci-gl.so: undefined symbol: virtio_pci_types_register

Signed-off-by: Li Zhang <lizh...@suse.de>
---
 util/module.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/util/module.c b/util/module.c
index 8370d4c6209eda4319342b202f6b..03896b7c469dedc5a80695aa7dee 100644
--- a/util/module.c
+++ b/util/module.c
@@ -125,6 +125,10 @@ bool s390x_blocklist(const char *name)
         "hw-display-qxl",
         "hw-display-virtio-vga",
         "hw-display-virtio-vga-gl",
+        "hw-display-virtio-gpu",
+        "hw-display-virtio-gpu-gl",
+        "hw-display-virtio-gpu-pci",
+        "hw-display-virtio-gpu-pci-gl",
         "hw-usb-host",
         "hw-usb-redirect",
         "hw-usb-smartcard"

++++++ Revert-python-iotests-replace-qmp-with-a.patch ++++++
From: Li Zhang <lizh...@suse.de>
Date: Tue, 29 Mar 2022 12:04:16 +0200
Subject: Revert "python, iotests: replace qmp with aqmp"

References: bsc#1197528 bsc#1197150

aqmp is still not stable, it causes failures.
This reverts commit 76cd358671e6b8e7c435ec65b1c44200254514a9.

Signed-off-by: Li Zhang <lizh...@suse.de>
---
 python/qemu/machine/machine.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index a487c397459a1fa6889276ab2538..a0cf69786b4bb7e851b5eeb2517b 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -41,6 +41,7 @@ from typing import (
 )
 
 from qemu.qmp import (  # pylint: disable=import-error
+    QEMUMonitorProtocol,
     QMPMessage,
     QMPReturnValue,
     SocketAddrT,
@@ -49,12 +50,6 @@ from qemu.qmp import (  # pylint: disable=import-error
 from . import console_socket
 
 
-if os.environ.get('QEMU_PYTHON_LEGACY_QMP'):
-    from qemu.qmp import QEMUMonitorProtocol
-else:
-    from qemu.aqmp.legacy import QEMUMonitorProtocol
-
-
 LOG = logging.getLogger(__name__)
 
 

++++++ Revert-python-machine-add-instance-disam.patch ++++++
From: Li Zhang <lizh...@suse.de>
Date: Tue, 29 Mar 2022 12:00:29 +0200
Subject: Revert "python/machine: add instance disambiguator to default
 nickname"

References: bsc#1197528 bsc#1197150

To improve testsuit, these patches still need more testing.
This reverts commit 72b17fe715056c96ea73f187ab46721788b3a782.

Signed-off-by: Li Zhang <lizh...@suse.de>
---
 python/qemu/machine/machine.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index ad529fd92a6022150fd0156d005d..ea9e07805df10a57115dace06885 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -133,7 +133,7 @@ class QEMUMachine:
         self._wrapper = wrapper
         self._qmp_timer = qmp_timer
 
-        self._name = name or f"qemu-{os.getpid()}-{id(self):02x}"
+        self._name = name or "qemu-%d" % os.getpid()
         self._temp_dir: Optional[str] = None
         self._base_temp_dir = base_temp_dir
         self._sock_dir = sock_dir

++++++ Revert-python-machine-add-sock_dir-prope.patch ++++++
From: Li Zhang <lizh...@suse.de>
Date: Tue, 29 Mar 2022 12:02:45 +0200
Subject: Revert "python/machine: add @sock_dir property"

References: bsc#1197528 bsc#1197150

To improve testsuit, these patches still need more testing.
This reverts commit 87bf1fe5cbffefe6b7ee13a7015ae285250ad2db.

Signed-off-by: Li Zhang <lizh...@suse.de>
---
 python/qemu/machine/machine.py | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index b1dd77b53885629eba452cdd1bc2..a487c397459a1fa6889276ab2538 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -134,9 +134,8 @@ class QEMUMachine:
         self._qmp_timer = qmp_timer
 
         self._name = name or "qemu-%d" % os.getpid()
-        self._temp_dir: Optional[str] = None
         self._base_temp_dir = base_temp_dir
-        self._sock_dir = sock_dir
+        self._sock_dir = sock_dir or self._base_temp_dir
         self._log_dir = log_dir
 
         if monitor_address is not None:
@@ -144,7 +143,7 @@ class QEMUMachine:
             self._remove_monitor_sockfile = False
         else:
             self._monitor_address = os.path.join(
-                self.sock_dir, f"{self._name}-monitor.sock"
+                self._sock_dir, f"{self._name}-monitor.sock"
             )
             self._remove_monitor_sockfile = True
 
@@ -164,13 +163,14 @@ class QEMUMachine:
         self._qmp_set = True   # Enable QMP monitor by default.
         self._qmp_connection: Optional[QEMUMonitorProtocol] = None
         self._qemu_full_args: Tuple[str, ...] = ()
+        self._temp_dir: Optional[str] = None
         self._launched = False
         self._machine: Optional[str] = None
         self._console_index = 0
         self._console_set = False
         self._console_device_type: Optional[str] = None
         self._console_address = os.path.join(
-            self.sock_dir, f"{self._name}-console.sock"
+            self._sock_dir, f"{self._name}-console.sock"
         )
         self._console_socket: Optional[socket.socket] = None
         self._remove_files: List[str] = []
@@ -816,15 +816,6 @@ class QEMUMachine:
                                               dir=self._base_temp_dir)
         return self._temp_dir
 
-    @property
-    def sock_dir(self) -> str:
-        """
-        Returns the directory used for sockfiles by this machine.
-        """
-        if self._sock_dir:
-            return self._sock_dir
-        return self.temp_dir
-
     @property
     def log_dir(self) -> str:
         """

++++++ Revert-python-machine-handle-fast-QEMU-t.patch ++++++
From: Li Zhang <lizh...@suse.de>
Date: Tue, 29 Mar 2022 11:51:54 +0200
Subject: Revert "python/machine: handle "fast" QEMU terminations"

References: bsc#1197528 bsc#1197150

This patch causes iotest failures, it needs to revert.
This reverts commit 1611e6cf4e7163f6102b37010a8b7e7120f468b5.

Signed-off-by: Li Zhang <lizh...@suse.de>
---
 python/qemu/machine/machine.py | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 67ab06ca2b6daa531b7c0ad9f7c2..f92e73de4010d10c9e062259c706 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -349,6 +349,9 @@ class QEMUMachine:
         Called to cleanup the VM instance after the process has exited.
         May also be called after a failed launch.
         """
+        # Comprehensive reset for the failed launch case:
+        self._early_cleanup()
+
         try:
             self._close_qmp_connection()
         except Exception as err:  # pylint: disable=broad-except
@@ -397,16 +400,9 @@ class QEMUMachine:
 
         try:
             self._launch()
+            self._launched = True
         except:
-            # We may have launched the process but it may
-            # have exited before we could connect via QMP.
-            # Assume the VM didn't launch or is exiting.
-            # If we don't wait for the process, exitcode() may still be
-            # 'None' by the time control is ceded back to the caller.
-            if self._launched:
-                self.wait()
-            else:
-                self._post_shutdown()
+            self._post_shutdown()
 
             LOG.debug('Error launching VM')
             if self._qemu_full_args:
@@ -430,7 +426,6 @@ class QEMUMachine:
                                        stderr=subprocess.STDOUT,
                                        shell=False,
                                        close_fds=False)
-        self._launched = True
         self._post_launch()
 
     def _close_qmp_connection(self) -> None:
@@ -462,8 +457,8 @@ class QEMUMachine:
         """
         Perform any cleanup that needs to happen before the VM exits.
 
-        This method may be called twice upon shutdown, once each by soft
-        and hard shutdown in failover scenarios.
+        May be invoked by both soft and hard shutdown in failover scenarios.
+        Called additionally by _post_shutdown for comprehensive cleanup.
         """
         # If we keep the console socket open, we may deadlock waiting
         # for QEMU to exit, while QEMU is waiting for the socket to

++++++ Revert-python-machine-move-more-variable.patch ++++++
From: Li Zhang <lizh...@suse.de>
Date: Tue, 29 Mar 2022 11:57:11 +0200
Subject: Revert "python/machine: move more variable initializations to
 _pre_launch"

References: bsc#1197528 bsc#1197150

To improve testsuit, these patches still need more testing.
This reverts commit b1ca99199320fcc010f407b84ac00d96e7e4baa1.

Signed-off-by: Li Zhang <lizh...@suse.de>
---
 python/qemu/machine/machine.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index f92e73de4010d10c9e062259c706..ad529fd92a6022150fd0156d005d 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -327,14 +327,6 @@ class QEMUMachine:
         self._qemu_log_path = os.path.join(self.log_dir, self._name + ".log")
         self._qemu_log_file = open(self._qemu_log_path, 'wb')
 
-        self._iolog = None
-        self._qemu_full_args = tuple(chain(
-            self._wrapper,
-            [self._binary],
-            self._base_args,
-            self._args
-        ))
-
     def _post_launch(self) -> None:
         if self._qmp_connection:
             self._qmp.accept(self._qmp_timer)
@@ -398,6 +390,8 @@ class QEMUMachine:
         if self._launched:
             raise QEMUMachineError('VM already launched')
 
+        self._iolog = None
+        self._qemu_full_args = ()
         try:
             self._launch()
             self._launched = True
@@ -416,6 +410,12 @@ class QEMUMachine:
         Launch the VM and establish a QMP connection
         """
         self._pre_launch()
+        self._qemu_full_args = tuple(
+            chain(self._wrapper,
+                  [self._binary],
+                  self._base_args,
+                  self._args)
+        )
         LOG.debug('VM launch command: %r', ' '.join(self._qemu_full_args))
 
         # Cleaning up of this subprocess is guaranteed by _do_shutdown.

++++++ Revert-python-machine-remove-_remove_mon.patch ++++++
From: Li Zhang <lizh...@suse.de>
Date: Tue, 29 Mar 2022 12:01:34 +0200
Subject: Revert "python/machine: remove _remove_monitor_sockfile property"

References: bsc#1197528 bsc#1197150

To improve testsuit, these patches still need more testing.
This reverts commit 6eeb3de7e1aff91ce6e092a39f85946d12664385.

Signed-off-by: Li Zhang <lizh...@suse.de>
---
 python/qemu/machine/machine.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index ea9e07805df10a57115dace06885..b1dd77b53885629eba452cdd1bc2 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -141,10 +141,12 @@ class QEMUMachine:
 
         if monitor_address is not None:
             self._monitor_address = monitor_address
+            self._remove_monitor_sockfile = False
         else:
             self._monitor_address = os.path.join(
                 self.sock_dir, f"{self._name}-monitor.sock"
             )
+            self._remove_monitor_sockfile = True
 
         self._console_log_path = console_log
         if self._console_log_path:
@@ -313,7 +315,8 @@ class QEMUMachine:
             self._remove_files.append(self._console_address)
 
         if self._qmp_set:
-            if isinstance(self._monitor_address, str):
+            if self._remove_monitor_sockfile:
+                assert isinstance(self._monitor_address, str)
                 self._remove_files.append(self._monitor_address)
             self._qmp_connection = QEMUMonitorProtocol(
                 self._monitor_address,

++++++ bundles.tar.xz ++++++
Binary files old/44f28df24767cf9dca1ddc9b23157737c4cbb645.bundle and 
new/44f28df24767cf9dca1ddc9b23157737c4cbb645.bundle differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/repo new/repo
--- old/repo    2021-12-16 17:53:29.000000000 +0100
+++ new/repo    2021-12-16 17:53:29.000000000 +0100
@@ -1 +1 @@
-https://git.qemu.org/git/qemu.git
+https://github.com/openSUSE/qemu.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/repo 
new/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/repo
--- old/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/repo 2021-12-16 
17:53:29.000000000 +0100
+++ new/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/repo 2021-12-16 
17:53:29.000000000 +0100
@@ -1 +1 @@
-https://github.com/google/brotli
+https://github.com/openSUSE/qemu-edk2-BrotliCompress-brotli.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roms/ipxe/repo new/roms/ipxe/repo
--- old/roms/ipxe/repo  2021-12-16 17:53:29.000000000 +0100
+++ new/roms/ipxe/repo  2021-12-16 17:53:29.000000000 +0100
@@ -1 +1 @@
-https://git.qemu.org/git/ipxe.git
+https://github.com/openSUSE/qemu-ipxe.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roms/opensbi/repo new/roms/opensbi/repo
--- old/roms/opensbi/repo       2021-12-16 17:53:29.000000000 +0100
+++ new/roms/opensbi/repo       2021-12-16 17:53:29.000000000 +0100
@@ -1 +1 @@
-https://git.qemu.org/git/opensbi.git
+https://github.com/openSUSE/qemu-opensbi.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roms/qboot/repo new/roms/qboot/repo
--- old/roms/qboot/repo 2021-12-16 17:53:29.000000000 +0100
+++ new/roms/qboot/repo 2021-12-16 17:53:29.000000000 +0100
@@ -1 +1 @@
-https://github.com/bonzini/qboot
+https://github.com/openSUSE/qemu-qboot.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roms/seabios/repo new/roms/seabios/repo
--- old/roms/seabios/repo       2021-12-16 17:53:29.000000000 +0100
+++ new/roms/seabios/repo       2021-12-16 17:53:29.000000000 +0100
@@ -1 +1 @@
-https://git.qemu.org/git/seabios.git/
+https://github.com/openSUSE/qemu-seabios.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roms/sgabios/repo new/roms/sgabios/repo
--- old/roms/sgabios/repo       2021-12-16 17:53:29.000000000 +0100
+++ new/roms/sgabios/repo       2021-12-16 17:53:29.000000000 +0100
@@ -1 +1 @@
-https://git.qemu.org/git/sgabios.git
+https://github.com/openSUSE/qemu-sgabios.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roms/skiboot/repo new/roms/skiboot/repo
--- old/roms/skiboot/repo       2021-12-16 17:53:29.000000000 +0100
+++ new/roms/skiboot/repo       2021-12-16 17:53:29.000000000 +0100
@@ -1 +1 @@
-https://gitlab.com/qemu-project/skiboot.git
+https://github.com/openSUSE/qemu-skiboot.git

++++++ doc-Add-the-SGX-numa-description.patch ++++++
From: Yang Zhong <yang.zh...@intel.com>
Date: Mon, 1 Nov 2021 12:20:08 -0400
Subject: doc: Add the SGX numa description

Git-commit: d1889b36098c79e2e6ac90faf3d0dc5ec0057677
References: bsc#1197807

Add the SGX numa reference command and how to check if
SGX numa is support or not with multiple EPC sections.

Signed-off-by: Yang Zhong <yang.zh...@intel.com>
Message-Id: <20211101162009.62161-5-yang.zh...@intel.com>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
Signed-off-by: Li Zhang <lizh...@suse.de>
---
 docs/system/i386/sgx.rst | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/docs/system/i386/sgx.rst b/docs/system/i386/sgx.rst
index f8fade5ac2d44b7378a87e8da14d..0f0a73f7587c44e69e028f061fed 100644
--- a/docs/system/i386/sgx.rst
+++ b/docs/system/i386/sgx.rst
@@ -141,8 +141,7 @@ To launch a SGX guest:
   |qemu_system_x86| \\
    -cpu host,+sgx-provisionkey \\
    -object memory-backend-epc,id=mem1,size=64M,prealloc=on \\
-   -object memory-backend-epc,id=mem2,size=28M \\
-   -M sgx-epc.0.memdev=mem1,sgx-epc.1.memdev=mem2
+   -M sgx-epc.0.memdev=mem1,sgx-epc.0.node=0
 
 Utilizing SGX in the guest requires a kernel/OS with SGX support.
 The support can be determined in guest by::
@@ -152,8 +151,32 @@ The support can be determined in guest by::
 and SGX epc info by::
 
   $ dmesg | grep sgx
-  [    1.242142] sgx: EPC section 0x180000000-0x181bfffff
-  [    1.242319] sgx: EPC section 0x181c00000-0x1837fffff
+  [    0.182807] sgx: EPC section 0x140000000-0x143ffffff
+  [    0.183695] sgx: [Firmware Bug]: Unable to map EPC section to online 
node. Fallback to the NUMA node 0.
+
+To launch a SGX numa guest:
+
+.. parsed-literal::
+
+  |qemu_system_x86| \\
+   -cpu host,+sgx-provisionkey \\
+   -object memory-backend-ram,size=2G,host-nodes=0,policy=bind,id=node0 \\
+   -object 
memory-backend-epc,id=mem0,size=64M,prealloc=on,host-nodes=0,policy=bind \\
+   -numa node,nodeid=0,cpus=0-1,memdev=node0 \\
+   -object memory-backend-ram,size=2G,host-nodes=1,policy=bind,id=node1 \\
+   -object 
memory-backend-epc,id=mem1,size=28M,prealloc=on,host-nodes=1,policy=bind \\
+   -numa node,nodeid=1,cpus=2-3,memdev=node1 \\
+   -M 
sgx-epc.0.memdev=mem0,sgx-epc.0.node=0,sgx-epc.1.memdev=mem1,sgx-epc.1.node=1
+
+and SGX epc numa info by::
+
+  $ dmesg | grep sgx
+  [    0.369937] sgx: EPC section 0x180000000-0x183ffffff
+  [    0.370259] sgx: EPC section 0x184000000-0x185bfffff
+
+  $ dmesg | grep SRAT
+  [    0.009981] ACPI: SRAT: Node 0 PXM 0 [mem 0x180000000-0x183ffffff]
+  [    0.009982] ACPI: SRAT: Node 1 PXM 1 [mem 0x184000000-0x185bfffff]
 
 References
 ----------

++++++ hw-nvme-fix-CVE-2021-3929.patch ++++++
From: Klaus Jensen <k.jen...@samsung.com>
Date: Fri, 17 Dec 2021 10:44:01 +0100
Subject: hw/nvme: fix CVE-2021-3929
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Git-commit: 736b01642d85be832385063f278fe7cd4ffb5221
Refrences:  bsc#1193880  CVE-2021-3929

This fixes CVE-2021-3929 "locally" by denying DMA to the iomem of the
device itself. This still allows DMA to MMIO regions of other devices
(e.g. doing P2P DMA to the controller memory buffer of another NVMe
device).

Fixes: CVE-2021-3929
Reported-by: Qiuhao Li <qiuhao...@outlook.com>
Reviewed-by: Keith Busch <kbu...@kernel.org>
Reviewed-by: Philippe Mathieu-Daud?? <f4...@amsat.org>
Signed-off-by: Klaus Jensen <k.jen...@samsung.com>
Signed-off-by: Li Zhang <lizh...@suse.de>
---
 hw/nvme/ctrl.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 5f573c417b3d66c30814a74b192a..eda52c6ac74b3419ca4b656d0ee0 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -357,6 +357,24 @@ static inline void *nvme_addr_to_pmr(NvmeCtrl *n, hwaddr 
addr)
     return memory_region_get_ram_ptr(&n->pmr.dev->mr) + (addr - n->pmr.cba);
 }
 
+static inline bool nvme_addr_is_iomem(NvmeCtrl *n, hwaddr addr)
+{
+    hwaddr hi, lo;
+
+    /*
+     * The purpose of this check is to guard against invalid "local" access to
+     * the iomem (i.e. controller registers). Thus, we check against the range
+     * covered by the 'bar0' MemoryRegion since that is currently composed of
+     * two subregions (the NVMe "MBAR" and the MSI-X table/pba). Note, however,
+     * that if the device model is ever changed to allow the CMB to be located
+     * in BAR0 as well, then this must be changed.
+     */
+    lo = n->bar0.addr;
+    hi = lo + int128_get64(n->bar0.size);
+
+    return addr >= lo && addr < hi;
+}
+
 static int nvme_addr_read(NvmeCtrl *n, hwaddr addr, void *buf, int size)
 {
     hwaddr hi = addr + size - 1;
@@ -614,6 +632,10 @@ static uint16_t nvme_map_addr(NvmeCtrl *n, NvmeSg *sg, 
hwaddr addr, size_t len)
 
     trace_pci_nvme_map_addr(addr, len);
 
+    if (nvme_addr_is_iomem(n, addr)) {
+        return NVME_DATA_TRAS_ERROR;
+    }
+
     if (nvme_addr_is_cmb(n, addr)) {
         cmb = true;
     } else if (nvme_addr_is_pmr(n, addr)) {

++++++ hw-nvram-at24-return-0xff-if-1-byte-addr.patch ++++++
--- /var/tmp/diff_new_pack.deiCRh/_old  2022-04-02 18:20:55.870012023 +0200
+++ /var/tmp/diff_new_pack.deiCRh/_new  2022-04-02 18:20:55.874011978 +0200
@@ -6,7 +6,6 @@
 Content-Transfer-Encoding: 8bit
 
 Git-commit: 1cbab82e9d1bdb2c7b9ef46a396fdc03ea3fa04c
-References: bsc#1193880 CVE-2021-3929
 
 The at24 eeproms are 2 byte devices that return 0xff when they are read
 from with a partial (1-byte) address written.  This distinction was

++++++ numa-Enable-numa-for-SGX-EPC-sections.patch ++++++
From: Yang Zhong <yang.zh...@intel.com>
Date: Mon, 1 Nov 2021 12:20:05 -0400
Subject: numa: Enable numa for SGX EPC sections

Git-commit: 1105812382e1126d86dddc16b3700f8c79dc93d1
References: bsc#1197807

The basic SGX did not enable numa for SGX EPC sections, which
result in all EPC sections located in numa node 0. This patch
enable SGX numa function in the guest and the EPC section can
work with RAM as one numa node.

The Guest kernel related log:
[    0.009981] ACPI: SRAT: Node 0 PXM 0 [mem 0x180000000-0x183ffffff]
[    0.009982] ACPI: SRAT: Node 1 PXM 1 [mem 0x184000000-0x185bfffff]
The SRAT table can normally show SGX EPC sections menory info in different
numa nodes.

The SGX EPC numa related command:
 ......
 -m 4G,maxmem=20G \
 -smp sockets=2,cores=2 \
 -cpu host,+sgx-provisionkey \
 -object memory-backend-ram,size=2G,host-nodes=0,policy=bind,id=node0 \
 -object 
memory-backend-epc,id=mem0,size=64M,prealloc=on,host-nodes=0,policy=bind \
 -numa node,nodeid=0,cpus=0-1,memdev=node0 \
 -object memory-backend-ram,size=2G,host-nodes=1,policy=bind,id=node1 \
 -object 
memory-backend-epc,id=mem1,size=28M,prealloc=on,host-nodes=1,policy=bind \
 -numa node,nodeid=1,cpus=2-3,memdev=node1 \
 -M 
sgx-epc.0.memdev=mem0,sgx-epc.0.node=0,sgx-epc.1.memdev=mem1,sgx-epc.1.node=1 \
 ......

Signed-off-by: Yang Zhong <yang.zh...@intel.com>
Message-Id: <20211101162009.62161-2-yang.zh...@intel.com>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
Signed-off-by: Li Zhang <lizh...@suse.de>
---
 hw/core/numa.c            |  5 ++---
 hw/i386/acpi-build.c      |  2 ++
 hw/i386/sgx-epc.c         |  3 +++
 hw/i386/sgx-stub.c        |  4 ++++
 hw/i386/sgx.c             | 44 +++++++++++++++++++++++++++++++++++++++
 include/hw/i386/sgx-epc.h |  3 +++
 monitor/hmp-cmds.c        |  1 +
 qapi/machine.json         | 10 ++++++++-
 qemu-options.hx           |  4 ++--
 9 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/hw/core/numa.c b/hw/core/numa.c
index e6050b22739f44a0c9acbed54599..1aa05dcf425f46eca6ac0468d56a 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -784,9 +784,8 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[])
                 break;
             case MEMORY_DEVICE_INFO_KIND_SGX_EPC:
                 se = value->u.sgx_epc.data;
-                /* TODO: once we support numa, assign to right node */
-                node_mem[0].node_mem += se->size;
-                node_mem[0].node_plugged_mem += se->size;
+                node_mem[se->node].node_mem += se->size;
+                node_mem[se->node].node_plugged_mem = 0;
                 break;
             default:
                 g_assert_not_reached();
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a99c6e4fe3fad88da568c9f738d7..8383b83ee36027631356f28aaedd 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2068,6 +2068,8 @@ build_srat(GArray *table_data, BIOSLinker *linker, 
MachineState *machine)
         nvdimm_build_srat(table_data);
     }
 
+    sgx_epc_build_srat(table_data);
+
     /*
      * TODO: this part is not in ACPI spec and current linux kernel boots fine
      * without these entries. But I recall there were issues the last time I
diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
index e508827e787b7b7a38cf9785a030..96b2940d75eba983124effc9963f 100644
--- a/hw/i386/sgx-epc.c
+++ b/hw/i386/sgx-epc.c
@@ -21,6 +21,7 @@
 
 static Property sgx_epc_properties[] = {
     DEFINE_PROP_UINT64(SGX_EPC_ADDR_PROP, SGXEPCDevice, addr, 0),
+    DEFINE_PROP_UINT32(SGX_EPC_NUMA_NODE_PROP, SGXEPCDevice, node, 0),
     DEFINE_PROP_LINK(SGX_EPC_MEMDEV_PROP, SGXEPCDevice, hostmem,
                      TYPE_MEMORY_BACKEND_EPC, HostMemoryBackendEpc *),
     DEFINE_PROP_END_OF_LIST(),
@@ -139,6 +140,8 @@ static void sgx_epc_md_fill_device_info(const 
MemoryDeviceState *md,
     se->memaddr = epc->addr;
     se->size = object_property_get_uint(OBJECT(epc), SGX_EPC_SIZE_PROP,
                                         NULL);
+    se->node = object_property_get_uint(OBJECT(epc), SGX_EPC_NUMA_NODE_PROP,
+                                        NULL);
     se->memdev = object_get_canonical_path(OBJECT(epc->hostmem));
 
     info->u.sgx_epc.data = se;
diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c
index c9b379e66519210337f039523593..26833eb233c5b6448831c76c3126 100644
--- a/hw/i386/sgx-stub.c
+++ b/hw/i386/sgx-stub.c
@@ -6,6 +6,10 @@
 #include "qapi/error.h"
 #include "qapi/qapi-commands-misc-target.h"
 
+void sgx_epc_build_srat(GArray *table_data)
+{
+}
+
 SGXInfo *qmp_query_sgx(Error **errp)
 {
     error_setg(errp, "SGX support is not compiled in");
diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
index 8fef3dd8fad4c20a4c9a3169f6e3..d04299904a2315308cbaa0ef7dcf 100644
--- a/hw/i386/sgx.c
+++ b/hw/i386/sgx.c
@@ -23,6 +23,7 @@
 #include "sysemu/hw_accel.h"
 #include "sysemu/reset.h"
 #include <sys/ioctl.h>
+#include "hw/acpi/aml-build.h"
 
 #define SGX_MAX_EPC_SECTIONS            8
 #define SGX_CPUID_EPC_INVALID           0x0
@@ -36,6 +37,46 @@
 
 #define RETRY_NUM                       2
 
+static int sgx_epc_device_list(Object *obj, void *opaque)
+{
+    GSList **list = opaque;
+
+    if (object_dynamic_cast(obj, TYPE_SGX_EPC)) {
+        *list = g_slist_append(*list, DEVICE(obj));
+    }
+
+    object_child_foreach(obj, sgx_epc_device_list, opaque);
+    return 0;
+}
+
+static GSList *sgx_epc_get_device_list(void)
+{
+    GSList *list = NULL;
+
+    object_child_foreach(qdev_get_machine(), sgx_epc_device_list, &list);
+    return list;
+}
+
+void sgx_epc_build_srat(GArray *table_data)
+{
+    GSList *device_list = sgx_epc_get_device_list();
+
+    for (; device_list; device_list = device_list->next) {
+        DeviceState *dev = device_list->data;
+        Object *obj = OBJECT(dev);
+        uint64_t addr, size;
+        int node;
+
+        node = object_property_get_uint(obj, SGX_EPC_NUMA_NODE_PROP,
+                                        &error_abort);
+        addr = object_property_get_uint(obj, SGX_EPC_ADDR_PROP, &error_abort);
+        size = object_property_get_uint(obj, SGX_EPC_SIZE_PROP, &error_abort);
+
+        build_srat_memory(table_data, addr, size, node, MEM_AFFINITY_ENABLED);
+    }
+    g_slist_free(device_list);
+}
+
 static uint64_t sgx_calc_section_metric(uint64_t low, uint64_t high)
 {
     return (low & MAKE_64BIT_MASK(12, 20)) +
@@ -226,6 +267,9 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms)
         /* set the memdev link with memory backend */
         object_property_parse(obj, SGX_EPC_MEMDEV_PROP, list->value->memdev,
                               &error_fatal);
+        /* set the numa node property for sgx epc object */
+        object_property_set_uint(obj, SGX_EPC_NUMA_NODE_PROP, 
list->value->node,
+                             &error_fatal);
         object_property_set_bool(obj, "realized", true, &error_fatal);
         object_unref(obj);
     }
diff --git a/include/hw/i386/sgx-epc.h b/include/hw/i386/sgx-epc.h
index a6a65be854f88db0e0c7b5d565a0..581fac389a630d66bc173d389e51 100644
--- a/include/hw/i386/sgx-epc.h
+++ b/include/hw/i386/sgx-epc.h
@@ -25,6 +25,7 @@
 #define SGX_EPC_ADDR_PROP "addr"
 #define SGX_EPC_SIZE_PROP "size"
 #define SGX_EPC_MEMDEV_PROP "memdev"
+#define SGX_EPC_NUMA_NODE_PROP "node"
 
 /**
  * SGXEPCDevice:
@@ -38,6 +39,7 @@ typedef struct SGXEPCDevice {
 
     /* public */
     uint64_t addr;
+    uint32_t node;
     HostMemoryBackendEpc *hostmem;
 } SGXEPCDevice;
 
@@ -56,6 +58,7 @@ typedef struct SGXEPCState {
 } SGXEPCState;
 
 bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size);
+void sgx_epc_build_srat(GArray *table_data);
 
 static inline uint64_t sgx_epc_above_4g_end(SGXEPCState *sgx_epc)
 {
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 9c91bf93e94cda6baccc53e9c0a3..2669156b284868188392a2da75b2 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1810,6 +1810,7 @@ void hmp_info_memory_devices(Monitor *mon, const QDict 
*qdict)
                                se->id ? se->id : "");
                 monitor_printf(mon, "  memaddr: 0x%" PRIx64 "\n", se->memaddr);
                 monitor_printf(mon, "  size: %" PRIu64 "\n", se->size);
+                monitor_printf(mon, "  node: %" PRId64 "\n", se->node);
                 monitor_printf(mon, "  memdev: %s\n", se->memdev);
                 break;
             default:
diff --git a/qapi/machine.json b/qapi/machine.json
index 067e3f53787928d38566e1e26e1c..16e771affcf6d4e085caf7e3d53e 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1207,12 +1207,15 @@
 #
 # @memdev: memory backend linked with device
 #
+# @node: the numa node
+#
 # Since: 6.2
 ##
 { 'struct': 'SgxEPCDeviceInfo',
   'data': { '*id': 'str',
             'memaddr': 'size',
             'size': 'size',
+            'node': 'int',
             'memdev': 'str'
           }
 }
@@ -1285,10 +1288,15 @@
 #
 # @memdev: memory backend linked with device
 #
+# @node: the numa node
+#
 # Since: 6.2
 ##
 { 'struct': 'SgxEPC',
-  'data': { 'memdev': 'str' } }
+  'data': { 'memdev': 'str',
+            'node': 'int'
+          }
+}
 
 ##
 # @SgxEPCProperties:
diff --git a/qemu-options.hx b/qemu-options.hx
index ae2c6dbbfc005c526026604d9886..489b58e15110662382136feaf0ae 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -127,11 +127,11 @@ SRST
 ERST
 
 DEF("M", HAS_ARG, QEMU_OPTION_M,
-    "                sgx-epc.0.memdev=memid\n",
+    "                sgx-epc.0.memdev=memid,sgx-epc.0.node=numaid\n",
     QEMU_ARCH_ALL)
 
 SRST
-``sgx-epc.0.memdev=@var{memid}``
+``sgx-epc.0.memdev=@var{memid},sgx-epc.0.node=@var{numaid}``
     Define an SGX EPC section.
 ERST
 

++++++ numa-Support-SGX-numa-in-the-monitor-and.patch ++++++
From: Yang Zhong <yang.zh...@intel.com>
Date: Mon, 1 Nov 2021 12:20:07 -0400
Subject: numa: Support SGX numa in the monitor and Libvirt interfaces

Git-commit: 4755927ae12547c2e7cb22c5fa1b39038c6c11b1
References: bsc#1197807

Add the SGXEPCSection list into SGXInfo to show the multiple
SGX EPC sections detailed info, not the total size like before.
This patch can enable numa support for 'info sgx' command and
QMP interfaces. The new interfaces show each EPC section info
in one numa node. Libvirt can use QMP interface to get the
detailed host SGX EPC capabilities to decide how to allocate
host EPC sections to guest.

(qemu) info sgx
 SGX support: enabled
 SGX1 support: enabled
 SGX2 support: enabled
 FLC support: enabled
 NUMA node #0: size=67108864
 NUMA node #1: size=29360128

The QMP interface show:
(QEMU) query-sgx
{"return": {"sgx": true, "sgx2": true, "sgx1": true, "sections": \
[{"node": 0, "size": 67108864}, {"node": 1, "size": 29360128}], "flc": true}}

(QEMU) query-sgx-capabilities
{"return": {"sgx": true, "sgx2": true, "sgx1": true, "sections": \
[{"node": 0, "size": 17070817280}, {"node": 1, "size": 17079205888}], "flc": 
true}}

Signed-off-by: Yang Zhong <yang.zh...@intel.com>
Message-Id: <20211101162009.62161-4-yang.zh...@intel.com>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
(cherry picked from commit 4755927ae12547c2e7cb22c5fa1b39038c6c11b1)
Signed-off-by: Li Zhang <lizh...@suse.de>
---
 hw/i386/sgx.c         | 51 +++++++++++++++++++++++++++++++++++--------
 qapi/misc-target.json | 19 ++++++++++++++--
 2 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
index d04299904a2315308cbaa0ef7dcf..5de5dd08936e10e8966722f5fac8 100644
--- a/hw/i386/sgx.c
+++ b/hw/i386/sgx.c
@@ -83,11 +83,13 @@ static uint64_t sgx_calc_section_metric(uint64_t low, 
uint64_t high)
            ((high & MAKE_64BIT_MASK(0, 20)) << 32);
 }
 
-static uint64_t sgx_calc_host_epc_section_size(void)
+static SGXEPCSectionList *sgx_calc_host_epc_sections(void)
 {
+    SGXEPCSectionList *head = NULL, **tail = &head;
+    SGXEPCSection *section;
     uint32_t i, type;
     uint32_t eax, ebx, ecx, edx;
-    uint64_t size = 0;
+    uint32_t j = 0;
 
     for (i = 0; i < SGX_MAX_EPC_SECTIONS; i++) {
         host_cpuid(0x12, i + 2, &eax, &ebx, &ecx, &edx);
@@ -101,10 +103,13 @@ static uint64_t sgx_calc_host_epc_section_size(void)
             break;
         }
 
-        size += sgx_calc_section_metric(ecx, edx);
+        section = g_new0(SGXEPCSection, 1);
+        section->node = j++;
+        section->size = sgx_calc_section_metric(ecx, edx);
+        QAPI_LIST_APPEND(tail, section);
     }
 
-    return size;
+    return head;
 }
 
 static void sgx_epc_reset(void *opaque)
@@ -168,13 +173,35 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
     info->sgx1 = eax & (1U << 0) ? true : false;
     info->sgx2 = eax & (1U << 1) ? true : false;
 
-    info->section_size = sgx_calc_host_epc_section_size();
+    info->sections = sgx_calc_host_epc_sections();
 
     close(fd);
 
     return info;
 }
 
+static SGXEPCSectionList *sgx_get_epc_sections_list(void)
+{
+    GSList *device_list = sgx_epc_get_device_list();
+    SGXEPCSectionList *head = NULL, **tail = &head;
+    SGXEPCSection *section;
+
+    for (; device_list; device_list = device_list->next) {
+        DeviceState *dev = device_list->data;
+        Object *obj = OBJECT(dev);
+
+        section = g_new0(SGXEPCSection, 1);
+        section->node = object_property_get_uint(obj, SGX_EPC_NUMA_NODE_PROP,
+                                                 &error_abort);
+        section->size = object_property_get_uint(obj, SGX_EPC_SIZE_PROP,
+                                                 &error_abort);
+        QAPI_LIST_APPEND(tail, section);
+    }
+    g_slist_free(device_list);
+
+    return head;
+}
+
 SGXInfo *qmp_query_sgx(Error **errp)
 {
     SGXInfo *info = NULL;
@@ -193,14 +220,13 @@ SGXInfo *qmp_query_sgx(Error **errp)
         return NULL;
     }
 
-    SGXEPCState *sgx_epc = &pcms->sgx_epc;
     info = g_new0(SGXInfo, 1);
 
     info->sgx = true;
     info->sgx1 = true;
     info->sgx2 = true;
     info->flc = true;
-    info->section_size = sgx_epc->size;
+    info->sections = sgx_get_epc_sections_list();
 
     return info;
 }
@@ -208,6 +234,7 @@ SGXInfo *qmp_query_sgx(Error **errp)
 void hmp_info_sgx(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
+    SGXEPCSectionList *section_list, *section;
     g_autoptr(SGXInfo) info = qmp_query_sgx(&err);
 
     if (err) {
@@ -222,8 +249,14 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict)
                    info->sgx2 ? "enabled" : "disabled");
     monitor_printf(mon, "FLC support: %s\n",
                    info->flc ? "enabled" : "disabled");
-    monitor_printf(mon, "size: %" PRIu64 "\n",
-                   info->section_size);
+
+    section_list = info->sections;
+    for (section = section_list; section; section = section->next) {
+        monitor_printf(mon, "NUMA node #%" PRId64 ": ",
+                       section->value->node);
+        monitor_printf(mon, "size=%" PRIu64 "\n",
+                       section->value->size);
+    }
 }
 
 bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index 5aa2b95b7d4aa09a4b11a9bbabaf..1022aa0184c74a16c8380e310bb3 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -337,6 +337,21 @@
   'if': 'TARGET_ARM' }
 
 
+##
+# @SGXEPCSection:
+#
+# Information about intel SGX EPC section info
+#
+# @node: the numa node
+#
+# @size: the size of epc section
+#
+# Since: 6.2
+##
+{ 'struct': 'SGXEPCSection',
+  'data': { 'node': 'int',
+            'size': 'uint64'}}
+
 ##
 # @SGXInfo:
 #
@@ -350,7 +365,7 @@
 #
 # @flc: true if FLC is supported
 #
-# @section-size: The EPC section size for guest
+# @sections: The EPC sections info for guest
 #
 # Since: 6.2
 ##
@@ -359,7 +374,7 @@
             'sgx1': 'bool',
             'sgx2': 'bool',
             'flc': 'bool',
-            'section-size': 'uint64'},
+            'sections': ['SGXEPCSection']},
    'if': 'TARGET_I386' }
 
 ##


++++++ qemu-binfmt-conf.sh-should-use-F-as-shor.patch ++++++
--- /var/tmp/diff_new_pack.deiCRh/_old  2022-04-02 18:20:56.018010362 +0200
+++ /var/tmp/diff_new_pack.deiCRh/_new  2022-04-02 18:20:56.022010317 +0200
@@ -13,7 +13,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index c46e604fa6ef3faaecccaae835ba..a73232edfd7f9dedb3a7c32218fb 100755
+index cb06245a834f9e8f2bb0464a25ce..53be2ba047fa3fba9d9b61030ab3 100755
 --- a/scripts/qemu-binfmt-conf.sh
 +++ b/scripts/qemu-binfmt-conf.sh
 @@ -340,7 +340,7 @@ PERSISTENT=no



++++++ scsi-generic-check-for-additional-SG_IO-.patch ++++++
From: Hannes Reinecke <h...@suse.de>
Date: Fri, 25 Mar 2022 18:41:52 +0100
Subject: scsi-generic: check for additional SG_IO status on completion

References: bsc#1178049

SG_IO may return additional status in the 'status', 'driver_status',
and 'host_status' fields. When either of these fields are set the
command has not been executed normally, so we should not continue
processing this command but rather return an error.
scsi_read_complete() already checks for these errors,
scsi_write_complete() does not.

Signed-off-by: Hannes Reinecke <h...@suse.de>
Signed-off-by: Lin Ma <l...@suse.com>
Signed-off-by: Dario Faggioli <dfaggi...@suse.com>
---
 hw/scsi/scsi-generic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 343b51c2c0ab5dc7fb792aeb6458..513b10bed0f4279dc4077a31c66f 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -391,7 +391,10 @@ static void scsi_write_complete(void * opaque, int ret)
 
     aio_context_acquire(blk_get_aio_context(s->conf.blk));
 
-    if (ret || r->req.io_canceled) {
+    if (ret || r->req.io_canceled ||
+        r->io_header.status != SCSI_HOST_OK ||
+        (r->io_header.driver_status & SG_ERR_DRIVER_TIMEOUT) ||
+        r->io_header.status != GOOD) {
         scsi_command_complete_noio(r, ret);
         goto done;
     }

++++++ tests-qemu-iotests-040-Skip-TestCommitWi.patch ++++++
From: Thomas Huth <th...@redhat.com>
Date: Wed, 23 Feb 2022 13:31:27 +0100
Subject: tests/qemu-iotests/040: Skip TestCommitWithFilters without 'throttle'

Git-commit: 024354ea9164d3c4b6fd766784939fe39fa4e166

iotest 040 already has some checks for the availability of the 'throttle'
driver, but some new code has been added in the course of time that
depends on 'throttle' but does not check for its availability. Add
a check to the TestCommitWithFilters class so that this iotest now
also passes again if 'throttle' has not been enabled in the QEMU
binaries.

Signed-off-by: Thomas Huth <th...@redhat.com>
Message-Id: <20220223123127.3206042-1-th...@redhat.com>
Signed-off-by: Hanna Reitz <hre...@redhat.com>
Signed-off-by: Li Zhang <lizh...@suse.de>
---
 tests/qemu-iotests/040 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index 6af5ab9e764cc5a061712a622a81..0e1cfd7e49d1b02f41d286c95f74 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -744,6 +744,7 @@ class TestCommitWithFilters(iotests.QMPTestCase):
                              pattern_file)
             self.assertFalse('Pattern verification failed' in result)
 
+    @iotests.skip_if_unsupported(['throttle'])
     def setUp(self):
         qemu_img('create', '-f', iotests.imgfmt, self.img0, '64M')
         qemu_img('create', '-f', iotests.imgfmt, self.img1, '64M')

++++++ tests-qemu-iotests-testrunner-Quote-case.patch ++++++
From: Thomas Huth <th...@redhat.com>
Date: Wed, 23 Feb 2022 13:43:53 +0100
Subject: tests/qemu-iotests/testrunner: Quote "case not run" lines in TAP mode

Git-commit: db4b2133b8d3012dfd1977dc12d48d6bf46543d6

In TAP mode, the stdout is reserved for the TAP protocol, so we
have to make sure to mark other lines with a comment '#' character
at the beginning to avoid that the TAP parser at the other end
gets confused.

To test this condition, run "configure" for example with:

 
--block-drv-rw-whitelist=copy-before-write,qcow2,raw,file,host_device,blkdebug,null-co,copy-on-read

so that iotest 041 will report that some tests are not run due to
the missing "quorum" driver. Without this change, "make check-block"
fails since the meson tap parser gets confused by these messages.

Signed-off-by: Thomas Huth <th...@redhat.com>
Message-Id: <20220223124353.3273898-1-th...@redhat.com>
Signed-off-by: Hanna Reitz <hre...@redhat.com>
Signed-off-by: Li Zhang <lizh...@suse.de>
---
 tests/qemu-iotests/testrunner.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index 0e29c2fddddb2e7c611f5ad1f366..a7e2c16e09559054e53da60a1ac9 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -305,7 +305,10 @@ class TestRunner(ContextManager['TestRunner']):
                                  test_field_width=test_field_width)
 
         if res.casenotrun:
-            print(res.casenotrun)
+            if self.tap:
+                print('#' + res.casenotrun.replace('\n', '\n#'))
+            else:
+                print(res.casenotrun)
 
         return res
 

++++++ update_git.sh ++++++
--- /var/tmp/diff_new_pack.deiCRh/_old  2022-04-02 18:20:56.238007893 +0200
+++ /var/tmp/diff_new_pack.deiCRh/_new  2022-04-02 18:20:56.242007847 +0200
@@ -839,6 +839,15 @@
 
 #==============================================================================
 
+# cleanup directories from any previous failed run:
+rm -rf /dev/shm/qemu-???????-git-dir
+rm -rf /dev/shm/qemu-???????-cmp-dir
+rm -rf /dev/shm/qemu-???????-bun-dir
+# Temporary directories used in this script
+GIT_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-git-dir)
+CMP_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-cmp-dir)
+BUN_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-bun-dir)
+
 if [[ ! -e $(readlink -f ${LOCAL_REPO_MAP[0]}) ]]; then
     echo "No local repo found at ${LOCAL_REPO_MAP[0]}"
     if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
@@ -949,15 +958,6 @@
     fi
 done
 
-# cleanup directories from any previous failed run:
-rm -rf /dev/shm/qemu-???????-git-dir
-rm -rf /dev/shm/qemu-???????-cmp-dir
-rm -rf /dev/shm/qemu-???????-bun-dir
-# Temporary directories used in this script
-GIT_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-git-dir)
-CMP_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-cmp-dir)
-BUN_DIR=$(mktemp -d /dev/shm/qemu-XXXXXXX-bun-dir)
-
 if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
     if [ "$1" = "continue" ]; then
         CONTINUE_AFTER_REBASE=1

Reply via email to