Message ID | 1490198476-12244-5-git-send-email-mst@redhat.com |
---|---|
State | New |
Headers | show |
On 03/22/17 17:01, Michael S. Tsirkin wrote: > 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> Can you please add the feedback tags from Igor and Ben? http://mid.mail-archive.com/23205322-903E-42E2-99D7-ED8351E62694@skyportsystems.com http://mid.mail-archive.com/20170321131414.08cc6bfa@nial.brq.redhat.com > Binary file /tmp/tmp.IaAwzHwwsQ matches I'm not sure what this means. Thanks, Laszlo > --- > 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); > } > >
On Wed, Mar 22, 2017 at 05:21:32PM +0100, Laszlo Ersek wrote: > On 03/22/17 17:01, Michael S. Tsirkin wrote: > > 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> > > Can you please add the feedback tags from Igor and Ben? > > http://mid.mail-archive.com/23205322-903E-42E2-99D7-ED8351E62694@skyportsystems.com > http://mid.mail-archive.com/20170321131414.08cc6bfa@nial.brq.redhat.com > > > Binary file /tmp/tmp.IaAwzHwwsQ matches > > I'm not sure what this means. > > Thanks, > Laszlo Fixed, thanks for paying attention. > > --- > > 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); > > } > > > >
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); }