[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 31/40] target/arm: Get and set class properties in the monito
From: |
Richard Henderson |
Subject: |
[RFC PATCH 31/40] target/arm: Get and set class properties in the monitor |
Date: |
Tue, 3 Jan 2023 10:16:37 -0800 |
Setting is not actually functional here, because it is always done
after the creation of the first object, and so will generate an error.
But at least it's a different error than 'Property not found'.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/monitor.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index ecdd5ee817..262785e713 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -89,7 +89,7 @@ QEMU_BUILD_BUG_ON(ARM_MAX_VQ > 16);
* will attempt to set them. If there are dependencies between features,
* then the order that considers those dependencies must be used.
*/
-static const char *cpu_model_advertised_features[] = {
+static const char * const cpu_model_advertised_features[] = {
"aarch64", "pmu", "sve",
"sve128", "sve256", "sve384", "sve512",
"sve640", "sve768", "sve896", "sve1024", "sve1152", "sve1280",
@@ -159,7 +159,7 @@ CpuModelExpansionInfo
*qmp_query_cpu_model_expansion(CpuModelExpansionType type,
}
}
- obj = object_new(object_class_get_name(oc));
+ obj = object_new_with_class(oc);
if (qdict_in) {
Visitor *visitor;
@@ -175,7 +175,10 @@ CpuModelExpansionInfo
*qmp_query_cpu_model_expansion(CpuModelExpansionType type,
i = 0;
while ((name = cpu_model_advertised_features[i++]) != NULL) {
if (qdict_get(qdict_in, name)) {
- if (!object_property_set(obj, name, visitor, &err)) {
+ ClassProperty *cp = class_property_find(oc, name);
+ if (cp
+ ? !class_property_set(oc, cp, visitor, &err)
+ : !object_property_set(obj, name, visitor, &err)) {
break;
}
}
@@ -207,12 +210,20 @@ CpuModelExpansionInfo
*qmp_query_cpu_model_expansion(CpuModelExpansionType type,
i = 0;
while ((name = cpu_model_advertised_features[i++]) != NULL) {
ObjectProperty *prop = object_property_find(obj, name);
- if (prop) {
- QObject *value;
+ QObject *value = NULL;
+ if (prop) {
assert(prop->get);
value = object_property_get_qobject(obj, name, &error_abort);
+ } else {
+ ClassProperty *cprop = class_property_find(oc, name);
+ if (cprop) {
+ assert(cprop->get);
+ value = class_property_get_qobject(oc, name, &error_abort);
+ }
+ }
+ if (value) {
qdict_put_obj(qdict_out, name, value);
}
}
--
2.34.1
- Re: [RFC PATCH 24/40] target/arm/hvf: Probe host into ARMCPUClass, (continued)
- [RFC PATCH 17/40] target/arm: Copy cp_regs from ARMCPUClass, Richard Henderson, 2023/01/03
- [RFC PATCH 22/40] target/arm: Hoist feature and dtb_compatible from KVM, HVF, Richard Henderson, 2023/01/03
- [RFC PATCH 25/40] target/arm/hvf: Use offsetof in hvf_arm_get_host_cpu_features, Richard Henderson, 2023/01/03
- [RFC PATCH 27/40] target/arm: Split out strongarm_class_init, Richard Henderson, 2023/01/03
- [RFC PATCH 28/40] target/arm: Split out xscale*_class_init, Richard Henderson, 2023/01/03
- [RFC PATCH 30/40] target/arm: Move feature bit propagation to class init, Richard Henderson, 2023/01/03
- [RFC PATCH 29/40] target/arm: Remove m-profile has_vfp and has_dsp properties, Richard Henderson, 2023/01/03
- [RFC PATCH 31/40] target/arm: Get and set class properties in the monitor,
Richard Henderson <=
- [RFC PATCH 32/40] target/arm: Move "midr" to class property, Richard Henderson, 2023/01/03
- [RFC PATCH 33/40] target/arm: Move "cntfrq" to class property, Richard Henderson, 2023/01/03
- [RFC PATCH 34/40] target/arm: Move "reset-hivecs" to class property, Richard Henderson, 2023/01/03
- [RFC PATCH 37/40] target/arm: Move "cfgend" to class property, Richard Henderson, 2023/01/03
- [RFC PATCH 36/40] target/arm: Move "has_el3" to class property, Richard Henderson, 2023/01/03
- [RFC PATCH 35/40] target/arm: Move "has_el2" to class property, Richard Henderson, 2023/01/03
- [RFC PATCH 38/40] target/arm: Move "vfp" and "neon" to class properties, Richard Henderson, 2023/01/03