Skip to contentSkip to conversation

QAPI patches patches for 2022-02-28

GIT PULL Applied Markus Armbruster 2 participants 11 messages Feb 28, 2022 – Mar 1, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#1 lore raw

[PULL 7/9] hw/rtc: Compile pl031 once-only

In reply to Markus Armbruster

From: Peter Maydell <[email protected]>

Now that the RTC_CHANGE event is no longer target-specific, we can move the pl031 back to a compile-once source file rather than a compile-per-target one.

Message-Id: <[email protected]>

---
 hw/rtc/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/rtc/meson.build +1 -1
index 8fd8d8f9a7..7cecdee5dd 100644
@@ -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'))
Signature · 1 line
2.35.1
#2 lore raw

[PULL 9/9] qapi: Belatedly adjust limitations documentation

In reply to Markus Armbruster

Commit 57df0dff1a "qapi: Extend -compat to set policy for unstable interfaces" (v6.2.0) took care of covering experimental features, but neglected to adjust a comment suggesting to cover it. Adjust it now.

Fixes 57df0dff1a1f4c846aa74a082bfd595a8a990015

Message-Id: <[email protected]>

---
 qapi/compat.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/compat.json +1 -1
index c53b69fe3f..39b52872d5 100644
@@ -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.
Signature · 1 line
2.35.1
#3 lore raw

[PULL 3/9] qapi: Fix stale reference to scripts/qapi.py in a comment

In reply to Markus Armbruster

Message-Id: <[email protected]>

---
 qapi/qapi-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/qapi-util.c +1 -1
index fda7044539..63596e11c5 100644
@@ -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.
  */
Signature · 1 line
2.35.1
#0 lore raw

The following changes since commit fa435db8ce1dff3b15e3f59a12f55f7b3a347b08:

Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' into staging (2022-02-24 12:48:14 +0000)

are available in the Git repository at:

git://repo.or.cz/qemu/armbru.git tags/pull-qapi-2022-02-28

for you to fetch changes up to 1428502c8c0c0cfbb04212558144fef970042cf3:

qapi: Belatedly adjust limitations documentation (2022-02-28 11:39:35 +0100)

----------------------------------------------------------------
QAPI patches patches for 2022-02-28

----------------------------------------------------------------
Fabian Holler (1):
qapi/migration: Fix examples document wrong field name for arguments

John Snow (1):
scripts/qapi: minor delinting

Markus Armbruster (4):
keyval: Fix grammar comment to cover downstream prefix
qapi: Fix stale reference to scripts/qapi.py in a comment
rtc: Have event RTC_CHANGE identify the RTC by QOM path
qapi: Belatedly adjust limitations documentation

Peter Maydell (3):
qapi: Move RTC_CHANGE back out of target schema
qapi: Document some missing details of RTC_CHANGE event hw/rtc: Compile pl031 once-only

 qapi/compat.json         |  2 +-
 qapi/migration.json      | 10 +++++-----
 qapi/misc-target.json    | 33 ---------------------------------
 qapi/misc.json           | 26 ++++++++++++++++++++++++++
 hw/ppc/spapr_rtc.c       |  6 ++++--
 hw/rtc/mc146818rtc.c     |  5 +++--
 hw/rtc/pl031.c           |  5 +++--
 qapi/qapi-util.c         |  2 +-
 util/keyval.c            |  4 +++-
 hw/rtc/meson.build       |  2 +-
 scripts/qapi/commands.py |  2 +-
 scripts/qapi/pylintrc    | 16 ++++++----------
 scripts/qapi/types.py    |  6 +++++-
 scripts/qapi/visit.py    |  6 +++++-
 14 files changed, 64 insertions(+), 61 deletions(-)
Signature · 1 line
2.35.1
#4 lore raw

[PULL 1/9] scripts/qapi: minor delinting

From: John Snow <[email protected]>

Get isort and pylint tools passing again.

Message-Id: <[email protected]>

[Comment explaining good-names-rgxs tweaked]
---
 scripts/qapi/commands.py |  2 +-
 scripts/qapi/pylintrc    | 16 ++++++----------
 scripts/qapi/types.py    |  6 +++++-
 scripts/qapi/visit.py    |  6 +++++-
 4 files changed, 17 insertions(+), 13 deletions(-)
scripts/qapi/commands.py +1 -1
index 869d799ed2..38ca38a7b9 100644
@@ -25,8 +25,8 @@
     QAPIGenC,
     QAPISchemaModularCVisitor,
     build_params,
-    ifcontext,
     gen_special_features,
+    ifcontext,
 )
 from .schema import (
     QAPISchema,
scripts/qapi/pylintrc +6 -10
index b259531a72..a724628203 100644
@@ -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]
 
scripts/qapi/types.py +5 -1
index 3013329c24..477d027001 100644
@@ -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,
scripts/qapi/visit.py +5 -1
index e13bbe4292..380fa197f5 100644
@@ -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,
Signature · 1 line
2.35.1
#5 lore raw

[PULL 6/9] qapi: Document some missing details of RTC_CHANGE event

In reply to Markus Armbruster

From: Peter Maydell <[email protected]>

The RTC_CHANGE event's documentation is missing some details:
* the offset argument is in units of seconds
* it isn't guaranteed that the RTC will implement the event

Message-Id: <[email protected]>

---
 qapi/misc.json | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
qapi/misc.json +4 -2
index 7a70eaa3ff..0ab235e41f 100644
@@ -533,10 +533,12 @@
 #
 # Emitted when the guest changes the RTC time.
 #
