> On Jan 18, 2017, at 4:02 PM, Ben Warren <b...@skyportsystems.com> wrote: > > Hi Michael, >> On Jan 17, 2017, at 9:45 AM, Michael S. Tsirkin <m...@redhat.com> wrote: >> >> On Mon, Jan 16, 2017 at 10:57:42AM -0800, Ben Warren wrote: >>> I think we have a misunderstanding here. I’m storing the VM >>> Generation ID __data__ (a GUID) in a fw_cfg blob, not the address. >> >> Yes, I think I gathered this much from the discussion. This is what >> I'm saying - don't. Have guest loader reserve guest memory and write the >> address into a fw cfg blob, and have qemu write the id at that address. >> This way you can update guest memory at any time. >> > So I’ve gone down the path of creating a writeable fw_cfg blob to hold the > VGID address, but it doesn’t seem to be getting updated. > > Here’s the code I’ve added: > > #define VMGENID_FW_CFG_FILE "etc/vmgenid" > #define VMGENID_FW_CFG_ADDR_FILE "etc/vmgenid_addr” > > // Create writeable fw_cfg blob, vas->vgia is a GArray of size 8 and element > size 1 > fw_cfg_add_file_callback(s, VMGENID_FW_CFG_ADDR_FILE, NULL, NULL, > vms->vgia->data, 8, false); > > // Request BIOS to allocate memory for the read-only DATA file: > bios_linker_loader_alloc(linker, VMGENID_FW_CFG_FILE, guid, 0,false); > > // Request BIOS to allocate memory for the writeable ADDRESS file: > bios_linker_loader_alloc(linker, VMGENID_FW_CFG_ADDR_FILE, s->vgia, 0, false); > > // Request BIOS to write the address of the DATA file into the ADDRESS file: > bios_linker_loader_add_pointer(linker, VMGENID_FW_CFG_ADDR_FILE, 0, > sizeof(uint64_t), VMGENID_FW_CFG_FILE, 0); > > I’ve instrumented SeaBIOS and see the requests being made and memcpy to the > file happening, but don’t see any changes in QEMU in the memory pointed to by > VMGENID_FW_CFG_ADDR_FILE. Is this how writeable fw_cfg is supposed to work? > Ed explained it to me and I think I get it now. I realize that you and Igor have explained this throughout the e-mail chain, but I’m a little bit slower.
Anyway, is this understanding correct? BIOS is in fact patching fw_cfg data, but it’s in a copy of the fw_cfg file that is in guest space. In order to get this to work we would need to add a new command to the linker/loader protocol to write back changes to QEMU after patching, and of course implement the change in BIOS and UEFI projects. > thanks, > Ben > >> -- >> MST >
smime.p7s
Description: S/MIME cryptographic signature