[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 102/106] qmp: add ACPI_DEVICE_OST event handling
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 102/106] qmp: add ACPI_DEVICE_OST event handling |
Date: |
Wed, 18 Jun 2014 19:22:23 +0300 |
From: Igor Mammedov <address@hidden>
emits event when ACPI OSPM evaluates _OST method
of ACPI device.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/monitor/monitor.h | 1 +
hw/acpi/memory_hotplug.c | 29 ++++++++++++++++++++++++++++-
monitor.c | 1 +
docs/qmp/qmp-events.txt | 10 ++++++++++
4 files changed, 40 insertions(+), 1 deletion(-)
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/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/monitor.c b/monitor.c
index afbb2d7..c7f8797 100644
--- a/monitor.c
+++ b/monitor.c
@@ -487,6 +487,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)
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
--------------
--
MST
- [Qemu-devel] [PULL v2 093/106] qdev: reorganize error reporting in bus_set_realized, (continued)
- [Qemu-devel] [PULL v2 093/106] qdev: reorganize error reporting in bus_set_realized, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 092/106] qapi: fix build on glib < 2.28, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 094/106] qdev: recursively unrealize devices when unrealizing bus, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 096/106] pc: acpi: do not hardcode preprocessor, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 095/106] qmp: clean out whitespace, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 097/106] numa: handle mmaped memory allocation failure correctly, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 099/106] acpi: introduce TYPE_ACPI_DEVICE_IF interface, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 098/106] qmp: add query-memory-devices command, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 100/106] acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 101/106] qmp: add query-acpi-ospm-status command, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 102/106] qmp: add ACPI_DEVICE_OST event handling,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 104/106] qapi: fix input visitor bugs, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 103/106] acpi: rephrase comment, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 019/106] acpi: rename cpu_hotplug_defs.h to pc-hotplug.h, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 016/106] pc: add memory hotplug handler to PC_MACHINE, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 077/106] memory: add error propagation to file-based RAM allocation, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 040/106] migration: export SELF_ANNOUNCE_ROUNDS, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 078/106] vl: redo -object parsing, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 106/106] qapi/string-output-visitor: fix bugs, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 074/106] qom: introduce object_property_get_enum and object_property_get_uint16List, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 006/106] vl.c: extend -m option to support options for memory hotplug, Michael S. Tsirkin, 2014/06/18