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 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 From: Christian Borntraeger Date: Fri, 28 Feb 2014 10:31:02 +0100 Message-Id: <1393579866-43465-19-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1393579866-43465-1-git-send-email-borntraeger@de.ibm.com> References: <1393579866-43465-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PULL 18/22] s390x/cpu: Use ioctl to reset state in the kernel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Anthony Liguori , Peter Maydell Cc: Thomas Huth , Alexander Graf , Christian Borntraeger , Jens Freimann , Cornelia Huck , Richard Henderson 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() */ -- 1.8.4.2