[libvirt] [PATCH 3/5] conf, schema, docs: Add support for TSEG size setting

Ján Tomko jtomko at redhat.com
Wed May 30 17:53:51 UTC 2018


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180530/ed3888c0/attachment-0001.sig>


More information about the libvir-list mailing list