]> Git Repo - qemu.git/commit
fw-cfg: turn FW_CFG_FILE_SLOTS into a device property
authorLaszlo Ersek <[email protected]>
Thu, 12 Jan 2017 18:24:15 +0000 (19:24 +0100)
committerMichael S. Tsirkin <[email protected]>
Wed, 18 Jan 2017 20:59:53 +0000 (22:59 +0200)
commite12f3a13e2e134fe9b8d3d1a160a8e54de1e8fa7
treeb4caa2a8ecd7ed28ee9302a934db45935701de24
parentbaf2d5bfbac015b27f4db74feab235e167df0c84
fw-cfg: turn FW_CFG_FILE_SLOTS into a device property

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" <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Acked-by: Gabriel Somlo <[email protected]>
Tested-by: Gabriel Somlo <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
docs/specs/fw_cfg.txt
hw/nvram/fw_cfg.c
include/hw/nvram/fw_cfg_keys.h
This page took 0.023194 seconds and 4 git commands to generate.