qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: peter.maydell@linaro.org
Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, agraf@suse.de,
	David Hildenbrand <dahi@linux.vnet.ibm.com>,
	jfrei@linux.vnet.ibm.com,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PULL v2 6/9] s390x/ipl: we always have an ipl device
Date: Wed, 21 Oct 2015 12:30:06 +0200	[thread overview]
Message-ID: <1445423409-22218-7-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1445423409-22218-1-git-send-email-cornelia.huck@de.ibm.com>

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

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 <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 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.2

  parent reply	other threads:[~2015-10-21 10:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 10:30 [Qemu-devel] [PULL v2 0/9] Next set of s390x patches Cornelia Huck
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 1/9] util/qemu-config: fix missing machine command line options Cornelia Huck
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 2/9] s390x/virtio-ccw: fix 2.4 virtio compat Cornelia Huck
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 3/9] s390x/kvm: Fix vector validity bit in device machine checks Cornelia Huck
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 4/9] s390x: flagify mcic values Cornelia Huck
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 5/9] s390x: unify device reset during subsystem_reset() Cornelia Huck
2015-10-21 10:30 ` Cornelia Huck [this message]
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 7/9] s390x: machine reset function with new ipl cpu handling Cornelia Huck
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 8/9] s390x: reset crypto only on clear reset and QEMU reset Cornelia Huck
2015-10-21 10:30 ` [Qemu-devel] [PULL v2 9/9] s390x/cmma: clean up cmma reset Cornelia Huck
2015-10-21 15:59 ` [Qemu-devel] [PULL v2 0/9] Next set of s390x patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445423409-22218-7-git-send-email-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).