Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2022-02-2…
Browse files Browse the repository at this point in the history
…8' into staging

QAPI patches patches for 2022-02-28

# gpg: Signature made Mon 28 Feb 2022 10:40:22 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2022-02-28:
  qapi: Belatedly adjust limitations documentation
  rtc: Have event RTC_CHANGE identify the RTC by QOM path
  hw/rtc: Compile pl031 once-only
  qapi: Document some missing details of RTC_CHANGE event
  qapi: Move RTC_CHANGE back out of target schema
  qapi/migration: Fix examples document wrong field name for arguments
  qapi: Fix stale reference to scripts/qapi.py in a comment
  keyval: Fix grammar comment to cover downstream prefix
  scripts/qapi: minor delinting

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Mar 1, 2022
2 parents a8d39f5 + 1428502 commit 648c15e
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 61 deletions.
6 changes: 4 additions & 2 deletions hw/ppc/spapr_rtc.c
Expand Up @@ -32,7 +32,7 @@
#include "hw/ppc/spapr.h"
#include "migration/vmstate.h"
#include "qapi/error.h"
#include "qapi/qapi-events-misc-target.h"
#include "qapi/qapi-events-misc.h"
#include "qemu/cutils.h"
#include "qemu/module.h"

Expand Down Expand Up @@ -97,6 +97,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, SpaprMachineState *spapr,
uint32_t nret, target_ulong rets)
{
SpaprRtcState *rtc = &spapr->rtc;
g_autofree const char *qom_path = NULL;
struct tm tm;
time_t new_s;
int64_t host_ns;
Expand All @@ -120,7 +121,8 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, SpaprMachineState *spapr,
}

/* Generate a monitor event for the change */
qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
qom_path = object_get_canonical_path(OBJECT(rtc));
qapi_event_send_rtc_change(qemu_timedate_diff(&tm), qom_path);

host_ns = qemu_clock_get_ns(rtc_clock);

Expand Down
5 changes: 3 additions & 2 deletions hw/rtc/mc146818rtc.c
Expand Up @@ -40,7 +40,7 @@
#include "hw/rtc/mc146818rtc_regs.h"
#include "migration/vmstate.h"
#include "qapi/error.h"
#include "qapi/qapi-events-misc-target.h"
#include "qapi/qapi-events-misc.h"
#include "qapi/visitor.h"
#include "hw/rtc/mc146818rtc_regs.h"

Expand Down Expand Up @@ -611,12 +611,13 @@ static void rtc_get_time(RTCState *s, struct tm *tm)
static void rtc_set_time(RTCState *s)
{
struct tm tm;
g_autofree const char *qom_path = object_get_canonical_path(OBJECT(s));

rtc_get_time(s, &tm);
s->base_rtc = mktimegm(&tm);
s->last_update = qemu_clock_get_ns(rtc_clock);

qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
qapi_event_send_rtc_change(qemu_timedate_diff(&tm), qom_path);
}

static void rtc_set_cmos(RTCState *s, const struct tm *tm)
Expand Down
2 changes: 1 addition & 1 deletion hw/rtc/meson.build
Expand Up @@ -2,7 +2,7 @@
softmmu_ss.add(when: 'CONFIG_DS1338', if_true: files('ds1338.c'))
softmmu_ss.add(when: 'CONFIG_M41T80', if_true: files('m41t80.c'))
softmmu_ss.add(when: 'CONFIG_M48T59', if_true: files('m48t59.c'))
specific_ss.add(when: 'CONFIG_PL031', if_true: files('pl031.c'))
softmmu_ss.add(when: 'CONFIG_PL031', if_true: files('pl031.c'))
softmmu_ss.add(when: 'CONFIG_TWL92230', if_true: files('twl92230.c'))
softmmu_ss.add(when: ['CONFIG_ISA_BUS', 'CONFIG_M48T59'], if_true: files('m48t59-isa.c'))
softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP', if_true: files('xlnx-zynqmp-rtc.c'))
Expand Down
5 changes: 3 additions & 2 deletions hw/rtc/pl031.c
Expand Up @@ -24,7 +24,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "trace.h"
#include "qapi/qapi-events-misc-target.h"
#include "qapi/qapi-events-misc.h"

