mbox series

[RFC,0/3] hw/block/pflash: Mmap read-only backend files with MAP_SHARED

Message ID 20210225230238.3719051-1-philmd@redhat.com (mailing list archive)
Headers show
Series hw/block/pflash: Mmap read-only backend files with MAP_SHARED | expand


Philippe Mathieu-Daudé Feb. 25, 2021, 11:02 p.m. UTC

This series aims to reduce the memory footprint of flash devices
when the backing file is read-only.

When a backing file is read-only, the model considers the flash
is in "protected" mode. No write are allowed, but the MMIO
state machine is still usable.

This series introduces a new memory region helper to mmap files
and use it with the pflash device (only with read-only backing

The goal is to reduce QEMU's memory footprint when multiple VMs
are instantiated using the same read-only backing file, which is
the case with the CODE flash from OVMF and AAVMF.

Previous attempts:

- Huawei
- Tencent
- Oracle

RFC because yet another approach to tackle this technical debt,
and very little tested.



Philippe Mathieu-Daudé (3):
  exec/memory: Introduce memory_region_init_rom_device_from_file()
  hw/block/pflash: Move code around
  hw/block/pflash: use memory_region_init_rom_device_from_file()

 include/exec/memory.h   | 85 +++++++++++++++++++++++++++++++++++
 hw/block/pflash_cfi01.c | 34 ++++++++------
 hw/block/pflash_cfi02.c | 30 ++++++++-----
 softmmu/memory.c        | 98 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 224 insertions(+), 23 deletions(-)