|
|
4841a6 |
From ddfee9d393af322938e4df466cd01b8f9570a1c9 Mon Sep 17 00:00:00 2001
|
|
|
4841a6 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
4841a6 |
Date: Tue, 5 Apr 2022 10:20:59 +0200
|
|
|
4841a6 |
Subject: [PATCH 1/6] s390x/ipl: support extended kernel command line size
|
|
|
4841a6 |
|
|
|
4841a6 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
4841a6 |
RH-MergeRequest: 144: s390x/ipl: support extended kernel command line size
|
|
|
4841a6 |
RH-Commit: [1/1] be227e50af5dbe7802605f873db29ac5358aa196
|
|
|
4841a6 |
RH-Bugzilla: 2043830
|
|
|
4841a6 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
4841a6 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
4841a6 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
4841a6 |
|
|
|
4841a6 |
Bugzilla: http://bugzilla.redhat.com/2043830
|
|
|
4841a6 |
|
|
|
4841a6 |
commit b2173046a64beed76715f310f98538f159276af1
|
|
|
4841a6 |
Author: Marc Hartmayer <mhartmay@linux.ibm.com>
|
|
|
4841a6 |
Date: Mon Nov 22 12:29:09 2021 +0100
|
|
|
4841a6 |
|
|
|
4841a6 |
s390x/ipl: support extended kernel command line size
|
|
|
4841a6 |
|
|
|
4841a6 |
In the past s390 used a fixed command line length of 896 bytes. This has changed
|
|
|
4841a6 |
with the Linux commit 5ecb2da660ab ("s390: support command lines longer than 896
|
|
|
4841a6 |
bytes"). There is now a parm area indicating the maximum command line size. This
|
|
|
4841a6 |
parm area has always been initialized to zero, so with older kernels this field
|
|
|
4841a6 |
would read zero and we must then assume that only 896 bytes are available.
|
|
|
4841a6 |
|
|
|
4841a6 |
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
|
|
|
4841a6 |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
4841a6 |
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
|
|
|
4841a6 |
Acked-by: Viktor Mihajlovski <mihajlov@de.ibm.com>
|
|
|
4841a6 |
Message-Id: <20211122112909.18138-1-mhartmay@linux.ibm.com>
|
|
|
4841a6 |
[thuth: Cosmetic fixes, and use PRIu64 instead of %lu]
|
|
|
4841a6 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
4841a6 |
|
|
|
4841a6 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
4841a6 |
---
|
|
|
4841a6 |
hw/s390x/ipl.c | 27 +++++++++++++++++++++++----
|
|
|
4841a6 |
1 file changed, 23 insertions(+), 4 deletions(-)
|
|
|
4841a6 |
|
|
|
4841a6 |
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
|
|
|
4841a6 |
index 7ddca0127f..eb7fc4c4ae 100644
|
|
|
4841a6 |
--- a/hw/s390x/ipl.c
|
|
|
4841a6 |
+++ b/hw/s390x/ipl.c
|
|
|
4841a6 |
@@ -37,8 +37,9 @@
|
|
|
4841a6 |
|
|
|
4841a6 |
#define KERN_IMAGE_START 0x010000UL
|
|
|
4841a6 |
#define LINUX_MAGIC_ADDR 0x010008UL
|
|
|
4841a6 |
+#define KERN_PARM_AREA_SIZE_ADDR 0x010430UL
|
|
|
4841a6 |
#define KERN_PARM_AREA 0x010480UL
|
|
|
4841a6 |
-#define KERN_PARM_AREA_SIZE 0x000380UL
|
|
|
4841a6 |
+#define LEGACY_KERN_PARM_AREA_SIZE 0x000380UL
|
|
|
4841a6 |
#define INITRD_START 0x800000UL
|
|
|
4841a6 |
#define INITRD_PARM_START 0x010408UL
|
|
|
4841a6 |
#define PARMFILE_START 0x001000UL
|
|
|
4841a6 |
@@ -110,6 +111,21 @@ static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr)
|
|
|
4841a6 |
return srcaddr + dstaddr;
|
|
|
4841a6 |
}
|
|
|
4841a6 |
|
|
|
4841a6 |
+static uint64_t get_max_kernel_cmdline_size(void)
|
|
|
4841a6 |
+{
|
|
|
4841a6 |
+ uint64_t *size_ptr = rom_ptr(KERN_PARM_AREA_SIZE_ADDR, sizeof(*size_ptr));
|
|
|
4841a6 |
+
|
|
|
4841a6 |
+ if (size_ptr) {
|
|
|
4841a6 |
+ uint64_t size;
|
|
|
4841a6 |
+
|
|
|
4841a6 |
+ size = be64_to_cpu(*size_ptr);
|
|
|
4841a6 |
+ if (size) {
|
|
|
4841a6 |
+ return size;
|
|
|
4841a6 |
+ }
|
|
|
4841a6 |
+ }
|
|
|
4841a6 |
+ return LEGACY_KERN_PARM_AREA_SIZE;
|
|
|
4841a6 |
+}
|
|
|
4841a6 |
+
|
|
|
4841a6 |
static void s390_ipl_realize(DeviceState *dev, Error **errp)
|
|
|
4841a6 |
{
|
|
|
4841a6 |
MachineState *ms = MACHINE(qdev_get_machine());
|
|
|
4841a6 |
@@ -197,10 +213,13 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
|
|
|
4841a6 |
ipl->start_addr = KERN_IMAGE_START;
|
|
|
4841a6 |
/* Overwrite parameters in the kernel image, which are "rom" */
|
|
|
4841a6 |
if (parm_area) {
|
|
|
4841a6 |
- if (cmdline_size > KERN_PARM_AREA_SIZE) {
|
|
|
4841a6 |
+ uint64_t max_cmdline_size = get_max_kernel_cmdline_size();
|
|
|
4841a6 |
+
|
|
|
4841a6 |
+ if (cmdline_size > max_cmdline_size) {
|
|
|
4841a6 |
error_setg(errp,
|
|
|
4841a6 |
- "kernel command line exceeds maximum size: %zu > %lu",
|
|
|
4841a6 |
- cmdline_size, KERN_PARM_AREA_SIZE);
|
|
|
4841a6 |
+ "kernel command line exceeds maximum size:"
|
|
|
4841a6 |
+ " %zu > %" PRIu64,
|
|
|
4841a6 |
+ cmdline_size, max_cmdline_size);
|
|
|
4841a6 |
return;
|
|
|
4841a6 |
}
|
|
|
4841a6 |
|
|
|
4841a6 |
--
|
|
|
4841a6 |
2.27.0
|
|
|
4841a6 |
|