diff --git a/kvm-acpi-pcihp-allow-repeating-hot-unplug-requests.patch b/kvm-acpi-pcihp-allow-repeating-hot-unplug-requests.patch new file mode 100644 index 0000000..b937d27 --- /dev/null +++ b/kvm-acpi-pcihp-allow-repeating-hot-unplug-requests.patch @@ -0,0 +1,84 @@ +From 61256a82ce78f40222455becb8850b5f5ebb5d72 Mon Sep 17 00:00:00 2001 +From: Igor Mammedov +Date: Tue, 18 Apr 2023 11:04:49 +0200 +Subject: [PATCH 1/3] acpi: pcihp: allow repeating hot-unplug requests + +RH-Author: Igor Mammedov +RH-MergeRequest: 159: acpi: pcihp: allow repeating hot-unplug requests +RH-Bugzilla: 2087047 +RH-Acked-by: Ani Sinha +RH-Acked-by: Julia Suvorova +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: MST +RH-Commit: [1/1] 9c597232466b27d91f127ee6004322d6ba69755f (imammedo/qemu-kvm-c-9-s-imam) + +with Q35 using ACPI PCI hotplug by default, user's request to unplug +device is ignored when it's issued before guest OS has been booted. +And any additional attempt to request device hot-unplug afterwards +results in following error: + + "Device XYZ is already in the process of unplug" + +arguably it can be considered as a regression introduced by [2], +before which it was possible to issue unplug request multiple +times. + +Accept new uplug requests after timeout (1ms). This brings ACPI PCI +hotplug on par with native PCIe unplug behavior [1] and allows user +to repeat unplug requests at propper times. +Set expire timeout to arbitrary 1msec so user won't be able to +flood guest with SCI interrupts by calling device_del in tight loop. + +PS: +ACPI spec doesn't mandate what OSPM can do with GPEx.status +bits set before it's booted => it's impl. depended. +Status bits may be retained (I tested with one Windows version) +or cleared (Linux since 2.6 kernel times) during guest's ACPI +subsystem initialization. +Clearing status bits (though not wrong per se) hides the unplug +event from guest, and it's upto user to repeat device_del later +when guest is able to handle unplug requests. + +1) 18416c62e3 ("pcie: expire pending delete") +2) +Fixes: cce8944cc9ef ("qdev-monitor: Forbid repeated device_del") +Signed-off-by: Igor Mammedov +Acked-by: Gerd Hoffmann +CC: mst@redhat.com +CC: anisinha@redhat.com +CC: jusual@redhat.com +CC: kraxel@redhat.com +Message-Id: <20230418090449.2155757-1-imammedo@redhat.com> +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +Reviewed-by: Ani Sinha +(cherry picked from commit 0f689cf5ada4d5df5ab95c7f7aa9fc221afa855d) +Signed-off-by: Igor Mammedov +--- + hw/acpi/pcihp.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c +index dcfb779a7a..cdd6f775a1 100644 +--- a/hw/acpi/pcihp.c ++++ b/hw/acpi/pcihp.c +@@ -357,6 +357,16 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, + * acpi_pcihp_eject_slot() when the operation is completed. + */ + pdev->qdev.pending_deleted_event = true; ++ /* if unplug was requested before OSPM is initialized, ++ * linux kernel will clear GPE0.sts[] bits during boot, which effectively ++ * hides unplug event. And than followup qmp_device_del() calls remain ++ * blocked by above flag permanently. ++ * Unblock qmp_device_del() by setting expire limit, so user can ++ * repeat unplug request later when OSPM has been booted. ++ */ ++ pdev->qdev.pending_deleted_expires_ms = ++ qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); /* 1 msec */ ++ + s->acpi_pcihp_pci_status[bsel].down |= (1U << slot); + acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); + } +-- +2.39.1 + diff --git a/kvm-hw-acpi-Mark-acpi-blobs-as-resizable-on-RHEL-pc-mach.patch b/kvm-hw-acpi-Mark-acpi-blobs-as-resizable-on-RHEL-pc-mach.patch new file mode 100644 index 0000000..67e702c --- /dev/null +++ b/kvm-hw-acpi-Mark-acpi-blobs-as-resizable-on-RHEL-pc-mach.patch @@ -0,0 +1,40 @@ +From b4645e7682aa1bde6f89df0eff2a9de83720eecc Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Tue, 2 May 2023 15:51:53 +0530 +Subject: [PATCH 3/3] hw/acpi: Mark acpi blobs as resizable on RHEL pc machines + version 7.6 and above + +RH-Author: Ani Sinha +RH-MergeRequest: 160: hw/acpi: limit warning on acpi table size to pc machines older than version 2.3 +RH-Bugzilla: 1934134 +RH-Acked-by: Igor Mammedov +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: MST +RH-Commit: [2/2] 95d443af6e75c569d89d04d028012c3c56c0c3a4 (anisinha/centos-qemu-kvm) + +Please look at QEMU upstream commit +1af507756bae7 ("hw/acpi: limit warning on acpi table size to pc machines older than version 2.3") +This patch adapts the above change so that it applies to RHEL pc machines of +version 7.6 and newer. These are the machine types that are currently supported +in RHEL. Q35 machines are not affected. + +Signed-off-by: Ani Sinha +--- + hw/i386/pc_piix.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index 4d5880e249..6c7be628e1 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -914,6 +914,7 @@ static void pc_machine_rhel7_options(MachineClass *m) + m->default_machine_opts = "firmware=bios-256k.bin,hpet=off"; + pcmc->default_nic_model = "e1000"; + pcmc->pci_root_uid = 0; ++ pcmc->resizable_acpi_blob = true; + m->default_display = "std"; + m->no_parallel = 1; + m->numa_mem_supported = true; +-- +2.39.1 + diff --git a/kvm-hw-acpi-limit-warning-on-acpi-table-size-to-pc-machi.patch b/kvm-hw-acpi-limit-warning-on-acpi-table-size-to-pc-machi.patch new file mode 100644 index 0000000..e06113a --- /dev/null +++ b/kvm-hw-acpi-limit-warning-on-acpi-table-size-to-pc-machi.patch @@ -0,0 +1,101 @@ +From 3f70da88788c398877b8ded0b27689530385302b Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Wed, 29 Mar 2023 10:27:26 +0530 +Subject: [PATCH 2/3] hw/acpi: limit warning on acpi table size to pc machines + older than version 2.3 + +RH-Author: Ani Sinha +RH-MergeRequest: 160: hw/acpi: limit warning on acpi table size to pc machines older than version 2.3 +RH-Bugzilla: 1934134 +RH-Acked-by: Igor Mammedov +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: MST +RH-Commit: [1/2] 96c3b6d51e16734eb4e8de52635e0ca036964090 (anisinha/centos-qemu-kvm) + +i440fx machine versions 2.3 and newer supports dynamic ram +resizing. See commit a1666142db6233 ("acpi-build: make ROMs RAM blocks resizeable") . +Currently supported all q35 machine types (versions 2.4 and newer) supports +resizable RAM/ROM blocks.Therefore the warning generated when the ACPI table +size exceeds a pre-defined value does not apply to those machine versions. +Add a check limiting the warning message to only those machines that does not +support expandable ram blocks (that is, i440fx machines with version 2.2 +and older). + +Signed-off-by: Ani Sinha +Message-Id: <20230329045726.14028-1-anisinha@redhat.com> +Reviewed-by: Igor Mammedov +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +(cherry picked from commit 1af507756bae775028c27d30e602e2b9c72cd074) +--- + hw/i386/acpi-build.c | 6 ++++-- + hw/i386/pc.c | 1 + + hw/i386/pc_piix.c | 1 + + include/hw/i386/pc.h | 3 +++ + 4 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c +index ec857a117e..9bc4d8a981 100644 +--- a/hw/i386/acpi-build.c ++++ b/hw/i386/acpi-build.c +@@ -2695,7 +2695,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) + int legacy_table_size = + ROUND_UP(tables_blob->len - aml_len + legacy_aml_len, + ACPI_BUILD_ALIGN_SIZE); +- if (tables_blob->len > legacy_table_size) { ++ if ((tables_blob->len > legacy_table_size) && ++ !pcmc->resizable_acpi_blob) { + /* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ + warn_report("ACPI table size %u exceeds %d bytes," + " migration may not work", +@@ -2706,7 +2707,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) + g_array_set_size(tables_blob, legacy_table_size); + } else { + /* Make sure we have a buffer in case we need to resize the tables. */ +- if (tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) { ++ if ((tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) && ++ !pcmc->resizable_acpi_blob) { + /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ + warn_report("ACPI table size %u exceeds %d bytes," + " migration may not work", +diff --git a/hw/i386/pc.c b/hw/i386/pc.c +index f216922cee..7db5a2348f 100644 +--- a/hw/i386/pc.c ++++ b/hw/i386/pc.c +@@ -2092,6 +2092,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) + pcmc->acpi_data_size = 0x20000 + 0x8000; + pcmc->pvh_enabled = true; + pcmc->kvmclock_create_always = true; ++ pcmc->resizable_acpi_blob = true; + assert(!mc->get_hotplug_handler); + mc->async_pf_vmexit_disable = false; + mc->get_hotplug_handler = pc_get_hotplug_handler; +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index fc704d783f..4d5880e249 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -750,6 +750,7 @@ static void pc_i440fx_2_2_machine_options(MachineClass *m) + compat_props_add(m->compat_props, hw_compat_2_2, hw_compat_2_2_len); + compat_props_add(m->compat_props, pc_compat_2_2, pc_compat_2_2_len); + pcmc->rsdp_in_ram = false; ++ pcmc->resizable_acpi_blob = false; + } + + DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2_fn, +diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h +index d218ad1628..2f514d13d8 100644 +--- a/include/hw/i386/pc.h ++++ b/include/hw/i386/pc.h +@@ -130,6 +130,9 @@ struct PCMachineClass { + + /* create kvmclock device even when KVM PV features are not exposed */ + bool kvmclock_create_always; ++ ++ /* resizable acpi blob compat */ ++ bool resizable_acpi_blob; + }; + + #define TYPE_PC_MACHINE "generic-pc-machine" +-- +2.39.1 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index a3315a4..89ff0fd 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -148,7 +148,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \ Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 8.0.0 -Release: 1%{?rcrel}%{?dist}%{?cc_suffix} +Release: 2%{?rcrel}%{?dist}%{?cc_suffix} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped # Epoch 15 used for RHEL 8 # Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5) @@ -189,6 +189,12 @@ Patch0016: 0016-qga-linux-add-usb-support-to-guest-get-fsinfo.patch Patch0017: 0017-Add-RHEL-9.2.0-compat-structure.patch Patch0018: 0018-redhat-hw-i386-pc-Update-x86-machine-type-compatibil.patch Patch0019: 0019-Disable-unwanted-new-devices.patch +# For bz#2087047 - Disk detach is unsuccessful while the guest is still booting +Patch20: kvm-acpi-pcihp-allow-repeating-hot-unplug-requests.patch +# For bz#1934134 - ACPI table limits warning when booting guest with 512 VCPUs +Patch21: kvm-hw-acpi-limit-warning-on-acpi-table-size-to-pc-machi.patch +# For bz#1934134 - ACPI table limits warning when booting guest with 512 VCPUs +Patch22: kvm-hw-acpi-Mark-acpi-blobs-as-resizable-on-RHEL-pc-mach.patch %if %{have_clang} BuildRequires: clang @@ -1211,6 +1217,15 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog +* Mon May 08 2023 Miroslav Rezanina - 8.0.0-2 +- kvm-acpi-pcihp-allow-repeating-hot-unplug-requests.patch [bz#2087047] +- kvm-hw-acpi-limit-warning-on-acpi-table-size-to-pc-machi.patch [bz#1934134] +- kvm-hw-acpi-Mark-acpi-blobs-as-resizable-on-RHEL-pc-mach.patch [bz#1934134] +- Resolves: bz#2087047 + (Disk detach is unsuccessful while the guest is still booting) +- Resolves: bz#1934134 + (ACPI table limits warning when booting guest with 512 VCPUs) + * Thu Apr 20 2023 Miroslav Rezanina - 8.0.0-1 - Rebase to QEMU 8.0.0 - Resolves: bz#2180898