[SeaBIOS] [PATCH v2 0/2] QEMU: Add capability to write back fw_cfg address to QEMU

Laszlo Ersek lersek at redhat.com
Wed Jan 25 12:37:36 CET 2017


On 01/24/17 23:17, Kevin O'Connor wrote:
> On Fri, Jan 20, 2017 at 02:33:14PM -0800, ben at skyportsystems.com wrote:
>> From: Ben Warren <ben at skyportsystems.com>
>>
>> This patch set adds the capability to write to QEMU across the DMA link and
>> adds a higher-level command to allocate a fw_cfg file and write its address
>> back to another, writeable fw_cfg file.
>>
>> 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.
> 
> Thanks.  The patches look fine to me.  If no one else comments, I'll
> commit when ALLOCATE_RET_ADDR is accepted in QEMU.

Thanks -- we're presently discussing that patch:

http://lists.nongnu.org/archive/html/qemu-devel/2017-01/msg05325.html
http://lists.nongnu.org/archive/html/qemu-devel/2017-01/msg05337.html

I think an update will be necessary for the SeaBIOS series. The fw_cfg
file that is supposed to receive the allocation address -- that is, the
"address file" --, for the allocated / downloaded fw_cfg file, should
*not* itself be allocated / downloaded.

In the current version of the SeaBIOS series, qemu_cfg_write_file()
takes a "struct romfile_s *file" parameter, for identifying the fw_cfg
file to write to. And patch #2 locates that file with romfile_loader_find().

However, romfile_loader_find() should *not* know about the address file
-- romfile_loader_find() can locate files which have been allocated /
downloaded, but the address file is not such a file.

Instead, the 2nd parameter of qemu_cfg_write_file() should be determined
by calling romfile_find(), with the name of the address file. This will
locate the right entry simply from the fw_cfg file directory. (See
qemu_cfg_init() -> qemu_romfile_add() -> romfile_add().)

Sorry about pointing this out somewhat late, but I got around reviewing
Ben's QEMU series only this dawn.

Thanks
Laszlo




More information about the SeaBIOS mailing list