File s390-tools-sles15sp2-02-zipl-stage3-correctly-handle-diag308-response-code.patch of Package s390-tools.17667
Subject: [PATCH] [BZ 186940] zipl/stage3: correctly handle diag308 response code
From: Stefan Haberland <sth@linux.ibm.com>
Description: zipl: Fix KVM IPL without bootindex
Symptom: Failed IPL on KVM when no bootindex is specified.
Problem: Without bootindex specified there is no IPL parmblock
on KVM which can be read by the stage3 loader.
Solution: In case diag308 gives a response code 0x102 the stage3
loader can safely assume that no secure IPL is required
since no IPL report block exists.
Reproduction: IPL on KVM without 'bootindex=' attached.
Upstream-ID: b7f1977d3f9332f82e7f388fb18076b89b83944e
Problem-ID: 186940
Upstream-Description:
zipl/stage3: correctly handle diag308 response code
In case diag308 gives a response code 0x102 the stage3 loader can
safely assume that no secure IPL is required since no IPL report
block exists.
Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
---
include/boot/s390.h | 1 +
zipl/boot/stage3.c | 25 +++++++++++--------------
2 files changed, 12 insertions(+), 14 deletions(-)
--- a/include/boot/s390.h
+++ b/include/boot/s390.h
@@ -279,6 +279,7 @@ enum diag308_subcode {
enum diag308_rc {
DIAG308_RC_OK = 0x0001,
+ DIAG308_RC_NO_CONF = 0x0102,
};
static __always_inline unsigned long diag308(unsigned long subcode, void *addr)
--- a/zipl/boot/stage3.c
+++ b/zipl/boot/stage3.c
@@ -55,18 +55,6 @@ static inline void __noreturn start_kern
while (1);
}
-unsigned int store_ipl_parmblock(struct ipl_pl_hdr *pl_hdr)
-{
- int rc;
-
- rc = diag308(DIAG308_STORE, pl_hdr);
- if (rc == DIAG308_RC_OK &&
- pl_hdr->version <= IPL_MAX_SUPPORTED_VERSION)
- return 0;
-
- return 1;
-}
-
unsigned int
is_verified_address(unsigned long image_addr)
{
@@ -124,9 +112,18 @@ secure_boot_enabled()
unsigned int rc;
pl_hdr = (void *)get_zeroed_page();
- if (!pl_hdr || store_ipl_parmblock(pl_hdr))
+ switch (diag308(DIAG308_STORE, pl_hdr)) {
+ case DIAG308_RC_OK:
+ rc = pl_hdr->version <= IPL_MAX_SUPPORTED_VERSION &&
+ !!(pl_hdr->flags & IPL_FLAG_SECURE);
+ break;
+ case DIAG308_RC_NO_CONF:
+ rc = 0;
+ break;
+ default:
panic(ESECUREBOOT, "%s", msg_sipl_noparm);
- rc = !!(pl_hdr->flags & IPL_FLAG_SECURE);
+ break;
+ }
free_page((unsigned long) pl_hdr);
return rc;