Branch: refs/heads/staging Home: https://github.com/qemu/qemu Commit: 4a18751cf423970221d86853c6909696fae52785 https://github.com/qemu/qemu/commit/4a18751cf423970221d86853c6909696fae52785 Author: Markus Armbruster <arm...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024)
Changed paths: M backends/iommufd.c M chardev/char-fe.c M system/rtc.c Log Message: ----------- error: Drop superfluous #include "qapi/qmp/qerror.h" Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-2-arm...@redhat.com> Commit: 7f65e789abf496480be6a54ba454dd6641b45784 https://github.com/qemu/qemu/commit/7f65e789abf496480be6a54ba454dd6641b45784 Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M hw/ppc/spapr_pci.c M include/qapi/qmp/qerror.h M system/qdev-monitor.c Log Message: ----------- qapi: Inline and remove QERR_BUS_NO_HOTPLUG definition Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, and manual cleanup. Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Reviewed-by: Cédric Le Goater <c...@kaod.org> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-3-arm...@redhat.com> Commit: a95921f1712b5f3bb9f905a08984b478b89e0fa5 https://github.com/qemu/qemu/commit/a95921f1712b5f3bb9f905a08984b478b89e0fa5 Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M block/snapshot.c M blockdev.c M include/qapi/qmp/qerror.h Log Message: ----------- qapi: Inline and remove QERR_DEVICE_HAS_NO_MEDIUM definition Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, and manual cleanup. Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-4-arm...@redhat.com> Commit: f95b25c37e34d575346fb171b2f59c162bbefb38 https://github.com/qemu/qemu/commit/f95b25c37e34d575346fb171b2f59c162bbefb38 Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M hw/core/qdev.c M include/qapi/qmp/qerror.h M system/qdev-monitor.c Log Message: ----------- qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, and manual cleanup. Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-5-arm...@redhat.com> Commit: c6f5d406e1ace1e3d7697e085024a3c7b93d6db5 https://github.com/qemu/qemu/commit/c6f5d406e1ace1e3d7697e085024a3c7b93d6db5 Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M include/qapi/qmp/qerror.h M qapi/opts-visitor.c M util/qemu-option.c Log Message: ----------- qapi: Inline and remove QERR_INVALID_PARAMETER definition Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using: $ sed -i -e "s/QERR_INVALID_PARAMETER,/\"Invalid parameter '%s'\",/" \ $(git grep -lw QERR_INVALID_PARAMETER) Manually simplify qemu_opts_create(), and remove the macro definition in include/qapi/qmp/qerror.h. Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-6-arm...@redhat.com> Commit: aaeafa5090c8d006d7c39b4e11bcfb8515ef1ece https://github.com/qemu/qemu/commit/aaeafa5090c8d006d7c39b4e11bcfb8515ef1ece Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M qapi/qobject-input-visitor.c M qapi/string-input-visitor.c M qom/object.c Log Message: ----------- qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value) Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using the following coccinelle semantic patch: @match@ expression errp; expression param; constant value; @@ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value); @script:python strformat depends on match@ value << match.value; fixedfmt; // new var @@ fixedfmt = f'"Invalid parameter type for \'%s\', expected: {value[1:-1]}"' coccinelle.fixedfmt = cocci.make_ident(fixedfmt) @replace@ expression match.errp; expression match.param; constant match.value; identifier strformat.fixedfmt; @@ - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value); + error_setg(errp, fixedfmt, param); Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-7-arm...@redhat.com> Reviewed-by: Zhao Liu <zhao1....@intel.com> Commit: ef929281f1ddb1ce74f5fe39377a88e6cc8237aa https://github.com/qemu/qemu/commit/ef929281f1ddb1ce74f5fe39377a88e6cc8237aa Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M include/qapi/qmp/qerror.h M qom/object.c M scripts/qapi/visit.py Log Message: ----------- qapi: Inline and remove QERR_INVALID_PARAMETER_TYPE definition Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Manual changes (escaping the format in qapi/visit.py). Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-8-arm...@redhat.com> Reviewed-by: Zhao Liu <zhao1....@intel.com> Commit: 45d19d9306ade96404905aa89d534fc989ff9389 https://github.com/qemu/qemu/commit/45d19d9306ade96404905aa89d534fc989ff9389 Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M migration/options.c Log Message: ----------- qapi: Correct error message for 'vcpu_dirty_limit' parameter QERR_INVALID_PARAMETER_VALUE is defined as: #define QERR_INVALID_PARAMETER_VALUE \ "Parameter '%s' expects %s" The current error is formatted as: "Parameter 'vcpu_dirty_limit' expects is invalid, it must greater then 1 MB/s" Replace by: "Parameter 'vcpu_dirty_limit' must be greater than 1 MB/s" Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Reviewed-by: Juan Quintela <quint...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-9-arm...@redhat.com> Reviewed-by: Zhao Liu <zhao1....@intel.com> [New error message corrected, commit message updated accordingly] Commit: 005807860d3e1498ee591223db38f90d2c736165 https://github.com/qemu/qemu/commit/005807860d3e1498ee591223db38f90d2c736165 Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M include/qapi/qmp/qerror.h M migration/migration.c M migration/options.c M migration/savevm.c Log Message: ----------- qapi: Inline and remove QERR_MIGRATION_ACTIVE definition Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, manually removing the definition in include/qapi/qmp/qerror.h. Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Reviewed-by: Juan Quintela <quint...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-10-arm...@redhat.com> Reviewed-by: Zhao Liu <zhao1....@intel.com> [Straightforward conflict with commit aeaafb1e59f (migration: export migration_is_running) resolved] Commit: be842efbe3102c6aa1980039f6d4a8f997f1ff8c https://github.com/qemu/qemu/commit/be842efbe3102c6aa1980039f6d4a8f997f1ff8c Author: Philippe Mathieu-Daudé <phi...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M hw/core/qdev-properties.c M include/qapi/qmp/qerror.h Log Message: ----------- qapi: Inline and remove QERR_PROPERTY_VALUE_BAD definition Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Manual change. Remove the definition in include/qapi/qmp/qerror.h. Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240312141343.3168265-11-arm...@redhat.com> Reviewed-by: Zhao Liu <zhao1....@intel.com> Commit: 4f8f199fa569492bb07efee02489f521629d275d https://github.com/qemu/qemu/commit/4f8f199fa569492bb07efee02489f521629d275d Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/parser.py Log Message: ----------- qapi/parser: fix typo - self.returns.info => self.errors.info Small copy-pasto. The correct info field to use in this conditional block is self.errors.info. Fixes: 3a025d3d1ffa Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-2-arm...@redhat.com> Commit: 2daf52df8b832a221e486ef373953ba160c2d9e1 https://github.com/qemu/qemu/commit/2daf52df8b832a221e486ef373953ba160c2d9e1 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/parser.py Log Message: ----------- qapi/parser: shush up pylint Shhh! Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-3-arm...@redhat.com> Commit: cebc18810ab7dd26117e68cadba1f4373712c508 https://github.com/qemu/qemu/commit/cebc18810ab7dd26117e68cadba1f4373712c508 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/pylintrc Log Message: ----------- qapi: sort pylint suppressions Suggested-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-4-arm...@redhat.com> Commit: ce7fde06306e0e63227bdf91be4c5d04ed26b23f https://github.com/qemu/qemu/commit/ce7fde06306e0e63227bdf91be4c5d04ed26b23f Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/pylintrc M scripts/qapi/schema.py Log Message: ----------- qapi/schema: add pylint suppressions With this patch, pylint is happy with the file, so enable it in the configuration. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-5-arm...@redhat.com> Commit: 2418d1c43add3e8e7089a092574da703c15ac14c https://github.com/qemu/qemu/commit/2418d1c43add3e8e7089a092574da703c15ac14c Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi: create QAPISchemaDefinition Include entities don't have names, but we generally expect "entities" to have names. Reclassify all entities with names as *definitions*, leaving the nameless include entities as QAPISchemaEntity instances. This is primarily to help simplify typing around expectations of what callers expect for properties of an "entity". Suggested-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-6-arm...@redhat.com> Commit: ec103961bf2b8e690d53f8ae98258e9c76caf99a https://github.com/qemu/qemu/commit/ec103961bf2b8e690d53f8ae98258e9c76caf99a Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: declare type for QAPISchemaObjectTypeMember.type A QAPISchemaObjectTypeMember's type gets resolved only during .check(). We have QAPISchemaObjectTypeMember.__init__() initialize self.type = None, and .check() assign the actual type. Using .type before .check() is wrong, and hopefully crashes due to the value being None. Works. However, it makes for awkward typing. With .type: Optional[QAPISchemaType], mypy is of course unable to see that it's None before .check(), and a QAPISchemaType after. To help it over the hump, we'd have to assert self.type is not None before all the (valid) uses. The assertion catches invalid uses, but only at run time; mypy can't flag them. Instead, declare .type in .__init__() as QAPISchemaType *without* initializing it. Using .type before .check() now certainly crashes, which is an improvement. Mypy still can't flag invalid uses, but that's okay. Addresses typing errors such as these: qapi/schema.py:657: error: "None" has no attribute "alternate_qtype" [attr-defined] qapi/schema.py:662: error: "None" has no attribute "describe" [attr-defined] Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-7-arm...@redhat.com> Commit: 578cd9329b2c5beac55a8a8c672f96bd40cc183f https://github.com/qemu/qemu/commit/578cd9329b2c5beac55a8a8c672f96bd40cc183f Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: declare type for QAPISchemaArrayType.element_type A QAPISchemaArrayType's element type gets resolved only during .check(). We have QAPISchemaArrayType.__init__() initialize self.element_type = None, and .check() assign the actual type. Using .element_type before .check() is wrong, and hopefully crashes due to the value being None. Works. However, it makes for awkward typing. With .element_type: Optional[QAPISchemaType], mypy is of course unable to see that it's None before .check(), and a QAPISchemaType after. To help it over the hump, we'd have to assert self.element_type is not None before all the (valid) uses. The assertion catches invalid uses, but only at run time; mypy can't flag them. Instead, declare .element_type in .__init__() as QAPISchemaType *without* initializing it. Using .element_type before .check() now certainly crashes, which is an improvement. Mypy still can't flag invalid uses, but that's okay. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-8-arm...@redhat.com> Commit: d150be3d54e4df04948b7205f7ccdde5a84f0684 https://github.com/qemu/qemu/commit/d150be3d54e4df04948b7205f7ccdde5a84f0684 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: make c_type() and json_type() abstract methods These methods should always return a str, it's only the default abstract implementation that doesn't. They can be marked "abstract", which requires subclasses to override the method with the proper return type. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-9-arm...@redhat.com> Commit: 9bda6c7d1108c13be67e615b50f5d1b61fa3177e https://github.com/qemu/qemu/commit/9bda6c7d1108c13be67e615b50f5d1b61fa3177e Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: adjust type narrowing for mypy's benefit We already take care to perform some type narrowing for arg_type and ret_type, but not in a way where mypy can utilize the result once we add type hints, e.g.: qapi/schema.py:833: error: Incompatible types in assignment (expression has type "QAPISchemaType", variable has type "Optional[QAPISchemaObjectType]") [assignment] qapi/schema.py:893: error: Incompatible types in assignment (expression has type "QAPISchemaType", variable has type "Optional[QAPISchemaObjectType]") [assignment] A simple change to use a temporary variable helps the medicine go down. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-10-arm...@redhat.com> Commit: 10755a9536eaf134f86df1d32a47ee8b07c2f1b9 https://github.com/qemu/qemu/commit/10755a9536eaf134f86df1d32a47ee8b07c2f1b9 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: add type narrowing to lookup_type() This function is a bit hard to type as-is; mypy needs some assertions to assist with the type narrowing. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-11-arm...@redhat.com> Commit: 802a3e3f74fa0dccf5f2e2198647e5fc15af8c5f https://github.com/qemu/qemu/commit/802a3e3f74fa0dccf5f2e2198647e5fc15af8c5f Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: assert resolve_type has 'info' and 'what' args on error resolve_type() is generally used to resolve configuration-provided type names into type objects, and generally requires valid 'info' and 'what' parameters. In some cases, such as with QAPISchemaArrayType.check(), resolve_type may be used to resolve built-in types and as such will not have an 'info' argument, but also must not fail in this scenario. Use an assertion to sate mypy that we will indeed have 'info' and 'what' parameters for the error pathway in resolve_type. Note: there are only three callsites to resolve_type at present where "info" is perceived by mypy to be possibly None: 1) QAPISchemaArrayType.check() 2) QAPISchemaObjectTypeMember.check() 3) QAPISchemaEvent.check() Of those three, only the first actually ever passes None; the other two are limited by their base class initializers which accept info=None, but neither subclass actually use a None value in practice, currently. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-12-arm...@redhat.com> Commit: 7191400a44c4eef49d2af356e0744bfb5d273046 https://github.com/qemu/qemu/commit/7191400a44c4eef49d2af356e0744bfb5d273046 Author: Markus Armbruster <arm...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/introspect.py Log Message: ----------- qapi: Assert built-in types exist QAPISchema.lookup_type('FOO') returns a QAPISchemaType when type 'FOO' exists, else None. It won't return None for built-in types like 'int'. Since mypy can't see that, it'll complain that we assign the Optional[QAPISchemaType] returned by .lookup_type() to QAPISchemaType variables. Add assertions to help it over the hump. Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-13-arm...@redhat.com> Reviewed-by: John Snow <js...@redhat.com> Commit: 8c91329ff09cec94dac22b459cc9914a7f49c54a https://github.com/qemu/qemu/commit/8c91329ff09cec94dac22b459cc9914a7f49c54a Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type Adjust the expression at the callsite to work around mypy's weak type introspection that believes this expression can resolve to QAPISourceInfo; it cannot. (Fundamentally: self.info only resolves to false in a boolean expression when it is None; therefore this expression may only ever produce Optional[str]. mypy does not know that 'info', when it is a QAPISourceInfo object, cannot ever be false.) Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-14-arm...@redhat.com> Commit: 8b9e7fd3b38d4e0fb9311752a5b44b71cd8fbbc1 https://github.com/qemu/qemu/commit/8b9e7fd3b38d4e0fb9311752a5b44b71cd8fbbc1 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: assert info is present when necessary QAPISchemaInfo arguments can often be None because built-in definitions don't have such information. The type hint can only be Optional[QAPISchemaInfo] then. But, mypy gets upset about all the places where we exploit that it can't actually be None there. Add assertions that will help mypy over the hump, to enable adding type hints in a forthcoming commit. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-15-arm...@redhat.com> Commit: 875f6242321a63b3599e0cf6f0694adf8d855799 https://github.com/qemu/qemu/commit/875f6242321a63b3599e0cf6f0694adf8d855799 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: add _check_complete flag Instead of using the None value for the members field, use a dedicated flag to detect recursive misconfigurations. This is intended to assist with subsequent patches that seek to remove the "None" value from the members field (which can never hold that value after the final call to check()) in order to simplify the static typing of that field; avoiding the need of assertions littered at many callsites to eliminate the possibility of the None value. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-16-arm...@redhat.com> Commit: 9beda22dcbd93150c822d651322f62e45eab25bb https://github.com/qemu/qemu/commit/9beda22dcbd93150c822d651322f62e45eab25bb Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: Don't initialize "members" with `None` Declare, but don't initialize the "members" field with type List[QAPISchemaObjectTypeMember]. This simplifies the typing from what would otherwise be Optional[List[T]] to merely List[T]. This removes the need to add assertions to several callsites that this value is not None - which it never will be after the delayed initialization in check() anyway. The type declaration without initialization trick will cause accidental uses of this field prior to full initialization to raise an AttributeError. (Note that it is valid to have an empty members list, see the internal q_empty object as an example. For this reason, we cannot use the empty list as a replacement test for full initialization and instead rely on the _checked/_check_complete fields.) Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-17-arm...@redhat.com> Commit: 583f4d6fdd96f0f25f39018a9b160654e3f9aa01 https://github.com/qemu/qemu/commit/583f4d6fdd96f0f25f39018a9b160654e3f9aa01 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: fix typing for QAPISchemaVariants.tag_member There are two related changes here: (1) We need to perform type narrowing for resolving the type of tag_member during check(), and (2) tag_member is a delayed initialization field, but we can hide it behind a property that raises an Exception if it's called too early. This simplifies the typing in quite a few places and avoids needing to assert that the "tag_member is not None" at a dozen callsites, which can be confusing and suggest the wrong thing to a drive-by contributor. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-18-arm...@redhat.com> Commit: 7e09dd686f9dc8ee75453fc400e0366cd4c9d3e2 https://github.com/qemu/qemu/commit/7e09dd686f9dc8ee75453fc400e0366cd4c9d3e2 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: assert inner type of QAPISchemaVariants in check_clash() QAPISchemaVariant's "variants" field is typed as List[QAPISchemaVariant], where the typing for QAPISchemaVariant allows its type field to be any QAPISchemaType. However, QAPISchemaVariant expects that all of its variants contain the narrower QAPISchemaObjectType. This relationship is enforced at runtime in QAPISchemaVariants.check(). This relationship is not embedded in the type system though, so QAPISchemaVariants.check_clash() needs to re-assert this property in order to call QAPISchemaVariant.type.check_clash(). Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-19-arm...@redhat.com> Commit: 7c6e446476ddcaa9c587c13f7815d14f8866ecea https://github.com/qemu/qemu/commit/7c6e446476ddcaa9c587c13f7815d14f8866ecea Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/parser.py Log Message: ----------- qapi/parser: demote QAPIExpression to Dict[str, Any] Dict[str, object] is a stricter type, but with the way that code is currently arranged, it is infeasible to enforce this strictness. In particular, although expr.py's entire raison d'être is normalization and type-checking of QAPI Expressions, that type information is not "remembered" in any meaningful way by mypy because each individual expression is not downcast to a specific expression type that holds all the details of each expression's unique form. As a result, all of the code in schema.py that deals with actually creating type-safe specialized structures has no guarantee (myopically) that the data it is being passed is correct. There are two ways to solve this: (1) Re-assert that the incoming data is in the shape we expect it to be, or (2) Disable type checking for this data. (1) is appealing to my sense of strictness, but I gotta concede that it is asinine to re-check the shape of a QAPIExpression in schema.py when expr.py has just completed that work at length. The duplication of code and the nightmare thought of needing to update both locations if and when we change the shape of these structures makes me extremely reluctant to go down this route. (2) allows us the chance to miss updating types in the case that types are updated in expr.py, but it *is* an awful lot simpler and, importantly, gets us closer to type checking schema.py *at all*. Something is better than nothing, I'd argue. So, do the simpler dumber thing and worry about future strictness improvements later. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-20-arm...@redhat.com> Commit: d5e2f3d03c38db716b3f18927626facc8233830c https://github.com/qemu/qemu/commit/d5e2f3d03c38db716b3f18927626facc8233830c Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/parser.py Log Message: ----------- qapi/parser.py: assert member.info is present in connect_member Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-21-arm...@redhat.com> Commit: 4ed3fe08222abcf4f3d15a9b810ded0790123b2e https://github.com/qemu/qemu/commit/4ed3fe08222abcf4f3d15a9b810ded0790123b2e Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: add type hints This patch only adds type hints, which aren't utilized at runtime and don't change the behavior of this module in any way. In a scant few locations, type hints are removed where no longer necessary due to inference power from typing all of the rest of creation; and any type hints that no longer need string quotes are changed. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-22-arm...@redhat.com> Commit: aa1fed9f54e11ae3e923bc12affbbcb31b997c76 https://github.com/qemu/qemu/commit/aa1fed9f54e11ae3e923bc12affbbcb31b997c76 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/mypy.ini Log Message: ----------- qapi/schema: turn on mypy strictness This patch can be rolled in with the previous one once the series is ready for merge, but for work-in-progress' sake, it's separate here. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-23-arm...@redhat.com> Commit: 8d413dbd5d369edd4b16e341dafbdde843397660 https://github.com/qemu/qemu/commit/8d413dbd5d369edd4b16e341dafbdde843397660 Author: John Snow <js...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi/schema: remove unnecessary asserts With strict typing enabled, these runtime statements aren't necessary anymore; we can prove them statically. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-24-arm...@redhat.com> Commit: 99e75d8c2a9fd13e8a2c0eb0718359b06445d38b https://github.com/qemu/qemu/commit/99e75d8c2a9fd13e8a2c0eb0718359b06445d38b Author: Markus Armbruster <arm...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi: Tighten check whether implicit object type already exists Entities with names starting with q_obj_ are implicit object types. Therefore, QAPISchema._make_implicit_object_type()'s .lookup_entity() can only return a QAPISchemaObjectType. Assert that. Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-25-arm...@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org> Reviewed-by: John Snow <js...@redhat.com> Commit: 060b5a9323e5f49c5edcb77c42e231065bbcc42e https://github.com/qemu/qemu/commit/060b5a9323e5f49c5edcb77c42e231065bbcc42e Author: Markus Armbruster <arm...@redhat.com> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/schema.py Log Message: ----------- qapi: Dumb down QAPISchema.lookup_entity() QAPISchema.lookup_entity() takes an optional type argument, a subtype of QAPISchemaDefinition, and returns that type or None. Callers can use this to save themselves an isinstance() test. The only remaining user of this convenience feature is .lookup_type(). But we don't actually save anything anymore there: we still need the isinstance() to help mypy over the hump. Drop the .lookup_entity() argument, and adjust .lookup_type(). Signed-off-by: Markus Armbruster <arm...@redhat.com> Message-ID: <20240315152301.3621858-26-arm...@redhat.com> Reviewed-by: John Snow <js...@redhat.com> [Commit message typo fixed] Commit: 1e0a7549e1f93112a2c0c08d95eb16b604d32cca https://github.com/qemu/qemu/commit/1e0a7549e1f93112a2c0c08d95eb16b604d32cca Author: Richard Henderson <richard.hender...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M backends/iommufd.c M block/snapshot.c M blockdev.c M chardev/char-fe.c M hw/core/qdev-properties.c M hw/core/qdev.c M hw/ppc/spapr_pci.c M include/qapi/qmp/qerror.h M migration/migration.c M migration/options.c M migration/savevm.c M qapi/opts-visitor.c M qapi/qobject-input-visitor.c M qapi/string-input-visitor.c M qom/object.c M scripts/qapi/visit.py M system/qdev-monitor.c M system/rtc.c M util/qemu-option.c Log Message: ----------- Merge tag 'pull-error-2024-04-24' of https://repo.or.cz/qemu/armbru into staging Error reporting patches for 2024-04-24 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmYouloSHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZTzLwP+wQjCWJHpTB+uQ3+U5Tb77BUJxuEjDMj # txNIJBXHOo7erxTSCieLuQICm8e30z62QAK4nVStyMDcyGh1KfwdSDAxBFnuLpA2 # 7X5bXbvCrm4vXVASRTV1zKCYDlIXFfrMWLvN5KgM90RsodLcy0szlXg+qYyoIM3Z # 8zp0Ug0fQPFHiOAQJi9ZTOsCYJBhZc2sbzgQEmf/g6q9bJaZHzPEHvVT4AQhTAtn # 7BIJY+vGDZNZwbP/0obWy2lai3kbGak8OXpwq/bewdrxeRmvqmM7sk+V/P2tXQD+ # kZe0/HWuDoO5J8L3KHiJnBJ0KCk8fbo4I0T6v9vf55Sj8K0r7O9sykgXXWv8q0lO # GrQa0YcyWAckI41stYQpwEpIlRanuZv/p8OZFJIqsTAfaw7RlbIBYA9xZCUnTton # FbHO/t2BLfo8eO9/xRD4r1u6vMbVozImPETuUMPyLHzlrdw2thxddKQNInHYYZ2U # SvvaByceEP2UywOnOflZhVL2dIhhnrBztiW2Vqod1fQHpfBAcJn909PZIlPZyMkr # gUnABI/rtC/lW3pBee6HmfzJ6Fah0e0XCpCY20qFe27Bi/z3xKi5NWYuyAUG5csp # CuTsc4pXfPVj5Z+Mk4pyY8PK5k4jSa7vAVLCLTNzXJLZlJTb6yuf0HsJ7768nHDc # hSEIjLwQWYtw # =r8Rv # -----END PGP SIGNATURE----- # gpg: Signature made Wed 24 Apr 2024 12:52:58 AM PDT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "arm...@redhat.com" # gpg: Good signature from "Markus Armbruster <arm...@redhat.com>" [undefined] # gpg: aka "Markus Armbruster <arm...@pond.sub.org>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-error-2024-04-24' of https://repo.or.cz/qemu/armbru: qapi: Inline and remove QERR_PROPERTY_VALUE_BAD definition qapi: Inline and remove QERR_MIGRATION_ACTIVE definition qapi: Correct error message for 'vcpu_dirty_limit' parameter qapi: Inline and remove QERR_INVALID_PARAMETER_TYPE definition qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value) qapi: Inline and remove QERR_INVALID_PARAMETER definition qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition qapi: Inline and remove QERR_DEVICE_HAS_NO_MEDIUM definition qapi: Inline and remove QERR_BUS_NO_HOTPLUG definition error: Drop superfluous #include "qapi/qmp/qerror.h" Signed-off-by: Richard Henderson <richard.hender...@linaro.org> Commit: bffc14efd9219bc11fed568f1dbd70f03be3103a https://github.com/qemu/qemu/commit/bffc14efd9219bc11fed568f1dbd70f03be3103a Author: Richard Henderson <richard.hender...@linaro.org> Date: 2024-04-24 (Wed, 24 Apr 2024) Changed paths: M scripts/qapi/introspect.py M scripts/qapi/mypy.ini M scripts/qapi/parser.py M scripts/qapi/pylintrc M scripts/qapi/schema.py Log Message: ----------- Merge tag 'pull-qapi-2024-04-24' of https://repo.or.cz/qemu/armbru into staging QAPI patches patches for 2024-04-24 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmYovX4SHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZT0RQP/1R1oOSdfWmiSR5gdW+IDE88VrjNY+Md # lZJ7dTtbIDbwABP6s7/wGIxlc4bf6lwIwhWNnfOa+y71jJ/u9aX2Q6D8wHY5lQnu # b8jhzoP3UyB+LQV5TTX1nTqTaO72Bj0pxw/0/DeKCzg7kgjys06a1Ln9P0oyWs6x # li/Cs133wPtZ5rISqif5yOmssber0h2D584k5MN2VK7eaGidLioQQIRmSDikPE6Z # TpnOEqySInIFhPJmm77il19ZDpCrgdCoD7lXoqX1C6XScYz7dU+m/TaToFk1lECw # VstR2SJT39TzbOLdis1O5/vsLP0QfciMRQbUktSrf4jQHumrkSa/OE6xKwJC3x82 # axJWc+BygcosylKc5CYVzwSlHugHw6Lf39qui//yzi5CXakzO6owKX7Q8AcH3PPy # 6thncy0dvw1ggq/BZGYhjyG+6MXBCWipPGVXFp9Gf2cAayTALhwyNtPvDNX57fzT # UZA/fa+/Wc9xZv1YAnxLaKyo4o65YWXVnq1eHXV17ny08BzZNYOC2ZuXim+rMThM # lxzcrTkrMLgsGXetp59uhZw9JRnVvaxLqNXfC2bwpoRzXzuifvnPithl6nkSm1YB # TvHGZZdO3B498kOW6947KrMVFh3t4aNWkdbOyetAMECy71H3Q4CTHYGFa5TzXT9O # Rjz31NYdVNBE # =uyfg # -----END PGP SIGNATURE----- # gpg: Signature made Wed 24 Apr 2024 01:06:22 AM PDT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "arm...@redhat.com" # gpg: Good signature from "Markus Armbruster <arm...@redhat.com>" [undefined] # gpg: aka "Markus Armbruster <arm...@pond.sub.org>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-qapi-2024-04-24' of https://repo.or.cz/qemu/armbru: (25 commits) qapi: Dumb down QAPISchema.lookup_entity() qapi: Tighten check whether implicit object type already exists qapi/schema: remove unnecessary asserts qapi/schema: turn on mypy strictness qapi/schema: add type hints qapi/parser.py: assert member.info is present in connect_member qapi/parser: demote QAPIExpression to Dict[str, Any] qapi/schema: assert inner type of QAPISchemaVariants in check_clash() qapi/schema: fix typing for QAPISchemaVariants.tag_member qapi/schema: Don't initialize "members" with `None` qapi/schema: add _check_complete flag qapi/schema: assert info is present when necessary qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type qapi: Assert built-in types exist qapi/schema: assert resolve_type has 'info' and 'what' args on error qapi/schema: add type narrowing to lookup_type() qapi/schema: adjust type narrowing for mypy's benefit qapi/schema: make c_type() and json_type() abstract methods qapi/schema: declare type for QAPISchemaArrayType.element_type qapi/schema: declare type for QAPISchemaObjectTypeMember.type ... Signed-off-by: Richard Henderson <richard.hender...@linaro.org> Compare: https://github.com/qemu/qemu/compare/0ac9dc900fc1...bffc14efd921 To unsubscribe from these emails, change your notification settings at https://github.com/qemu/qemu/settings/notifications