[libvirt] [PATCH v2 2/5] conf: add support for Hyper-V PV IPIs

Vitaly Kuznetsov posted 5 patches 6 years ago
[libvirt] [PATCH v2 2/5] conf: add support for Hyper-V PV IPIs
Posted by Vitaly Kuznetsov 6 years ago
Support Hyper-V PV IPI enlightenment in domain config. Qemu support will
be implemented in the next patch, adding interim VIR_DOMAIN_HYPERV_IPI cases
to src/qemu/* for now.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 docs/formatdomain.html.in     | 7 +++++++
 docs/schemas/domaincommon.rng | 5 +++++
 src/conf/domain_conf.c        | 7 ++++++-
 src/conf/domain_conf.h        | 1 +
 src/cpu/cpu_x86.c             | 3 +++
 src/cpu/cpu_x86_data.h        | 1 +
 src/qemu/qemu_command.c       | 1 +
 src/qemu/qemu_parse_command.c | 1 +
 src/qemu/qemu_process.c       | 1 +
 9 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 28246deb63..7592f13a84 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1981,6 +1981,7 @@
     &lt;frequencies state='on'/&gt;
     &lt;reenlightenment state='on'/&gt;
     &lt;tlbflush state='on'/&gt;
+    &lt;ipi state='on'/&gt;
   &lt;/hyperv&gt;
   &lt;kvm&gt;
     &lt;hidden state='on'/&gt;
@@ -2121,6 +2122,12 @@
           <td>on, off</td>
           <td><span class="since">4.7.0 (QEMU 3.0)</span></td>
         </tr>
+        <tr>
+          <td>ipi</td>
+          <td>Enable PV IPI support</td>
+          <td>on, off</td>
+          <td><span class="since">4.10.0 (QEMU 3.1)</span></td>
+        </tr>
       </table>
       </dd>
       <dt><code>pvspinlock</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index b9ac5df479..26019b3279 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5769,6 +5769,11 @@
             <ref name="featurestate"/>
           </element>
         </optional>
+        <optional>
+          <element name="ipi">
+            <ref name="featurestate"/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e8e0adc819..24876994c5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -172,7 +172,9 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
               "vendor_id",
               "frequencies",
               "reenlightenment",
-              "tlbflush")
+              "tlbflush",
+              "ipi",
+);
 
 VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
               "hidden")
@@ -19990,6 +19992,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             case VIR_DOMAIN_HYPERV_FREQUENCIES:
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
+            case VIR_DOMAIN_HYPERV_IPI:
                 break;
 
             case VIR_DOMAIN_HYPERV_SPINLOCKS:
@@ -22184,6 +22187,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
             case VIR_DOMAIN_HYPERV_FREQUENCIES:
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
+            case VIR_DOMAIN_HYPERV_IPI:
                 if (src->hyperv_features[i] != dst->hyperv_features[i]) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("State of HyperV enlightenment "
@@ -27948,6 +27952,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                     case VIR_DOMAIN_HYPERV_FREQUENCIES:
                     case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
                     case VIR_DOMAIN_HYPERV_TLBFLUSH:
+                    case VIR_DOMAIN_HYPERV_IPI:
                         break;
 
                     case VIR_DOMAIN_HYPERV_SPINLOCKS:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e30a4b2fe7..9eea75548d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1795,6 +1795,7 @@ typedef enum {
     VIR_DOMAIN_HYPERV_FREQUENCIES,
     VIR_DOMAIN_HYPERV_REENLIGHTENMENT,
     VIR_DOMAIN_HYPERV_TLBFLUSH,
+    VIR_DOMAIN_HYPERV_IPI,
 
     VIR_DOMAIN_HYPERV_LAST
 } virDomainHyperv;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 69a0c8db28..33252e927e 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -114,6 +114,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT,
                 0x40000003, 0x00002000);
 KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_TLBFLUSH,
                 0x40000004, 0x00000004);
+KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_IPI,
+                0x40000004, 0x00000400);
 
 static virCPUx86Feature x86_kvm_features[] =
 {
@@ -137,6 +139,7 @@ static virCPUx86Feature x86_kvm_features[] =
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT),
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_TLBFLUSH),
+    KVM_FEATURE(VIR_CPU_x86_KVM_HV_IPI),
 };
 
 typedef struct _virCPUx86Model virCPUx86Model;
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
index e75b3a2d0d..8c51d88e1a 100644
--- a/src/cpu/cpu_x86_data.h
+++ b/src/cpu/cpu_x86_data.h
@@ -65,6 +65,7 @@ struct _virCPUx86CPUID {
 # define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
 # define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
 # define VIR_CPU_x86_KVM_HV_TLBFLUSH  "__kvm_hv_tlbflush"
+# define VIR_CPU_x86_KVM_HV_IPI       "__kvm_hv_ipi"
 
 
 # define VIR_CPU_X86_DATA_INIT { 0 }
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f59cbf559e..b4d3f1ee35 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6899,6 +6899,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
                                       def->hyperv_vendor_id);
                 break;
 
+            case VIR_DOMAIN_HYPERV_IPI:
             /* coverity[dead_error_begin] */
             case VIR_DOMAIN_HYPERV_LAST:
                 break;
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 5b4a378a18..ab418432af 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1579,6 +1579,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
 
                 break;
 
+            case VIR_DOMAIN_HYPERV_IPI:
             case VIR_DOMAIN_HYPERV_LAST:
                 break;
             }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1850923914..3291d3f439 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3958,6 +3958,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
                            virDomainHypervTypeToString(i));
             return -1;
 
+        case VIR_DOMAIN_HYPERV_IPI:
         /* coverity[dead_error_begin] */
         case VIR_DOMAIN_HYPERV_VENDOR_ID:
         case VIR_DOMAIN_HYPERV_LAST:
-- 
2.17.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/5] conf: add support for Hyper-V PV IPIs
Posted by Andrea Bolognani 6 years ago
On Wed, 2018-11-14 at 17:27 +0100, Vitaly Kuznetsov wrote:
> Support Hyper-V PV IPI enlightenment in domain config. Qemu support will

s/Qemu/QEMU/

> be implemented in the next patch, adding interim VIR_DOMAIN_HYPERV_IPI cases
> to src/qemu/* for now.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  docs/formatdomain.html.in     | 7 +++++++
>  docs/schemas/domaincommon.rng | 5 +++++
>  src/conf/domain_conf.c        | 7 ++++++-
>  src/conf/domain_conf.h        | 1 +
>  src/cpu/cpu_x86.c             | 3 +++
>  src/cpu/cpu_x86_data.h        | 1 +
>  src/qemu/qemu_command.c       | 1 +
>  src/qemu/qemu_parse_command.c | 1 +
>  src/qemu/qemu_process.c       | 1 +
>  9 files changed, 26 insertions(+), 1 deletion(-)

So, personally I don't feel like splitting the patch into two really
improves the situation - actually the opposite, since now as you
mention in the commit message you have to go out of your way to add
placeholders only to remove them in the next commit.

But it's really not a big deal either way, so you can leave it as-is
and, with the commit message fixed, still get a

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list