aboutsummaryrefslogtreecommitdiff
path: root/target/s390x
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-03-12 16:55:56 +0000
committerPeter Maydell <peter.maydell@linaro.org>2024-03-12 16:55:56 +0000
commit441e0eefabbb6283223237a26f2a48c6a61db40a (patch)
tree1f26a5d0155561753ecac2c61b4fe4eea38f0e2a /target/s390x
parente692f9c6a681de1372a41999b14a947a553b6a1a (diff)
parent28054406715a90e3fab96d4a29190e8857e57fbc (diff)
downloadqemu-441e0eefabbb6283223237a26f2a48c6a61db40a.zip
qemu-441e0eefabbb6283223237a26f2a48c6a61db40a.tar.gz
qemu-441e0eefabbb6283223237a26f2a48c6a61db40a.tar.bz2
Merge tag 'pull-error-2024-03-12' of https://repo.or.cz/qemu/armbru into staging
Error reporting patches for 2024-03-12 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmXwWOYSHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZT+voP/jAEyPfbtwggKLHjSCkHchn/uUziLJ2o # //i7+ZV9soCizAEkW+AkIR17PsMCaRsa8W4AULLn+ZaDJNy1Vlj2WYIkgeFm/rba # AWfNXywIg7dLnj0Hd98nz13hPuP52hO9vpakPhcua9L6mmk1htdqbbGIFIIfbQhp # e6FM+sBEW44uGcZx+N0wMEpKF0F7RId/jzH4mfP35WE7CLaAr2EfTXFaadAM636e # QsrM8wuiNAPQeyXz14gxYTWAnnMGglM5WQ4hoxSGN0y8c007gvff5vMKc7vapn4/ # DdiYJqpq/DIWaiGL0Fl8Cpry3WrQ8UY0st745kCLF/f9nlL0GvnBGdLdUaap7lQZ # A/C1sDKNubAGwzcw643AhV73QHc9f5kDBdWIj5wj3k5DQmBmgKACzGs1edDVVB+2 # OaStqZZ/V9Q5gljjh6PiHEptTjPhsaftX7GGjbhXTJUDFB9GONSCEVwAdZZxJ0Pm # 6cQLtcIMtcjL4xXNz6niVZkxGT/zu4kqbZ01LudIqEQAnULwRiVpyjkCmReSAOPP # eBtkCQtn7WPlz4N3ZiV2+a1p4/e88KH9wvxF+XvPEJjgsdeUmxX44f82ouLPJzvE # fOXE11tRr41u9m+UmoinVo581CKYGlkRJlNQWQwFOmnXoKP2nPZzADxraihkCR5p # wT0Hz9uwJs94 # =6FSf # -----END PGP SIGNATURE----- # gpg: Signature made Tue 12 Mar 2024 13:30:14 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 * tag 'pull-error-2024-03-12' of https://repo.or.cz/qemu/armbru: target/loongarch: Fix query-cpu-model-expansion to reject props target: Improve error reporting for CpuModelInfo member @props target/i386: Fix query-cpu-model-expansion to reject props target: Simplify type checks for CpuModelInfo member @props Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/s390x')
-rw-r--r--target/s390x/cpu_models_sysemu.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c
index 63981bf..2d99218 100644
--- a/target/s390x/cpu_models_sysemu.c
+++ b/target/s390x/cpu_models_sysemu.c
@@ -17,7 +17,6 @@
#include "sysemu/kvm.h"
#include "qapi/error.h"
#include "qapi/visitor.h"
-#include "qapi/qmp/qerror.h"
#include "qapi/qobject-input-visitor.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qapi-commands-machine-target.h"
@@ -98,24 +97,16 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
}
static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
- Error **errp)
+ const char *info_arg_name, Error **errp)
{
Error *err = NULL;
- const QDict *qdict = NULL;
+ const QDict *qdict;
const QDictEntry *e;
Visitor *visitor;
ObjectClass *oc;
S390CPU *cpu;
Object *obj;
- if (info->props) {
- qdict = qobject_to(QDict, info->props);
- if (!qdict) {
- error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
- return;
- }
- }
-
oc = cpu_class_by_name(TYPE_S390_CPU, info->name);
if (!oc) {
error_setg(errp, "The CPU definition \'%s\' is unknown.", info->name);
@@ -135,13 +126,17 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
return;
}
- if (qdict) {
+ if (info->props) {
+ g_autofree const char *props_name = g_strdup_printf("%s.props",
+ info_arg_name);
+
visitor = qobject_input_visitor_new(info->props);
- if (!visit_start_struct(visitor, NULL, NULL, 0, errp)) {
+ if (!visit_start_struct(visitor, props_name, NULL, 0, errp)) {
visit_free(visitor);
object_unref(obj);
return;
}
+ qdict = qobject_to(QDict, info->props);
for (e = qdict_first(qdict); e; e = qdict_next(qdict, e)) {
if (!object_property_set(obj, e->key, visitor, &err)) {
break;
@@ -223,7 +218,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
bool delta_changes = false;
/* convert it to our internal representation */
- cpu_model_from_info(&s390_model, model, &err);
+ cpu_model_from_info(&s390_model, model, "model", &err);
if (err) {
error_propagate(errp, err);
return NULL;
@@ -261,12 +256,12 @@ CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *infoa,
S390CPUModel modela, modelb;
/* convert both models to our internal representation */
- cpu_model_from_info(&modela, infoa, &err);
+ cpu_model_from_info(&modela, infoa, "modela", &err);
if (err) {
error_propagate(errp, err);
return NULL;
}
- cpu_model_from_info(&modelb, infob, &err);
+ cpu_model_from_info(&modelb, infob, "modelb", &err);
if (err) {
error_propagate(errp, err);
return NULL;
@@ -338,13 +333,13 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa,
uint8_t max_gen;
/* convert both models to our internal representation */
- cpu_model_from_info(&modela, infoa, &err);
+ cpu_model_from_info(&modela, infoa, "modela", &err);
if (err) {
error_propagate(errp, err);
return NULL;
}
- cpu_model_from_info(&modelb, infob, &err);
+ cpu_model_from_info(&modelb, infob, "modelb", &err);
if (err) {
error_propagate(errp, err);
return NULL;