[PATCH v2 1/2] qemu: add panic device support for S390

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

 



If a panic device is being defined without a model in a domain
the default value is always overwritten with model ISA. An ISA
bus does not exist on S390 and therefore specifying a panic device
results in an unsupported configuration.
Since the S390 architecture inherently provides a crash detection
capability the panic device should be defined in the domain xml.

This patch addes an s390 panic device model, prevents setting a
device address and by default adds a panic device for S390 guests.

Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Cornelia Huck <cornelia.huck@xxxxxxxxxx>
---
 docs/formatdomain.html.in     |  7 ++++++-
 docs/schemas/domaincommon.rng |  1 +
 src/conf/domain_conf.c        |  3 ++-
 src/conf/domain_conf.h        |  1 +
 src/qemu/qemu_command.c       | 21 ++++++++++++++++++++-
 src/qemu/qemu_domain.c        |  9 ++++++++-
 6 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c2955eb..10c27fb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6242,6 +6242,9 @@ qemu-kvm -net nic,model=? /dev/null
       For pSeries guests, this feature is always enabled since it's
       implemented by the guest firmware, thus libvirt automatically
       adds the <code>panic</code> element to the domain XML.
+      For S390 guests, this feature is always enabled since it's an
+      integral part of the S390 architecture, thus libvirt automatically
+      adds the <code>panic</code> element to the domain XML.
     </p>
     <p>
       Example: usage of panic configuration
@@ -6269,6 +6272,8 @@ qemu-kvm -net nic,model=? /dev/null
           <li>'pseries' &mdash; default and valid only for pSeries guests.</li>
           <li>'hyperv' &mdash; for Hyper-V crash CPU feature.
             <span class="since">Since 1.3.0, QEMU and KVM only</span></li>
+          <li>'s390' &mdash; default for S390 guests.
+            <span class="since">Since 1.3.4</span></li>
         </ul>
       </dd>
     <dt><code>address</code></dt>
@@ -6276,7 +6281,7 @@ qemu-kvm -net nic,model=? /dev/null
       <p>
         address of panic. The default ioport is 0x505. Most users
         don't need to specify an address, and doing so is forbidden
-        altogether for pseries and hyperv models.
+        altogether for s390, pseries and hyperv models.
       </p>
     </dd>
   </dl>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index fa54526..03ca4fe 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5507,6 +5507,7 @@
             <value>isa</value>
             <value>pseries</value>
             <value>hyperv</value>
+            <value>s390</value>
           </choice>
         </attribute>
       </optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 446fbc5..a6b2b90 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -521,7 +521,8 @@ VIR_ENUM_IMPL(virDomainPanicModel, VIR_DOMAIN_PANIC_MODEL_LAST,
               "default",
               "isa",
               "pseries",
-              "hyperv")
+              "hyperv",
+              "s390")
 
 VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
               "vga",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 443a1d7..936bea1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2072,6 +2072,7 @@ typedef enum {
     VIR_DOMAIN_PANIC_MODEL_ISA,
     VIR_DOMAIN_PANIC_MODEL_PSERIES,
     VIR_DOMAIN_PANIC_MODEL_HYPERV,
+    VIR_DOMAIN_PANIC_MODEL_S390,
 
     VIR_DOMAIN_PANIC_MODEL_LAST
 } virDomainPanicModel;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index da99e5c..028a469 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8991,6 +8991,25 @@ qemuBuildPanicCommandLine(virCommandPtr cmd,
 
     for (i = 0; i < def->npanics; i++) {
         switch ((virDomainPanicModel) def->panics[i]->model) {
+        case VIR_DOMAIN_PANIC_MODEL_S390:
+            /* For s390 guests, the hardware provides the same
+             * functionality as the pvpanic device. The address
+             * cannot be configured by the user */
+            if (!ARCH_IS_S390(def->os.arch)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("only S390 guests support "
+                                 "panic device of model 's390'"));
+                return -1;
+            }
+            if (def->panics[i]->info.type !=
+                VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("setting the panic device address is not "
+                                 "supported for model 's390'"));
+                return -1;
+            }
+            break;
+
         case VIR_DOMAIN_PANIC_MODEL_HYPERV:
             /* Panic with model 'hyperv' is not a device, it should
              * be configured in cpu commandline. The address
@@ -9034,7 +9053,7 @@ qemuBuildPanicCommandLine(virCommandPtr cmd,
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PANIC)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("the QEMU binary does not support the "
-                                 "panic device"));
+                                 "ISA panic device"));
                 return -1;
             }
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5d54fff..a83b43c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1505,9 +1505,11 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
         break;
     case VIR_ARCH_S390:
         addDefaultUSB = false;
+        addPanicDevice = true;
         break;
     case VIR_ARCH_S390X:
         addDefaultUSB = false;
+        addPanicDevice = true;
         break;
 
     case VIR_ARCH_SPARC:
@@ -1586,7 +1588,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
         size_t j;
         for (j = 0; j < def->npanics; j++) {
             if (def->panics[j]->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT ||
-                def->panics[j]->model == VIR_DOMAIN_PANIC_MODEL_PSERIES)
+                (ARCH_IS_PPC64(def->os.arch) &&
+                     def->panics[j]->model == VIR_DOMAIN_PANIC_MODEL_PSERIES) ||
+                (ARCH_IS_S390(def->os.arch) &&
+                     def->panics[j]->model == VIR_DOMAIN_PANIC_MODEL_S390))
                 break;
         }
 
@@ -1883,6 +1888,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
         if (ARCH_IS_PPC64(def->os.arch) &&
             STRPREFIX(def->os.machine, "pseries"))
             dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_PSERIES;
+        else if (ARCH_IS_S390(def->os.arch))
+            dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_S390;
         else
             dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_ISA;
     }
-- 
2.3.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]