diff --git a/SOURCES/kvm-i386-Add-2nd-Generation-AMD-EPYC-processors.patch b/SOURCES/kvm-i386-Add-2nd-Generation-AMD-EPYC-processors.patch new file mode 100644 index 0000000..b2cc438 --- /dev/null +++ b/SOURCES/kvm-i386-Add-2nd-Generation-AMD-EPYC-processors.patch @@ -0,0 +1,199 @@ +From 1bee5a77b3f999d2933a440021737d0720b32269 Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert" +Date: Wed, 29 Jul 2020 18:56:21 -0400 +Subject: [PATCH 1/4] i386: Add 2nd Generation AMD EPYC processors + +RH-Author: Dr. David Alan Gilbert +Message-id: <20200729185621.152427-2-dgilbert@redhat.com> +Patchwork-id: 98078 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/1] i386: Add 2nd Generation AMD EPYC processors +Bugzilla: 1780385 +RH-Acked-by: Danilo de Paula +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Maxim Levitsky + +From: "Moger, Babu" + +Adds the support for 2nd Gen AMD EPYC Processors. The model display +name will be EPYC-Rome. + +Adds the following new feature bits on top of the feature bits from the +first generation EPYC models. +perfctr-core : core performance counter extensions support. Enables the VM to + use extended performance counter support. It enables six + programmable counters instead of four counters. +clzero : instruction zeroes out the 64 byte cache line specified in RAX. +xsaveerptr : XSAVE, XSAVE, FXSAVEOPT, XSAVEC, XSAVES always save error + pointers and FXRSTOR, XRSTOR, XRSTORS always restore error + pointers. +wbnoinvd : Write back and do not invalidate cache +ibpb : Indirect Branch Prediction Barrier +amd-stibp : Single Thread Indirect Branch Predictor +clwb : Cache Line Write Back and Retain +xsaves : XSAVES, XRSTORS and IA32_XSS support +rdpid : Read Processor ID instruction support +umip : User-Mode Instruction Prevention support + +The Reference documents are available at +https://developer.amd.com/wp-content/resources/55803_0.54-PUB.pdf +https://www.amd.com/system/files/TechDocs/24594.pdf + +Depends on following kernel commits: +40bc47b08b6e ("kvm: x86: Enumerate support for CLZERO instruction") +504ce1954fba ("KVM: x86: Expose XSAVEERPTR to the guest") +6d61e3c32248 ("kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID") +52297436199d ("kvm: svm: Update svm_xsaves_supported") + +Signed-off-by: Babu Moger +Message-Id: <157314966312.23828.17684821666338093910.stgit@naples-babu.amd.com> +Signed-off-by: Eduardo Habkost +(cherry picked from commit 143c30d4d346831a09e59e9af45afdca0331e819) +Signed-off-by: Danilo C. L. de Paula +--- + target/i386/cpu.c | 102 +++++++++++++++++++++++++++++++++++++++++++++- + target/i386/cpu.h | 2 + + 2 files changed, 103 insertions(+), 1 deletion(-) + +diff --git a/target/i386/cpu.c b/target/i386/cpu.c +index a343de0c9d..ff39fc9905 100644 +--- a/target/i386/cpu.c ++++ b/target/i386/cpu.c +@@ -1133,7 +1133,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { + "clzero", NULL, "xsaveerptr", NULL, + NULL, NULL, NULL, NULL, + NULL, "wbnoinvd", NULL, NULL, +- "ibpb", NULL, NULL, NULL, ++ "ibpb", NULL, NULL, "amd-stibp", + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL, +@@ -1803,6 +1803,56 @@ static CPUCaches epyc_cache_info = { + }, + }; + ++static CPUCaches epyc_rome_cache_info = { ++ .l1d_cache = &(CPUCacheInfo) { ++ .type = DATA_CACHE, ++ .level = 1, ++ .size = 32 * KiB, ++ .line_size = 64, ++ .associativity = 8, ++ .partitions = 1, ++ .sets = 64, ++ .lines_per_tag = 1, ++ .self_init = 1, ++ .no_invd_sharing = true, ++ }, ++ .l1i_cache = &(CPUCacheInfo) { ++ .type = INSTRUCTION_CACHE, ++ .level = 1, ++ .size = 32 * KiB, ++ .line_size = 64, ++ .associativity = 8, ++ .partitions = 1, ++ .sets = 64, ++ .lines_per_tag = 1, ++ .self_init = 1, ++ .no_invd_sharing = true, ++ }, ++ .l2_cache = &(CPUCacheInfo) { ++ .type = UNIFIED_CACHE, ++ .level = 2, ++ .size = 512 * KiB, ++ .line_size = 64, ++ .associativity = 8, ++ .partitions = 1, ++ .sets = 1024, ++ .lines_per_tag = 1, ++ }, ++ .l3_cache = &(CPUCacheInfo) { ++ .type = UNIFIED_CACHE, ++ .level = 3, ++ .size = 16 * MiB, ++ .line_size = 64, ++ .associativity = 16, ++ .partitions = 1, ++ .sets = 16384, ++ .lines_per_tag = 1, ++ .self_init = true, ++ .inclusive = true, ++ .complex_indexing = true, ++ }, ++}; ++ + /* The following VMX features are not supported by KVM and are left out in the + * CPU definitions: + * +@@ -4024,6 +4074,56 @@ static X86CPUDefinition builtin_x86_defs[] = { + .model_id = "Hygon Dhyana Processor", + .cache_info = &epyc_cache_info, + }, ++ { ++ .name = "EPYC-Rome", ++ .level = 0xd, ++ .vendor = CPUID_VENDOR_AMD, ++ .family = 23, ++ .model = 49, ++ .stepping = 0, ++ .features[FEAT_1_EDX] = ++ CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUSH | ++ CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE | ++ CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE | ++ CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE | ++ CPUID_VME | CPUID_FP87, ++ .features[FEAT_1_ECX] = ++ CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX | ++ CPUID_EXT_XSAVE | CPUID_EXT_AES | CPUID_EXT_POPCNT | ++ CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | ++ CPUID_EXT_CX16 | CPUID_EXT_FMA | CPUID_EXT_SSSE3 | ++ CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3, ++ .features[FEAT_8000_0001_EDX] = ++ CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB | ++ CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX | ++ CPUID_EXT2_SYSCALL, ++ .features[FEAT_8000_0001_ECX] = ++ CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | ++ CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | ++ CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | ++ CPUID_EXT3_TOPOEXT | CPUID_EXT3_PERFCORE, ++ .features[FEAT_8000_0008_EBX] = ++ CPUID_8000_0008_EBX_CLZERO | CPUID_8000_0008_EBX_XSAVEERPTR | ++ CPUID_8000_0008_EBX_WBNOINVD | CPUID_8000_0008_EBX_IBPB | ++ CPUID_8000_0008_EBX_STIBP, ++ .features[FEAT_7_0_EBX] = ++ CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 | ++ CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED | ++ CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLFLUSHOPT | ++ CPUID_7_0_EBX_SHA_NI | CPUID_7_0_EBX_CLWB, ++ .features[FEAT_7_0_ECX] = ++ CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_RDPID, ++ .features[FEAT_XSAVE] = ++ CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | ++ CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES, ++ .features[FEAT_6_EAX] = ++ CPUID_6_EAX_ARAT, ++ .features[FEAT_SVM] = ++ CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE, ++ .xlevel = 0x8000001E, ++ .model_id = "AMD EPYC-Rome Processor", ++ .cache_info = &epyc_rome_cache_info, ++ }, + }; + + /* KVM-specific features that are automatically added/removed +diff --git a/target/i386/cpu.h b/target/i386/cpu.h +index 7bfbf2a5e5..f3da25cb8a 100644 +--- a/target/i386/cpu.h ++++ b/target/i386/cpu.h +@@ -792,6 +792,8 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS]; + #define CPUID_8000_0008_EBX_WBNOINVD (1U << 9) + /* Indirect Branch Prediction Barrier */ + #define CPUID_8000_0008_EBX_IBPB (1U << 12) ++/* Single Thread Indirect Branch Predictors */ ++#define CPUID_8000_0008_EBX_STIBP (1U << 15) + + #define CPUID_XSAVE_XSAVEOPT (1U << 0) + #define CPUID_XSAVE_XSAVEC (1U << 1) +-- +2.27.0 + diff --git a/SOURCES/kvm-i386-Mask-SVM-features-if-nested-SVM-is-disabled.patch b/SOURCES/kvm-i386-Mask-SVM-features-if-nested-SVM-is-disabled.patch new file mode 100644 index 0000000..17251bf --- /dev/null +++ b/SOURCES/kvm-i386-Mask-SVM-features-if-nested-SVM-is-disabled.patch @@ -0,0 +1,82 @@ +From d3b9c1891a6d05308dd5ea119d2c32c8f98a25da Mon Sep 17 00:00:00 2001 +From: Eduardo Habkost +Date: Tue, 30 Jun 2020 23:40:15 -0400 +Subject: [PATCH 1/4] i386: Mask SVM features if nested SVM is disabled + +RH-Author: Eduardo Habkost +Message-id: <20200630234015.166253-2-ehabkost@redhat.com> +Patchwork-id: 97852 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/1] i386: Mask SVM features if nested SVM is disabled +Bugzilla: 1835390 +RH-Acked-by: Igor Mammedov +RH-Acked-by: Bandan Das +RH-Acked-by: Dr. David Alan Gilbert + +QEMU incorrectly validates FEAT_SVM feature flags against +GET_SUPPORTED_CPUID even if SVM features are being masked out by +cpu_x86_cpuid(). This can make QEMU print warnings on most AMD +CPU models, even when SVM nesting is disabled (which is the +default). + +This bug was never detected before because of a Linux KVM bug: +until Linux v5.6, KVM was not filtering out SVM features in +GET_SUPPORTED_CPUID when nested was disabled. This KVM bug was +fixed in Linux v5.7-rc1, on Linux commit a50718cc3f43 ("KVM: +nSVM: Expose SVM features to L1 iff nested is enabled"). + +Fix the problem by adding a CPUID_EXT3_SVM dependency to all +FEAT_SVM feature flags in the feature_dependencies table. + +Reported-by: Yanan Fu +Signed-off-by: Eduardo Habkost +Message-Id: <20200623230116.277409-1-ehabkost@redhat.com> +[Fix testcase. - Paolo] +Signed-off-by: Paolo Bonzini +(cherry picked from commit 730319aef0fcb94f11a4a2d32656437fdde7efdd) +Signed-off-by: Eduardo Habkost +Signed-off-by: Danilo C. L. de Paula +--- + target/i386/cpu.c | 4 ++++ + tests/test-x86-cpuid-compat.c | 4 ++-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/target/i386/cpu.c b/target/i386/cpu.c +index 7d7b016bb7..a343de0c9d 100644 +--- a/target/i386/cpu.c ++++ b/target/i386/cpu.c +@@ -1477,6 +1477,10 @@ static FeatureDep feature_dependencies[] = { + .from = { FEAT_VMX_SECONDARY_CTLS, VMX_SECONDARY_EXEC_ENABLE_VMFUNC }, + .to = { FEAT_VMX_VMFUNC, ~0ull }, + }, ++ { ++ .from = { FEAT_8000_0001_ECX, CPUID_EXT3_SVM }, ++ .to = { FEAT_SVM, ~0ull }, ++ }, + }; + + typedef struct X86RegisterInfo32 { +diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c +index e7c075ed98..983aa0719a 100644 +--- a/tests/test-x86-cpuid-compat.c ++++ b/tests/test-x86-cpuid-compat.c +@@ -256,7 +256,7 @@ int main(int argc, char **argv) + "-cpu 486,+invtsc", "xlevel", 0x80000007); + /* CPUID[8000_000A].EDX: */ + add_cpuid_test("x86/cpuid/auto-xlevel/486/npt", +- "-cpu 486,+npt", "xlevel", 0x8000000A); ++ "-cpu 486,+svm,+npt", "xlevel", 0x8000000A); + /* CPUID[C000_0001].EDX: */ + add_cpuid_test("x86/cpuid/auto-xlevel2/phenom/xstore", + "-cpu phenom,+xstore", "xlevel2", 0xC0000001); +@@ -349,7 +349,7 @@ int main(int argc, char **argv) + "-machine pc-i440fx-2.4 -cpu SandyBridge,", + "xlevel", 0x80000008); + add_cpuid_test("x86/cpuid/xlevel-compat/pc-i440fx-2.4/npt-on", +- "-machine pc-i440fx-2.4 -cpu SandyBridge,+npt", ++ "-machine pc-i440fx-2.4 -cpu SandyBridge,+svm,+npt", + "xlevel", 0x80000008); + #endif + +-- +2.27.0 + diff --git a/SOURCES/kvm-iotests-026-Move-v3-exclusive-test-to-new-file.patch b/SOURCES/kvm-iotests-026-Move-v3-exclusive-test-to-new-file.patch new file mode 100644 index 0000000..a50bff9 --- /dev/null +++ b/SOURCES/kvm-iotests-026-Move-v3-exclusive-test-to-new-file.patch @@ -0,0 +1,241 @@ +From a4a984e67e276e643b8a51f39ca426d0967754a0 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Mon, 13 Jul 2020 14:24:51 -0400 +Subject: [PATCH 4/4] iotests/026: Move v3-exclusive test to new file +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Max Reitz +Message-id: <20200713142451.289703-5-mreitz@redhat.com> +Patchwork-id: 97956 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 4/4] iotests/026: Move v3-exclusive test to new file +Bugzilla: 1807057 +RH-Acked-by: Stefano Garzarella +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Kevin Wolf + +data_file does not work with v2, and we probably want 026 to keep +working for v2 images. Thus, open a new file for v3-exclusive error +path test cases. + +Fixes: 81311255f217859413c94f2cd9cebf2684bbda94 + (“iotests/026: Test EIO on allocation in a data-file”) +Signed-off-by: Max Reitz +Message-Id: <20200311140707.1243218-1-mreitz@redhat.com> +Reviewed-by: John Snow +Tested-by: John Snow +Signed-off-by: Max Reitz +(cherry picked from commit c264e5d2f9f5d73977eac8e5d084f727b3d07ea9) + +Conflicts: + tests/qemu-iotests/group + - As per usual. + +Signed-off-by: Max Reitz +Signed-off-by: Danilo C. L. de Paula +--- + tests/qemu-iotests/026 | 31 ----------- + tests/qemu-iotests/026.out | 6 -- + tests/qemu-iotests/026.out.nocache | 6 -- + tests/qemu-iotests/289 | 89 ++++++++++++++++++++++++++++++ + tests/qemu-iotests/289.out | 8 +++ + tests/qemu-iotests/group | 1 + + 6 files changed, 98 insertions(+), 43 deletions(-) + create mode 100755 tests/qemu-iotests/289 + create mode 100644 tests/qemu-iotests/289.out + +diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 +index c1c96a41d9..3afd708863 100755 +--- a/tests/qemu-iotests/026 ++++ b/tests/qemu-iotests/026 +@@ -237,37 +237,6 @@ $QEMU_IO -c "write 0 $CLUSTER_SIZE" "$BLKDBG_TEST_IMG" | _filter_qemu_io + + _check_test_img + +-echo +-echo === Avoid freeing external data clusters on failure === +-echo +- +-# Similar test as the last one, except we test what happens when there +-# is an error when writing to an external data file instead of when +-# writing to a preallocated zero cluster +-_make_test_img -o "data_file=$TEST_IMG.data_file" $CLUSTER_SIZE +- +-# Put blkdebug above the data-file, and a raw node on top of that so +-# that blkdebug will see a write_aio event and emit an error +-$QEMU_IO -c "write 0 $CLUSTER_SIZE" \ +- "json:{ +- 'driver': 'qcow2', +- 'file': { 'driver': 'file', 'filename': '$TEST_IMG' }, +- 'data-file': { +- 'driver': 'raw', +- 'file': { +- 'driver': 'blkdebug', +- 'config': '$TEST_DIR/blkdebug.conf', +- 'image': { +- 'driver': 'file', +- 'filename': '$TEST_IMG.data_file' +- } +- } +- } +- }" \ +- | _filter_qemu_io +- +-_check_test_img +- + # success, all done + echo "*** done" + rm -f $seq.full +diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out +index c1b3b58482..83989996ff 100644 +--- a/tests/qemu-iotests/026.out ++++ b/tests/qemu-iotests/026.out +@@ -653,10 +653,4 @@ wrote 1024/1024 bytes at offset 0 + 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + write failed: Input/output error + No errors were found on the image. +- +-=== Avoid freeing external data clusters on failure === +- +-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 data_file=TEST_DIR/t.IMGFMT.data_file +-write failed: Input/output error +-No errors were found on the image. + *** done +diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache +index 8d5001648a..9359d26d7e 100644 +--- a/tests/qemu-iotests/026.out.nocache ++++ b/tests/qemu-iotests/026.out.nocache +@@ -661,10 +661,4 @@ wrote 1024/1024 bytes at offset 0 + 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + write failed: Input/output error + No errors were found on the image. +- +-=== Avoid freeing external data clusters on failure === +- +-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 data_file=TEST_DIR/t.IMGFMT.data_file +-write failed: Input/output error +-No errors were found on the image. + *** done +diff --git a/tests/qemu-iotests/289 b/tests/qemu-iotests/289 +new file mode 100755 +index 0000000000..1c11d4030e +--- /dev/null ++++ b/tests/qemu-iotests/289 +@@ -0,0 +1,89 @@ ++#!/usr/bin/env bash ++# ++# qcow2 v3-exclusive error path testing ++# (026 tests paths common to v2 and v3) ++# ++# Copyright (C) 2020 Red Hat, Inc. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++# ++ ++seq=$(basename $0) ++echo "QA output created by $seq" ++ ++status=1 # failure is the default! ++ ++_cleanup() ++{ ++ _cleanup_test_img ++ rm "$TEST_DIR/blkdebug.conf" ++ rm -f "$TEST_IMG.data_file" ++} ++trap "_cleanup; exit \$status" 0 1 2 3 15 ++ ++# get standard environment, filters and checks ++. ./common.rc ++. ./common.filter ++. ./common.pattern ++ ++_supported_fmt qcow2 ++_supported_proto file ++# This is a v3-exclusive test; ++# As for data_file, error paths often very much depend on whether ++# there is an external data file or not; so we create one exactly when ++# we want to test it ++_unsupported_imgopts 'compat=0.10' data_file ++ ++echo ++echo === Avoid freeing external data clusters on failure === ++echo ++ ++cat > "$TEST_DIR/blkdebug.conf" < +Date: Mon, 13 Jul 2020 14:24:50 -0400 +Subject: [PATCH 3/4] iotests/026: Test EIO on allocation in a data-file + +RH-Author: Max Reitz +Message-id: <20200713142451.289703-4-mreitz@redhat.com> +Patchwork-id: 97955 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 3/4] iotests/026: Test EIO on allocation in a data-file +Bugzilla: 1807057 +RH-Acked-by: Stefano Garzarella +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Kevin Wolf + +Test what happens when writing data to an external data file, where the +write requires an L2 entry to be allocated, but the data write fails. + +Signed-off-by: Max Reitz +Message-Id: <20200225143130.111267-4-mreitz@redhat.com> +Signed-off-by: Kevin Wolf +(cherry picked from commit 81311255f217859413c94f2cd9cebf2684bbda94) +Signed-off-by: Max Reitz +Signed-off-by: Danilo C. L. de Paula +--- + tests/qemu-iotests/026 | 32 ++++++++++++++++++++++++++++++ + tests/qemu-iotests/026.out | 6 ++++++ + tests/qemu-iotests/026.out.nocache | 6 ++++++ + 3 files changed, 44 insertions(+) + +diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 +index d89729697f..c1c96a41d9 100755 +--- a/tests/qemu-iotests/026 ++++ b/tests/qemu-iotests/026 +@@ -30,6 +30,7 @@ _cleanup() + { + _cleanup_test_img + rm "$TEST_DIR/blkdebug.conf" ++ rm -f "$TEST_IMG.data_file" + } + trap "_cleanup; exit \$status" 0 1 2 3 15 + +@@ -236,6 +237,37 @@ $QEMU_IO -c "write 0 $CLUSTER_SIZE" "$BLKDBG_TEST_IMG" | _filter_qemu_io + + _check_test_img + ++echo ++echo === Avoid freeing external data clusters on failure === ++echo ++ ++# Similar test as the last one, except we test what happens when there ++# is an error when writing to an external data file instead of when ++# writing to a preallocated zero cluster ++_make_test_img -o "data_file=$TEST_IMG.data_file" $CLUSTER_SIZE ++ ++# Put blkdebug above the data-file, and a raw node on top of that so ++# that blkdebug will see a write_aio event and emit an error ++$QEMU_IO -c "write 0 $CLUSTER_SIZE" \ ++ "json:{ ++ 'driver': 'qcow2', ++ 'file': { 'driver': 'file', 'filename': '$TEST_IMG' }, ++ 'data-file': { ++ 'driver': 'raw', ++ 'file': { ++ 'driver': 'blkdebug', ++ 'config': '$TEST_DIR/blkdebug.conf', ++ 'image': { ++ 'driver': 'file', ++ 'filename': '$TEST_IMG.data_file' ++ } ++ } ++ } ++ }" \ ++ | _filter_qemu_io ++ ++_check_test_img ++ + # success, all done + echo "*** done" + rm -f $seq.full +diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out +index 83989996ff..c1b3b58482 100644 +--- a/tests/qemu-iotests/026.out ++++ b/tests/qemu-iotests/026.out +@@ -653,4 +653,10 @@ wrote 1024/1024 bytes at offset 0 + 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + write failed: Input/output error + No errors were found on the image. ++ ++=== Avoid freeing external data clusters on failure === ++ ++Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 data_file=TEST_DIR/t.IMGFMT.data_file ++write failed: Input/output error ++No errors were found on the image. + *** done +diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache +index 9359d26d7e..8d5001648a 100644 +--- a/tests/qemu-iotests/026.out.nocache ++++ b/tests/qemu-iotests/026.out.nocache +@@ -661,4 +661,10 @@ wrote 1024/1024 bytes at offset 0 + 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + write failed: Input/output error + No errors were found on the image. ++ ++=== Avoid freeing external data clusters on failure === ++ ++Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 data_file=TEST_DIR/t.IMGFMT.data_file ++write failed: Input/output error ++No errors were found on the image. + *** done +-- +2.27.0 + diff --git a/SOURCES/kvm-iotests-026-Test-EIO-on-preallocated-zero-cluster.patch b/SOURCES/kvm-iotests-026-Test-EIO-on-preallocated-zero-cluster.patch new file mode 100644 index 0000000..36d609c --- /dev/null +++ b/SOURCES/kvm-iotests-026-Test-EIO-on-preallocated-zero-cluster.patch @@ -0,0 +1,102 @@ +From b1035096f2d46e2146704d1db9581c6d2131d1f4 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Mon, 13 Jul 2020 14:24:49 -0400 +Subject: [PATCH 2/4] iotests/026: Test EIO on preallocated zero cluster + +RH-Author: Max Reitz +Message-id: <20200713142451.289703-3-mreitz@redhat.com> +Patchwork-id: 97953 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 2/4] iotests/026: Test EIO on preallocated zero cluster +Bugzilla: 1807057 +RH-Acked-by: Stefano Garzarella +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Kevin Wolf + +Test what happens when writing data to a preallocated zero cluster, but +the data write fails. + +Signed-off-by: Max Reitz +Message-Id: <20200225143130.111267-3-mreitz@redhat.com> +Signed-off-by: Kevin Wolf +(cherry picked from commit 31ab00f3747c00fdbb9027cea644b40dd1405480) +Signed-off-by: Max Reitz +Signed-off-by: Danilo C. L. de Paula +--- + tests/qemu-iotests/026 | 21 +++++++++++++++++++++ + tests/qemu-iotests/026.out | 10 ++++++++++ + tests/qemu-iotests/026.out.nocache | 10 ++++++++++ + 3 files changed, 41 insertions(+) + +diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 +index 3430029ed6..d89729697f 100755 +--- a/tests/qemu-iotests/026 ++++ b/tests/qemu-iotests/026 +@@ -215,6 +215,27 @@ _make_test_img 64M + $QEMU_IO -c "write 0 1M" -c "write 0 1M" "$BLKDBG_TEST_IMG" | _filter_qemu_io + _check_test_img + ++echo ++echo === Avoid freeing preallocated zero clusters on failure === ++echo ++ ++cat > "$TEST_DIR/blkdebug.conf" < +Date: Mon, 13 Jul 2020 14:24:48 -0400 +Subject: [PATCH 1/4] qcow2: Fix alloc_cluster_abort() for pre-existing + clusters + +RH-Author: Max Reitz +Message-id: <20200713142451.289703-2-mreitz@redhat.com> +Patchwork-id: 97954 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/4] qcow2: Fix alloc_cluster_abort() for pre-existing clusters +Bugzilla: 1807057 +RH-Acked-by: Stefano Garzarella +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Kevin Wolf + +handle_alloc() reuses preallocated zero clusters. If anything goes +wrong during the data write, we do not change their L2 entry, so we +must not let qcow2_alloc_cluster_abort() free them. + +Fixes: 8b24cd141549b5b264baeddd4e72902cfb5de23b +Cc: qemu-stable@nongnu.org +Signed-off-by: Max Reitz +Message-Id: <20200225143130.111267-2-mreitz@redhat.com> +Signed-off-by: Kevin Wolf +(cherry picked from commit 3ede935fdbbd5f7b24b4724bbfb8938acb5956d8) +Signed-off-by: Max Reitz +Signed-off-by: Danilo C. L. de Paula +--- + block/qcow2-cluster.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c +index 9d04f8d77b..1970797ce5 100644 +--- a/block/qcow2-cluster.c ++++ b/block/qcow2-cluster.c +@@ -1015,7 +1015,7 @@ err: + void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m) + { + BDRVQcow2State *s = bs->opaque; +- if (!has_data_file(bs)) { ++ if (!has_data_file(bs) && !m->keep_old_clusters) { + qcow2_free_clusters(bs, m->alloc_offset, + m->nb_clusters << s->cluster_bits, + QCOW2_DISCARD_NEVER); +-- +2.27.0 + diff --git a/SOURCES/kvm-s390x-protvirt-allow-to-IPL-secure-guests-with-no-re.patch b/SOURCES/kvm-s390x-protvirt-allow-to-IPL-secure-guests-with-no-re.patch new file mode 100644 index 0000000..b12b458 --- /dev/null +++ b/SOURCES/kvm-s390x-protvirt-allow-to-IPL-secure-guests-with-no-re.patch @@ -0,0 +1,61 @@ +From 8b994757136780998e0dd1d41613d2006c0dbcf6 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Tue, 4 Aug 2020 10:16:04 -0400 +Subject: [PATCH 4/4] s390x/protvirt: allow to IPL secure guests with + -no-reboot + +RH-Author: Thomas Huth +Message-id: <20200804101604.6259-2-thuth@redhat.com> +Patchwork-id: 98126 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/1] s390x/protvirt: allow to IPL secure guests with -no-reboot +Bugzilla: 1863034 +RH-Acked-by: Danilo de Paula +RH-Acked-by: Cornelia Huck +RH-Acked-by: David Hildenbrand + +From: Christian Borntraeger + +Right now, -no-reboot prevents secure guests from running. This is +correct from an implementation point of view, as we have modeled the +transition from non-secure to secure as a program directed IPL. From +a user perspective, this is not the behavior of least surprise. + +We should implement the IPL into protected mode similar to the +functions that we use for kdump/kexec. In other words, we do not stop +here when -no-reboot is specified on the command line. Like function 0 +or function 1, function 10 is not a classic reboot. For example, it +can only be called once. Before calling it a second time, a real +reboot/reset must happen in-between. So function code 10 is more or +less a state transition reset, but not a "standard" reset or reboot. + +Fixes: 4d226deafc44 ("s390x: protvirt: Support unpack facility") +Signed-off-by: Christian Borntraeger +Reviewed-by: Janosch Frank +Reviewed-by: David Hildenbrand +Acked-by: Viktor Mihajlovski +Message-Id: <20200721103202.30610-1-borntraeger@de.ibm.com> +[CH: tweaked description] +Signed-off-by: Cornelia Huck +(cherry picked from commit d1bb69db4ceb6897ef6a17bf263146b53a123632) +Signed-off-by: Danilo C. L. de Paula +--- + hw/s390x/ipl.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index 586d95b5b6..5b3ea990af 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -624,7 +624,8 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) + } + } + if (reset_type == S390_RESET_MODIFIED_CLEAR || +- reset_type == S390_RESET_LOAD_NORMAL) { ++ reset_type == S390_RESET_LOAD_NORMAL || ++ reset_type == S390_RESET_PV) { + /* ignore -no-reboot, send no event */ + qemu_system_reset_request(SHUTDOWN_CAUSE_SUBSYSTEM_RESET); + } else { +-- +2.27.0 + diff --git a/SOURCES/kvm-s390x-sigp-Fix-sense-running-reporting.patch b/SOURCES/kvm-s390x-sigp-Fix-sense-running-reporting.patch new file mode 100644 index 0000000..7143964 --- /dev/null +++ b/SOURCES/kvm-s390x-sigp-Fix-sense-running-reporting.patch @@ -0,0 +1,49 @@ +From a2befb24c10f58ce6c27d242f3b88afee1f77ec8 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Tue, 7 Jul 2020 09:35:31 -0400 +Subject: [PATCH 2/4] s390x: sigp: Fix sense running reporting + +RH-Author: Thomas Huth +Message-id: <20200707093532.22456-2-thuth@redhat.com> +Patchwork-id: 97920 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/2] s390x: sigp: Fix sense running reporting +Bugzilla: 1854092 +RH-Acked-by: Jens Freimann +RH-Acked-by: Cornelia Huck +RH-Acked-by: David Hildenbrand + +From: Janosch Frank + +The logic was inverted and reported running if the cpu was stopped. +Let's fix that. + +Signed-off-by: Janosch Frank +Fixes: d1b468bc8869 ("s390x/tcg: implement SIGP SENSE RUNNING STATUS") +Reviewed-by: David Hildenbrand +Message-Id: <20200124134818.9981-1-frankja@linux.ibm.com> +Signed-off-by: Cornelia Huck +(cherry picked from commit 4103500e2fa934a6995e4cedab37423e606715bf) +Signed-off-by: Danilo C. L. de Paula +--- + target/s390x/sigp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c +index 727875bb4a..c604f17710 100644 +--- a/target/s390x/sigp.c ++++ b/target/s390x/sigp.c +@@ -348,9 +348,9 @@ static void sigp_sense_running(S390CPU *dst_cpu, SigpInfo *si) + + /* If halted (which includes also STOPPED), it is not running */ + if (CPU(dst_cpu)->halted) { +- si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; +- } else { + set_sigp_status(si, SIGP_STAT_NOT_RUNNING); ++ } else { ++ si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; + } + } + +-- +2.27.0 + diff --git a/SOURCES/kvm-s390x-tcg-clear-local-interrupts-on-reset-normal.patch b/SOURCES/kvm-s390x-tcg-clear-local-interrupts-on-reset-normal.patch new file mode 100644 index 0000000..b6ac314 --- /dev/null +++ b/SOURCES/kvm-s390x-tcg-clear-local-interrupts-on-reset-normal.patch @@ -0,0 +1,57 @@ +From 0c85e86077b42547034ec6e8330a3e61d79b97ee Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Tue, 7 Jul 2020 09:35:32 -0400 +Subject: [PATCH 3/4] s390x/tcg: clear local interrupts on reset normal + +RH-Author: Thomas Huth +Message-id: <20200707093532.22456-3-thuth@redhat.com> +Patchwork-id: 97919 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 2/2] s390x/tcg: clear local interrupts on reset normal +Bugzilla: 1854092 +RH-Acked-by: Jens Freimann +RH-Acked-by: Cornelia Huck +RH-Acked-by: David Hildenbrand + +From: Cornelia Huck + +We neglected to clean up pending interrupts and emergency signals; +fix that. + +Message-Id: <20191206135404.16051-1-cohuck@redhat.com> +Signed-off-by: Cornelia Huck +Reviewed-by: David Hildenbrand +(cherry picked from commit bcf88d56efec4ffc153bbe98d11b689a5ebe1a91) +Signed-off-by: Danilo C. L. de Paula +--- + target/s390x/cpu.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h +index edf8391504..a48e655c4d 100644 +--- a/target/s390x/cpu.h ++++ b/target/s390x/cpu.h +@@ -98,10 +98,6 @@ struct CPUS390XState { + + uint64_t cregs[16]; /* control registers */ + +- int pending_int; +- uint16_t external_call_addr; +- DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS); +- + uint64_t ckc; + uint64_t cputm; + uint32_t todpr; +@@ -117,6 +113,10 @@ struct CPUS390XState { + struct {} start_normal_reset_fields; + uint8_t riccb[64]; /* runtime instrumentation control */ + ++ int pending_int; ++ uint16_t external_call_addr; ++ DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS); ++ + /* Fields up to this point are cleared by a CPU reset */ + struct {} end_reset_fields; + +-- +2.27.0 + diff --git a/SOURCES/kvm-target-i386-sev-fail-query-sev-capabilities-if-QEMU-.patch b/SOURCES/kvm-target-i386-sev-fail-query-sev-capabilities-if-QEMU-.patch new file mode 100644 index 0000000..60abc1b --- /dev/null +++ b/SOURCES/kvm-target-i386-sev-fail-query-sev-capabilities-if-QEMU-.patch @@ -0,0 +1,56 @@ +From 9adf5e57df32df464e7465b1df72c993d0ed4ed4 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 31 Jul 2020 18:08:35 -0400 +Subject: [PATCH 3/4] target/i386: sev: fail query-sev-capabilities if QEMU + cannot use SEV +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Paolo Bonzini +Message-id: <20200731180835.86786-3-pbonzini@redhat.com> +Patchwork-id: 98124 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 2/2] target/i386: sev: fail query-sev-capabilities if QEMU cannot use SEV +Bugzilla: 1689341 +RH-Acked-by: Danilo de Paula +RH-Acked-by: Philippe Mathieu-Daudé +RH-Acked-by: Dr. David Alan Gilbert + +In some cases, such as if the kvm-amd "sev" module parameter is set +to 0, SEV will be unavailable but query-sev-capabilities will still +return all the information. This tricks libvirt into erroneously +reporting that SEV is available. Check the actual usability of the +feature and return the appropriate error if QEMU cannot use KVM +or KVM cannot use SEV. + +Reviewed-by: Eric Blake +Signed-off-by: Paolo Bonzini +cherry picked from commit 1b38750c40281dd0d068f8536b2ea95d7b9bd585 +Signed-off-by: Danilo C. L. de Paula +--- + target/i386/sev.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/target/i386/sev.c b/target/i386/sev.c +index 054f2d846a..a47f0d3880 100644 +--- a/target/i386/sev.c ++++ b/target/i386/sev.c +@@ -504,6 +504,15 @@ sev_get_capabilities(Error **errp) + uint32_t ebx; + int fd; + ++ if (!kvm_enabled()) { ++ error_setg(errp, "KVM not enabled"); ++ return NULL; ++ } ++ if (kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, NULL) < 0) { ++ error_setg(errp, "SEV is not enabled in KVM"); ++ return NULL; ++ } ++ + fd = open(DEFAULT_SEV_DEVICE, O_RDWR); + if (fd < 0) { + error_setg_errno(errp, errno, "Failed to open %s", +-- +2.27.0 + diff --git a/SOURCES/kvm-target-i386-sev-provide-proper-error-reporting-for-q.patch b/SOURCES/kvm-target-i386-sev-provide-proper-error-reporting-for-q.patch new file mode 100644 index 0000000..e5f3459 --- /dev/null +++ b/SOURCES/kvm-target-i386-sev-provide-proper-error-reporting-for-q.patch @@ -0,0 +1,142 @@ +From 8789f2662c6ddacc5472a803d253b94d93c6e9f0 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 31 Jul 2020 18:08:34 -0400 +Subject: [PATCH 2/4] target/i386: sev: provide proper error reporting for + query-sev-capabilities +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Paolo Bonzini +Message-id: <20200731180835.86786-2-pbonzini@redhat.com> +Patchwork-id: 98123 +O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/2] target/i386: sev: provide proper error reporting for query-sev-capabilities +Bugzilla: 1689341 +RH-Acked-by: Danilo de Paula +RH-Acked-by: Philippe Mathieu-Daudé +RH-Acked-by: Dr. David Alan Gilbert + +The query-sev-capabilities was reporting errors through error_report; +change it to use Error** so that the cause of the failure is clearer. + +Reviewed-by: Eric Blake +Signed-off-by: Paolo Bonzini +Cherry picked from commit e4f6278557148151e77260b872b41bcd7ceb4737 +Signed-off-by: Danilo C. L. de Paula +--- + target/i386/monitor.c | 10 +--------- + target/i386/sev-stub.c | 3 ++- + target/i386/sev.c | 18 +++++++++--------- + target/i386/sev_i386.h | 2 +- + 4 files changed, 13 insertions(+), 20 deletions(-) + +diff --git a/target/i386/monitor.c b/target/i386/monitor.c +index 9fb4d641d5..cfd8075e4f 100644 +--- a/target/i386/monitor.c ++++ b/target/i386/monitor.c +@@ -727,13 +727,5 @@ SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) + + SevCapability *qmp_query_sev_capabilities(Error **errp) + { +- SevCapability *data; +- +- data = sev_get_capabilities(); +- if (!data) { +- error_setg(errp, "SEV feature is not available"); +- return NULL; +- } +- +- return data; ++ return sev_get_capabilities(errp); + } +diff --git a/target/i386/sev-stub.c b/target/i386/sev-stub.c +index e5ee13309c..88e3f39a1e 100644 +--- a/target/i386/sev-stub.c ++++ b/target/i386/sev-stub.c +@@ -44,7 +44,8 @@ char *sev_get_launch_measurement(void) + return NULL; + } + +-SevCapability *sev_get_capabilities(void) ++SevCapability *sev_get_capabilities(Error **errp) + { ++ error_setg(errp, "SEV is not available in this QEMU"); + return NULL; + } +diff --git a/target/i386/sev.c b/target/i386/sev.c +index 024bb24e51..054f2d846a 100644 +--- a/target/i386/sev.c ++++ b/target/i386/sev.c +@@ -453,7 +453,7 @@ sev_get_info(void) + + static int + sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, +- size_t *cert_chain_len) ++ size_t *cert_chain_len, Error **errp) + { + guchar *pdh_data = NULL; + guchar *cert_chain_data = NULL; +@@ -464,8 +464,8 @@ sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, + r = sev_platform_ioctl(fd, SEV_PDH_CERT_EXPORT, &export, &err); + if (r < 0) { + if (err != SEV_RET_INVALID_LEN) { +- error_report("failed to export PDH cert ret=%d fw_err=%d (%s)", +- r, err, fw_error_to_str(err)); ++ error_setg(errp, "failed to export PDH cert ret=%d fw_err=%d (%s)", ++ r, err, fw_error_to_str(err)); + return 1; + } + } +@@ -477,8 +477,8 @@ sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, + + r = sev_platform_ioctl(fd, SEV_PDH_CERT_EXPORT, &export, &err); + if (r < 0) { +- error_report("failed to export PDH cert ret=%d fw_err=%d (%s)", +- r, err, fw_error_to_str(err)); ++ error_setg(errp, "failed to export PDH cert ret=%d fw_err=%d (%s)", ++ r, err, fw_error_to_str(err)); + goto e_free; + } + +@@ -495,7 +495,7 @@ e_free: + } + + SevCapability * +-sev_get_capabilities(void) ++sev_get_capabilities(Error **errp) + { + SevCapability *cap = NULL; + guchar *pdh_data = NULL; +@@ -506,13 +506,13 @@ sev_get_capabilities(void) + + fd = open(DEFAULT_SEV_DEVICE, O_RDWR); + if (fd < 0) { +- error_report("%s: Failed to open %s '%s'", __func__, +- DEFAULT_SEV_DEVICE, strerror(errno)); ++ error_setg_errno(errp, errno, "Failed to open %s", ++ DEFAULT_SEV_DEVICE); + return NULL; + } + + if (sev_get_pdh_info(fd, &pdh_data, &pdh_len, +- &cert_chain_data, &cert_chain_len)) { ++ &cert_chain_data, &cert_chain_len, errp)) { + goto out; + } + +diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h +index 8ada9d385d..1e073342ba 100644 +--- a/target/i386/sev_i386.h ++++ b/target/i386/sev_i386.h +@@ -38,7 +38,7 @@ extern SevInfo *sev_get_info(void); + extern uint32_t sev_get_cbit_position(void); + extern uint32_t sev_get_reduced_phys_bits(void); + extern char *sev_get_launch_measurement(void); +-extern SevCapability *sev_get_capabilities(void); ++extern SevCapability *sev_get_capabilities(Error **errp); + + typedef struct QSevGuestInfo QSevGuestInfo; + typedef struct QSevGuestInfoClass QSevGuestInfoClass; +-- +2.27.0 + diff --git a/SOURCES/kvm-virtio-net-fix-removal-of-failover-device.patch b/SOURCES/kvm-virtio-net-fix-removal-of-failover-device.patch new file mode 100644 index 0000000..6044f3d --- /dev/null +++ b/SOURCES/kvm-virtio-net-fix-removal-of-failover-device.patch @@ -0,0 +1,52 @@ +From 92fb4f6cdde32652352a0a831a2ba815701a4014 Mon Sep 17 00:00:00 2001 +From: Juan Quintela +Date: Fri, 3 Jul 2020 12:37:05 -0400 +Subject: [PATCH 4/4] virtio-net: fix removal of failover device + +RH-Author: Juan Quintela +Message-id: <20200703123705.7175-2-quintela@redhat.com> +Patchwork-id: 97901 +O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/1] virtio-net: fix removal of failover device +Bugzilla: +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Laurent Vivier +RH-Acked-by: Dr. David Alan Gilbert + +If you have a networking device and its virtio failover device, and +you remove them in this order: +- virtio device +- the real device + +You get qemu crash. +See bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1820120 + +Bug exist on qemu 4.2 and 5.0. +But in 5.0 don't shows because commit +77b06bba62034a87cc61a9c8de1309ae3e527d97 + +somehow papers over it. + +CC: Jason Wang +CC: Michael S. Tsirkin + +Signed-off-by: Juan Quintela +Signed-off-by: Danilo C. L. de Paula +--- + hw/net/virtio-net.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c +index f325440d01..dabeb9e720 100644 +--- a/hw/net/virtio-net.c ++++ b/hw/net/virtio-net.c +@@ -3091,6 +3091,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp) + g_free(n->vlans); + + if (n->failover) { ++ device_listener_unregister(&n->primary_listener); + g_free(n->primary_device_id); + g_free(n->standby_id); + qobject_unref(n->primary_device_dict); +-- +2.27.0 + diff --git a/SPECS/qemu-kvm.spec b/SPECS/qemu-kvm.spec index 9f52a1c..da91b80 100644 --- a/SPECS/qemu-kvm.spec +++ b/SPECS/qemu-kvm.spec @@ -67,7 +67,7 @@ Obsoletes: %1-rhev Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 4.2.0 -Release: 29%{?dist} +Release: 33%{?dist} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 15 License: GPLv2 and GPLv2+ and CC-BY @@ -913,6 +913,29 @@ Patch377: kvm-virtio-blk-Refactor-the-code-that-processes-queued-r.patch Patch378: kvm-virtio-blk-On-restart-process-queued-requests-in-the.patch # For bz#1838070 - CVE-2020-1983 virt:rhel/qemu-kvm: QEMU: slirp: use-after-free in ip_reass() function in ip_input.c [rhel-8] Patch379: kvm-Fix-use-afte-free-in-ip_reass-CVE-2020-1983.patch +# For bz#1835390 - qemu promote host does not support 'EDX.npt' and 'EDX.nrip-save' when test with Q35 machine type on EPYC host +Patch380: kvm-i386-Mask-SVM-features-if-nested-SVM-is-disabled.patch +# For bz#1854092 - kvm-unit-tests: tcg smp FAIL +Patch381: kvm-s390x-sigp-Fix-sense-running-reporting.patch +# For bz#1854092 - kvm-unit-tests: tcg smp FAIL +Patch382: kvm-s390x-tcg-clear-local-interrupts-on-reset-normal.patch +Patch383: kvm-virtio-net-fix-removal-of-failover-device.patch +# For bz#1807057 - qcow2_alloc_cluster_abort() frees preallocated zero clusters +Patch384: kvm-qcow2-Fix-alloc_cluster_abort-for-pre-existing-clust.patch +# For bz#1807057 - qcow2_alloc_cluster_abort() frees preallocated zero clusters +Patch385: kvm-iotests-026-Test-EIO-on-preallocated-zero-cluster.patch +# For bz#1807057 - qcow2_alloc_cluster_abort() frees preallocated zero clusters +Patch386: kvm-iotests-026-Test-EIO-on-allocation-in-a-data-file.patch +# For bz#1807057 - qcow2_alloc_cluster_abort() frees preallocated zero clusters +Patch387: kvm-iotests-026-Move-v3-exclusive-test-to-new-file.patch +# For bz#1780385 - [RFE] AMD EPYC-Rome support for KVM / QEMU guest +Patch388: kvm-i386-Add-2nd-Generation-AMD-EPYC-processors.patch +# For bz#1689341 - QEMU should report an error and return failure if AMD SEV is not enabled in the kernel +Patch389: kvm-target-i386-sev-provide-proper-error-reporting-for-q.patch +# For bz#1689341 - QEMU should report an error and return failure if AMD SEV is not enabled in the kernel +Patch390: kvm-target-i386-sev-fail-query-sev-capabilities-if-QEMU-.patch +# For bz#1863034 - RHEL8.3 Beta - Secure Execution: Unable to start Qemu with "-no-reboot" option (qemu-kvm) +Patch391: kvm-s390x-protvirt-allow-to-IPL-secure-guests-with-no-re.patch BuildRequires: wget BuildRequires: rpm-build @@ -979,7 +1002,7 @@ BuildRequires: python3-sphinx BuildRequires: rdma-core-devel %endif %if %{have_fdt} -BuildRequires: libfdt-devel >= 1.4.3 +BuildRequires: libfdt-devel >= 1.6.0 %endif # iasl and cpp for acpi generation (not a hard requirement as we can use # pre-compiled files, but it's better to use this) @@ -1076,6 +1099,9 @@ Requires: libusbx >= 1.0.19 %if %{have_usbredir} Requires: usbredir >= 0.7.1 %endif +%if %{have_fdt} +Requires: libfdt >= 1.6.0 +%endif %rhev_ma_conflicts qemu-kvm @@ -1845,6 +1871,41 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Wed Aug 19 2020 Danilo Cesar Lemes de Paula - 4.2.0-33.el8 +- kvm-Require-libfdt-1.6.0.patch [bz#1867847] +- Resolves: bz#1867847 + ([ppc] virt module 7629: /usr/libexec/qemu-kvm: undefined symbol: fdt_check_full, version LIBFDT_1.2) + +* Mon Aug 10 2020 Danilo Cesar Lemes de Paula - 4.2.0-32.el8 +- kvm-i386-Add-2nd-Generation-AMD-EPYC-processors.patch [bz#1780385] +- kvm-target-i386-sev-provide-proper-error-reporting-for-q.patch [bz#1689341] +- kvm-target-i386-sev-fail-query-sev-capabilities-if-QEMU-.patch [bz#1689341] +- kvm-s390x-protvirt-allow-to-IPL-secure-guests-with-no-re.patch [bz#1863034] +- Resolves: bz#1689341 + (QEMU should report an error and return failure if AMD SEV is not enabled in the kernel) +- Resolves: bz#1780385 + ([RFE] AMD EPYC-Rome support for KVM / QEMU guest) +- Resolves: bz#1863034 + (RHEL8.3 Beta - Secure Execution: Unable to start Qemu with "-no-reboot" option (qemu-kvm)) + +* Wed Jul 22 2020 Danilo Cesar Lemes de Paula - 4.2.0-31.el8 +- kvm-qcow2-Fix-alloc_cluster_abort-for-pre-existing-clust.patch [bz#1807057] +- kvm-iotests-026-Test-EIO-on-preallocated-zero-cluster.patch [bz#1807057] +- kvm-iotests-026-Test-EIO-on-allocation-in-a-data-file.patch [bz#1807057] +- kvm-iotests-026-Move-v3-exclusive-test-to-new-file.patch [bz#1807057] +- Resolves: bz#1807057 + (qcow2_alloc_cluster_abort() frees preallocated zero clusters) + +* Tue Jul 07 2020 Danilo Cesar Lemes de Paula - 4.2.0-30.el8 +- kvm-i386-Mask-SVM-features-if-nested-SVM-is-disabled.patch [bz#1835390] +- kvm-s390x-sigp-Fix-sense-running-reporting.patch [bz#1854092] +- kvm-s390x-tcg-clear-local-interrupts-on-reset-normal.patch [bz#1854092] +- kvm-virtio-net-fix-removal-of-failover-device.patch [] +- Resolves: bz#1835390 + (qemu promote host does not support 'EDX.npt' and 'EDX.nrip-save' when test with Q35 machine type on EPYC host) +- Resolves: bz#1854092 + (kvm-unit-tests: tcg smp FAIL) + * Sun Jun 28 2020 Danilo Cesar Lemes de Paula - 4.2.0-29.el8 - kvm-vfio-ccw-Fix-error-message.patch [bz#1660916] - kvm-vfio-ccw-allow-non-prefetch-ORBs.patch [bz#1660916]