]> Git Repo - qemu.git/commitdiff
hw/acpi/vmgenid: prevent more than one vmgenid device
authorLaszlo Ersek <[email protected]>
Mon, 20 Mar 2017 17:05:57 +0000 (18:05 +0100)
committerMichael S. Tsirkin <[email protected]>
Wed, 22 Mar 2017 16:29:27 +0000 (18:29 +0200)
A system with multiple VMGENID devices is undefined in the VMGENID spec by
omission.

Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Ben Warren <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
hw/acpi/vmgenid.c
include/hw/acpi/vmgenid.h

index c3ddcc8e7cb0b971923ddb3644ef06ad92da6148..a32b847fe0dfb41b498ae721736f3ccb42fadfdd 100644 (file)
@@ -221,6 +221,14 @@ static void vmgenid_realize(DeviceState *dev, Error **errp)
         return;
     }
 
+    /* Given that this function is executing, there is at least one VMGENID
+     * device. Check if there are several.
+     */
+    if (!find_vmgenid_dev()) {
+        error_setg(errp, "at most one %s device is permitted", VMGENID_DEVICE);
+        return;
+    }
+
     qemu_register_reset(vmgenid_handle_reset, vms);
 }
 
index 8578476baebebe13fb21eba79e16dbfe7a7fc984..7beb9592fb01b0a766bbe2be5b8bd9978f5850c9 100644 (file)
@@ -24,6 +24,7 @@ typedef struct VmGenIdState {
     bool write_pointer_available;
 } VmGenIdState;
 
+/* returns NULL unless there is exactly one device */
 static inline Object *find_vmgenid_dev(void)
 {
     return object_resolve_path_type("", VMGENID_DEVICE, NULL);
This page took 0.029593 seconds and 4 git commands to generate.