From: Hans-Joachim Picht <hpicht@redhat.com> Date: Thu, 12 Mar 2009 15:24:26 +0100 Subject: [s390] extra kernel parameters via VMPARM Message-id: 20090312142426.GJ5103@redhat.com O-Subject: [RHEL5 U4 PATCH 9/20] FEAT: s390 - kernel: Extra kernel parameters via VMPARM (NSS part of the patch) Bugzilla: 475530 Description ============ This feature allows the user to append or replace kernel parameters using PARM option of the IPL command. Parameters can be set with the IPL command on the CP/CMS commandline or via the new "parm" sysfs attribute for the ccw and nss reipl types. Whereas the previous patch in this series addresses the base implementation, this patch provides the kernel NSS part. Bugzilla ========= BZ 475530 https://bugzilla.redhat.com/show_bug.cgi?id=475530 Upstream status of the patch: ============================= The patch is upstream as of git commit a0443fbb467af5e5930b9b059b52190605f70059 Test status: ============ The patch has been tested by the IBM test department. Please ACK. With best regards, --Hans diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index febfa6f..0c71557 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -318,12 +318,37 @@ static inline void setup_zfcpdump(unsigned int console_devno) {} /* * Create a Kernel NSS if the SAVESYS= parameter is defined */ -#define DEFSYS_CMD_SIZE 96 +#define DEFSYS_CMD_SIZE 128 #define SAVESYS_CMD_SIZE 32 char kernel_nss_name[NSS_NAME_SIZE + 1]; #ifdef CONFIG_SHARED_KERNEL +int __init savesys_ipl_nss(char *cmd, const int cmdlen); + +asm( + " .section .init.text,\"ax\",@progbits\n" + " .align 4\n" + " .type savesys_ipl_nss, @function\n" + "savesys_ipl_nss:\n" +#ifdef CONFIG_64BIT + " stmg 6,15,48(15)\n" + " lgr 14,3\n" + " sam31\n" + " diag 2,14,0x8\n" + " sam64\n" + " lgr 2,14\n" + " lmg 6,15,48(15)\n" +#else + " stm 6,15,24(15)\n" + " lr 14,3\n" + " diag 2,14,0x8\n" + " lr 2,14\n" + " lm 6,15,24(15)\n" +#endif + " br 14\n" + " .size savesys_ipl_nss, .-savesys_ipl_nss\n"); + static __init void create_kernel_nss(void) { unsigned int i, stext_pfn, eshared_pfn, end_pfn, min_size; @@ -331,6 +356,7 @@ static __init void create_kernel_nss(void) unsigned int sinitrd_pfn, einitrd_pfn; #endif int response; + size_t len; char *savesys_ptr; char upper_command_line[COMMAND_LINE_SIZE]; char defsys_cmd[DEFSYS_CMD_SIZE]; @@ -340,9 +366,9 @@ static __init void create_kernel_nss(void) if (!MACHINE_IS_VM) return; - /* Convert COMMAND_LINE to upper case */ - for (i = 0; i < strlen(COMMAND_LINE); i++) - upper_command_line[i] = toupper(COMMAND_LINE[i]); + /* Convert s390_command_line to upper case */ + for (i = 0; i < strlen(s390_command_line); i++) + upper_command_line[i] = toupper(s390_command_line[i]); savesys_ptr = strstr(upper_command_line, "SAVESYS="); @@ -375,7 +401,8 @@ static __init void create_kernel_nss(void) } #endif - sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK", defsys_cmd, min_size); + sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK PARMREGS=0-13", + defsys_cmd, min_size); sprintf(savesys_cmd, "SAVESYS %s \n IPL %s", kernel_nss_name, kernel_nss_name); @@ -386,13 +413,24 @@ static __init void create_kernel_nss(void) return; } - __cpcmd(savesys_cmd, NULL, 0, &response); + len = strlen(savesys_cmd); + ASCEBC(savesys_cmd, len); + response = savesys_ipl_nss(savesys_cmd, len); - if (response != strlen(savesys_cmd)) { + /* On success: response is equal to the command size, + * max SAVESYS_CMD_SIZE + * On error: response contains the numeric portion of cp error message. + * for SAVESYS it will be >= 263 + */ + if (response > SAVESYS_CMD_SIZE) { kernel_nss_name[0] = '\0'; return; } + /* re-setup boot command line with new ipl vm parms */ + ipl_update_parameters(); + setup_boot_command_line(); + ipl_flags = IPL_NSS_VALID; }