[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 28/28] s390x/cpumodel: implement QMP interface "query-
From: |
David Hildenbrand |
Subject: |
[Qemu-devel] [RFC 28/28] s390x/cpumodel: implement QMP interface "query-cpu-model-baseline" |
Date: |
Tue, 21 Jun 2016 15:02:33 +0200 |
Let's implement that interface by reusing our conversion code and
lookup code for cpu definitions.
Acked-by: Cornelia Huck <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target-s390x/cpu_models.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/target-s390x/cpu_models.c b/target-s390x/cpu_models.c
index 75d808b..56b945d 100644
--- a/target-s390x/cpu_models.c
+++ b/target-s390x/cpu_models.c
@@ -503,6 +503,67 @@ CpuModelCompareInfo
*arch_query_cpu_model_comparison(CpuModelInfo *infoa,
}
return compare_info;
}
+
+CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelBaselineType type,
+ CpuModelInfo *infoa,
+ CpuModelInfo *infob,
+ Error **errp)
+{
+ CpuModelBaselineInfo *baseline_info;
+ S390CPUModel modela, modelb, model;
+ uint16_t cpu_type;
+ uint8_t max_gen_ga;
+ uint8_t max_gen;
+
+ /* convert both models to our internal representation */
+ cpu_model_from_info(&modela, infoa, errp);
+ if (*errp) {
+ return NULL;
+ }
+
+ cpu_model_from_info(&modelb, infob, errp);
+ if (*errp) {
+ return NULL;
+ }
+
+ /* features both models support */
+ bitmap_and(model.features, modela.features, modelb.features,
S390_FEAT_MAX);
+
+ /* detect the maximum model not regarding features */
+ if (modela.def->gen == modelb.def->gen) {
+ if (modela.def->type == modelb.def->type) {
+ cpu_type = modela.def->type;
+ } else {
+ cpu_type = 0;
+ }
+ max_gen = modela.def->gen;
+ max_gen_ga = MIN(modela.def->ec_ga, modelb.def->ec_ga);
+ } else if (modela.def->gen > modelb.def->gen) {
+ cpu_type = modelb.def->type;
+ max_gen = modelb.def->gen;
+ max_gen_ga = modelb.def->ec_ga;
+ } else {
+ cpu_type = modela.def->type;
+ max_gen = modela.def->gen;
+ max_gen_ga = modela.def->ec_ga;
+ }
+
+ model.def = s390_find_cpu_def(cpu_type, max_gen, max_gen_ga,
+ model.features);
+ /* make sure we don't exceed full features of that vcpu */
+ if (type == CPU_MODEL_BASELINE_TYPE_STABLE) {
+ bitmap_and(model.features, model.features, model.def->default_feat,
+ S390_FEAT_MAX);
+ } else {
+ bitmap_and(model.features, model.features, model.def->full_feat,
+ S390_FEAT_MAX);
+ }
+
+ baseline_info = g_malloc0(sizeof(*baseline_info));
+ baseline_info->model = g_malloc0(sizeof(*baseline_info->model));
+ cpu_info_from_model(baseline_info->model, &model, true);
+ return baseline_info;
+}
#endif
static void check_consistency(const S390CPUModel *model)
--
2.6.6
- Re: [Qemu-devel] [RFC 06/28] s390x/cpumodel: introduce CPU feature group definitions, (continued)
- [Qemu-devel] [RFC 12/28] s390x/sclp: factor out preparation of cpu entries, David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 09/28] s390x/cpumodel: expose features and feature groups as properties, David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 18/28] update linux headers (CPU model), David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 24/28] qmp: add QMP interface "query-cpu-model-comparison", David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 21/28] s390x/kvm: disable host model for existing compat machines, David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 25/28] qmp: add QMP interface "query-cpu-model-baseline", David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 17/28] s390x/sclp: propagate hmfai, David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 16/28] s390x/sclp: propagate the mha via sclp, David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 28/28] s390x/cpumodel: implement QMP interface "query-cpu-model-baseline",
David Hildenbrand <=
- [Qemu-devel] [RFC 20/28] s390x/kvm: implement CPU model support, David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 26/28] s390x/cpumodel: implement QMP interface "query-cpu-model-expansion", David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 27/28] s390x/cpumodel: implement QMP interface "query-cpu-model-comparison", David Hildenbrand, 2016/06/21
- [Qemu-devel] [RFC 22/28] s390x/kvm: let the CPU model control CMM(A), David Hildenbrand, 2016/06/21
- Re: [Qemu-devel] [RFC 00/28] s390x CPU models: exposing features, Eduardo Habkost, 2016/06/21