Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 840798a1 authored by Philipp Rudo's avatar Philipp Rudo Committed by Martin Schwidefsky
Browse files

s390/kexec_file: Add purgatory



The common code expects the architecture to have a purgatory that runs
between the two kernels. Add it now. For simplicity first skip crash
support.

Signed-off-by: default avatarPhilipp Rudo <prudo@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 15ceb8c9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,3 +8,4 @@ obj-$(CONFIG_APPLDATA_BASE) += appldata/
obj-y				+= net/
obj-$(CONFIG_PCI)		+= pci/
obj-$(CONFIG_NUMA)		+= numa/
obj-$(CONFIG_ARCH_HAS_KEXEC_PURGATORY) += purgatory/
+4 −0
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ config KEXEC
	def_bool y
	select KEXEC_CORE

config ARCH_HAS_KEXEC_PURGATORY
	def_bool y
	depends on KEXEC_FILE

config AUDIT_ARCH
	def_bool y

+17 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright IBM Corp. 2018
 *
 * Author(s): Philipp Rudo <prudo@linux.vnet.ibm.com>
 */

#ifndef _S390_PURGATORY_H_
#define _S390_PURGATORY_H_
#ifndef __ASSEMBLY__

#include <linux/purgatory.h>

int verify_sha256_digest(void);

#endif	/* __ASSEMBLY__ */
#endif /* _S390_PURGATORY_H_ */
+5 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/kbuild.h>
#include <linux/kvm_host.h>
#include <linux/sched.h>
#include <linux/purgatory.h>
#include <asm/idle.h>
#include <asm/vdso.h>
#include <asm/pgtable.h>
@@ -204,5 +205,9 @@ int main(void)
	OFFSET(__GMAP_ASCE, gmap, asce);
	OFFSET(__SIE_PROG0C, kvm_s390_sie_block, prog0c);
	OFFSET(__SIE_PROG20, kvm_s390_sie_block, prog20);
	/* kexec_sha_region */
	OFFSET(__KEXEC_SHA_REGION_START, kexec_sha_region, start);
	OFFSET(__KEXEC_SHA_REGION_LEN, kexec_sha_region, len);
	DEFINE(__KEXEC_SHA_REGION_SIZE, sizeof(struct kexec_sha_region));
	return 0;
}
+37 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

OBJECT_FILES_NON_STANDARD := y

purgatory-y := head.o purgatory.o string.o sha256.o mem.o

targets += $(purgatory-y) purgatory.ro kexec-purgatory.c
PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))

$(obj)/sha256.o: $(srctree)/lib/sha256.c
	$(call if_changed_rule,cc_o_c)

$(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S
	$(call if_changed_rule,as_o_S)

$(obj)/string.o: $(srctree)/arch/s390/lib/string.c
	$(call if_changed_rule,cc_o_c)

LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib
LDFLAGS_purgatory.ro += -z nodefaultlib
KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
KBUILD_CFLAGS += -c -MD -Os -m64
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)

$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
		$(call if_changed,ld)

CMD_BIN2C = $(objtree)/scripts/basic/bin2c
quiet_cmd_bin2c = BIN2C   $@
      cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@

$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
	$(call if_changed,bin2c)

obj-$(CONFIG_ARCH_HAS_KEXEC_PURGATORY) += kexec-purgatory.o
Loading