Commit b95fdc0e authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'borntraeger/tags/kdump' into staging

This is a set of patches dealing with kdump support for s390x/kvm.
kdump on s390x uses subcode 1 of diagnose 0x308 to put the hardware
in a defined state. This is different from a full reset, since it
does not touch all CPU registers.
These patches define the cpu resets, the subsystem reset a load
function and also wires up the "nmi" command to issue a RESTART
interrupt as defined in the z/Architecture principles of operation.

This allows recent guest kernels with properly setup userspace
to trigger kdump:
- via guest crash
- via nmi from the host

# gpg: Signature made Fri 30 Aug 2013 07:19:18 AM CDT using RSA key ID B5A61C7C
# gpg: Can't check signature: public key not found

# By Christian Borntraeger (5) and Eugene (jno) Dvurechenski (2)
# Via Christian Borntraeger
* borntraeger/tags/kdump:
  s390: wire up nmi command to raise a RESTART interrupt on S390
  s390: Implement load normal reset
  s390/cpu: split CPU reset into architectured functions
  s390: provide a cpu load normal function
  s390: provide I/O subsystem reset
  s390/kvm: basic implementation of diagnose 308 subcode 6
  s390x/kvm: Fix switch/case indentation for handle_diag

Message-id: 1377810649-47484-1-git-send-email-borntraeger@de.ibm.com
parents b5d54bd4 7f7f9752
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1401,6 +1401,20 @@ void qmp_inject_nmi(Error **errp)
            apic_deliver_nmi(env->apic_state);
        }
    }
#elif defined(TARGET_S390X)
    CPUState *cs;
    S390CPU *cpu;

    for (cs = first_cpu; cs != NULL; cs = cs->next_cpu) {
        cpu = S390_CPU(cs);
        if (cpu->env.cpu_num == monitor_get_cpu_index()) {
            if (s390_cpu_restart(S390_CPU(cs)) == -1) {
                error_set(errp, QERR_UNSUPPORTED);
                return;
            }
            break;
        }
    }
#else
    error_set(errp, QERR_UNSUPPORTED);
#endif
+2 −2
Original line number Diff line number Diff line
@@ -822,7 +822,7 @@ The values that can be specified here depend on the machine type, but are
the same that can be specified in the @code{-boot} command line option.
ETEXI

#if defined(TARGET_I386)
#if defined(TARGET_I386) || defined(TARGET_S390X)
    {
        .name       = "nmi",
        .args_type  = "",
@@ -834,7 +834,7 @@ ETEXI
STEXI
@item nmi @var{cpu}
@findex nmi
Inject an NMI on the given CPU (x86 only).
Inject an NMI (x86) or RESTART (s390x) on the given CPU.

ETEXI

+15 −0
Original line number Diff line number Diff line
@@ -17,6 +17,21 @@
#include "css.h"
#include "virtio-ccw.h"

void io_subsystem_reset(void)
{
    DeviceState *css, *sclp;

    css = DEVICE(object_resolve_path_type("", "virtual-css-bridge", NULL));
    if (css) {
        qdev_reset_all(css);
    }
    sclp = DEVICE(object_resolve_path_type("",
                  "s390-sclp-event-facility", NULL));
    if (sclp) {
        qdev_reset_all(sclp);
    }
}

static int virtio_ccw_hcall_notify(const uint64_t *args)
{
    uint64_t subch_id = args[0];
+1 −1
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ Example:
<- { "return": {} }

Note: inject-nmi fails when the guest doesn't support injecting.
      Currently, only x86 guests do.
      Currently, only x86 (NMI) and s390x (RESTART) guests do.

EQMP

+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@
 * S390CPUClass:
 * @parent_realize: The parent class' realize handler.
 * @parent_reset: The parent class' reset handler.
 * @load_normal: Performs a load normal.
 * @cpu_reset: Performs a CPU reset.
 * @initial_cpu_reset: Performs an initial CPU reset.
 *
 * An S/390 CPU model.
 */
@@ -46,6 +49,9 @@ typedef struct S390CPUClass {

    DeviceRealize parent_realize;
    void (*parent_reset)(CPUState *cpu);
    void (*load_normal)(CPUState *cpu);
    void (*cpu_reset)(CPUState *cpu);
    void (*initial_cpu_reset)(CPUState *cpu);
} S390CPUClass;

/**
Loading