From patchwork Fri Feb 28 09:31:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 325099 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CE542C007E for ; Fri, 28 Feb 2014 20:42:20 +1100 (EST) Received: from localhost ([::1]:50044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJJxS-0000Zn-7M for incoming@patchwork.ozlabs.org; Fri, 28 Feb 2014 04:42:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJJmk-0002W6-97 for qemu-devel@nongnu.org; Fri, 28 Feb 2014 04:31:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJJmX-0004nX-Mk for qemu-devel@nongnu.org; Fri, 28 Feb 2014 04:31:14 -0500 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:50528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJJmX-0004nL-DR for qemu-devel@nongnu.org; Fri, 28 Feb 2014 04:31:01 -0500 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Feb 2014 09:31:00 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 28 Feb 2014 09:30:57 -0000 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 6821A219005E for ; Fri, 28 Feb 2014 09:30:53 +0000 (GMT) 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 s1S9UirL2032062 for ; Fri, 28 Feb 2014 09:30:44 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 s1S9Uq22016282 for ; Fri, 28 Feb 2014 02:30:56 -0700 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 s1S9Up44016247; Fri, 28 Feb 2014 02:30:51 -0700 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 91E3D122444C; Fri, 28 Feb 2014 10:30:51 +0100 (CET) From: Christian Borntraeger To: qemu-devel , Anthony Liguori , Peter Maydell Date: Fri, 28 Feb 2014 10:31:02 +0100 Message-Id: <1393579866-43465-19-git-send-email-borntraeger@de.ibm.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1393579866-43465-1-git-send-email-borntraeger@de.ibm.com> References: <1393579866-43465-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14022809-8372-0000-0000-000008D55D30 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: Thomas Huth , Alexander Graf , Christian Borntraeger , Jens Freimann , Cornelia Huck , Richard Henderson Subject: [Qemu-devel] [PULL 18/22] s390x/cpu: Use ioctl to reset state in the kernel 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 From: Thomas Huth Some of the state in the kernel can not be reset from QEMU yet. For this we've got to use the KVM_S390_INITIAL_RESET ioctl to make sure that the state in the kernel is set to the right values during initial CPU reset, too. Signed-off-by: Thomas Huth Acked-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- target-s390x/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index f1319e5..1a8c1cc 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -108,6 +108,15 @@ static void s390_cpu_initial_reset(CPUState *s) env->cregs[14] = CR14_RESET; env->pfault_token = -1UL; + +#if defined(CONFIG_KVM) + /* Reset state inside the kernel that we cannot access yet from QEMU. */ + if (kvm_enabled()) { + if (kvm_vcpu_ioctl(s, KVM_S390_INITIAL_RESET, NULL)) { + perror("Initial CPU reset failed"); + } + } +#endif } /* CPUClass:reset() */