From patchwork Thu Aug 29 21:10:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 270958 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 1543A2C0085 for ; Fri, 30 Aug 2013 07:21:27 +1000 (EST) Received: from localhost ([::1]:45922 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF9ef-0000Rd-8F for incoming@patchwork.ozlabs.org; Thu, 29 Aug 2013 17:21:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF9UM-0003We-6H for qemu-devel@nongnu.org; Thu, 29 Aug 2013 17:10:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF9UB-0001qx-A5 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 17:10:45 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:39660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF9UA-0001qF-Fz for qemu-devel@nongnu.org; Thu, 29 Aug 2013 17:10:34 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 29 Aug 2013 22:04:07 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 29 Aug 2013 22:04:05 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 57E1217D805C for ; Thu, 29 Aug 2013 22:10:30 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7TLAHoA7340154 for ; Thu, 29 Aug 2013 21:10:17 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7TLASJa029289 for ; Thu, 29 Aug 2013 15:10:29 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r7TLAS5B029260; Thu, 29 Aug 2013 15:10:28 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id A97D01224437; Thu, 29 Aug 2013 23:10:28 +0200 (CEST) From: Christian Borntraeger To: Alexander Graf Date: Thu, 29 Aug 2013 23:10:46 +0200 Message-Id: <1377810649-47484-4-git-send-email-borntraeger@de.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1377810649-47484-1-git-send-email-borntraeger@de.ibm.com> References: <1377810649-47484-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13082921-8372-0000-0000-0000070729F7 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.108 Cc: Cornelia Huck , Christian Borntraeger , Jens Freimann , =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-devel Subject: [Qemu-devel] [PULL 3/6] s390: provide a cpu load normal function 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 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 --- target-s390x/cpu-qom.h | 2 ++ target-s390x/cpu.c | 14 ++++++++++++++ target-s390x/cpu.h | 3 +++ 3 files changed, 19 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 5cc9938..69f5e10 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -65,6 +65,17 @@ static void s390_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.psw.addr = value; } +#if !defined(CONFIG_USER_ONLY) +/* S390CPUClass::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); +} +#endif + /* CPUClass::reset() */ static void s390_cpu_reset(CPUState *s) { @@ -169,6 +180,9 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) dc->realize = s390_cpu_realizefn; scc->parent_reset = cc->reset; +#if !defined(CONFIG_USER_ONLY) + scc->load_normal = s390_cpu_load_normal; +#endif 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