On Mon, 20 Feb 2017 19:56:14 -0800 ben@skyportsystems.com wrote:
From: Ben Warren ben@skyportsystems.com
This patch set adds the capability to write to QEMU across the fw_cfg DMA link. It adds a higher-level command to write the BIOS-allocated address of one fw_cfg file into an arbitrary point within another, writeable fw_cfg file across the above-mentioned link.
The initial use case is for Windows VM Generation ID, where QEMU needs to change the contents of fw_cfg data at runtime, while still having BIOS allocate and manage the memory.
The final corresponding QEMU patch can be found here: https://www.mail-archive.com/qemu-devel@nongnu.org/msg430490.html
Tested-by: Igor Mammedov imammedo@redhat.com
Tested with WS201R2 * migrated to file and then restored from file - guest gets notification and new GUID * make guest go into S3 and resume then migrate to file - vmgenid_addr_le value is not 0 in migration stream so SeaBIOS replayed fw_cfg write after reset at S3 resume time
v6->v7: - minor refactoring of qemu_cfg_write_file* functions
v5->v6: - Rebased to top-of-tree - Minor refactoring and conditional execution based on code review
v4->v5: - Minor changes to range checking and data validation - Added code for replaying COMMAND_WRITE_POINTER commands on S3 resume
v3->v4: - Added a 'src_offset' field in the message so the pointer need not point to the beginning of the file. - Changed the command struct definitions from anonymous to named.
v2->v3: - fixed up the qemu_cfg_write* functions to allow writing to an arbitrary offset within the destination file. - Changed function name to COMMAND_WRITE_POINTER and its functionality to not patch memory at all, but write back to a specified offset. v1->v2: - separated patch into two functional units. - changed so writes only occur over the DMA interface. - fixed coding style. - removed change to romfile struct definition (removed new write_back method).
Ben Warren (5): QEMU DMA: Add DMA write capability romfile-loader: Switch to using named structs QEMU fw_cfg: Add command to write back address of file QEMU fw_cfg: Add functions for accessing files by key QEMU fw_cfg: Write fw_cfg back on S3 resume
src/fw/paravirt.c | 68 +++++++++++++++++++++++++++++ src/fw/paravirt.h | 5 +++ src/fw/romfile_loader.c | 112 ++++++++++++++++++++++++++++++++++++++++-------- src/fw/romfile_loader.h | 65 ++++++++++++++++++---------- src/resume.c | 4 ++ 5 files changed, 214 insertions(+), 40 deletions(-)