diff options
author | Peter Maydell | 2022-03-01 11:43:35 +0100 |
---|---|---|
committer | Peter Maydell | 2022-03-01 11:43:36 +0100 |
commit | 648c15e4ec3470513624c4b54f09fd15adb12258 (patch) | |
tree | 1fb992c72a1704d3ec55452cf09100a016d45d5f | |
parent | Merge remote-tracking branch 'remotes/legoater/tags/pull-aspeed-20220227' int... (diff) | |
parent | qapi: Belatedly adjust limitations documentation (diff) | |
download | qemu-648c15e4ec3470513624c4b54f09fd15adb12258.tar.gz qemu-648c15e4ec3470513624c4b54f09fd15adb12258.tar.xz qemu-648c15e4ec3470513624c4b54f09fd15adb12258.zip |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2022-02-28' 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>
-rw-r--r-- | hw/ppc/spapr_rtc.c | 6 | ||||
-rw-r--r-- | hw/rtc/mc146818rtc.c | 5 | ||||
-rw-r--r-- | hw/rtc/meson.build | 2 | ||||
-rw-r--r-- | hw/rtc/pl031.c | 5 | ||||
-rw-r--r-- | qapi/compat.json | 2 | ||||
-rw-r--r-- | qapi/migration.json | 10 | ||||
-rw-r--r-- | qapi/misc-target.json | 33 | ||||
-rw-r--r-- | qapi/misc.json | 26 | ||||
-rw-r--r-- | qapi/qapi-util.c | 2 | ||||
-rw-r--r-- | scripts/qapi/commands.py | 2 | ||||
-rw-r--r-- | scripts/qapi/pylintrc | 16 | ||||
-rw-r--r-- | scripts/qapi/types.py | 6 | ||||
-rw-r--r-- | scripts/qapi/visit.py | 6 | ||||
-rw-r--r-- | util/keyval.c | 4 |
14 files changed, 64 insertions, 61 deletions
diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index 94a5510e4e..d55b4b0c50 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -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" @@ -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; @@ -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); diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index e61a0cced4..ac9a60c90e 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -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" @@ -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) diff --git a/hw/rtc/meson.build b/hw/rtc/meson.build index 8fd8d8f9a7..7cecdee5dd 100644 --- a/hw/rtc/meson.build +++ b/hw/rtc/meson.build @@ -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')) diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c index 38d9d3c2f3..b01d0e75d1 100644 --- a/hw/rtc/pl031.c +++ b/hw/rtc/pl031.c @@ -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 */ @@ -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; diff --git a/qapi/compat.json b/qapi/compat.json index c53b69fe3f..39b52872d5 100644 --- a/qapi/compat.json +++ b/qapi/compat.json @@ -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. diff --git a/qapi/migration.json b/qapi/migration.json index 5975a0e104..18e2610e88 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -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', @@ -1888,7 +1888,7 @@ # Example: # # -> { "execute": "snapshot-save", -# "data": { +# "arguments": { # "job-id": "snapsave0", # "tag": "my-snap", # "vmstate": "disk0", @@ -1949,7 +1949,7 @@ # Example: # # -> { "execute": "snapshot-load", -# "data": { +# "arguments": { # "job-id": "snapload0", # "tag": "my-snap", # "vmstate": "disk0", @@ -2002,7 +2002,7 @@ # Example: # # -> { "execute": "snapshot-delete", -# "data": { +# "arguments": { # "job-id": "snapdelete0", # "tag": "my-snap", # "devices": ["disk0", "disk1"] diff --git a/qapi/misc-target.json b/qapi/misc-target.json index 4bc45d2474..036c5e4a91 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -3,39 +3,6 @@ # ## -# @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: # # This command will reset the RTC interrupt reinjection backlog. diff --git a/qapi/misc.json b/qapi/misc.json index e8054f415b..b83cc39029 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -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' } } diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c index fda7044539..63596e11c5 100644 --- a/qapi/qapi-util.c +++ b/qapi/qapi-util.c @@ -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. */ diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 869d799ed2..38ca38a7b9 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -25,8 +25,8 @@ from .gen import ( QAPIGenC, QAPISchemaModularCVisitor, build_params, - ifcontext, gen_special_features, + ifcontext, ) from .schema import ( QAPISchema, diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index b259531a72..a724628203 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi/pylintrc @@ -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] diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 3013329c24..477d027001 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -16,7 +16,11 @@ This work is licensed under the terms of the GNU GPL, version 2. 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, diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index e13bbe4292..380fa197f5 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -21,7 +21,11 @@ from .common import ( indent, mcgen, ) -from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext +from .gen import ( + QAPISchemaModularCVisitor, + gen_special_features, + ifcontext, +) from .schema import ( QAPISchema, QAPISchemaEnumMember, diff --git a/util/keyval.c b/util/keyval.c index 904337c8a1..0cf2e84dc8 100644 --- a/util/keyval.c +++ b/util/keyval.c @@ -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' | '?' * |