Report the host-recommended CPU definition in the domaincapabilities.
Currently, only s390x supports this model, but the formatting remains
open if other archs decide to support this as well.
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
---
src/conf/domain_capabilities.c | 16 +++++++
src/conf/domain_capabilities.h | 1 +
src/conf/schemas/domaincaps.rng | 24 ++++++++++
src/qemu/qemu_capabilities.c | 8 ++++
tests/domaincapsdata/qemu_8.1.0.s390x.xml | 55 +++++++++++++++++++++++
5 files changed, 104 insertions(+)
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 2fa5756184..4b9019f252 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -450,6 +450,22 @@ virDomainCapsCPUFormat(virBuffer *buf,
virBufferAddLit(buf, "supported='no'/>\n");
}
+ if (cpu->hostRecommended) {
+ virBufferAsprintf(buf, "<mode name='%s' ",
+ virCPUModeTypeToString(VIR_CPU_MODE_HOST_RECOMMENDED));
+ if (cpu->hostRecommended) {
+ virBufferAddLit(buf, "supported='yes'>\n");
+ virBufferAdjustIndent(buf, 2);
+
+ virCPUDefFormatBuf(buf, cpu->hostRecommended);
+
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</mode>\n");
+ } else {
+ virBufferAddLit(buf, "supported='no'/>\n");
+ }
+ }
+
virBufferAsprintf(buf, "<mode name='%s' ",
virCPUModeTypeToString(VIR_CPU_MODE_CUSTOM));
if (cpu->custom && cpu->custom->nmodels) {
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 01bcfa2e39..893101ee97 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -201,6 +201,7 @@ struct _virDomainCapsCPU {
bool maximum;
virDomainCapsEnum maximumMigratable;
virCPUDef *hostModel;
+ virCPUDef *hostRecommended;
virDomainCapsCPUModels *custom;
};
diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng
index 99ef148d44..91657555dd 100644
--- a/src/conf/schemas/domaincaps.rng
+++ b/src/conf/schemas/domaincaps.rng
@@ -93,6 +93,9 @@
<ref name="cpuHost"/>
<ref name="cpuMax"/>
<ref name="cpuHostModel"/>
+ <optional>
+ <ref name="cpuHostRecModel"/>
+ </optional>
<ref name="cpuCustom"/>
</element>
</define>
@@ -142,6 +145,27 @@
</element>
</define>
+ <define name="cpuHostRecModel">
+ <element name="mode">
+ <attribute name="name">
+ <value>host-recommended</value>
+ </attribute>
+ <ref name="supported"/>
+ <optional>
+ <ref name="cpuModel"/>
+ <optional>
+ <ref name="cpuVendor"/>
+ </optional>
+ <optional>
+ <ref name="cpuMaxPhysAddr"/>
+ </optional>
+ <zeroOrMore>
+ <ref name="cpuFeature"/>
+ </zeroOrMore>
+ </optional>
+ </element>
+ </define>
+
<define name="cpuCustom">
<element name="mode">
<attribute name="name">
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d7096a08c2..6ac8aaf248 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6250,6 +6250,14 @@ virQEMUCapsFillDomainCPUCaps(virQEMUCaps *qemuCaps,
domCaps->cpu.custom = NULL;
}
}
+
+ if (virQEMUCapsIsCPUModeSupported(qemuCaps, hostarch, domCaps->virttype,
+ VIR_CPU_MODE_HOST_RECOMMENDED,
+ domCaps->machine)) {
+ virCPUDef *cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype,
+ VIR_QEMU_CAPS_HOST_CPU_RECOMMENDED);
+ domCaps->cpu.hostRecommended = virCPUDefCopy(cpu);
+ }
}
diff --git a/tests/domaincapsdata/qemu_8.1.0.s390x.xml b/tests/domaincapsdata/qemu_8.1.0.s390x.xml
index 37c7c3b8bf..68a456645c 100644
--- a/tests/domaincapsdata/qemu_8.1.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_8.1.0.s390x.xml
@@ -90,6 +90,61 @@
<feature policy='require' name='cmm'/>
<feature policy='require' name='vxpdeh2'/>
</mode>
+ <mode name='host-recommended' supported='yes'>
+ <model fallback='forbid'>gen16a-base</model>
+ <feature policy='require' name='nnpa'/>
+ <feature policy='require' name='aen'/>
+ <feature policy='require' name='cmmnt'/>
+ <feature policy='require' name='vxpdeh'/>
+ <feature policy='require' name='aefsi'/>
+ <feature policy='require' name='diag318'/>
+ <feature policy='disable' name='csske'/>
+ <feature policy='require' name='mepoch'/>
+ <feature policy='require' name='msa9'/>
+ <feature policy='require' name='msa8'/>
+ <feature policy='require' name='msa7'/>
+ <feature policy='require' name='msa6'/>
+ <feature policy='require' name='msa5'/>
+ <feature policy='require' name='msa4'/>
+ <feature policy='require' name='msa3'/>
+ <feature policy='require' name='msa2'/>
+ <feature policy='require' name='msa1'/>
+ <feature policy='require' name='sthyi'/>
+ <feature policy='require' name='edat'/>
+ <feature policy='require' name='ri'/>
+ <feature policy='require' name='deflate'/>
+ <feature policy='require' name='edat2'/>
+ <feature policy='require' name='etoken'/>
+ <feature policy='require' name='vx'/>
+ <feature policy='require' name='ipter'/>
+ <feature policy='require' name='pai'/>
+ <feature policy='require' name='paie'/>
+ <feature policy='require' name='mepochptff'/>
+ <feature policy='require' name='ap'/>
+ <feature policy='require' name='vxeh'/>
+ <feature policy='require' name='vxpd'/>
+ <feature policy='require' name='esop'/>
+ <feature policy='require' name='msa9_pckmo'/>
+ <feature policy='require' name='vxeh2'/>
+ <feature policy='require' name='esort'/>
+ <feature policy='require' name='apqi'/>
+ <feature policy='require' name='apft'/>
+ <feature policy='require' name='els'/>
+ <feature policy='require' name='iep'/>
+ <feature policy='require' name='apqci'/>
+ <feature policy='disable' name='cte'/>
+ <feature policy='require' name='ais'/>
+ <feature policy='disable' name='bpb'/>
+ <feature policy='require' name='gs'/>
+ <feature policy='require' name='ppa15'/>
+ <feature policy='require' name='zpci'/>
+ <feature policy='require' name='rdp'/>
+ <feature policy='require' name='sea_esop2'/>
+ <feature policy='require' name='beareh'/>
+ <feature policy='disable' name='te'/>
+ <feature policy='require' name='cmm'/>
+ <feature policy='require' name='vxpdeh2'/>
+ </mode>
<mode name='custom' supported='yes'>
<model usable='yes' vendor='IBM'>gen16a-base</model>
<model usable='yes' vendor='IBM'>gen16a</model>
--
2.41.0