summaryrefslogtreecommitdiffstats
path: root/hw/acpi/vmgenid.c
diff options
context:
space:
mode:
authorPeter Maydell2017-03-23 12:04:56 +0100
committerPeter Maydell2017-03-23 12:04:56 +0100
commit2077cabcac3e052af320cd93522467c2c5861c76 (patch)
treee1dd3fde3ef80239205cd2e30952d4aa6091f4ef /hw/acpi/vmgenid.c
parentMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into ... (diff)
parenthw/acpi/vmgenid: prevent more than one vmgenid device (diff)
downloadqemu-2077cabcac3e052af320cd93522467c2c5861c76.tar.gz
qemu-2077cabcac3e052af320cd93522467c2c5861c76.tar.xz
qemu-2077cabcac3e052af320cd93522467c2c5861c76.zip
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
virtio, pc: fixes virtio and misc fixes for 2.9. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Wed 22 Mar 2017 16:29:50 GMT # gpg: using RSA key 0x281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: hw/acpi/vmgenid: prevent more than one vmgenid device hw/acpi/vmgenid: prevent device realization on pre-2.5 machine types virtio: always use handle_aio_output if registered virtio: Fix error handling in virtio_bus_device_plugged Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/acpi/vmgenid.c')
-rw-r--r--hw/acpi/vmgenid.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c
index 7a3ad17d66..a32b847fe0 100644
--- a/hw/acpi/vmgenid.c
+++ b/hw/acpi/vmgenid.c
@@ -205,9 +205,30 @@ static void vmgenid_handle_reset(void *opaque)
memset(vms->vmgenid_addr_le, 0, ARRAY_SIZE(vms->vmgenid_addr_le));
}
+static Property vmgenid_properties[] = {
+ DEFINE_PROP_BOOL("x-write-pointer-available", VmGenIdState,
+ write_pointer_available, true),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void vmgenid_realize(DeviceState *dev, Error **errp)
{
VmGenIdState *vms = VMGENID(dev);
+
+ if (!vms->write_pointer_available) {
+ error_setg(errp, "%s requires DMA write support in fw_cfg, "
+ "which this machine type does not provide", VMGENID_DEVICE);
+ 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);
}
@@ -218,6 +239,7 @@ static void vmgenid_device_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_vmgenid;
dc->realize = vmgenid_realize;
dc->hotpluggable = false;
+ dc->props = vmgenid_properties;
object_class_property_add_str(klass, VMGENID_GUID, NULL,
vmgenid_set_guid, NULL);