thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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