qemu-e2k/softmmu
Stefan Hajnoczi 369d6dc4de memory: add readonly support to memory_region_init_ram_from_file()
There is currently no way to open(O_RDONLY) and mmap(PROT_READ) when
creating a memory region from a file. This functionality is needed since
the underlying host file may not allow writing.

Add a bool readonly argument to memory_region_init_ram_from_file() and
the APIs it calls.

Extend memory_region_init_ram_from_file() rather than introducing a
memory_region_init_rom_from_file() API so that callers can easily make a
choice between read/write and read-only at runtime without calling
different APIs.

No new RAMBlock flag is introduced for read-only because it's unclear
whether RAMBlocks need to know that they are read-only. Pass a bool
readonly argument instead.

Both of these design decisions can be changed in the future. It just
seemed like the simplest approach to me.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20210104171320.575838-2-stefanha@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2021-02-01 17:07:34 -05:00
..
arch_init.c 8bit AVR port from Michael Rolnik. 2020-07-11 19:27:59 +01:00
balloon.c qapi: Restrict balloon-related commands to machine code 2020-09-29 15:41:35 +02:00
bootdevice.c softmmu: move more files to softmmu/ 2020-10-12 11:50:21 -04:00
cpu-throttle.c qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
cpu-timers.c cpus: prepare new CpusAccel cpu accelerator interface 2020-10-05 16:41:22 +02:00
cpus.c WHPX: support for the kernel-irqchip on/off 2020-12-10 12:15:01 -05:00
datadir.c vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
device_tree.c vl: make qemu_get_machine_opts static 2020-12-15 12:51:55 -05:00
dma-helpers.c dma: Let dma_memory_set() propagate MemTxResult 2020-12-10 12:15:01 -05:00
globals.c qmp: generalize watchdog-set-action to -no-reboot/-no-shutdown 2020-12-15 12:51:57 -05:00
icount.c accel/tcg: split CpusAccel into three TCG variants 2020-12-10 17:44:10 -06:00
ioport.c softmmu: Add missing trace-events file 2020-09-09 17:15:18 +01:00
main.c meson: move SDL and SDL-image detection to meson 2020-08-21 06:30:44 -04:00
memory.c memory: add readonly support to memory_region_init_ram_from_file() 2021-02-01 17:07:34 -05:00
memory_mapping.c softmmu: move softmmu only files from root 2020-07-10 18:02:24 -04:00
meson.build seccomp: convert to meson 2021-01-06 10:21:20 +01:00
physmem.c memory: add readonly support to memory_region_init_ram_from_file() 2021-02-01 17:07:34 -05:00
qdev-monitor.c clock: Define and use new clock_display_freq() 2021-01-04 23:24:44 +01:00
qemu-seccomp.c seccomp: convert to meson 2021-01-06 10:21:20 +01:00
qtest.c module: silence errors for module_load_qom_all(). 2020-10-15 10:43:48 +02:00
rtc.c vl: extract softmmu/rtc.c 2020-12-10 12:15:18 -05:00
runstate-action.c runstate: cleanup reboot and panic actions 2021-01-21 13:00:41 +01:00
runstate.c runstate: cleanup reboot and panic actions 2021-01-21 13:00:41 +01:00
timers-state.h cpu-timers, icount: new modules 2020-10-05 16:41:22 +02:00
tpm.c qapi: More complex uses of QAPI_LIST_APPEND 2021-01-28 08:08:45 +01:00
trace-events softmmu: Add missing trace-events file 2020-09-09 17:15:18 +01:00
trace.h softmmu: Add missing trace-events file 2020-09-09 17:15:18 +01:00
vl.c vnc: support "-vnc help" 2021-01-23 15:55:07 -05:00