From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQFL3-0001YA-Rq for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:15:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQFKu-0002Mf-MR for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:15:49 -0500 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:44904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQFKu-0002LG-82 for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:15:40 -0500 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Feb 2015 13:15:37 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 010602190069 for ; Tue, 24 Feb 2015 13:15:29 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1ODFZs764356386 for ; Tue, 24 Feb 2015 13:15:35 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1ODFYMp008870 for ; Tue, 24 Feb 2015 06:15:35 -0700 From: Jens Freimann Date: Tue, 24 Feb 2015 14:15:30 +0100 Message-Id: <1424783731-43426-10-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: <1424783731-43426-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1424783731-43426-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 09/10] s390x/kvm: deliver SIGP RESTART directly if stopped List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: David Hildenbrand , Jens Freimann , qemu-devel@nongnu.org From: David Hildenbrand According to the PoP, a restart irq has to be delivered "without first honoring any other pending interruptions", if a cpu is in the STOPPED state. While it is hard to implement this case in kvm, it can easily be handled in qemu. Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck Signed-off-by: Jens Freimann Signed-off-by: David Hildenbrand --- target-s390x/kvm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index ed56b3c..7f9fd02 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -1241,8 +1241,17 @@ static void sigp_restart(void *arg) .type = KVM_S390_RESTART, }; - kvm_s390_vcpu_interrupt(si->cpu, &irq); - s390_cpu_set_state(CPU_STATE_OPERATING, si->cpu); + switch (s390_cpu_get_state(si->cpu)) { + case CPU_STATE_STOPPED: + /* the restart irq has to be delivered prior to any other pending irq */ + cpu_synchronize_state(CPU(si->cpu)); + do_restart_interrupt(&si->cpu->env); + s390_cpu_set_state(CPU_STATE_OPERATING, si->cpu); + break; + case CPU_STATE_OPERATING: + kvm_s390_vcpu_interrupt(si->cpu, &irq); + break; + } si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; } -- 2.1.4