Il 20/06/2014 20:44, Luiz Capitulino ha scritto: > On Fri, 20 Jun 2014 19:24:48 +0100 > Peter Maydell <peter.mayd...@linaro.org> wrote: > >> On 19 June 2014 20:39, Luiz Capitulino <lcapitul...@redhat.com> wrote: >>> The following changes since commit 6baa963f4dcc211801608ebe1e0482b51653350c: >>> >>> Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging >>> (2014-06-19 16:18:04 +0100) >>> >>> are available in the git repository at: >>> >>> >>> git://repo.or.cz/qemu/qmp-unstable.git queue/qmp >>> >>> for you to fetch changes up to b98ff90e9459e0113da8502c03670a9539f90aa1: >>> >>> monitor: protect event emission (2014-06-19 15:34:33 -0400) >> >> CONFLICT (content): Merge conflict in vl.c >> CONFLICT (content): Merge conflict in qemu-char.c >> CONFLICT (content): Merge conflict in qapi-schema.json >> CONFLICT (content): Merge conflict in monitor.c >> CONFLICT (content): Merge conflict in include/monitor/monitor.h >> CONFLICT (content): Merge conflict in hw/core/qdev.c >> CONFLICT (modify/delete): docs/qmp/qmp-events.txt deleted in >> remotes/qmp-unstable/queue/qmp and modified in HEAD. Version HEAD of >> docs/qmp/qmp-events.txt left in tree.
Ugh. The conflicts are messy because there's many of them, but they're not hard to fix. The problem is basically that another event (ACPI_DEVICE_OST) was added in mst's merge. All other conflicts are just new include files or similar. I pushed to qapi-event the merge commit with the resolution of the merge, which is also included below. I included the two INLINE fixes in the branch because that's what I compiled. > Paolo, Wenchao, it's the QAPI event series that doesn't apply anymore. Can > you please rebase it and post a new version? Could you also: > > 1. Add/keep Reviewed-bys of patches that did not change > 2. Drop Reviewed-bys of patches that changed > 3. Add Eric's review suggestions > 4. Test build all targets As I explained on IRC, many patches when rebased would have conflicts with Igor's new event. I think this is much more complex than having an "extraordinary" merge commit. I include the conflict resolution: - hw/acpi/memory-hotplug.c is only present in mst's branch, so I'm including the diff from there (changing to the QAPI event style) - qapi-event.json is only present in luiz's branch, so I'm including the diff from there (adding the ACPI_DEVICE_OST event) - Paolo a76d72f692ed5f4f30f116cc9c3ac5fefe221cb7 Merge: 0a99aae b98ff90 Author: Paolo Bonzini <pbonz...@redhat.com> Date: Fri Jun 20 21:18:08 2014 +0200 Merge commit b98ff90e9459e0113da8502c03670a9539f90aa1 of git://repo.or.cz/qemu/qmp-unstable into HEAD Conflicts: docs/qmp/qmp-events.txt [removed with QAPI event conversion] hw/core/qdev.c [trivial header file conflict] include/monitor/monitor.h [QMP event enum removed by QAPI conversion] monitor.c [QMP event enum removed by QAPI conversion] qapi-schema.json [trivial, code added by both sides in the same place] qemu-char.c [trivial, code added by both sides in the same place] vl.c [trivial header file conflict] Other files changed: qapi-event.json [include ACPI_DEVICE_OST event] hw/acpi/memory-hotplug.c [use QAPI event] Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index de4ddc2..98d900e 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -4,6 +4,7 @@ #include "hw/boards.h" #include "trace.h" #include "qapi-visit.h" +#include "qapi-event.h" #include "monitor/monitor.h" #include "qapi/dealloc-visitor.h" #include "qapi/qmp-output-visitor.h" @@ -41,25 +42,18 @@ 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); + /* QAPI event declarations support struct names in the 'data', + * field, but we have to list all the fields of ACPIOSTInfo. + */ + qapi_event_send_acpi_device_ost(info->has_device, info->device, + info->slot, info->slot_type, + info->source, info->status, + 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); + qapi_free_ACPIOSTInfo(info); } static uint64_t acpi_memory_hotplug_read(void *opaque, hwaddr addr, diff --git a/qapi-event.json b/qapi-event.json index fbdda48..cb63d85 100644 --- a/qapi-event.json +++ b/qapi-event.json @@ -304,3 +304,13 @@ { 'event': 'QUORUM_REPORT_BAD', 'data': { '*error': 'str', 'node-name': 'str', 'sector-num': 'int', 'sector-count': 'int' } } + +## @ACPI_DEVICE_OST +# +# Emitted when the guest executes the ACPI _OST method. +# For the description of data, see @ACPIOSTInfo. +# +# Since: 2.1 +## +{ 'event': 'ACPI_DEVICE_OST', + 'data' : 'ACPIOSTInfo' } diff --cc monitor.c index c7f8797,38a64a3..224b32e --- a/monitor.c +++ b/monitor.c diff --cc include/monitor/monitor.h index 97696ea,3d6929d..3d6929d --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h diff --cc hw/core/qdev.c index b9cd4fc,cbe8bdd..d1eba3c --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@@ -32,9 -32,8 +32,9 @@@ #include "qapi/qmp/qerror.h" #include "qapi/visitor.h" #include "qapi/qmp/qjson.h" - #include "monitor/monitor.h" #include "hw/hotplug.h" +#include "hw/boards.h" + #include "qapi-event.h" int qdev_hotplug = 0; static bool qdev_hot_added = false; diff --cc qapi-schema.json index 9835004,d62bb7d..cf3e21a --- a/qapi-schema.json +++ b/qapi-schema.json @@@ -3099,190 -3142,53 +3159,242 @@@ 'abs' : 'InputMoveEvent' } } ## +# @NumaOptions +# +# A discriminated record of NUMA options. (for OptsVisitor) +# +# Since 2.1 +## +{ 'union': 'NumaOptions', + 'data': { + 'node': 'NumaNodeOptions' }} + +## +# @NumaNodeOptions +# +# Create a guest NUMA node. (for OptsVisitor) +# +# @nodeid: #optional NUMA node ID (increase by 1 from 0 if omitted) +# +# @cpus: #optional VCPUs belonging to this node (assign VCPUS round-robin +# if omitted) +# +# @mem: #optional memory size of this node; mutually exclusive with @memdev. +# Equally divide total memory among nodes if both @mem and @memdev are +# omitted. +# +# @memdev: #optional memory backend object. If specified for one node, +# it must be specified for all nodes. +# +# Since: 2.1 +## +{ 'type': 'NumaNodeOptions', + 'data': { + '*nodeid': 'uint16', + '*cpus': ['uint16'], + '*mem': 'size', + '*memdev': 'str' }} + +## +# @HostMemPolicy +# +# Host memory policy types +# +# @default: restore default policy, remove any nondefault policy +# +# @preferred: set the preferred host nodes for allocation +# +# @bind: a strict policy that restricts memory allocation to the +# host nodes specified +# +# @interleave: memory allocations are interleaved across the set +# of host nodes specified +# +# Since 2.1 +## +{ 'enum': 'HostMemPolicy', + 'data': [ 'default', 'preferred', 'bind', 'interleave' ] } + +## +# @Memdev: +# +# Information of memory device +# +# @size: memory device size +# +# @merge: enables or disables memory merge support +# +# @dump: includes memory device's memory in a core dump or not +# +# @prealloc: enables or disables memory preallocation +# +# @host-nodes: host nodes for its memory policy +# +# @policy: memory policy of memory device +# +# Since: 2.1 +## + +{ 'type': 'Memdev', + 'data': { + 'size': 'size', + 'merge': 'bool', + 'dump': 'bool', + 'prealloc': 'bool', + 'host-nodes': ['uint16'], + 'policy': 'HostMemPolicy' }} + +## +# @query-memdev: +# +# Returns information for all memory devices. +# +# Returns: a list of @Memdev. +# +# Since: 2.1 +## +{ 'command': 'query-memdev', 'returns': ['Memdev'] } +# @PCDIMMDeviceInfo: +# +# PCDIMMDevice state information +# +# @id: #optional device's ID +# +# @addr: physical address, where device is mapped +# +# @size: size of memory that the device provides +# +# @slot: slot number at which device is plugged in +# +# @node: NUMA node number where device is plugged in +# +# @memdev: memory backend linked with device +# +# @hotplugged: true if device was hotplugged +# +# @hotpluggable: true if device if could be added/removed while machine is running +# +# Since: 2.1 +## +{ 'type': 'PCDIMMDeviceInfo', + 'data': { '*id': 'str', + 'addr': 'int', + 'size': 'int', + 'slot': 'int', + 'node': 'int', + 'memdev': 'str', + 'hotplugged': 'bool', + 'hotpluggable': 'bool' + } +} + +## +# @MemoryDeviceInfo: +# +# Union containing information about a memory device +# +# Since: 2.1 +## +{ 'union': 'MemoryDeviceInfo', 'data': {'dimm': 'PCDIMMDeviceInfo'} } + +## +# @query-memory-devices +# +# Lists available memory devices and their state +# +# Since: 2.1 +## +{ 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] } + +## @ACPISlotType +# +# @DIMM: memory slot +# +{ 'enum': 'ACPISlotType', 'data': [ 'DIMM' ] } + +## @ACPIOSTInfo +# +# OSPM Status Indication for a device +# For description of possible values of @source and @status fields +# see "_OST (OSPM Status Indication)" chapter of ACPI5.0 spec. +# +# @device: #optional device ID associated with slot +# +# @slot: slot ID, unique per slot of a given @slot-type +# +# @slot-type: type of the slot +# +# @source: an integer containing the source event +# +# @status: an integer containing the status code +# +# Since: 2.1 +## +{ 'type': 'ACPIOSTInfo', + 'data' : { '*device': 'str', + 'slot': 'str', + 'slot-type': 'ACPISlotType', + 'source': 'int', + 'status': 'int' } } + +## +# @query-acpi-ospm-status +# +# Lists ACPI OSPM status of ACPI device objects, +# which might be reported via _OST method +# +# Since: 2.1 +## +{ 'command': 'query-acpi-ospm-status', 'returns': ['ACPIOSTInfo'] } ++ ++## + # @WatchdogExpirationAction + # + # An enumeration of the actions taken when the watchdog device's timer is + # expired + # + # @reset: system resets + # + # @shutdown: system shutdown, note that it is similar to @powerdown, which + # tries to set to system status and notify guest + # + # @poweroff: system poweroff, the emulator program exits + # + # @pause: system pauses, similar to @stop + # + # @debug: system enters debug state + # + # @none: nothing is done + # + # Since: 2.1 + ## + { 'enum': 'WatchdogExpirationAction', + 'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none' ] } + + ## + # @IoOperationType + # + # An enumeration of the I/O operation types + # + # @read: read operation + # + # @write: write operation + # + # Since: 2.1 + ## + { 'enum': 'IoOperationType', + 'data': [ 'read', 'write' ] } + + ## + # @GuestPanicAction + # + # An enumeration of the actions taken when guest OS panic is detected + # + # @pause: system pauses + # + # Since: 2.1 + ## + { 'enum': 'GuestPanicAction', + 'data': [ 'pause' ] } + + { 'include': 'qapi-event.json' } diff --cc qemu-char.c index b3bd3b5,b0f3ff4..16e0a4c --- a/qemu-char.c +++ b/qemu-char.c @@@ -2351,53 -2337,7 +2387,54 @@@ typedef struct static gboolean tcp_chr_accept(GIOChannel *chan, GIOCondition cond, void *opaque); +#ifndef _WIN32 +static int unix_send_msgfds(CharDriverState *chr, const uint8_t *buf, int len) +{ + TCPCharDriver *s = chr->opaque; + struct msghdr msgh; + struct iovec iov; + int r; + + size_t fd_size = s->write_msgfds_num * sizeof(int); + char control[CMSG_SPACE(fd_size)]; + struct cmsghdr *cmsg; + + memset(&msgh, 0, sizeof(msgh)); + memset(control, 0, sizeof(control)); + + /* set the payload */ + iov.iov_base = (uint8_t *) buf; + iov.iov_len = len; + + msgh.msg_iov = &iov; + msgh.msg_iovlen = 1; + + msgh.msg_control = control; + msgh.msg_controllen = sizeof(control); + + cmsg = CMSG_FIRSTHDR(&msgh); + + cmsg->cmsg_len = CMSG_LEN(fd_size); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + memcpy(CMSG_DATA(cmsg), s->write_msgfds, fd_size); + + do { + r = sendmsg(s->fd, &msgh, 0); + } while (r < 0 && errno == EINTR); + + /* free the written msgfds, no matter what */ + if (s->write_msgfds_num) { + g_free(s->write_msgfds); + s->write_msgfds = 0; + s->write_msgfds_num = 0; + } + + return r; +} +#endif + + /* Called with chr_write_lock held. */ static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { TCPCharDriver *s = chr->opaque; diff --cc stubs/Makefile.objs index 997d68d,60de407..3032ec1 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@@ -19,10 -14,7 +19,9 @@@ stub-obj-y += machine-init-done. stub-obj-y += migr-blocker.o stub-obj-y += mon-is-qmp.o stub-obj-y += mon-printf.o - stub-obj-y += mon-protocol-event.o stub-obj-y += mon-set-error.o +stub-obj-y += monitor-init.o +stub-obj-y += notify-event.o stub-obj-y += pci-drive-hot-add.o stub-obj-y += qtest.o stub-obj-y += reset.o diff --cc vl.c index 54b4627,198c77a..c339156 --- a/vl.c +++ b/vl.c @@@ -116,7 -116,8 +116,9 @@@ int main(int argc, char **argv #include "ui/qemu-spice.h" #include "qapi/string-input-visitor.h" +#include "qapi/opts-visitor.h" + #include "qom/object_interfaces.h" + #include "qapi-event.h" #define DEFAULT_RAM_SIZE 128