]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: query and cache static/host deprecated features
authorCollin Walling <walling@linux.ibm.com>
Thu, 20 Nov 2025 22:34:42 +0000 (17:34 -0500)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 21 Nov 2025 15:17:31 +0000 (16:17 +0100)
When performing a static CPU model expansion, the reported list of
deprecated features will reflect the features which are currently
enabled on the CPU model.

Retrieve this subset and store them as static deprecated properties for
the model info, and as host deprecated features in the cache.

Note that this list may exclude items that are shown in the
<deprecatedFeatures> list, as some feature support has been dropped by
hardware (e.g. csske).

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
tests/qemucapabilitiesdata/caps_10.0.0_s390x.xml
tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml
tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml

index 3243ba8ad3c62ce5889a5f0c80f106ff8ee9bc17..2dfdedfa1a89ae7ded8c61e0cc9c6a1aa1501a3f 100644 (file)
@@ -4234,7 +4234,9 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps,
 
     ctxt->node = hostCPUNode;
     if (virQEMUCapsParseHostCPUModelInfoDepFeats(ctxt, &hostCPU->full_dep_props,
-                                                "./deprecatedFeatures") < 0) {
+                                                "./deprecatedFeatures") < 0 ||
+        virQEMUCapsParseHostCPUModelInfoDepFeats(ctxt, &hostCPU->static_dep_props,
+                                                "./hostDeprecatedFeatures") < 0) {
         return -1;
     }
 
@@ -5017,6 +5019,8 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *caps,
 
     virQEMUCapsFormatHostCPUModelInfoDepFeats(buf, model->full_dep_props,
                                               "deprecatedFeatures");
+    virQEMUCapsFormatHostCPUModelInfoDepFeats(buf, model->static_dep_props,
+                                              "hostDeprecatedFeatures");
 
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</hostCPU>\n");
index bcedd96f4eb910a8c054429ce0c018eb158f6344..504500c864d1f458327de6777f6b55ee0c69c226 100644 (file)
@@ -3375,6 +3375,7 @@ qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfo *model_info)
     }
 
     g_strfreev(model_info->full_dep_props);
+    g_strfreev(model_info->static_dep_props);
     g_free(model_info->props);
     g_free(model_info->name);
     g_free(model_info);
@@ -3420,6 +3421,7 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig)
     }
 
     copy->full_dep_props = g_strdupv(orig->full_dep_props);
+    copy->static_dep_props = g_strdupv(orig->static_dep_props);
 
     return copy;
 }
index 6cd93297879d24b273bbf913f0a9f9c99f72ad4b..d096f474c1a50cdfde13939a3251d95c3f44b31f 100644 (file)
@@ -1431,6 +1431,7 @@ struct _qemuMonitorCPUModelInfo {
     size_t nprops;
     qemuMonitorCPUProperty *props;
     GStrv full_dep_props;   /* deprecated properties resulting from a full model expansion */
+    GStrv static_dep_props; /* deprecated properties resulting from a static model expansion */
     bool migratability;
 };
 
index e911c1929cce25ac89dda3e4fbb021c0b34ffc1b..494d7ef515576a6de786c54abe62de8ac51f276c 100644 (file)
@@ -5392,19 +5392,32 @@ static int
 qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
                                       virJSONValue *cpu_props,
                                       virJSONValue *cpu_deprecated_props,
+                                      qemuMonitorCPUModelExpansionType type,
                                       qemuMonitorCPUModelInfo **model_info)
 {
     g_autoptr(qemuMonitorCPUModelInfo) expanded_model = NULL;
+    GStrv dep_props = NULL;
 
     if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model) < 0)
         return -1;
 
     if (cpu_deprecated_props &&
         virJSONValueArraySize(cpu_deprecated_props) &&
-        (!(expanded_model->full_dep_props = virJSONValueArrayToStringList(cpu_deprecated_props)))) {
+        (!(dep_props = virJSONValueArrayToStringList(cpu_deprecated_props)))) {
         return -1;
     }
 
+    switch (type) {
+    case QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC:
+        expanded_model->static_dep_props = dep_props;
+        break;
+
+    case QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL:
+    case QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL:
+        expanded_model->full_dep_props = dep_props;
+        break;
+    }
+
     *model_info = g_steal_pointer(&expanded_model);
     return 0;
 }
@@ -5509,7 +5522,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
 
     return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props,
                                                  cpu_deprecated_props,
-                                                 model_info);
+                                                 type, model_info);
 }
 
 
index 0e834544af2170424eeef738370e5cd6bdee3c8a..82a66a65246a60dcaf1318c28ee7c5bc62dcff7e 100644 (file)
       <property name='cte'/>
       <property name='csske'/>
     </deprecatedFeatures>
+    <hostDeprecatedFeatures>
+      <property name='bpb'/>
+      <property name='te'/>
+      <property name='cte'/>
+      <property name='csske'/>
+    </hostDeprecatedFeatures>
   </hostCPU>
   <cpu type='kvm' name='z13' typename='z13-s390x-cpu' usable='yes'/>
   <cpu type='kvm' name='z990.3' typename='z990.3-s390x-cpu' usable='yes'/>
index bdbb60a097e2c40a862f8a17f6959ad78afca754..b961f7980802a6587dc647b9804d7021ad3fa75e 100644 (file)
       <property name='cte'/>
       <property name='csske'/>
     </deprecatedFeatures>
+    <hostDeprecatedFeatures>
+      <property name='bpb'/>
+      <property name='te'/>
+      <property name='cte'/>
+      <property name='csske'/>
+    </hostDeprecatedFeatures>
   </hostCPU>
   <cpu type='kvm' name='z13' typename='z13-s390x-cpu' usable='yes'/>
   <cpu type='kvm' name='z990.3' typename='z990.3-s390x-cpu' usable='yes'/>
index 8da55b1c4e0c94d7c4741264b934623000010b09..e9f79261f7f0861e6ce96ad988c282ed13d43283 100644 (file)
       <property name='cte'/>
       <property name='csske'/>
     </deprecatedFeatures>
+    <hostDeprecatedFeatures>
+      <property name='bpb'/>
+      <property name='te'/>
+      <property name='cte'/>
+      <property name='csske'/>
+    </hostDeprecatedFeatures>
   </hostCPU>
   <cpu type='kvm' name='z13' typename='z13-s390x-cpu' usable='yes'/>
   <cpu type='kvm' name='z990.3' typename='z990.3-s390x-cpu' usable='yes'/>