e12f3a13e2
We'd like to raise the value of FW_CFG_FILE_SLOTS. Doing it naively could lead to problems with backward migration: a more recent QEMU (running an older machine type) would allow the guest, in fw_cfg_select(), to select a high key value that is unavailable in the same machine type implemented by the older (target) QEMU. On the target host, fw_cfg_data_read() for example could dereference nonexistent entries. As first step, size the FWCfgState.entries[*] and FWCfgState.entry_order arrays dynamically. All three array sizes will be influenced by the new field FWCfgState.file_slots (and matching device property). Make the following changes: - Replace the FW_CFG_FILE_SLOTS macro with FW_CFG_FILE_SLOTS_MIN (minimum count of fw_cfg file slots) in the header file. The value remains 0x10. - Replace all uses of FW_CFG_FILE_SLOTS with a helper function called fw_cfg_file_slots(), returning the new property. - Eliminate the macro FW_CFG_MAX_ENTRY, and replace all its uses with a helper function called fw_cfg_max_entry(). - In the MMIO- and IO-mapped realize functions both, allocate all three arrays dynamically, based on the new property. - The new property defaults to FW_CFG_FILE_SLOTS_MIN. This is going to be customized in the following patches. Cc: "Gabriel L. Somlo" <somlo@cmu.edu> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Gabriel Somlo <somlo@cmu.edu> Tested-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> |
||
---|---|---|
.. | ||
specs | ||
aio_notify_accept.promela | ||
aio_notify_bug.promela | ||
aio_notify.promela | ||
atomics.txt | ||
bitmaps.md | ||
blkdebug.txt | ||
blkverify.txt | ||
block-replication.txt | ||
bootindex.txt | ||
build-system.txt | ||
ccid.txt | ||
COLO-FT.txt | ||
colo-proxy.txt | ||
generic-loader.txt | ||
ich9-ehci-uhci.cfg | ||
igd-assign.txt | ||
image-fuzzer.txt | ||
live-block-ops.txt | ||
lockcnt.txt | ||
memory-hotplug.txt | ||
memory.txt | ||
migration.txt | ||
multi-thread-compression.txt | ||
multiple-iothreads.txt | ||
multiseat.txt | ||
pci_expander_bridge.txt | ||
pcie.txt | ||
q35-chipset.cfg | ||
qapi-code-gen.txt | ||
qcow2-cache.txt | ||
qdev-device-use.txt | ||
qemu_logo.pdf | ||
qemu-ga-ref.texi | ||
qemu-qmp-ref.texi | ||
qemupciserial.inf | ||
qmp-intro.txt | ||
qmp-spec.txt | ||
rcu.txt | ||
rdma.txt | ||
replay.txt | ||
spice-port-fqdn.txt | ||
tcg-exclusive.promela | ||
throttle.txt | ||
tracing.txt | ||
usb2.txt | ||
usb-storage.txt | ||
virtio-balloon-stats.txt | ||
virtio-migration.txt | ||
vnc-ledstate-Pseudo-encoding.txt | ||
win32-qemu-event.promela | ||
writing-qmp-commands.txt | ||
xbzrle.txt | ||
xen-save-devices-state.txt |