#define RTC_DR 0x00 /* Data read register */
#define RTC_MR 0x04 /* Match register */
Expand Down Expand Up @@ -138,12 +138,13 @@ static void pl031_write(void * opaque, hwaddr offset,

switch (offset) {
case RTC_LR: {
g_autofree const char *qom_path = object_get_canonical_path(opaque);
struct tm tm;

s->tick_offset += value - pl031_get_count(s);

qemu_get_timedate(&tm, s->tick_offset);
qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
qapi_event_send_rtc_change(qemu_timedate_diff(&tm), qom_path);

pl031_set_alarm(s);
break;
Expand Down
2 changes: 1 addition & 1 deletion qapi/compat.json
Expand Up @@ -41,7 +41,7 @@
#
# Limitation: covers only syntactic aspects of QMP, i.e. stuff tagged
# with feature 'deprecated'. We may want to extend it to cover
# semantic aspects, CLI, and experimental features.
# semantic aspects and CLI.
#
# Limitation: deprecated-output policy @hide is not implemented for
# enumeration values. They behave the same as with policy @accept.
Expand Down
10 changes: 5 additions & 5 deletions qapi/migration.json
Expand Up @@ -1843,8 +1843,8 @@
# Since: 5.2
#
# Example:
# {"command": "calc-dirty-rate", "data": {"calc-time": 1,
# 'sample-pages': 512} }
# {"command": "calc-dirty-rate", "arguments": {"calc-time": 1,
# 'sample-pages': 512} }
#
##
{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
Expand Down Expand Up @@ -1888,7 +1888,7 @@
# Example:
#
# -> { "execute": "snapshot-save",
# "data": {
# "arguments": {
# "job-id": "snapsave0",
# "tag": "my-snap",
# "vmstate": "disk0",
Expand Down Expand Up @@ -1949,7 +1949,7 @@
# Example:
#
# -> { "execute": "snapshot-load",
# "data": {
# "arguments": {
# "job-id": "snapload0",
# "tag": "my-snap",
# "vmstate": "disk0",
Expand Down Expand Up @@ -2002,7 +2002,7 @@
# Example:
#
# -> { "execute": "snapshot-delete",
# "data": {
# "arguments": {
# "job-id": "snapdelete0",
# "tag": "my-snap",
# "devices": ["disk0", "disk1"]
Expand Down
33 changes: 0 additions & 33 deletions qapi/misc-target.json
Expand Up @@ -2,39 +2,6 @@
# vim: filetype=python
#

##
# @RTC_CHANGE:
#
# Emitted when the guest changes the RTC time.
#
# @offset: offset between base RTC clock (as specified by -rtc base), and
# new RTC clock value
#
# Note: This event is rate-limited.
#
# Since: 0.13
#
# Example:
#
# <- { "event": "RTC_CHANGE",
# "data": { "offset": 78 },
# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
#
##
{ 'event': 'RTC_CHANGE',
'data': { 'offset': 'int' },
'if': { 'any': [ 'TARGET_ALPHA',
'TARGET_ARM',
'TARGET_HPPA',
'TARGET_I386',
'TARGET_MIPS',
'TARGET_MIPS64',
'TARGET_PPC',
'TARGET_PPC64',
'TARGET_S390X',
'TARGET_SH4',
'TARGET_SPARC' ] } }

##
# @rtc-reset-reinjection:
#
Expand Down
26 changes: 26 additions & 0 deletions qapi/misc.json
Expand Up @@ -527,3 +527,29 @@
'data': { '*option': 'str' },
'returns': ['CommandLineOptionInfo'],
'allow-preconfig': true }

##
# @RTC_CHANGE:
#
# Emitted when the guest changes the RTC time.
#
# @offset: offset in seconds between base RTC clock (as specified
# by -rtc base), and new RTC clock value
#
# @qom-path: path to the RTC object in the QOM tree
#
# Note: This event is rate-limited.
# It is not guaranteed that the RTC in the system implements
# this event, or even that the system has an RTC at all.
#
# Since: 0.13
#
# Example:
#
# <- { "event": "RTC_CHANGE",
# "data": { "offset": 78 },
# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
#
##
{ 'event': 'RTC_CHANGE',
'data': { 'offset': 'int', 'qom-path': 'str' } }
2 changes: 1 addition & 1 deletion qapi/qapi-util.c
Expand Up @@ -113,7 +113,7 @@ bool qapi_bool_parse(const char *name, const char *value, bool *obj, Error **err
* may contain only letters, digits, hyphen and period.
* The special exception for enumeration names is not implemented.
* See docs/devel/qapi-code-gen.txt for more on QAPI naming rules.
* Keep this consistent with scripts/qapi.py!
* Keep this consistent with scripts/qapi-gen.py!
* If @complete, the parse fails unless it consumes @str completely.
* Return its length on success, -1 on failure.
*/
Expand Down
2 changes: 1 addition & 1 deletion scripts/qapi/commands.py
Expand Up @@ -25,8 +25,8 @@
QAPIGenC,
QAPISchemaModularCVisitor,
build_params,
ifcontext,
gen_special_features,
ifcontext,
)
from .schema import (
QAPISchema,
Expand Down
16 changes: 6 additions & 10 deletions scripts/qapi/pylintrc
Expand Up @@ -34,16 +34,12 @@ disable=fixme,

[BASIC]

# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
ex,
Run,
_,
fp, # fp = open(...)
fd, # fd = os.open(...)
ch,
# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted.
#
# Suppress complaints about short names. PEP-8 is cool with them,
# and so are we.
good-names-rgxs=^[_a-z][_a-z0-9]?$

[VARIABLES]

Expand Down
6 changes: 5 additions & 1 deletion scripts/qapi/types.py
Expand Up @@ -16,7 +16,11 @@
from typing import List, Optional

from .common import c_enum_const, c_name, mcgen
from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext
from .gen import (
QAPISchemaModularCVisitor,
gen_special_features,
ifcontext,
)
from .schema import (
QAPISchema,
QAPISchemaEnumMember,
Expand Down
6 changes: 5 additions & 1 deletion scripts/qapi/visit.py
Expand Up @@ -21,7 +21,11 @@
indent,
mcgen,
)
from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext
from .gen import (
QAPISchemaModularCVisitor,
gen_special_features,
ifcontext,
)
from .schema import (
QAPISchema,
QAPISchemaEnumMember,
Expand Down
4 changes: 3 additions & 1 deletion util/keyval.c
Expand Up @@ -16,7 +16,9 @@
* key-vals = [ key-val { ',' key-val } [ ',' ] ]
* key-val = key '=' val | help
* key = key-fragment { '.' key-fragment }
* key-fragment = / [^=,.]+ /
* key-fragment = qapi-name | index
* qapi-name = '__' / [a-z0-9.-]+ / '_' / [A-Za-z][A-Za-z0-9_-]* /
* index = / [0-9]+ /
* val = { / [^,]+ / | ',,' }
* help = 'help' | '?'
*
Expand Down

0 comments on commit 648c15e

Please sign in to comment.