From patchwork Tue Feb 24 13:15:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Freimann X-Patchwork-Id: 442962 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 98A2C140119 for ; Wed, 25 Feb 2015 00:16:32 +1100 (AEDT) Received: from localhost ([::1]:49250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQFLi-00031j-OL for incoming@patchwork.ozlabs.org; Tue, 24 Feb 2015 08:16:30 -0500 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 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; Tue, 24 Feb 2015 13:15:36 -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 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t1ODFYXo008862; Tue, 24 Feb 2015 06:15:34 -0700 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 1122) id 7428F1224462; Tue, 24 Feb 2015 14:15:34 +0100 (CET) From: Jens Freimann To: Christian Borntraeger , Alexander Graf , Cornelia Huck Date: Tue, 24 Feb 2015 14:15:30 +0100 Message-Id: <1424783731-43426-10-git-send-email-jfrei@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 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> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15022413-0009-0000-0000-0000033F6C3A X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.108 Cc: David Hildenbrand , Jens Freimann , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 09/10] s390x/kvm: deliver SIGP RESTART directly if stopped 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: 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; }