Skip to content

Commit

Permalink
pc-bios: s390x: Clear out leftover S390EP string
Browse files Browse the repository at this point in the history
A Linux binary will have the string "S390EP" at address 0x10008,
which is important in getting the guest up off the ground. In the
case of a reboot (specifically chreipl going to a new device),
we should defer to the PSW at address zero for the new config,
which will re-write "S390EP" from the new image.

Let's clear it out at this point so that a reipl to, say, a DASD
passthrough device drives the IPL path from scratch without disrupting
disrupting the order of operations for other boots.

Rather than hardcoding the address of this magic (again), let's
define it somewhere so that the two users are visibly related.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20201120160117.59366-3-farman@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
efarman authored and huth committed Nov 23, 2020
1 parent d8e5bbd commit 3d65199
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pc-bios/s390-ccw/jump2ipl.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void jump_to_low_kernel(void)
* kernel start address (when jumping to the PSW-at-zero address instead,
* the kernel startup code fails when we booted from a network device).
*/
if (!memcmp((char *)0x10008, "S390EP", 6)) {
if (!memcmp((char *)S390EP, "S390EP", 6)) {
jump_to_IPL_code(KERN_IMAGE_START);
}

Expand Down
6 changes: 6 additions & 0 deletions pc-bios/s390-ccw/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ static void boot_setup(void)
memcpy(lpmsg + 10, loadparm_str, 8);
sclp_print(lpmsg);

/*
* Clear out any potential S390EP magic (see jump_to_low_kernel()),
* so we don't taint our decision-making process during a reboot.
*/
memset((char *)S390EP, 0, 6);

have_iplb = store_iplb(&iplb);
}

Expand Down
3 changes: 3 additions & 0 deletions pc-bios/s390-ccw/s390-arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ typedef struct LowCore {

extern LowCore *lowcore;

/* Location of "S390EP" in a Linux binary (see arch/s390/boot/head.S) */
#define S390EP 0x10008

static inline void set_prefix(uint32_t address)
{
asm volatile("spx %0" : : "m" (address) : "memory");
Expand Down

0 comments on commit 3d65199

Please sign in to comment.