qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Alexander Graf <agraf@suse.de>,
	David Hildenbrand <david@redhat.com>
Subject: [Qemu-devel] [PATCH v1 2/2] s390x/sclp: fix missing be conversion
Date: Mon, 18 Dec 2017 23:46:16 +0100	[thread overview]
Message-ID: <20171218224616.21030-3-david@redhat.com> (raw)
In-Reply-To: <20171218224616.21030-1-david@redhat.com>

Linux crashes right now if maxmem > mem is specified on the command line.

On s390x, the guest can hotplug memory itself right now - very weird -
and e.g. Fedora 27 will simply add all memory it can when booting.

So now, we have at least the same behavior on TCG and KVM.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 hw/s390x/sclp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 9be0cb80ad..829c13bcf2 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -233,7 +233,7 @@ static void assign_storage(SCLPDevice *sclp, SCCB *sccb)
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
         return;
     }
-    assign_addr = (assign_info->rn - 1) * mhd->rzm;
+    assign_addr = (be16_to_cpu(assign_info->rn) - 1) * mhd->rzm;
 
     if ((assign_addr % MEM_SECTION_SIZE == 0) &&
         (assign_addr >= mhd->padded_ram_size)) {
@@ -292,7 +292,7 @@ static void unassign_storage(SCLPDevice *sclp, SCCB *sccb)
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
         return;
     }
-    unassign_addr = (assign_info->rn - 1) * mhd->rzm;
+    unassign_addr = (be16_to_cpu(assign_info->rn) - 1) * mhd->rzm;
 
     /* if the addr is a multiple of 256 MB */
     if ((unassign_addr % MEM_SECTION_SIZE == 0) &&
-- 
2.14.3

  parent reply	other threads:[~2017-12-18 22:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 22:46 [Qemu-devel] [PATCH v1 0/2] s390x/tcg: TEST PROTECTION and memory hotplug David Hildenbrand
2017-12-18 22:46 ` [Qemu-devel] [PATCH v1 1/2] s390x/tcg: implement TEST PROTECTION David Hildenbrand
2017-12-19  8:20   ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2017-12-19 10:32     ` David Hildenbrand
2017-12-21 17:17       ` Cornelia Huck
2017-12-18 22:46 ` David Hildenbrand [this message]
2017-12-19  8:25   ` [Qemu-devel] [qemu-s390x] [PATCH v1 2/2] s390x/sclp: fix missing be conversion Thomas Huth
2017-12-22 10:57 ` [Qemu-devel] [PATCH v1 0/2] s390x/tcg: TEST PROTECTION and memory hotplug Cornelia Huck
2018-01-12 10:43   ` [Qemu-devel] [qemu-s390x] " David Hildenbrand
2018-01-12 10:51     ` Cornelia Huck
2018-01-12 10:52       ` David Hildenbrand

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=20171218224616.21030-3-david@redhat.com \
    --to=david@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    /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).