File s390-tools-sles15sp2-28-zipl-move-loaders-layout-definitions-into-separate-h.patch of Package s390-tools.19608
Subject: [PATCH] [FEAT VS1804] zipl: move loaders layout definitions into separate header
From: Marc Hartmayer <mhartmay@linux.ibm.com>
Summary: genprotimg: Introduce new tool for the creation of PV images
Description: genprotimg takes a kernel, host-key documents, optionally an
initrd, optionally a file with the kernel command line, and it
generates a single, loadable image file. The image consists of a
concatenation of a plain text boot loader, the encrypted
components for kernel, initrd, and cmdline, and the
integrity-protected PV header, containing metadata necessary for
running the guest in PV mode. It's possible to use this image file
as a kernel for zIPL or for a direct kernel boot using QEMU.
Upstream-ID: 97ab8fb4e98c84a89d421c08b392db665125a3c0
Problem-ID: VS1804
Upstream-Description:
zipl: move loaders layout definitions into separate header
Move the loaders (stage2/stage3) layout values to
`include/boot/loaders_layout.h` and use the `_AC` macro for the
constants. This allows the reuse of the definitions, e.g. in assembler
files, and later for the creation of linker scripts.
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
include/boot/loaders_layout.h | 32 ++++++++++++++++++++++++++++++++
zipl/include/zipl.h | 14 +-------------
2 files changed, 33 insertions(+), 13 deletions(-)
--- /dev/null
+++ b/include/boot/loaders_layout.h
@@ -0,0 +1,32 @@
+/*
+ * zipl stage2/stage3 layout definitions
+ *
+ * Copyright IBM Corp. 2020
+ *
+ * s390-tools is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ *
+ */
+
+#ifndef LOADERS_LAYOUT_H
+#define LOADERS_LAYOUT_H
+
+#include "lib/zt_common.h"
+#include "linux_layout.h"
+
+#define STAGE3_ENTRY _AC(0xa000, UL)
+
+#define STAGE2_LOAD_ADDRESS _AC(0x2000, UL)
+#define STAGE3_LOAD_ADDRESS STAGE3_ENTRY
+#define IMAGE_LOAD_ADDRESS IMAGE_ENTRY
+
+#define STAGE3_HEAP_SIZE _AC(0x4000, UL)
+#define STAGE3_HEAP_ADDRESS _AC(0x2000, UL)
+#define STAGE3_STACK_SIZE _AC(0x1000, UL)
+#define STAGE3_STACK_ADDRESS _AC(0xF000, UL)
+#define STAGE3_PARAMS_ADDRESS _AC(0x9000, UL)
+
+
+#ifndef __ASSEMBLER__
+#endif /* __ASSEMBLER__ */
+#endif /* LOADERS_LAYOUT_H */
--- a/zipl/include/zipl.h
+++ b/zipl/include/zipl.h
@@ -14,30 +14,18 @@
#include <stdint.h>
#include "lib/zt_common.h"
-#include "boot/linux_layout.h"
+#include "boot/loaders_layout.h"
#define ZIPL_MAGIC "zIPL"
#define ZIPL_MAGIC_SIZE 4
#define DISK_LAYOUT_ID 0x00000001
-#define STAGE3_ENTRY 0xa000UL
-
-#define STAGE2_LOAD_ADDRESS 0x2000UL
-#define STAGE3_LOAD_ADDRESS STAGE3_ENTRY
-#define IMAGE_LOAD_ADDRESS IMAGE_ENTRY
-
#define ADDRESS_LIMIT 0x80000000UL
#define ADDRESS_LIMIT_KDUMP 0x2000000UL /* HSA size: 32 MiB */
#define UNSPECIFIED_ADDRESS -1UL
#define MAXIMUM_PARMLINE_SIZE 0x380UL
#define MAXIMUM_PHYSICAL_BLOCKSIZE 0x1000UL
-#define STAGE3_HEAP_SIZE 0x4000UL
-#define STAGE3_HEAP_ADDRESS 0x2000UL
-#define STAGE3_STACK_SIZE 0x1000UL
-#define STAGE3_STACK_ADDRESS 0xF000UL
-#define STAGE3_PARAMS_ADDRESS 0x9000UL
-
#define PSW_ADDRESS_MASK 0x000000007fffffffUL
#define PSW_LOAD 0x0008000080000000UL
#define PSW_DISABLED_WAIT 0x000a000000000000UL