Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/boot: add dfltcc= kernel command line parameter

Add the new kernel command line parameter 'dfltcc=' to configure s390
zlib hardware support.

Format: { on | off | def_only | inf_only | always }
on: s390 zlib hardware support for compression on
level 1 and decompression (default)
off: No s390 zlib hardware support
def_only: s390 zlib hardware support for deflate
only (compression on level 1)
inf_only: s390 zlib hardware support for inflate
only (decompression)
always: Same as 'on' but ignores the selected compression
level always using hardware support (used for debugging)

Link: http://lkml.kernel.org/r/20200103223334.20669-5-zaslonko@linux.ibm.com
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Cc: Chris Mason <clm@fb.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: David Sterba <dsterba@suse.com>
Cc: Eduard Shishkin <edward6@linux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mikhail Zaslonko and committed by
Linus Torvalds
c65e6815 12619610

+55 -2
+12
Documentation/admin-guide/kernel-parameters.txt
··· 834 834 dump out devices still on the deferred probe list after 835 835 retrying. 836 836 837 + dfltcc= [HW,S390] 838 + Format: { on | off | def_only | inf_only | always } 839 + on: s390 zlib hardware support for compression on 840 + level 1 and decompression (default) 841 + off: No s390 zlib hardware support 842 + def_only: s390 zlib hardware support for deflate 843 + only (compression on level 1) 844 + inf_only: s390 zlib hardware support for inflate 845 + only (decompression) 846 + always: Same as 'on' but ignores the selected compression 847 + level always using hardware support (used for debugging) 848 + 837 849 dhash_entries= [KNL] 838 850 Set number of hash buckets for dentry cache. 839 851
+14
arch/s390/boot/ipl_parm.c
··· 14 14 char __bootdata(early_command_line)[COMMAND_LINE_SIZE]; 15 15 struct ipl_parameter_block __bootdata_preserved(ipl_block); 16 16 int __bootdata_preserved(ipl_block_valid); 17 + unsigned int __bootdata_preserved(zlib_dfltcc_support) = ZLIB_DFLTCC_FULL; 17 18 18 19 unsigned long __bootdata(vmalloc_size) = VMALLOC_DEFAULT_SIZE; 19 20 unsigned long __bootdata(memory_end); ··· 229 228 230 229 if (!strcmp(param, "vmalloc") && val) 231 230 vmalloc_size = round_up(memparse(val, NULL), PAGE_SIZE); 231 + 232 + if (!strcmp(param, "dfltcc")) { 233 + if (!strcmp(val, "off")) 234 + zlib_dfltcc_support = ZLIB_DFLTCC_DISABLED; 235 + else if (!strcmp(val, "on")) 236 + zlib_dfltcc_support = ZLIB_DFLTCC_FULL; 237 + else if (!strcmp(val, "def_only")) 238 + zlib_dfltcc_support = ZLIB_DFLTCC_DEFLATE_ONLY; 239 + else if (!strcmp(val, "inf_only")) 240 + zlib_dfltcc_support = ZLIB_DFLTCC_INFLATE_ONLY; 241 + else if (!strcmp(val, "always")) 242 + zlib_dfltcc_support = ZLIB_DFLTCC_FULL_DEBUG; 243 + } 232 244 233 245 if (!strcmp(param, "noexec")) { 234 246 rc = kstrtobool(val, &enabled);
+7
arch/s390/include/asm/setup.h
··· 79 79 char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */ 80 80 }; 81 81 82 + extern unsigned int zlib_dfltcc_support; 83 + #define ZLIB_DFLTCC_DISABLED 0 84 + #define ZLIB_DFLTCC_FULL 1 85 + #define ZLIB_DFLTCC_DEFLATE_ONLY 2 86 + #define ZLIB_DFLTCC_INFLATE_ONLY 3 87 + #define ZLIB_DFLTCC_FULL_DEBUG 4 88 + 82 89 extern int noexec_disabled; 83 90 extern int memory_end_set; 84 91 extern unsigned long memory_end;
+2
arch/s390/kernel/setup.c
··· 111 111 unsigned long __bootdata_preserved(__sdma); 112 112 unsigned long __bootdata_preserved(__edma); 113 113 unsigned long __bootdata_preserved(__kaslr_offset); 114 + unsigned int __bootdata_preserved(zlib_dfltcc_support); 115 + EXPORT_SYMBOL(zlib_dfltcc_support); 114 116 115 117 unsigned long VMALLOC_START; 116 118 EXPORT_SYMBOL(VMALLOC_START);
+4 -1
lib/zlib_dfltcc/dfltcc.c
··· 44 44 dfltcc_state->param.nt = 1; 45 45 46 46 /* Initialize tuning parameters */ 47 - dfltcc_state->level_mask = DFLTCC_LEVEL_MASK; 47 + if (zlib_dfltcc_support == ZLIB_DFLTCC_FULL_DEBUG) 48 + dfltcc_state->level_mask = DFLTCC_LEVEL_MASK_DEBUG; 49 + else 50 + dfltcc_state->level_mask = DFLTCC_LEVEL_MASK; 48 51 dfltcc_state->block_size = DFLTCC_BLOCK_SIZE; 49 52 dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE; 50 53 dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE;
+1
lib/zlib_dfltcc/dfltcc.h
··· 8 8 * Tuning parameters. 9 9 */ 10 10 #define DFLTCC_LEVEL_MASK 0x2 /* DFLTCC compression for level 1 only */ 11 + #define DFLTCC_LEVEL_MASK_DEBUG 0x3fe /* DFLTCC compression for all levels */ 11 12 #define DFLTCC_BLOCK_SIZE 1048576 12 13 #define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096 13 14 #define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096
+6
lib/zlib_dfltcc/dfltcc_deflate.c
··· 3 3 #include "../zlib_deflate/defutil.h" 4 4 #include "dfltcc_util.h" 5 5 #include "dfltcc.h" 6 + #include <asm/setup.h> 6 7 #include <linux/zutil.h> 7 8 8 9 /* ··· 15 14 { 16 15 deflate_state *state = (deflate_state *)strm->state; 17 16 struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); 17 + 18 + /* Check for kernel dfltcc command line parameter */ 19 + if (zlib_dfltcc_support == ZLIB_DFLTCC_DISABLED || 20 + zlib_dfltcc_support == ZLIB_DFLTCC_INFLATE_ONLY) 21 + return 0; 18 22 19 23 /* Unsupported compression settings */ 20 24 if (!dfltcc_are_params_ok(state->level, state->w_bits, state->strategy,
+6
lib/zlib_dfltcc/dfltcc_inflate.c
··· 3 3 #include "../zlib_inflate/inflate.h" 4 4 #include "dfltcc_util.h" 5 5 #include "dfltcc.h" 6 + #include <asm/setup.h> 6 7 #include <linux/zutil.h> 7 8 8 9 /* ··· 15 14 { 16 15 struct inflate_state *state = (struct inflate_state *)strm->state; 17 16 struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); 17 + 18 + /* Check for kernel dfltcc command line parameter */ 19 + if (zlib_dfltcc_support == ZLIB_DFLTCC_DISABLED || 20 + zlib_dfltcc_support == ZLIB_DFLTCC_DEFLATE_ONLY) 21 + return 0; 18 22 19 23 /* Unsupported compression settings */ 20 24 if (state->wbits != HB_BITS)
+3 -1
lib/zlib_dfltcc/dfltcc_util.h
··· 4 4 5 5 #include <linux/zutil.h> 6 6 #include <asm/facility.h> 7 + #include <asm/setup.h> 7 8 8 9 /* 9 10 * C wrapper for the DEFLATE CONVERSION CALL instruction. ··· 103 102 104 103 static inline int is_dfltcc_enabled(void) 105 104 { 106 - return test_facility(DFLTCC_FACILITY); 105 + return (zlib_dfltcc_support != ZLIB_DFLTCC_DISABLED && 106 + test_facility(DFLTCC_FACILITY)); 107 107 } 108 108 109 109 char *oesc_msg(char *buf, int oesc);