From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKb9-0003eP-TO for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:52:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmKb6-0000dw-GW for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:51:59 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:59635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKb6-0000d6-81 for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:51:56 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Oct 2015 12:51:55 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id BB84D1B08069 for ; Wed, 14 Oct 2015 12:51:57 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9EBpqMa39321804 for ; Wed, 14 Oct 2015 11:51:52 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9EBpqXq024395 for ; Wed, 14 Oct 2015 05:51:52 -0600 From: Cornelia Huck Date: Wed, 14 Oct 2015 13:51:44 +0200 Message-Id: <1444823507-7267-7-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1444823507-7267-1-git-send-email-cornelia.huck@de.ibm.com> References: <1444823507-7267-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH 6/9] s390x/ipl: we always have an ipl device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de, David Hildenbrand From: David Hildenbrand Both s390 machines unconditionally create an ipl device, so no need to handle the missing case. Now we can also change s390_ipl_update_diag308() to return void. Reviewed-by: Cornelia Huck Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/ipl.c | 26 ++++++++++++-------------- hw/s390x/ipl.h | 2 +- target-s390x/misc_helper.c | 7 ++----- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 31473e7..b8c6378 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -95,6 +95,11 @@ static const VMStateDescription vmstate_ipl = { } }; +static S390IPLState *get_ipl_device(void) +{ + return S390_IPL(object_resolve_path_type("", TYPE_S390_IPL, NULL)); +} + static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr) { uint64_t dstaddr = *(uint64_t *) opaque; @@ -251,25 +256,19 @@ out: return (uint32_t) (ipl->cssid << 24 | ipl->ssid << 16 | ipl->devno); } -int s390_ipl_update_diag308(IplParameterBlock *iplb) +void s390_ipl_update_diag308(IplParameterBlock *iplb) { - S390IPLState *ipl; + S390IPLState *ipl = get_ipl_device(); - ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); - if (ipl) { - ipl->iplb = *iplb; - ipl->iplb_valid = true; - return 0; - } - return -1; + ipl->iplb = *iplb; + ipl->iplb_valid = true; } IplParameterBlock *s390_ipl_get_iplb(void) { - S390IPLState *ipl; + S390IPLState *ipl = get_ipl_device(); - ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); - if (!ipl || !ipl->iplb_valid) { + if (!ipl->iplb_valid) { return NULL; } return &ipl->iplb; @@ -277,9 +276,8 @@ IplParameterBlock *s390_ipl_get_iplb(void) void s390_reipl_request(void) { - S390IPLState *ipl; + S390IPLState *ipl = get_ipl_device(); - ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL)); ipl->reipl_requested = true; qemu_system_reset_request(); } diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index 70497bc..6424e08 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -18,7 +18,7 @@ typedef struct IplParameterBlock { uint8_t reserved2[88]; } IplParameterBlock; -int s390_ipl_update_diag308(IplParameterBlock *iplb); +void s390_ipl_update_diag308(IplParameterBlock *iplb); IplParameterBlock *s390_ipl_get_iplb(void); void s390_reipl_request(void); diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c index 3a19e32..ddf2498 100644 --- a/target-s390x/misc_helper.c +++ b/target-s390x/misc_helper.c @@ -233,11 +233,8 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3) } iplb = g_malloc0(sizeof(struct IplParameterBlock)); cpu_physical_memory_read(addr, iplb, sizeof(struct IplParameterBlock)); - if (!s390_ipl_update_diag308(iplb)) { - env->regs[r1 + 1] = DIAG_308_RC_OK; - } else { - env->regs[r1 + 1] = DIAG_308_RC_INVALID; - } + s390_ipl_update_diag308(iplb); + env->regs[r1 + 1] = DIAG_308_RC_OK; g_free(iplb); return; case 6: -- 2.6.1