[RFC v2 19/24] hw/arm/virt: Move virt_flash_create() to machvirt_init()
Mathieu Poirier <[email protected]> Tue, 28 Jul 2026 13:26:25 -0600
| Newsgroups | org.nongnu.qemu-arm,org.kernel.vger.kvm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Jean-Philippe Brucker <[email protected]> For confidential VMs we'll want to skip flash device creation. Unfortunately, in virt_instance_init() the machine->cgs member has not yet been initialized, so we cannot check whether confidential guest is enabled. Move virt_flash_create() to machvirt_init(), where we can access the machine->cgs member. Signed-off-by: Jean-Philippe Brucker <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> --- hw/arm/virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 65ed8573f8b1..74fe21712d4f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2911,6 +2911,8 @@ static void machvirt_init(MachineState *machine) unsigned int smp_cpus = machine->smp.cpus; unsigned int max_cpus = machine->smp.max_cpus; + virt_flash_create(vms); + possible_cpus = mc->possible_cpu_arch_ids(machine); /* @@ -4433,8 +4435,6 @@ static void virt_instance_init(Object *obj) vms->virtio_transports = NUM_VIRTIO_TRANSPORTS; - virt_flash_create(vms); - vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6); vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); cxl_machine_init(obj, &vms->cxl_devices_state); -- 2.43.0