Skip to contentSkip to conversation

hw/arm/virt: Fix non-secure flash mode

PATCH In review David Engraf 2 participants 2 messages Jul 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/virt: Fix non-secure flash mode

Using the whole 128 MiB flash in non-secure mode is not working because virt_flash_fdt() expects the same address for secure_sysmem and sysmem. This is not correctly handled by caller because it forwards NULL for secure_sysmem in non-secure flash mode.

Fixed by using sysmem when secure_sysmem is NULL.

---
 hw/arm/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt.c +1 -1
index 0b5138cb22..d9496c9363 100644
@@ -1674,7 +1674,7 @@ static void machvirt_init(MachineState *machine)
                                     &machine->device_memory->mr);
     }
 
-    virt_flash_fdt(vms, sysmem, secure_sysmem);
+    virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem);
 
     create_gic(vms, pic);
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 9 lines · David Engraf

Using the whole 128 MiB flash in non-secure mode is not working because virt_flash_fdt() expects the same address for secure_sysmem and sysmem. This is not correctly handled by caller because it forwards NULL for secure_sysmem in non-secure flash mode.

Fixed by using sysmem when secure_sysmem is NULL.

Nice catch; applied to target-arm.next for 4.1.

thanks
-- PMM