[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu: hyperv: Add enlightenment support for TSC timekeeping



The hyperv enlightenment features allow to ease guests timekeeping by
allowing to store offset from the TSC as a reference. Add the support
for enabling this flag in qemu.
---

Notes:
    This feature is still under development in qemu. I will wait until it's finished before pushing this:
    
    http://lists.nongnu.org/archive/html/qemu-devel/2014-01/msg02569.html

 docs/formatdomain.html.in | 7 +++++++
 src/conf/domain_conf.c    | 6 +++++-
 src/conf/domain_conf.h    | 1 +
 src/qemu/qemu_command.c   | 2 ++
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ff50214..6e1f93a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1194,6 +1194,7 @@
     <hyperv>
       <relaxed state='on'/>
       <vapic state='on'/>
+      <time state='on'/>
       <spinlocks state='on' retries='4096'/>
     </hyperv>
     <pvspinlock/>
@@ -1266,6 +1267,12 @@
           <td>on, off; retries - at least 4095</td>
           <td><span class="since">1.1.0 (QEMU only)</span></td>
         </tr>
+        <tr>
+          <td>time</td>
+          <td>Ease timekeeping in guests by providing reference TSC offsets</td>
+          <td>on, off</td>
+          <td><span class="since">1.2.2 (QEMU only)</span></td>
+        </tr>
       </table>
       </dd>
       <dt><code>pvspinlock</code></dt>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 28e24f9..a3f7284 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -153,7 +153,8 @@ VIR_ENUM_IMPL(virDomainFeatureState, VIR_DOMAIN_FEATURE_STATE_LAST,
 VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
               "relaxed",
               "vapic",
-              "spinlocks")
+              "spinlocks",
+              "time")

 VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
               "destroy",
@@ -11720,6 +11721,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             switch ((enum virDomainHyperv) feature) {
                 case VIR_DOMAIN_HYPERV_RELAXED:
                 case VIR_DOMAIN_HYPERV_VAPIC:
+                case VIR_DOMAIN_HYPERV_TIME:
                     if (!(tmp = virXPathString("string(./@state)", ctxt))) {
                         virReportError(VIR_ERR_XML_ERROR,
                                        _("missing 'state' attribute for "
@@ -13744,6 +13746,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
             switch ((enum virDomainHyperv) i) {
             case VIR_DOMAIN_HYPERV_RELAXED:
             case VIR_DOMAIN_HYPERV_VAPIC:
+            case VIR_DOMAIN_HYPERV_TIME:
                 if (src->hyperv_features[i] != dst->hyperv_features[i]) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("State of HyperV enlightenment "
@@ -17226,6 +17229,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                     switch ((enum virDomainHyperv) j) {
                     case VIR_DOMAIN_HYPERV_RELAXED:
                     case VIR_DOMAIN_HYPERV_VAPIC:
+                    case VIR_DOMAIN_HYPERV_TIME:
                         if (def->hyperv_features[j])
                             virBufferAsprintf(buf, "      <%s state='%s'/>\n",
                                               virDomainHypervTypeToString(j),
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d8f2e49..2516341 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1658,6 +1658,7 @@ enum virDomainHyperv {
     VIR_DOMAIN_HYPERV_RELAXED = 0,
     VIR_DOMAIN_HYPERV_VAPIC,
     VIR_DOMAIN_HYPERV_SPINLOCKS,
+    VIR_DOMAIN_HYPERV_TIME,

     VIR_DOMAIN_HYPERV_LAST
 };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 96b8825..7cf9ec9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6779,6 +6779,7 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
             switch ((enum virDomainHyperv) i) {
             case VIR_DOMAIN_HYPERV_RELAXED:
             case VIR_DOMAIN_HYPERV_VAPIC:
+            case VIR_DOMAIN_HYPERV_TIME:
                 if (def->hyperv_features[i] == VIR_DOMAIN_FEATURE_STATE_ON)
                     virBufferAsprintf(&buf, ",hv_%s",
                                       virDomainHypervTypeToString(i));
@@ -10971,6 +10972,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
             switch ((enum virDomainHyperv) f) {
             case VIR_DOMAIN_HYPERV_RELAXED:
             case VIR_DOMAIN_HYPERV_VAPIC:
+            case VIR_DOMAIN_HYPERV_TIME:
                 if (value) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("HyperV feature '%s' should not "
-- 
1.8.5.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]