[libvirt PATCH v2 2/2] conf: Adjust hyperv tlbflush formatting

Ján Tomko posted 2 patches 2 weeks ago
[libvirt PATCH v2 2/2] conf: Adjust hyperv tlbflush formatting
Posted by Ján Tomko 2 weeks ago
From: Martin Kletzander <mkletzan@redhat.com>

Commit 247357cc292a added support for direct and extended modes for
tlbflush, but forgot to do the formatting as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/domain_conf.c                         | 11 ++++++++++-
 tests/qemuxmlconfdata/hyperv.x86_64-latest.xml |  5 ++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ba1b3a7398..af88d0bcfd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27974,7 +27974,6 @@ virDomainDefFormatFeatures(virBuffer *buf,
                 case VIR_DOMAIN_HYPERV_RESET:
                 case VIR_DOMAIN_HYPERV_FREQUENCIES:
                 case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
-                case VIR_DOMAIN_HYPERV_TLBFLUSH:
                 case VIR_DOMAIN_HYPERV_IPI:
                 case VIR_DOMAIN_HYPERV_EVMCS:
                 case VIR_DOMAIN_HYPERV_AVIC:
@@ -28004,6 +28003,16 @@ virDomainDefFormatFeatures(virBuffer *buf,
                     }
                     break;
 
+                case VIR_DOMAIN_HYPERV_TLBFLUSH:
+                    if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON)
+                        break;
+
+                    if (def->hyperv_tlbflush_direct == VIR_TRISTATE_SWITCH_ON)
+                        virBufferAddLit(&hypervChildBuf, "<direct state='on'/>\n");
+                    if (def->hyperv_tlbflush_extended == VIR_TRISTATE_SWITCH_ON)
+                        virBufferAddLit(&hypervChildBuf, "<extended state='on'/>\n");
+                    break;
+
                 case VIR_DOMAIN_HYPERV_LAST:
                     break;
                 }
diff --git a/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml b/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml
index 36d9161fa8..49537188af 100644
--- a/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml
@@ -22,7 +22,10 @@
       <vendor_id state='on' value='KVM Hv'/>
       <frequencies state='on'/>
       <reenlightenment state='on'/>
-      <tlbflush state='on'/>
+      <tlbflush state='on'>
+        <direct state='on'/>
+        <extended state='on'/>
+      </tlbflush>
       <ipi state='on'/>
       <evmcs state='on'/>
       <avic state='on'/>
-- 
2.47.0