qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gal Hammer <ghammer@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gal Hammer <ghammer@redhat.com>, imammedo@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH V15 2/5] acpi: add a vm_generation_id_changed method
Date: Mon, 27 Apr 2015 14:19:48 +0300	[thread overview]
Message-ID: <1430133591-6197-3-git-send-email-ghammer@redhat.com> (raw)
In-Reply-To: <1430133591-6197-1-git-send-email-ghammer@redhat.com>

Add a new method to the AcpiDeviceIfClass interface. The new
method send an ACPI notfication when the VM generation id is
changed.

Signed-off-by: Gal Hammer <ghammer@redhat.com>
---
 hw/acpi/core.c                       | 8 ++++++++
 hw/acpi/ich9.c                       | 8 ++++++++
 hw/acpi/piix4.c                      | 8 ++++++++
 hw/isa/lpc_ich9.c                    | 1 +
 include/hw/acpi/acpi.h               | 2 ++
 include/hw/acpi/acpi_dev_interface.h | 4 ++++
 include/hw/acpi/ich9.h               | 2 ++
 7 files changed, 33 insertions(+)

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 51913d6..d4597c6 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -28,6 +28,8 @@
 #include "qapi-visit.h"
 #include "qapi-event.h"
 
+#define ACPI_VM_GENERATION_ID_CHANGED_STATUS 1
+
 struct acpi_table_header {
     uint16_t _length;         /* our length, not actual part of the hdr */
                               /* allows easier parsing for fw_cfg clients */
@@ -683,3 +685,9 @@ void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
                        (regs->pm1.evt.en & ACPI_BITMASK_TIMER_ENABLE) &&
                        !(pm1a_sts & ACPI_BITMASK_TIMER_STATUS));
 }
+
+void acpi_vm_generation_id_changed(ACPIREGS *acpi_regs, qemu_irq irq)
+{
+    acpi_regs->gpe.sts[0] |= ACPI_VM_GENERATION_ID_CHANGED_STATUS;
+    acpi_update_sci(acpi_regs, irq);
+}
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 5352e19..613b82e 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -417,3 +417,11 @@ void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
 
     acpi_memory_ospm_status(&s->pm.acpi_memory_hotplug, list);
 }
+
+void ich9_vm_generation_id_changed(AcpiDeviceIf *adev)
+{
+    ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
+    ICH9LPCPMRegs *pm = &s->pm;
+
+    acpi_vm_generation_id_changed(&pm->acpi_regs, pm->irq);
+}
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index d1f1179..4708cfc 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -580,6 +580,13 @@ static void piix4_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
     acpi_memory_ospm_status(&s->acpi_memory_hotplug, list);
 }
 
+static void piix4_vm_generation_id_changed(AcpiDeviceIf *adev)
+{
+    PIIX4PMState *s = PIIX4_PM(adev);
+
+    acpi_vm_generation_id_changed(&s->ar, s->irq);
+}
+
 static Property piix4_pm_properties[] = {
     DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
     DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0),
@@ -618,6 +625,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
     hc->unplug_request = piix4_device_unplug_request_cb;
     hc->unplug = piix4_device_unplug_cb;
     adevc->ospm_status = piix4_ospm_status;
+    adevc->vm_generation_id_changed = piix4_vm_generation_id_changed;
 }
 
 static const TypeInfo piix4_pm_info = {
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index dba7585..2626fd5 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -688,6 +688,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
     hc->unplug_request = ich9_device_unplug_request_cb;
     hc->unplug = ich9_device_unplug_cb;
     adevc->ospm_status = ich9_pm_ospm_status;
+    adevc->vm_generation_id_changed = ich9_vm_generation_id_changed;
 }
 
 static const TypeInfo ich9_lpc_info = {
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index 1f678b4..9373b4d 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -185,4 +185,6 @@ unsigned acpi_table_len(void *current);
 void acpi_table_add(const QemuOpts *opts, Error **errp);
 void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);
 
+void acpi_vm_generation_id_changed(ACPIREGS *acpi_regs, qemu_irq irq);
+
 #endif /* !QEMU_HW_ACPI_H */
diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h
index f245f8d..757ce60 100644
--- a/include/hw/acpi/acpi_dev_interface.h
+++ b/include/hw/acpi/acpi_dev_interface.h
@@ -28,6 +28,9 @@ typedef struct AcpiDeviceIf {
  * ospm_status: returns status of ACPI device objects, reported
  *              via _OST method if device supports it.
  *
+ * vm_generation_id_changed: notify the guest that it generation
+ *                           id was changed.
+ *
  * Interface is designed for providing unified interface
  * to generic ACPI functionality that could be used without
  * knowledge about internals of actual device that implements
@@ -39,5 +42,6 @@ typedef struct AcpiDeviceIfClass {
 
     /* <public> */
     void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
+    void (*vm_generation_id_changed)(AcpiDeviceIf *adev);
 } AcpiDeviceIfClass;
 #endif
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index c2d3dba..255a113 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -69,4 +69,6 @@ void ich9_pm_device_unplug_cb(ICH9LPCPMRegs *pm, DeviceState *dev,
                               Error **errp);
 
 void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
+
+void ich9_vm_generation_id_changed(AcpiDeviceIf *adev);
 #endif /* HW_ACPI_ICH9_H */
-- 
2.1.0

  parent reply	other threads:[~2015-04-27 11:20 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 11:19 [Qemu-devel] [PATCH V15 0/5] Virtual Machine Generation ID Gal Hammer
2015-04-27 11:19 ` [Qemu-devel] [PATCH V15 1/5] docs: vm generation id device's description Gal Hammer
2015-04-27 13:42   ` Michael S. Tsirkin
2015-04-27 13:55   ` Michael S. Tsirkin
2015-04-28 14:20     ` Gal Hammer
2015-04-27 14:56   ` Eric Blake
2015-04-28 14:38     ` Gal Hammer
2015-04-27 11:19 ` Gal Hammer [this message]
2015-04-27 14:57   ` [Qemu-devel] [PATCH V15 2/5] acpi: add a vm_generation_id_changed method Eric Blake
2015-04-27 11:19 ` [Qemu-devel] [PATCH V15 3/5] aml: implement a 32-bit fixed memory range descriptor Gal Hammer
2015-04-27 11:19 ` [Qemu-devel] [PATCH V15 4/5] i386: add a Virtual Machine Generation ID device Gal Hammer
2015-04-27 13:38   ` Michael S. Tsirkin
2015-04-29 12:46     ` Gal Hammer
2015-04-27 14:59   ` Eric Blake
2015-05-28 10:25   ` Paolo Bonzini
2015-05-28 11:49     ` Michael S. Tsirkin
2015-05-28 11:59     ` Gal Hammer
2015-05-28 12:21       ` Michael S. Tsirkin
2015-05-28 13:00         ` Paolo Bonzini
2015-05-28 13:24           ` Michael S. Tsirkin
2015-05-28 13:35             ` Paolo Bonzini
2015-05-29 11:46   ` Igor Mammedov
2015-06-03 16:32     ` Michael S. Tsirkin
2015-06-03 16:37   ` Paolo Bonzini
2015-06-08 13:42     ` Gal Hammer
2015-06-08 13:43       ` Paolo Bonzini
2015-06-08 13:52         ` Gal Hammer
2015-06-08 13:55           ` Paolo Bonzini
2015-06-08 13:58             ` Daniel P. Berrange
2015-06-08 14:05               ` Gal Hammer
2015-06-08 15:01               ` Michael S. Tsirkin
2015-06-08 15:17                 ` Paolo Bonzini
2015-06-08 15:22                   ` Michael S. Tsirkin
2015-06-08 15:28                     ` Gal Hammer
2015-06-08 15:32                       ` Michael S. Tsirkin
2015-06-08 15:33                     ` Paolo Bonzini
2015-06-08 15:41                       ` Michael S. Tsirkin
2015-06-08 15:43                         ` Paolo Bonzini
2015-06-08 14:00             ` Gal Hammer
2015-06-08 13:59               ` Paolo Bonzini
2015-04-27 11:19 ` [Qemu-devel] [PATCH V15 5/5] tests: add a unit test for the vmgenid device Gal Hammer
2015-04-27 15:01   ` Eric Blake
2015-04-27 16:17     ` Michael S. Tsirkin

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=1430133591-6197-3-git-send-email-ghammer@redhat.com \
    --to=ghammer@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --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).