On Mon, May 21, 2018 at 05:00:51PM +0200, Martin Kletzander wrote:
TSEG (Top of Memory Segment) is one of many regions that SMM (System
Management
Mode) can occupy. This one, however is special, because a) most of the SMM code
lives in TSEG nowadays and b) QEMU just (well, some time ago) added support for
so called 'extended' TSEG. The difference to the TSEG implemented in real
q35's
MCH (Memory Controller Hub) is that it can have any size from 1 MiB up to 65534
MiB in 1 MiB increments. But more about that in the QEMU patch.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
docs/formatdomain.html.in | 39 +++++++++++++++++++
docs/schemas/domaincommon.rng | 5 +++
src/conf/domain_conf.c | 60 ++++++++++++++++++++++++++++-
src/conf/domain_conf.h | 1 +
tests/genericxml2xmlindata/tseg.xml | 23 +++++++++++
tests/genericxml2xmltest.c | 2 +
6 files changed, 129 insertions(+), 1 deletion(-)
create mode 100644 tests/genericxml2xmlindata/tseg.xml
@@ -27076,6 +27102,38 @@ virDomainDefFormatInternal(virDomainDefPtr def,
break;
+ case VIR_DOMAIN_FEATURE_SMM:
+ switch ((virTristateSwitch) def->features[i]) {
+ case VIR_TRISTATE_SWITCH_LAST:
+ case VIR_TRISTATE_SWITCH_ABSENT:
+ break;
+
+ case VIR_TRISTATE_SWITCH_ON:
+ virBufferAddLit(buf, "<smm state='on'");
+ if (!def->tseg_size) {
+ virBufferAddLit(buf, "/>\n");
+ } else {
+ const char *unit;
+ unsigned long long short_size =
virFormatIntPretty(def->tseg_size,
+ &unit);
+
+ virBufferAddLit(buf, ">\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferAsprintf(buf, "<tseg
unit='%s'>%llu</tseg>\n",
+ unit, short_size);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</smm>\n");
+ }
+
+ break;
+
+ case VIR_TRISTATE_SWITCH_OFF:
+ virBufferAddLit(buf, "<smm
state='off'/>\n");
+ break;
Consider using virXMLFormatElement.
Jano