From patchwork Thu Feb 12 17:02:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Freimann X-Patchwork-Id: 439259 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 627841400A0 for ; Fri, 13 Feb 2015 04:05:36 +1100 (AEDT) Received: from localhost ([::1]:51257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLxCo-00068M-Go for incoming@patchwork.ozlabs.org; Thu, 12 Feb 2015 12:05:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLxBm-0004dW-GX for qemu-devel@nongnu.org; Thu, 12 Feb 2015 12:04:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLxBg-0005xP-LI for qemu-devel@nongnu.org; Thu, 12 Feb 2015 12:04:30 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:59987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLxBg-0005x9-Cl for qemu-devel@nongnu.org; Thu, 12 Feb 2015 12:04:24 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Feb 2015 17:04:23 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Feb 2015 17:04:21 -0000 Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1CH2Osm3736016 for ; Thu, 12 Feb 2015 17:02:24 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1CH2Mt9011409 for ; Thu, 12 Feb 2015 10:02:23 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t1CH2MTC011386; Thu, 12 Feb 2015 10:02:22 -0700 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 1122) id 48A15122445A; Thu, 12 Feb 2015 18:02:22 +0100 (CET) From: Jens Freimann To: Christian Borntraeger , Alexander Graf , Cornelia Huck Date: Thu, 12 Feb 2015 18:02:15 +0100 Message-Id: <1423760536-58356-4-git-send-email-jfrei@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1423760536-58356-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1423760536-58356-1-git-send-email-jfrei@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 15021217-0017-0000-0000-00000305694F X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.110 Cc: Jens Freimann , qemu-devel@nongnu.org, Fan Zhang Subject: [Qemu-devel] [PATCH 3/4] s390x/ipl: drop reipl parameters on resets 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: Fan Zhang Whenever a reboot initiated by the guest is done, the reipl parameters should remain valid. The disk configured by the guest is to be used for ipl'ing. External reboot/reset request (e.g. via virsh reset guest) should completely reset the guest to the initial state, and therefore also reset the reipl parameters, resulting in an ipl behaviour of the initially configured guest. This could be an external kernel or a disk. Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Jens Freimann Signed-off-by: Fan Zhang --- hw/s390x/ipl.c | 15 +++++++++++++++ hw/s390x/ipl.h | 1 + target-s390x/kvm.c | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 231713d..a1aa051 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -55,6 +55,7 @@ typedef struct S390IPLState { bool enforce_bios; IplParameterBlock iplb; bool iplb_valid; + bool reipl_requested; /*< public >*/ char *kernel; @@ -233,6 +234,15 @@ IplParameterBlock *s390_ipl_get_iplb(void) return &ipl->iplb; } +void s390_reipl_request(void) +{ + S390IPLState *ipl; + + ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); + ipl->reipl_requested = true; + qemu_system_reset_request(); +} + static void s390_ipl_reset(DeviceState *dev) { S390IPLState *ipl = S390_IPL(dev); @@ -242,6 +252,11 @@ static void s390_ipl_reset(DeviceState *dev) env->psw.addr = ipl->start_addr; env->psw.mask = IPL_PSW_MASK; + if (!ipl->reipl_requested) { + ipl->iplb_valid = false; + } + ipl->reipl_requested = false; + if (!ipl->kernel || ipl->iplb_valid) { env->psw.addr = ipl->bios_start_addr; env->regs[7] = s390_update_iplstate(env, ipl); diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index f1d082f..70497bc 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -20,5 +20,6 @@ typedef struct IplParameterBlock { int s390_ipl_update_diag308(IplParameterBlock *iplb); IplParameterBlock *s390_ipl_get_iplb(void); +void s390_reipl_request(void); #endif diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 6f2d5b4..8c2f228 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -42,6 +42,7 @@ #include "qapi-event.h" #include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-bus.h" +#include "hw/s390x/ipl.h" /* #define DEBUG_KVM */ @@ -1397,7 +1398,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) ret = handle_intercept(cpu); break; case KVM_EXIT_S390_RESET: - qemu_system_reset_request(); + s390_reipl_request(); break; case KVM_EXIT_S390_TSCH: ret = handle_tsch(cpu);