提交 0ee6f885 编写于 作者: A Andrea Bolognani

conf: Parse and format HPT maxpagesize

Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
上级 15f9db53
...@@ -1922,7 +1922,9 @@ ...@@ -1922,7 +1922,9 @@
&lt;pvspinlock state='on'/&gt; &lt;pvspinlock state='on'/&gt;
&lt;gic version='2'/&gt; &lt;gic version='2'/&gt;
&lt;ioapic driver='qemu'/&gt; &lt;ioapic driver='qemu'/&gt;
&lt;hpt resizing='required'/&gt; &lt;hpt resizing='required'&gt;
&lt;maxpagesize unit='MiB'&gt;16&lt;/maxpagesize&gt;
&lt;/hpt&gt;
&lt;vmcoreinfo state='on'/&gt; &lt;vmcoreinfo state='on'/&gt;
&lt;smm state='on'&gt; &lt;smm state='on'&gt;
&lt;tseg unit='MiB'&gt;48&lt;/tseg&gt; &lt;tseg unit='MiB'&gt;48&lt;/tseg&gt;
...@@ -2149,7 +2151,12 @@ ...@@ -2149,7 +2151,12 @@
support; and <code>required</code>, which prevents the guest from support; and <code>required</code>, which prevents the guest from
starting unless both the guest and the host support HPT resizing. If starting unless both the guest and the host support HPT resizing. If
the attribute is not defined, the hypervisor default will be used. the attribute is not defined, the hypervisor default will be used.
<span class="since">Since 3.10.0</span> (QEMU/KVM only) <span class="since">Since 3.10.0</span> (QEMU/KVM only).
<p>The optional <code>maxpagesize</code> subelement can be used to
limit the usable page size for HPT guests. Common values are 64 KiB,
16 MiB and 16 GiB; when not specified, the hypervisor default will
be used. <span class="since">Since 4.5.0</span> (QEMU/KVM only).</p>
</dd> </dd>
<dt><code>vmcoreinfo</code></dt> <dt><code>vmcoreinfo</code></dt>
<dd>Enable QEMU vmcoreinfo device to let the guest kernel save debug <dd>Enable QEMU vmcoreinfo device to let the guest kernel save debug
......
...@@ -5127,6 +5127,7 @@ ...@@ -5127,6 +5127,7 @@
<define name="hpt"> <define name="hpt">
<element name="hpt"> <element name="hpt">
<optional>
<attribute name="resizing"> <attribute name="resizing">
<choice> <choice>
<value>enabled</value> <value>enabled</value>
...@@ -5134,6 +5135,12 @@ ...@@ -5134,6 +5135,12 @@
<value>required</value> <value>required</value>
</choice> </choice>
</attribute> </attribute>
</optional>
<optional>
<element name="maxpagesize">
<ref name='scaledInteger'/>
</element>
</optional>
</element> </element>
</define> </define>
......
...@@ -19807,8 +19807,24 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -19807,8 +19807,24 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(tmp); VIR_FREE(tmp);
} }
if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE) if (virDomainParseScaledValue("./features/hpt/maxpagesize",
NULL,
ctxt,
&def->hpt_maxpagesize,
1024,
ULLONG_MAX,
false) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s",
_("Unable to parse HPT maxpagesize setting"));
goto error;
}
def->hpt_maxpagesize = VIR_DIV_UP(def->hpt_maxpagesize, 1024);
if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE ||
def->hpt_maxpagesize > 0) {
def->features[val] = VIR_TRISTATE_SWITCH_ON; def->features[val] = VIR_TRISTATE_SWITCH_ON;
}
break; break;
/* coverity[dead_error_begin] */ /* coverity[dead_error_begin] */
...@@ -21987,15 +22003,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, ...@@ -21987,15 +22003,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
case VIR_DOMAIN_FEATURE_HPT: case VIR_DOMAIN_FEATURE_HPT:
if (src->features[i] != dst->features[i] || if (src->features[i] != dst->features[i] ||
src->hpt_resizing != dst->hpt_resizing) { src->hpt_resizing != dst->hpt_resizing ||
src->hpt_maxpagesize != dst->hpt_maxpagesize) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of feature '%s' differs: " _("State of feature '%s' differs: "
"source: '%s,%s=%s', destination: '%s,%s=%s'"), "source: '%s,%s=%s,%s=%llu', destination: '%s,%s=%s,%s=%llu'"),
featureName, featureName,
virTristateSwitchTypeToString(src->features[i]), virTristateSwitchTypeToString(src->features[i]),
"resizing", virDomainHPTResizingTypeToString(src->hpt_resizing), "resizing", virDomainHPTResizingTypeToString(src->hpt_resizing),
"maxpagesize", src->hpt_maxpagesize,
virTristateSwitchTypeToString(dst->features[i]), virTristateSwitchTypeToString(dst->features[i]),
"resizing", virDomainHPTResizingTypeToString(dst->hpt_resizing)); "resizing", virDomainHPTResizingTypeToString(dst->hpt_resizing),
"maxpagesize", dst->hpt_maxpagesize);
return false; return false;
} }
break; break;
...@@ -27778,15 +27797,22 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -27778,15 +27797,22 @@ virDomainDefFormatInternal(virDomainDefPtr def,
break; break;
virBufferFreeAndReset(&attributeBuf); virBufferFreeAndReset(&attributeBuf);
virBufferFreeAndReset(&childrenBuf);
if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE) { if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE) {
virBufferAsprintf(&attributeBuf, virBufferAsprintf(&attributeBuf,
" resizing='%s'", " resizing='%s'",
virDomainHPTResizingTypeToString(def->hpt_resizing)); virDomainHPTResizingTypeToString(def->hpt_resizing));
} }
if (def->hpt_maxpagesize > 0) {
virBufferSetChildIndent(&childrenBuf, buf);
virBufferAsprintf(&childrenBuf,
"<maxpagesize unit='KiB'>%llu</maxpagesize>\n",
def->hpt_maxpagesize);
}
if (virXMLFormatElement(buf, "hpt", if (virXMLFormatElement(buf, "hpt",
&attributeBuf, NULL) < 0) { &attributeBuf, &childrenBuf) < 0) {
goto error; goto error;
} }
break; break;
......
...@@ -2439,6 +2439,7 @@ struct _virDomainDef { ...@@ -2439,6 +2439,7 @@ struct _virDomainDef {
unsigned int hyperv_spinlocks; unsigned int hyperv_spinlocks;
virGICVersion gic_version; virGICVersion gic_version;
virDomainHPTResizing hpt_resizing; virDomainHPTResizing hpt_resizing;
unsigned long long hpt_maxpagesize; /* Stored in KiB */
char *hyperv_vendor_id; char *hyperv_vendor_id;
int apic_eoi; int apic_eoi;
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
<type arch='ppc64' machine='pseries'>hvm</type> <type arch='ppc64' machine='pseries'>hvm</type>
</os> </os>
<features> <features>
<hpt resizing='required'/> <hpt resizing='required'>
<maxpagesize unit='GiB'>1</maxpagesize>
</hpt>
</features> </features>
<devices> <devices>
<emulator>/usr/bin/qemu-system-ppc64</emulator> <emulator>/usr/bin/qemu-system-ppc64</emulator>
......
...@@ -1849,6 +1849,7 @@ mymain(void) ...@@ -1849,6 +1849,7 @@ mymain(void)
DO_TEST("pseries-features", DO_TEST("pseries-features",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
DO_TEST_FAILURE("pseries-features", DO_TEST_FAILURE("pseries-features",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<boot dev='hd'/> <boot dev='hd'/>
</os> </os>
<features> <features>
<hpt resizing='required'/> <hpt resizing='required'>
<maxpagesize unit='KiB'>1048576</maxpagesize>
</hpt>
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
<on_poweroff>destroy</on_poweroff> <on_poweroff>destroy</on_poweroff>
......
...@@ -619,6 +619,7 @@ mymain(void) ...@@ -619,6 +619,7 @@ mymain(void)
DO_TEST("pseries-features", DO_TEST("pseries-features",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
DO_TEST("pseries-serial-native", DO_TEST("pseries-serial-native",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册