From 71562f446db550489bf4ba79e634a8b55e74d83f Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Thu, 26 Apr 2018 02:54:06 +0000 Subject: Remove SeaBIOS shadowing As we do not support RHEL 6 compatibility on RHEL 8 we can remove hacks that shadow SeaBIOS for incomming RHEL-6 host This feature was added in qemu-kvm RHEL 7.1 for BZ 1027565 (fail to reboot guest after migration from RHEL6.5 host to RHEL7.0 host) as commit 9f136b4ed4ec and was backported to RHEL 7.0 as 0day fix (BZ 1091322, commit df9e9e9c56c7). In addition, fix was provided for qemu-kvm-rhev in RHEL 7.1 (BZ 1103579, commit cada12245ab9). For qemu-kvm, use of this hack was extended for BZ 1176283 ([migration]migrationfailed when configure guest with OVMF bios + machine type=rhel6.5.0) in RHEL 7.2 by commit c3f813d2f. For qemu-kvm-rhev, use of this hack was extened for BZ 1170093 (guest NUMA failed to migrate when machine is rhel6.5.0) for RHEL 7.1 by commit 8e8107cb3 and BZ 1175099 ([migration]migration failed when configure guest with OVMF bios + machine type=rhel6.5.0) for RHEL 7.2 by commit 8b220c0e. In addition, during rebase to 2.10, handling was moved to separate module and stub version was provided. Signed-off-by: Miroslav Rezanina --- hw/i386/Makefile.objs | 1 - hw/i386/pc_sysfw.c | 16 ------------- hw/i386/shadow-bios.c | 64 ------------------------------------------------- include/sysemu/sysemu.h | 2 -- migration/savevm.c | 7 ------ numa.c | 13 ---------- stubs/Makefile.objs | 1 - stubs/shadow-bios.c | 7 ------ 8 files changed, 111 deletions(-) delete mode 100644 hw/i386/shadow-bios.c delete mode 100644 stubs/shadow-bios.c diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 8c25538..fa87a14 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -10,4 +10,3 @@ obj-$(CONFIG_VMMOUSE) += vmmouse.o obj-y += kvmvapic.o obj-y += acpi-build.o -obj-y += shadow-bios.o diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 2a6de35..73ac783 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -207,13 +207,6 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) (bios_size % 65536) != 0) { goto bios_error; } - if (shadow_bios_after_incoming && bios_size != 128 * 1024) { - MachineClass *mc; - - mc = MACHINE_GET_CLASS(current_machine); - error_report("machine %s only supports a 128KB BIOS image", mc->name); - exit(1); - } bios = g_malloc(sizeof(*bios)); memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal); if (!isapc_ram_fw) { @@ -261,15 +254,6 @@ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw) return; } - if (shadow_bios_after_incoming) { - MachineClass *mc; - - mc = MACHINE_GET_CLASS(current_machine); - error_report("flash-based firmware is not supported by machine %s", - mc->name); - exit(1); - } - if (kvm_enabled() && !kvm_readonly_mem_enabled()) { /* Older KVM cannot execute from device memory. So, flash memory * cannot be used unless the readonly memory kvm capability is present. */ diff --git a/hw/i386/shadow-bios.c b/hw/i386/shadow-bios.c deleted file mode 100644 index 65a4cb8..0000000 --- a/hw/i386/shadow-bios.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "qemu/osdep.h" -#include "sysemu/sysemu.h" -#include "target/i386/cpu.h" -#include "exec/ram_addr.h" -#include "qemu/cutils.h" - -void shadow_bios(void) -{ - RAMBlock *block, *ram, *oprom, *bios; - size_t one_meg, oprom_size, bios_size; - uint8_t *cd_seg_host, *ef_seg_host; - - ram = NULL; - oprom = NULL; - bios = NULL; - rcu_read_lock(); - QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { - if (strcmp("pc.ram", block->idstr) == 0) { - assert(ram == NULL); - ram = block; - } else if (strcmp("pc.rom", block->idstr) == 0) { - assert(oprom == NULL); - oprom = block; - } else if (strcmp("pc.bios", block->idstr) == 0) { - assert(bios == NULL); - bios = block; - } - } - assert(ram != NULL); - assert(oprom != NULL); - assert(bios != NULL); - assert(memory_region_is_ram(ram->mr)); - assert(memory_region_is_ram(oprom->mr)); - assert(memory_region_is_ram(bios->mr)); - assert(int128_eq(ram->mr->size, int128_make64(ram->used_length))); - assert(int128_eq(oprom->mr->size, int128_make64(oprom->used_length))); - assert(int128_eq(bios->mr->size, int128_make64(bios->used_length))); - - one_meg = 1024 * 1024; - oprom_size = 128 * 1024; - bios_size = 128 * 1024; - assert(ram->used_length >= one_meg); - assert(oprom->used_length == oprom_size); - assert(bios->used_length == bios_size); - - ef_seg_host = memory_region_get_ram_ptr(ram->mr) + (one_meg - bios_size); - cd_seg_host = ef_seg_host - oprom_size; - - /* This is a crude hack, but we must distinguish a rhel6.x.0 machtype guest - * coming in from a RHEL-6 emulator (where shadowing has had no effect on - * "pc.ram") from a similar guest coming in from a RHEL-7 emulator (where - * shadowing has worked). In the latter case we must not trample the live - * SeaBIOS variables in "pc.ram". - */ - if (buffer_is_zero(ef_seg_host, bios_size)) { - fprintf(stderr, "copying E and F segments from pc.bios to pc.ram\n"); - memcpy(ef_seg_host, memory_region_get_ram_ptr(bios->mr), bios_size); - } - if (buffer_is_zero(cd_seg_host, oprom_size)) { - fprintf(stderr, "copying C and D segments from pc.rom to pc.ram\n"); - memcpy(cd_seg_host, memory_region_get_ram_ptr(oprom->mr), oprom_size); - } - rcu_read_unlock(); -} diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 5832c38..2b42151 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -94,8 +94,6 @@ void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); void qemu_announce_self(void); -extern bool shadow_bios_after_incoming; -void shadow_bios(void); extern int autostart; diff --git a/migration/savevm.c b/migration/savevm.c index 56c9feb..6c539d1 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -84,7 +84,6 @@ enum qemu_vm_cmd { MIG_CMD_PACKAGED, /* Send a wrapped stream within this stream */ MIG_CMD_MAX }; -bool shadow_bios_after_incoming; #define MAX_VM_CMD_PACKAGED_SIZE UINT32_MAX static struct mig_cmd_args { @@ -2206,12 +2205,6 @@ int qemu_loadvm_state(QEMUFile *f) } qemu_loadvm_state_cleanup(); - /* Supplement SeaBIOS's shadowing now, because it was useless when the - * incoming VM started on the RHEL-6 emulator. - */ - if (shadow_bios_after_incoming) { - shadow_bios(); - } cpu_synchronize_all_post_init(); diff --git a/numa.c b/numa.c index daf10d8..1116c90 100644 --- a/numa.c +++ b/numa.c @@ -493,19 +493,6 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, return; } - /* The shadow_bios_after_incoming hack at savevm.c:shadow_bios() is not - * able to handle the multiple memory blocks added when using NUMA - * memdevs. We can disallow -numa memdev= when using rhel6.* machine-types - * because RHEL-6 didn't support the NUMA memdev option. - */ - if (shadow_bios_after_incoming) { - MachineClass *mc; - mc = MACHINE_GET_CLASS(current_machine); - error_report("-numa memdev is not supported by machine %s", - mc->name); - exit(1); - } - memory_region_init(mr, owner, name, ram_size); for (i = 0; i < nb_numa_nodes; i++) { uint64_t size = numa_info[i].node_mem; diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 8f111c5..dfdfca7 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -44,4 +44,3 @@ stub-obj-y += xen-hvm.o stub-obj-y += pci-host-piix.o stub-obj-y += ram-block.o stub-obj-y += ide-isa.o -stub-obj-y += shadow-bios.o diff --git a/stubs/shadow-bios.c b/stubs/shadow-bios.c deleted file mode 100644 index c77cd7a..0000000 --- a/stubs/shadow-bios.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "qemu/osdep.h" -#include "sysemu/sysemu.h" - -void shadow_bios(void) -{ - abort(); -} -- 1.8.3.1