* [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends
@ 2013-07-29 14:19 Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 1/6] s390/kvm: basic implementation of diagnose 308 subcode 6 Christian Borntraeger
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Christian Borntraeger @ 2013-07-29 14:19 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Christian Borntraeger, Andreas Färber,
qemu-devel
Alex, Andreas,
here is an implementation for a soft-reset variant that is used
by s390 on kdump. The last patch also wires up the nmi command
to inject a restart interrupt. So there are two methods to trigger
kdump:
- a crash, e.g. via echo c > /proc/sysrq_trigger
- inject-nmi /nmi via virsh/monitor
Feedback is welcome
Christian Borntraeger (4):
s390: provide I/O subsystem reset
s390: provide a cpu load normal function
s390/cpu: split CPU reset into architectured functions
s390: Implement load normal reset
Eugene (jno) Dvurechenski (2):
s390/kvm: basic implementation of diagnose 308 subcode 6
s390: wire up nmi command to raise a RESTART interrupt on S390
cpus.c | 14 ++++++++
hmp-commands.hx | 4 +--
hw/s390x/s390-virtio-ccw.c | 15 +++++++++
qmp-commands.hx | 2 +-
target-s390x/cpu-qom.h | 6 ++++
target-s390x/cpu.c | 50 ++++++++++++++++++++++++----
target-s390x/cpu.h | 17 ++++++++++
target-s390x/kvm.c | 81 ++++++++++++++++++++++++++++++++++++++++++++--
8 files changed, 176 insertions(+), 13 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/6] s390/kvm: basic implementation of diagnose 308 subcode 6
2013-07-29 14:19 [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends Christian Borntraeger
@ 2013-07-29 14:19 ` Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 2/6] s390: provide I/O subsystem reset Christian Borntraeger
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2013-07-29 14:19 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Eugene (jno) Dvurechenski, Andreas Färber,
Christian Borntraeger, qemu-devel
From: "Eugene (jno) Dvurechenski" <jno@linux.vnet.ibm.com>
Linux uses a check for subcode 6 to decide if other subcodes are
available. Provide a minimal implementation.
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
target-s390x/kvm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 960b3cf..ec1d1a5 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -72,9 +72,12 @@
#define PRIV_XSCH 0x76
#define PRIV_SQBS 0x8a
#define PRIV_EQBS 0x9c
+#define DIAG_IPL 0x308
#define DIAG_KVM_HYPERCALL 0x500
#define DIAG_KVM_BREAKPOINT 0x501
+#define DIAG_IPL_RC_OK_NOT4CONF 0x0102
+
#define ICPT_INSTRUCTION 0x04
#define ICPT_WAITPSW 0x1c
#define ICPT_SOFT_INTERCEPT 0x24
@@ -578,11 +581,54 @@ static int handle_hypercall(S390CPU *cpu, struct kvm_run *run)
return 0;
}
+static int handle_diag308(S390CPU *cpu, struct kvm_run *run)
+{
+ uint64_t r1, r3, addr, subcode;
+
+ cpu_synchronize_state(CPU(cpu));
+
+ if (cpu->env.psw.mask & PSW_MASK_PSTATE) {
+ enter_pgmcheck(cpu, PGM_PRIVILEGED);
+ return 0;
+ }
+
+ r1 = (run->s390_sieic.ipa & 0x00f0) >> 8;
+ r3 = run->s390_sieic.ipa & 0x000f;
+ addr = cpu->env.regs[r1];
+ subcode = cpu->env.regs[r3];
+
+ if ((subcode & ~0x0ffffULL) || (subcode > 6)) {
+ enter_pgmcheck(cpu, PGM_SPECIFICATION);
+ return 0;
+ }
+
+ switch (subcode) {
+ case 5:
+ if ((r1 & 1) || (addr & 0x0fffULL)) {
+ enter_pgmcheck(cpu, PGM_SPECIFICATION);
+ return 0;
+ }
+ return -1;
+ case 6:
+ if ((r1 & 1) || (addr & 0x0fffULL)) {
+ enter_pgmcheck(cpu, PGM_SPECIFICATION);
+ return 0;
+ }
+ cpu->env.regs[r1+1] = DIAG_IPL_RC_OK_NOT4CONF;
+ return 0;
+ default:
+ return -1;
+ }
+}
+
static int handle_diag(S390CPU *cpu, struct kvm_run *run, int ipb_code)
{
int r = 0;
switch (ipb_code) {
+ case DIAG_IPL:
+ r = handle_diag308(cpu, run);
+ break;
case DIAG_KVM_HYPERCALL:
r = handle_hypercall(cpu, run);
break;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 2/6] s390: provide I/O subsystem reset
2013-07-29 14:19 [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 1/6] s390/kvm: basic implementation of diagnose 308 subcode 6 Christian Borntraeger
@ 2013-07-29 14:19 ` Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 3/6] s390: provide a cpu load normal function Christian Borntraeger
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2013-07-29 14:19 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Christian Borntraeger, Andreas Färber,
qemu-devel
Provide a function that resets the I/O subsystem.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
hw/s390x/s390-virtio-ccw.c | 15 +++++++++++++++
target-s390x/cpu.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index aebbbf1..c5cdb11 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -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];
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 65bef86..1c8e2c2 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -400,6 +400,7 @@ void cpu_unlock(void);
typedef struct SubchDev SubchDev;
#ifndef CONFIG_USER_ONLY
+extern void io_subsystem_reset(void);
SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
uint16_t schid);
bool css_subch_visible(SubchDev *sch);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 3/6] s390: provide a cpu load normal function
2013-07-29 14:19 [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 1/6] s390/kvm: basic implementation of diagnose 308 subcode 6 Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 2/6] s390: provide I/O subsystem reset Christian Borntraeger
@ 2013-07-29 14:19 ` Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 4/6] s390/cpu: split CPU reset into architectured functions Christian Borntraeger
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2013-07-29 14:19 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Christian Borntraeger, Andreas Färber,
qemu-devel
Some code needs to perform an IPL-like bootup that mimics the
ESA (31bit) restart. Provide a cpu class method that does so.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
target-s390x/cpu-qom.h | 2 ++
target-s390x/cpu.c | 10 ++++++++++
target-s390x/cpu.h | 3 +++
3 files changed, 15 insertions(+)
diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h
index cbe2341..2dc1750 100644
--- a/target-s390x/cpu-qom.h
+++ b/target-s390x/cpu-qom.h
@@ -36,6 +36,7 @@
* S390CPUClass:
* @parent_realize: The parent class' realize handler.
* @parent_reset: The parent class' reset handler.
+ * @load_normal: Performs a load normal.
*
* An S/390 CPU model.
*/
@@ -46,6 +47,7 @@ typedef struct S390CPUClass {
DeviceRealize parent_realize;
void (*parent_reset)(CPUState *cpu);
+ void (*load_normal)(CPUState *cpu);
} S390CPUClass;
/**
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index a414750..0915c45 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -65,6 +65,15 @@ static void s390_cpu_set_pc(CPUState *cs, vaddr value)
cpu->env.psw.addr = value;
}
+/* CPUClass::load_normal() */
+static void s390_cpu_load_normal(CPUState *s)
+{
+ S390CPU *cpu = S390_CPU(s);
+ cpu->env.psw.addr = ldl_phys(4) & PSW_MASK_ESA_ADDR;
+ cpu->env.psw.mask = PSW_MASK_32 | PSW_MASK_64;
+ s390_add_running_cpu(cpu);
+}
+
/* CPUClass::reset() */
static void s390_cpu_reset(CPUState *s)
{
@@ -168,6 +177,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
dc->realize = s390_cpu_realizefn;
scc->parent_reset = cc->reset;
+ scc->load_normal = s390_cpu_load_normal;
cc->reset = s390_cpu_reset;
cc->do_interrupt = s390_cpu_do_interrupt;
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 1c8e2c2..7ba4da2 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -228,6 +228,8 @@ typedef struct CPUS390XState {
#undef PSW_MASK_CC
#undef PSW_MASK_PM
#undef PSW_MASK_64
+#undef PSW_MASK_32
+#undef PSW_MASK_ESA_ADDR
#define PSW_MASK_PER 0x4000000000000000ULL
#define PSW_MASK_DAT 0x0400000000000000ULL
@@ -243,6 +245,7 @@ typedef struct CPUS390XState {
#define PSW_MASK_PM 0x00000F0000000000ULL
#define PSW_MASK_64 0x0000000100000000ULL
#define PSW_MASK_32 0x0000000080000000ULL
+#define PSW_MASK_ESA_ADDR 0x000000007fffffffULL
#undef PSW_ASC_PRIMARY
#undef PSW_ASC_ACCREG
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 4/6] s390/cpu: split CPU reset into architectured functions
2013-07-29 14:19 [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends Christian Borntraeger
` (2 preceding siblings ...)
2013-07-29 14:19 ` [Qemu-devel] [PATCH 3/6] s390: provide a cpu load normal function Christian Borntraeger
@ 2013-07-29 14:19 ` Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 5/6] s390: Implement load normal reset Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 6/6] s390: wire up nmi command to raise a RESTART interrupt on S390 Christian Borntraeger
5 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2013-07-29 14:19 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Christian Borntraeger, Andreas Färber,
qemu-devel
s390 provides several CPU resets:
- CPU reset, clears interrupts, stop processing, clears TLB, but does
not touch registers
- initial CPU reset, like CPU reset, but also clears PSW, prefix, FPC,
timer and control registers. It does not touch gprs, fprs and acrs (!)
- Power on reset: the full monty
wire up CPUClass reset to the full monty, but provide the lesser resets
as part of S390CPUClass.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
target-s390x/cpu-qom.h | 4 ++++
target-s390x/cpu.c | 40 +++++++++++++++++++++++++++++++++-------
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h
index 2dc1750..ac0460e 100644
--- a/target-s390x/cpu-qom.h
+++ b/target-s390x/cpu-qom.h
@@ -37,6 +37,8 @@
* @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.
*/
@@ -48,6 +50,8 @@ 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;
/**
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index 0915c45..5fab918 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -74,7 +74,7 @@ static void s390_cpu_load_normal(CPUState *s)
s390_add_running_cpu(cpu);
}
-/* CPUClass::reset() */
+/* S390CPUClass::cpu_reset() */
static void s390_cpu_reset(CPUState *s)
{
S390CPU *cpu = S390_CPU(s);
@@ -85,11 +85,6 @@ static void s390_cpu_reset(CPUState *s)
scc->parent_reset(s);
- memset(env, 0, offsetof(CPUS390XState, breakpoints));
-
- /* architectured initial values for CR 0 and 14 */
- env->cregs[0] = CR0_RESET;
- env->cregs[14] = CR14_RESET;
/* set halted to 1 to make sure we can add the cpu in
* s390_ipl_cpu code, where CPUState::halted is set back to 0
* after incrementing the cpu counter */
@@ -108,6 +103,35 @@ static void s390_cpu_machine_reset_cb(void *opaque)
}
#endif
+/* S390CPUClass::initial_reset() */
+static void s390_cpu_initial_reset(CPUState *s)
+{
+ S390CPU *cpu = S390_CPU(s);
+ CPUS390XState *env = &cpu->env;
+
+ s390_cpu_reset(s);
+ /* initial reset does not touch regs,fregs and aregs */
+ memset(&env->fpc, 0, offsetof(CPUS390XState, breakpoints) -
+ offsetof(CPUS390XState, fpc));
+
+ /* architectured initial values for CR 0 and 14 */
+ env->cregs[0] = CR0_RESET;
+ env->cregs[14] = CR14_RESET;
+}
+
+/* CPUClass:reset() */
+static void s390_cpu_full_reset(CPUState *s)
+{
+ S390CPU *cpu = S390_CPU(s);
+ CPUS390XState *env = &cpu->env;
+
+ s390_cpu_initial_reset(s);
+ /* also reset regs,aregs and fregs */
+ memset(env, 0, offsetof(CPUS390XState, fpc));
+}
+
+
+
static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
{
S390CPU *cpu = S390_CPU(dev);
@@ -178,7 +202,9 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
scc->parent_reset = cc->reset;
scc->load_normal = s390_cpu_load_normal;
- cc->reset = s390_cpu_reset;
+ scc->cpu_reset = s390_cpu_reset;
+ scc->initial_cpu_reset = s390_cpu_initial_reset;
+ cc->reset = s390_cpu_full_reset;
cc->do_interrupt = s390_cpu_do_interrupt;
cc->dump_state = s390_cpu_dump_state;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 5/6] s390: Implement load normal reset
2013-07-29 14:19 [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends Christian Borntraeger
` (3 preceding siblings ...)
2013-07-29 14:19 ` [Qemu-devel] [PATCH 4/6] s390/cpu: split CPU reset into architectured functions Christian Borntraeger
@ 2013-07-29 14:19 ` Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 6/6] s390: wire up nmi command to raise a RESTART interrupt on S390 Christian Borntraeger
5 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2013-07-29 14:19 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Christian Borntraeger, Andreas Färber,
qemu-devel
kdump on s390 uses a load normal reset to bring the system in a defined
state by doing a subsystem reset. The issuing CPUs will have an initial
CPU reset, all other CPUs will have a CPU reset as defined in POP (no
register content will change).
Implement this as architectured.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
target-s390x/kvm.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index ec1d1a5..532326f 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -33,6 +33,7 @@
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
#include "cpu.h"
+#include "sysemu/cpus.h"
#include "sysemu/device_tree.h"
#include "qapi/qmp/qjson.h"
#include "monitor/monitor.h"
@@ -581,6 +582,32 @@ static int handle_hypercall(S390CPU *cpu, struct kvm_run *run)
return 0;
}
+static void cpu_reset_all(void)
+{
+ CPUState *cpu;
+ S390CPUClass *scc;
+
+ for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
+ scc = S390_CPU_GET_CLASS(CPU(cpu));
+ scc->cpu_reset(CPU(cpu));
+ }
+}
+
+static int load_normal_reset(S390CPU *cpu)
+{
+ S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);
+
+ pause_all_vcpus();
+ cpu_synchronize_all_states();
+ cpu_reset_all();
+ io_subsystem_reset();
+ scc->initial_cpu_reset(CPU(cpu));
+ scc->load_normal(CPU(cpu));
+ cpu_synchronize_all_post_reset();
+ resume_all_vcpus();
+ return 0;
+}
+
static int handle_diag308(S390CPU *cpu, struct kvm_run *run)
{
uint64_t r1, r3, addr, subcode;
@@ -603,6 +630,8 @@ static int handle_diag308(S390CPU *cpu, struct kvm_run *run)
}
switch (subcode) {
+ case 1:
+ return load_normal_reset(cpu);
case 5:
if ((r1 & 1) || (addr & 0x0fffULL)) {
enter_pgmcheck(cpu, PGM_SPECIFICATION);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 6/6] s390: wire up nmi command to raise a RESTART interrupt on S390
2013-07-29 14:19 [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends Christian Borntraeger
` (4 preceding siblings ...)
2013-07-29 14:19 ` [Qemu-devel] [PATCH 5/6] s390: Implement load normal reset Christian Borntraeger
@ 2013-07-29 14:19 ` Christian Borntraeger
5 siblings, 0 replies; 7+ messages in thread
From: Christian Borntraeger @ 2013-07-29 14:19 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Eugene (jno) Dvurechenski, Andreas Färber,
Christian Borntraeger, qemu-devel
From: "Eugene (jno) Dvurechenski" <jno@linux.vnet.ibm.com>
There is the 'nmi' command that is used to trigger a guest dump via kdump feature on x86.
s390 uses RESTART interrupt to trigger kdump.
So, this patch provides a mean to use 'nmi' command on s390 to raise RESTART interrupt.
The CPU to receive the RESTART interrupt is the "default" one.
There is an infrastructure to select the "default" CPU using 'cpu' command.
The 'info cpus' command can be used to see which one is the "default".
In order to wire up the RESTART to 'nmi' command we had to:
1. implement the kvm_s390_cpu_restart function by exporting the existing code
2. implement s390_cpu_restart function as kvm-aware wrapper
3. modify the qmp_inject_nmi function to enable (for s390) the scan for
"default" CPU and call s390_cpu_restart for it;
3. fix some messages.
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
cpus.c | 14 ++++++++++++++
hmp-commands.hx | 4 ++--
qmp-commands.hx | 2 +-
target-s390x/cpu.h | 13 +++++++++++++
target-s390x/kvm.c | 6 +++---
5 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/cpus.c b/cpus.c
index 0f65e76..728b1bc 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1367,6 +1367,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
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 8c6b91a..628807f 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -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
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 2e59b0d..4ed51d3 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -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
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 7ba4da2..a09515e 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -1066,6 +1066,7 @@ void kvm_s390_enable_css_support(S390CPU *cpu);
int kvm_s390_get_registers_partial(CPUState *cpu);
int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch,
int vq, bool assign);
+int kvm_s390_cpu_restart(S390CPU *cpu);
#else
static inline void kvm_s390_io_interrupt(S390CPU *cpu,
uint16_t subchannel_id,
@@ -1090,8 +1091,20 @@ static inline int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier,
{
return -ENOSYS;
}
+static inline int kvm_s390_cpu_restart(S390CPU *cpu)
+{
+ return -ENOSYS;
+}
#endif
+static inline int s390_cpu_restart(S390CPU *cpu)
+{
+ if (kvm_enabled()) {
+ return kvm_s390_cpu_restart(cpu);
+ }
+ return -ENOSYS;
+}
+
static inline void s390_io_interrupt(S390CPU *cpu,
uint16_t subchannel_id,
uint16_t subchannel_nr,
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 532326f..7c440c7 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -673,12 +673,12 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *run, int ipb_code)
return r;
}
-static int s390_cpu_restart(S390CPU *cpu)
+int kvm_s390_cpu_restart(S390CPU *cpu)
{
kvm_s390_interrupt(cpu, KVM_S390_RESTART, 0);
s390_add_running_cpu(cpu);
qemu_cpu_kick(CPU(cpu));
- dprintf("DONE: SIGP cpu restart: %p\n", &cpu->env);
+ dprintf("DONE: KVM cpu restart: %p\n", &cpu->env);
return 0;
}
@@ -747,7 +747,7 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
switch (order_code) {
case SIGP_RESTART:
- r = s390_cpu_restart(target_cpu);
+ r = kvm_s390_cpu_restart(target_cpu);
break;
case SIGP_STORE_STATUS_ADDR:
r = s390_store_status(target_env, parameter);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-07-29 14:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29 14:19 [Qemu-devel] [PATCH/RFC 0/6] s390 kdump /soft reset and friends Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 1/6] s390/kvm: basic implementation of diagnose 308 subcode 6 Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 2/6] s390: provide I/O subsystem reset Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 3/6] s390: provide a cpu load normal function Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 4/6] s390/cpu: split CPU reset into architectured functions Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 5/6] s390: Implement load normal reset Christian Borntraeger
2013-07-29 14:19 ` [Qemu-devel] [PATCH 6/6] s390: wire up nmi command to raise a RESTART interrupt on S390 Christian Borntraeger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).