From patchwork Mon Jul 29 14:19:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 262795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 826D02C00C1 for ; Tue, 30 Jul 2013 00:24:41 +1000 (EST) Received: from localhost ([::1]:39296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3oNI-0000F2-3m for incoming@patchwork.ozlabs.org; Mon, 29 Jul 2013 10:24:36 -0400 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 d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 29 Jul 2013 15:13:10 +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 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r6TEJEnQ005765; Mon, 29 Jul 2013 08:19:14 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id DDDBD122443A; Mon, 29 Jul 2013 16:19:13 +0200 (CEST) From: Christian Borntraeger To: Alexander Graf Date: Mon, 29 Jul 2013 16:19:26 +0200 Message-Id: <1375107567-24301-6-git-send-email-borntraeger@de.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1375107567-24301-1-git-send-email-borntraeger@de.ibm.com> References: <1375107567-24301-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13072914-3548-0000-0000-00000611403C X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.112 Cc: Cornelia Huck , Christian Borntraeger , =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-devel Subject: [Qemu-devel] [PATCH 5/6] s390: Implement load normal reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);