cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-hw-s390x-Use-the-IEC-binary-prefix-definitions.patch

ae23c9
From 7b5de347e3786f6c2ade136cb4029344969b34ac Mon Sep 17 00:00:00 2001
ae23c9
From: Cornelia Huck <cohuck@redhat.com>
ae23c9
Date: Wed, 17 Apr 2019 13:57:20 +0100
ae23c9
Subject: [PATCH 03/24] hw/s390x: Use the IEC binary prefix definitions
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Cornelia Huck <cohuck@redhat.com>
ae23c9
Message-id: <20190417135741.25297-4-cohuck@redhat.com>
ae23c9
Patchwork-id: 85782
ae23c9
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 03/24] hw/s390x: Use the IEC binary prefix definitions
ae23c9
Bugzilla: 1699070
ae23c9
RH-Acked-by: David Hildenbrand <david@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ae23c9
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
ae23c9
ae23c9
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
ae23c9
ae23c9
It eases code review, unit is explicit.
ae23c9
ae23c9
Patch generated using:
ae23c9
ae23c9
  $ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/
ae23c9
ae23c9
and modified manually.
ae23c9
ae23c9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
ae23c9
Reviewed-by: Thomas Huth <thuth@redhat.com>
ae23c9
Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
Message-Id: <20180625124238.25339-20-f4bug@amsat.org>
ae23c9
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ae23c9
(cherry picked from commit 393fc4c740d8d83d45bdbcd5f6a4cbc6be09b600)
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 hw/s390x/s390-skeys.c    | 3 ++-
ae23c9
 hw/s390x/s390-stattrib.c | 3 ++-
ae23c9
 hw/s390x/sclp.c          | 3 ++-
ae23c9
 3 files changed, 6 insertions(+), 3 deletions(-)
ae23c9
ae23c9
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
ae23c9
index 76241c2..15f7ab0 100644
ae23c9
--- a/hw/s390x/s390-skeys.c
ae23c9
+++ b/hw/s390x/s390-skeys.c
ae23c9
@@ -10,6 +10,7 @@
ae23c9
  */
ae23c9
 
ae23c9
 #include "qemu/osdep.h"
ae23c9
+#include "qemu/units.h"
ae23c9
 #include "hw/boards.h"
ae23c9
 #include "hw/s390x/storage-keys.h"
ae23c9
 #include "qapi/error.h"
ae23c9
@@ -19,7 +20,7 @@
ae23c9
 #include "sysemu/kvm.h"
ae23c9
 #include "migration/register.h"
ae23c9
 
ae23c9
-#define S390_SKEYS_BUFFER_SIZE 131072  /* Room for 128k storage keys */
ae23c9
+#define S390_SKEYS_BUFFER_SIZE (128 * KiB)  /* Room for 128k storage keys */
ae23c9
 #define S390_SKEYS_SAVE_FLAG_EOS 0x01
ae23c9
 #define S390_SKEYS_SAVE_FLAG_SKEYS 0x02
ae23c9
 #define S390_SKEYS_SAVE_FLAG_ERROR 0x04
ae23c9
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
ae23c9
index 70b9555..5161a16 100644
ae23c9
--- a/hw/s390x/s390-stattrib.c
ae23c9
+++ b/hw/s390x/s390-stattrib.c
ae23c9
@@ -10,6 +10,7 @@
ae23c9
  */
ae23c9
 
ae23c9
 #include "qemu/osdep.h"
ae23c9
+#include "qemu/units.h"
ae23c9
 #include "hw/boards.h"
ae23c9
 #include "cpu.h"
ae23c9
 #include "migration/qemu-file.h"
ae23c9
@@ -20,7 +21,7 @@
ae23c9
 #include "qapi/error.h"
ae23c9
 #include "qapi/qmp/qdict.h"
ae23c9
 
ae23c9
-#define CMMA_BLOCK_SIZE  (1 << 10)
ae23c9
+#define CMMA_BLOCK_SIZE  (1 * KiB)
ae23c9
 
ae23c9
 #define STATTR_FLAG_EOS     0x01ULL
ae23c9
 #define STATTR_FLAG_MORE    0x02ULL
ae23c9
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
ae23c9
index 2abdb62..4510a80 100644
ae23c9
--- a/hw/s390x/sclp.c
ae23c9
+++ b/hw/s390x/sclp.c
ae23c9
@@ -13,6 +13,7 @@
ae23c9
  */
ae23c9
 
ae23c9
 #include "qemu/osdep.h"
ae23c9
+#include "qemu/units.h"
ae23c9
 #include "qapi/error.h"
ae23c9
 #include "cpu.h"
ae23c9
 #include "sysemu/sysemu.h"
ae23c9
@@ -289,7 +290,7 @@ static void sclp_realize(DeviceState *dev, Error **errp)
ae23c9
     ret = s390_set_memory_limit(machine->maxram_size, &hw_limit);
ae23c9
     if (ret == -E2BIG) {
ae23c9
         error_setg(&err, "host supports a maximum of %" PRIu64 " GB",
ae23c9
-                   hw_limit >> 30);
ae23c9
+                   hw_limit / GiB);
ae23c9
     } else if (ret) {
ae23c9
         error_setg(&err, "setting the guest size failed");
ae23c9
     }
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9