From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: lcapitulino@redhat.com, pkrempa@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH v2 5/5] qmp: add ACPI_DEVICE_OST event handling
Date: Mon, 16 Jun 2014 19:12:29 +0200 [thread overview]
Message-ID: <1402938749-13371-6-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1402938749-13371-1-git-send-email-imammedo@redhat.com>
emits event when ACPI OSPM evaluates _OST method
of ACPI device.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
v2:
- move event description at the beginning of file
to preserve alphabet ordering in file
- fix example json
---
docs/qmp/qmp-events.txt | 10 ++++++++++
hw/acpi/memory_hotplug.c | 29 ++++++++++++++++++++++++++++-
include/monitor/monitor.h | 1 +
monitor.c | 1 +
4 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt
index 145402e..019db53 100644
--- a/docs/qmp/qmp-events.txt
+++ b/docs/qmp/qmp-events.txt
@@ -1,6 +1,16 @@
QEMU Machine Protocol Events
============================
+ACPI_DEVICE_OST
+---------------
+
+Emitted when guest executes ACPI _OST method.
+
+ - data: ACPIOSTInfo type as described in qapi-schema.json
+
+{ "event": "ACPI_DEVICE_OST",
+ "data": { "device": "d1", "slot": "0", "slot-type": "DIMM", "source": 1, "status": 0 } }
+
BALLOON_CHANGE
--------------
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index e7009bc..de4ddc2 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -3,6 +3,10 @@
#include "hw/mem/pc-dimm.h"
#include "hw/boards.h"
#include "trace.h"
+#include "qapi-visit.h"
+#include "monitor/monitor.h"
+#include "qapi/dealloc-visitor.h"
+#include "qapi/qmp-output-visitor.h"
static ACPIOSTInfo *acpi_memory_device_status(int slot, MemStatus *mdev)
{
@@ -35,6 +39,29 @@ void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list)
}
}
+static void acpi_memory_ost_mon_event(const MemHotplugState *mem_st)
+{
+ Visitor *v;
+ QObject *out_info;
+ QapiDeallocVisitor *md;
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ MemStatus *mdev = &mem_st->devs[mem_st->selector];
+ ACPIOSTInfo *info = acpi_memory_device_status(mem_st->selector, mdev);
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_ACPIOSTInfo(v, &info, "unused", NULL);
+
+ out_info = qmp_output_get_qobject(mo);
+ monitor_protocol_event(QEVENT_ACPI_OST, out_info);
+ qobject_decref(out_info);
+
+ qmp_output_visitor_cleanup(mo);
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ACPIOSTInfo(v, &info, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
static uint64_t acpi_memory_hotplug_read(void *opaque, hwaddr addr,
unsigned int size)
{
@@ -119,8 +146,8 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
mdev = &mem_st->devs[mem_st->selector];
mdev->ost_status = data;
trace_mhp_acpi_write_ost_status(mem_st->selector, mdev->ost_status);
- /* TODO: report async error */
/* TODO: implement memory removal on guest signal */
+ acpi_memory_ost_mon_event(mem_st);
break;
case 0x14:
mdev = &mem_st->devs[mem_st->selector];
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 1c1f56f..97696ea 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -51,6 +51,7 @@ typedef enum MonitorEvent {
QEVENT_BLOCK_IMAGE_CORRUPTED,
QEVENT_QUORUM_FAILURE,
QEVENT_QUORUM_REPORT_BAD,
+ QEVENT_ACPI_OST,
/* Add to 'monitor_event_names' array in monitor.c when
* defining new events here */
diff --git a/monitor.c b/monitor.c
index c270fd8..6c61824 100644
--- a/monitor.c
+++ b/monitor.c
@@ -486,6 +486,7 @@ static const char *monitor_event_names[] = {
[QEVENT_BLOCK_IMAGE_CORRUPTED] = "BLOCK_IMAGE_CORRUPTED",
[QEVENT_QUORUM_FAILURE] = "QUORUM_FAILURE",
[QEVENT_QUORUM_REPORT_BAD] = "QUORUM_REPORT_BAD",
+ [QEVENT_ACPI_OST] = "ACPI_DEVICE_OST",
};
QEMU_BUILD_BUG_ON(ARRAY_SIZE(monitor_event_names) != QEVENT_MAX)
--
1.7.1
next prev parent reply other threads:[~2014-06-16 17:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-16 17:12 [Qemu-devel] [PATCH v2 0/5] ACPI memory hotplug: QMP interfaces Igor Mammedov
2014-06-16 17:12 ` [Qemu-devel] [PATCH v2 1/5] qmp: add query-memory-devices command Igor Mammedov
2014-06-16 17:12 ` [Qemu-devel] [PATCH v2 2/5] acpi: introduce TYPE_ACPI_DEVICE_IF interface Igor Mammedov
2014-06-16 17:12 ` [Qemu-devel] [PATCH v2 3/5] acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices Igor Mammedov
2014-06-16 17:12 ` [Qemu-devel] [PATCH v2 4/5] qmp: add query-acpi-ospm-status command Igor Mammedov
2014-06-16 17:12 ` Igor Mammedov [this message]
2014-06-17 11:25 ` [Qemu-devel] [PATCH v2 0/5] ACPI memory hotplug: QMP interfaces 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=1402938749-13371-6-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mst@redhat.com \
--cc=pkrempa@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).