summary refs log tree commit diff stats
path: root/hw/mips/malta.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-09-27 13:18:17 +0200
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-10-17 13:59:40 +0200
commitacab36ca25101930b263dd9e8afd9b244354d338 (patch)
tree2e1e801b61aac4df59e1b948b92f33a7ebf19e4b /hw/mips/malta.c
parent9d585eaa87bf1c5f66e12d6c4a8a38c80f69c5da (diff)
downloadfocaccia-qemu-acab36ca25101930b263dd9e8afd9b244354d338.tar.gz
focaccia-qemu-acab36ca25101930b263dd9e8afd9b244354d338.zip
hw/mips: Simplify code using ROUND_UP(INITRD_PAGE_SIZE)
Instead of using a INITRD_PAGE_MASK definition, use the
simpler INITRD_PAGE_SIZE one which allows us to simplify
the code by using directly the self-explicit ROUND_UP()
macro.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200927163943.614604-3-f4bug@amsat.org>
Diffstat (limited to 'hw/mips/malta.c')
-rw-r--r--hw/mips/malta.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index ff3225bb8e..beb0f43941 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -1077,9 +1077,9 @@ static int64_t load_kernel(void)
              * the initrd.  It takes at most 128kiB for 2GB RAM and 4kiB
              * pages.
              */
-            initrd_offset = (loaderparams.ram_low_size - initrd_size
-                             - (128 * KiB)
-                             - ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
+            initrd_offset = ROUND_UP(loaderparams.ram_low_size
+                                     - (initrd_size + 128 * KiB),
+                                     INITRD_PAGE_SIZE);
             if (kernel_high >= initrd_offset) {
                 error_report("memory too small for initial ram disk '%s'",
                              loaderparams.initrd_filename);