> On Feb 16, 2017, at 1:56 AM, Igor Mammedov <imamm...@redhat.com> wrote: > > On Wed, 15 Feb 2017 22:18:14 -0800 > b...@skyportsystems.com wrote: > >> From: Ben Warren <b...@skyportsystems.com> >> >> This implements the VM Generation ID feature by passing a 128-bit >> GUID to the guest via a fw_cfg blob. >> Any time the GUID changes, an ACPI notify event is sent to the guest >> >> The user interface is a simple device with one parameter: >> - guid (string, must be "auto" or in UUID format >> xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) >> >> Signed-off-by: Ben Warren <b...@skyportsystems.com> > Reviewed-by: Igor Mammedov <imamm...@redhat.com> > > Thing to get fixed on top is to check > that there isn't vmgenid device present already > into realizefn() and fail gracefully is there is. > I made the change as follows: ===
diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index c8465df..fa3de6d 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -207,8 +207,15 @@ static void vmgenid_handle_reset(void *opaque) static void vmgenid_realize(DeviceState *dev, Error **errp) { + static bool is_realized = false; VmGenIdState *vms = VMGENID(dev); + + if (is_realized) { + error_setg(errp, "Device %s may only be specified once", + VMGENID_DEVICE); + } qemu_register_reset(vmgenid_handle_reset, vms); + is_realized = true; } === Sample output: $ ../workspace/qemu/x86_64-softmmu/qemu-system-x86_64 -nographic -bios ../workspace/seabios/out/bios.bin -machine type=q35 -hda beiwe-with-vmgenid-driver.qcow2 -qmp unix:./qmp-sock,server,nowait -device vmgenid,guid="324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb66" -device vmgenid,guid="324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb67" qemu-system-x86_64: -device vmgenid,guid=324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb67: Device vmgenid may only be specified once Good enough? If so, I’ll roll it in. Otherwise, it’ll be a supplemental patch. —Ben <snip>
smime.p7s
Description: S/MIME cryptographic signature