-# @offset: offset between base RTC clock (as specified by -rtc base), and
-#          new RTC clock value
+# @offset: offset in seconds between base RTC clock (as specified
+#          by -rtc base), and new RTC clock value
 #
 # 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
 #
Signature · 1 line
2.35.1
#6 lore raw

[PULL 4/9] qapi/migration: Fix examples document wrong field name for arguments

In reply to Markus Armbruster

From: Fabian Holler <[email protected]>

The examples for the snapshot-* and calc-dirty-rate commands document that arguments for the commands are passed in a 'data' field. This is wrong, passing them in a "data" field results in the error:
{"error": {"class": "GenericError", "desc": "QMP input member 'data'

		       is unexpected"}}

Arguments are expected to be passed in an field called "arguments".

Replace "data" with "arguments" in the snapshot-* and calc-dirty-rate command examples.

Message-Id: <[email protected]>

---
 qapi/migration.json | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
qapi/migration.json +5 -5
index 5975a0e104..18e2610e88 100644
@@ -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"]
Signature · 1 line
2.35.1
#7 lore raw

[PULL 8/9] rtc: Have event RTC_CHANGE identify the RTC by QOM path

In reply to Markus Armbruster

Event RTC_CHANGE is "emitted when the guest changes the RTC time" (and the RTC supports the event). What if there's more than one RTC? Which one changed? New @qom-path identifies it.

Message-Id: <[email protected]>

---
 qapi/misc.json       | 4 +++-
 hw/ppc/spapr_rtc.c   | 4 +++-
 hw/rtc/mc146818rtc.c | 3 ++-
 hw/rtc/pl031.c       | 3 ++-
 4 files changed, 10 insertions(+), 4 deletions(-)
qapi/misc.json +3 -1
index 0ab235e41f..b83cc39029 100644
@@ -536,6 +536,8 @@
 # @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.
@@ -550,4 +552,4 @@
 #
 ##
 { 'event': 'RTC_CHANGE',
-  'data': { 'offset': 'int' } }
+  'data': { 'offset': 'int', 'qom-path': 'str' } }
hw/ppc/spapr_rtc.c +3 -1
index 79677cf550..d55b4b0c50 100644
@@ -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);
 
hw/rtc/mc146818rtc.c +2 -1
index 57c514e15c..ac9a60c90e 100644
@@ -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)
hw/rtc/pl031.c +2 -1
index 60167c778f..b01d0e75d1 100644
@@ -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;
Signature · 1 line
2.35.1
#8 lore raw

[PULL 5/9] qapi: Move RTC_CHANGE back out of target schema

In reply to Markus Armbruster

From: Peter Maydell <[email protected]>

This commit effectively reverts commit 183e4281a30962, which moved the RTC_CHANGE event to the target schema. That change was an attempt to make the event target-specific to improve introspection, but the event isn't really target-specific: it's machine or device specific. Putting RTC_CHANGE in the target schema with an ifdef list reduces maintainability (by adding an if: list with a long list of targets that needs to be manually updated as architectures are added or removed or as new devices gain the RTC_CHANGE functionality) and increases compile time (by preventing RTC devices which emit the event from being "compile once" rather than "compile once per target", because qapi-events-misc-target.h uses TARGET_* ifdefs, which are poisoned in "compile once" files.)

Move RTC_CHANGE back to misc.json.

Message-Id: <[email protected]>

---
 qapi/misc-target.json | 33 ---------------------------------
 qapi/misc.json        | 22 ++++++++++++++++++++++
 hw/ppc/spapr_rtc.c    |  2 +-
 hw/rtc/mc146818rtc.c  |  2 +-
 hw/rtc/pl031.c        |  2 +-
 5 files changed, 25 insertions(+), 36 deletions(-)
qapi/misc-target.json +0 -33
index 4bc45d2474..036c5e4a91 100644
@@ -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:
 #
qapi/misc.json +22 -0
index e8054f415b..7a70eaa3ff 100644
@@ -527,3 +527,25 @@
  'data': { '*option': 'str' },
  'returns': ['CommandLineOptionInfo'],
  'allow-preconfig': true }
+
+##
+# @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' } }
hw/ppc/spapr_rtc.c +1 -1
index 94a5510e4e..79677cf550 100644
@@ -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"
 
hw/rtc/mc146818rtc.c +1 -1
index e61a0cced4..57c514e15c 100644
@@ -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"
 
hw/rtc/pl031.c +1 -1
index 38d9d3c2f3..60167c778f 100644
@@ -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 */
Signature · 1 line
2.35.1
#9 lore raw

[PULL 2/9] keyval: Fix grammar comment to cover downstream prefix

In reply to Markus Armbruster

According to the grammar, a key __com.redhat_foo would be parsed as two key fragments __com and redhat_foo. It's actually parsed as a single fragment. Fix the grammar.

Message-Id: <[email protected]>

---
 util/keyval.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/keyval.c +3 -1
index 904337c8a1..0cf2e84dc8 100644
@@ -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' | '?'
  *
Signature · 1 line
2.35.1
#10 lore raw
In reply to Markus Armbruster
Quoted 7 lines · Markus Armbruster

The following changes since commit fa435db8ce1dff3b15e3f59a12f55f7b3a347b08:

Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' into staging (2022-02-24 12:48:14 +0000)

are available in the Git repository at:

Quoted 9 lines

git://repo.or.cz/qemu/armbru.git tags/pull-qapi-2022-02-28

for you to fetch changes up to 1428502c8c0c0cfbb04212558144fef970042cf3:

qapi: Belatedly adjust limitations documentation (2022-02-28 11:39:35 +0100)

----------------------------------------------------------------
QAPI patches patches for 2022-02-28

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.

-- PMM