From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3oIM-0000d1-9w for qemu-devel@nongnu.org; Mon, 29 Jul 2013 10:19:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3oIA-0000nx-Tz for qemu-devel@nongnu.org; Mon, 29 Jul 2013 10:19:30 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:49217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3oIA-0000nV-Ff for qemu-devel@nongnu.org; Mon, 29 Jul 2013 10:19:18 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Jul 2013 15:13:13 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4478A2190061 for ; Mon, 29 Jul 2013 15:23:29 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6TEJ3LY66978044 for ; Mon, 29 Jul 2013 14:19:03 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r6TEJEKe005778 for ; Mon, 29 Jul 2013 08:19:14 -0600 From: Christian Borntraeger Date: Mon, 29 Jul 2013 16:19:26 +0200 Message-Id: <1375107567-24301-6-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1375107567-24301-1-git-send-email-borntraeger@de.ibm.com> References: <1375107567-24301-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH 5/6] s390: Implement load normal reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Cornelia Huck , Christian Borntraeger , =?UTF-8?q?Andreas=20F=C3=A4rber?= , 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 --- 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