From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Laszlo Ersek <lersek@redhat.com>,
Ben Warren <ben@skyportsystems.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL 4/4] hw/acpi/vmgenid: prevent more than one vmgenid device
Date: Wed, 22 Mar 2017 18:01:43 +0200 [thread overview]
Message-ID: <1490198476-12244-5-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1490198476-12244-1-git-send-email-mst@redhat.com>
From: Laszlo Ersek <lersek@redhat.com>
A system with multiple VMGENID devices is undefined in the VMGENID spec by
omission.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Ben Warren <ben@skyportsystems.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Binary file /tmp/tmp.IaAwzHwwsQ matches
---
include/hw/acpi/vmgenid.h | 1 +
hw/acpi/vmgenid.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/hw/acpi/vmgenid.h b/include/hw/acpi/vmgenid.h
index 8578476..7beb959 100644
--- a/include/hw/acpi/vmgenid.h
+++ b/include/hw/acpi/vmgenid.h
@@ -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);
diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c
index c3ddcc8..a32b847 100644
--- a/hw/acpi/vmgenid.c
+++ b/hw/acpi/vmgenid.c
@@ -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);
}
--
MST
next prev parent reply other threads:[~2017-03-22 16:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 16:01 [Qemu-devel] [PULL 0/4] virtio, pc: fixes Michael S. Tsirkin
2017-03-22 16:01 ` [Qemu-devel] [PULL 1/4] virtio: Fix error handling in virtio_bus_device_plugged Michael S. Tsirkin
2017-03-22 16:01 ` [Qemu-devel] [PULL 2/4] virtio: always use handle_aio_output if registered Michael S. Tsirkin
2017-03-22 16:01 ` [Qemu-devel] [PULL 3/4] hw/acpi/vmgenid: prevent device realization on pre-2.5 machine types Michael S. Tsirkin
2017-03-22 16:19 ` Laszlo Ersek
2017-03-22 16:01 ` Michael S. Tsirkin [this message]
2017-03-22 16:21 ` [Qemu-devel] [PULL 4/4] hw/acpi/vmgenid: prevent more than one vmgenid device Laszlo Ersek
2017-03-22 16:31 ` Michael S. Tsirkin
2017-03-22 16:28 ` [Qemu-devel] [PULL 0/4] virtio, pc: fixes Michael S. Tsirkin
2017-03-22 16:30 ` Michael S. Tsirkin
2017-03-23 11:39 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1490198476-12244-5-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=ben@skyportsystems.com \
--cc=imammedo@redhat.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).