From patchwork Mon Jun 23 16:36:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 363056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 86E0214007C for ; Tue, 24 Jun 2014 02:56:45 +1000 (EST) Received: from localhost ([::1]:55021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz7Xv-0003Ly-QX for incoming@patchwork.ozlabs.org; Mon, 23 Jun 2014 12:56:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz7FF-0003w9-AS for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz7F7-00043M-O7 for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:37:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz7F7-000436-Gp for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:37:17 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5NGbBsn032255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jun 2014 12:37:11 -0400 Received: from localhost (ovpn-113-42.phx2.redhat.com [10.3.113.42]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5NGbAZ0010518; Mon, 23 Jun 2014 12:37:11 -0400 From: Luiz Capitulino To: peter.maydell@linaro.org Date: Mon, 23 Jun 2014 12:36:33 -0400 Message-Id: <1403541403-16468-34-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1403541403-16468-1-git-send-email-lcapitulino@redhat.com> References: <1403541403-16468-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws Subject: [Qemu-devel] [PULL 33/43] qmp: convert ACPI_DEVICE_OST event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov ... using new QAPI event infrastructure Signed-off-by: Igor Mammedov Signed-off-by: Luiz Capitulino --- docs/qmp/qmp-events.txt | 10 ---------- hw/acpi/memory_hotplug.c | 34 ++++++---------------------------- include/monitor/monitor.h | 1 - monitor.c | 1 - qapi-event.json | 12 ++++++++++++ 5 files changed, 18 insertions(+), 40 deletions(-) diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt index adb83d3..4fbc3de 100644 --- a/docs/qmp/qmp-events.txt +++ b/docs/qmp/qmp-events.txt @@ -1,16 +1,6 @@ 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 de4ddc2..38ca415 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -3,10 +3,7 @@ #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" +#include "qapi-event.h" static ACPIOSTInfo *acpi_memory_device_status(int slot, MemStatus *mdev) { @@ -39,29 +36,6 @@ 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) { @@ -115,6 +89,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data, { MemHotplugState *mem_st = opaque; MemStatus *mdev; + ACPIOSTInfo *info; if (!mem_st->dev_count) { return; @@ -147,7 +122,10 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data, mdev->ost_status = data; trace_mhp_acpi_write_ost_status(mem_st->selector, mdev->ost_status); /* TODO: implement memory removal on guest signal */ - acpi_memory_ost_mon_event(mem_st); + + info = acpi_memory_device_status(mem_st->selector, mdev); + qapi_event_send_acpi_device_ost(info, &error_abort); + qapi_free_ACPIOSTInfo(info); break; case 0x14: mdev = &mem_st->devs[mem_st->selector]; diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 97696ea..1c1f56f 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -51,7 +51,6 @@ 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 0b4a4b4..2f64195 100644 --- a/monitor.c +++ b/monitor.c @@ -497,7 +497,6 @@ 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/qapi-event.json b/qapi-event.json index 1e23549..5188a72 100644 --- a/qapi-event.json +++ b/qapi-event.json @@ -241,3 +241,15 @@ # Since: 1.3 ## { 'event': 'SPICE_MIGRATE_COMPLETED' } + +## +# @ACPI_DEVICE_OST +# +# Emitted when guest executes ACPI _OST method. +# +# Since: 2.1 +# +# @info: ACPIOSTInfo type as described in qapi-schema.json +## +{ 'event': 'ACPI_DEVICE_OST', + 'data': { 'info': 'ACPIOSTInfo' } }