diff --git a/Always-create-pflash-objects-and-register-properties.patch b/Always-create-pflash-objects-and-register-properties.patch new file mode 100644 index 0000000000000000000000000000000000000000..78a909b4a0e37b6a74db7c81f00261e3baf82686 --- /dev/null +++ b/Always-create-pflash-objects-and-register-properties.patch @@ -0,0 +1,93 @@ +From 77e90909b868a7e394903e9f0e990f212e896242 Mon Sep 17 00:00:00 2001 +From: houmingyong +Date: Thu, 4 Sep 2025 10:50:38 +0800 +Subject: [PATCH] Always create pflash objects and register properties for QOM + even in confidential mode, to satisfy qemu_apply_machine_options. This fixes + the "Property 'virt-8.2-machine.pflash0' not found" error. + +Revert "hw/arm/virt: Move virt_flash_create() to machvirt_init()" +This reverts commit ddf23b6f58d3c605a083ad3f09388dcb6edf729e. +--- + hw/arm/virt.c | 31 ++++++++++++------------------- + 1 file changed, 12 insertions(+), 19 deletions(-) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index cf4156ed49..f7a9ba9a58 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -1407,10 +1407,10 @@ static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms, + + static void virt_flash_create(VirtMachineState *vms) + { +- if (virt_machine_is_confidential(vms)) { +- return; +- } +- ++ /* Always create pflash objects and register properties for QOM ++ * even in confidential mode, to satisfy qemu_apply_machine_options. ++ * This fixes the "Property 'virt-8.2-machine.pflash0' not found" error. ++ */ + vms->flash[0] = virt_flash_create1(vms, "virt.flash0", "pflash0"); + vms->flash[1] = virt_flash_create1(vms, "virt.flash1", "pflash1"); + } +@@ -1449,10 +1449,6 @@ static void virt_flash_map(VirtMachineState *vms, + hwaddr flashsize = vms->memmap[VIRT_FLASH].size / 2; + hwaddr flashbase = vms->memmap[VIRT_FLASH].base; + +- if (virt_machine_is_confidential(vms)) { +- return; +- } +- + virt_flash_map1(vms->flash[0], flashbase, flashsize, + secure_sysmem); + virt_flash_map1(vms->flash[1], flashbase + flashsize, flashsize, +@@ -1532,15 +1528,6 @@ static bool virt_firmware_init(VirtMachineState *vms, + const char *bios_name; + BlockBackend *pflash_blk0; + +- /* +- * For a confidential VM, the firmware image and any boot information, +- * including EFI variables, are stored in RAM in order to be measurable and +- * private. Create a RAM region and load the firmware image there. +- */ +- if (virt_machine_is_confidential(vms)) { +- return virt_confidential_firmware_init(vms, sysmem); +- } +- + /* Map legacy -drive if=pflash to machine properties */ + for (i = 0; i < ARRAY_SIZE(vms->flash); i++) { + pflash_cfi01_legacy_drive(vms->flash[i], +@@ -1551,7 +1538,12 @@ static bool virt_firmware_init(VirtMachineState *vms, + + pflash_blk0 = pflash_cfi01_get_blk(vms->flash[0]); + +- if (virtcca_cvm_enabled()) { ++ /* ++ * For a confidential VM, the firmware image and any boot information, ++ * including EFI variables, are stored in RAM in order to be measurable and ++ * private. Create a RAM region and load the firmware image there. ++ */ ++ if (virtcca_cvm_enabled() || virt_machine_is_confidential(vms)) { + return virt_confidential_firmware_init(vms, sysmem); + } + +@@ -2609,7 +2601,6 @@ static void machvirt_init(MachineState *machine) + } + + finalize_gic_version(vms); +- virt_flash_create(vms); + + possible_cpus = mc->possible_cpu_arch_ids(machine); + +@@ -4163,6 +4154,8 @@ static void virt_instance_init(Object *obj) + + vms->irqmap = a15irqmap; + ++ virt_flash_create(vms); ++ + vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6); + vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); + +-- +2.33.0 + diff --git a/qemu.spec b/qemu.spec index 6af78a39dacf7674aa8d6878f05f408fd9fc2c70..e74e9cb611ed4e72ee86f43e9932aff238087325 100644 --- a/qemu.spec +++ b/qemu.spec @@ -3,7 +3,7 @@ Name: qemu Version: 8.2.0 -Release: 45 +Release: 46 Epoch: 11 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -1067,6 +1067,7 @@ Patch1050: hw-core-cpu-Remove-final-vestiges-of-dynamic-state-t.patch Patch1051: target-riscv-Fix-mcycle-minstret-increment-behavior.patch Patch1052: chardev-char.c-fix-abstract-device-type-error-messag.patch Patch1053: hw-net-cadence_gem-Fix-MDIO_OP_xxx-values.patch +Patch1054: Always-create-pflash-objects-and-register-properties.patch BuildRequires: flex BuildRequires: gcc @@ -1669,6 +1670,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Fri Sep 05 2025 Pengrui Zhang - 11:8.2.0-46 +- Always create pflash objects and register properties for QOM + * Sat Aug 30 2025 Pengrui Zhang - 11:8.2.0-45 - tests/unit/test-qmp-event: Drop superfluous mutex - configure: use a native non-cross compiler for linux-user