]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390/boot: add dfltcc= kernel command line parameter
authorMikhail Zaslonko <zaslonko@linux.ibm.com>
Fri, 31 Jan 2020 06:16:27 +0000 (22:16 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2020 18:30:40 +0000 (10:30 -0800)
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>
Documentation/admin-guide/kernel-parameters.txt
arch/s390/boot/ipl_parm.c
arch/s390/include/asm/setup.h
arch/s390/kernel/setup.c
lib/zlib_dfltcc/dfltcc.c
lib/zlib_dfltcc/dfltcc.h
lib/zlib_dfltcc/dfltcc_deflate.c
lib/zlib_dfltcc/dfltcc_inflate.c
lib/zlib_dfltcc/dfltcc_util.h

index ec92120a795266abd27a115a399ce2c31eb5638b..ddc5ccdd4cd151b3c68ed7be361cacb86e236f47 100644 (file)
                        dump out devices still on the deferred probe list after
                        retrying.
 
+       dfltcc=         [HW,S390]
+                       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)
+
        dhash_entries=  [KNL]
                        Set number of hash buckets for dentry cache.
 
index 24ef67eb1ceffd096e7c3b9050a02029cba2ca92..357adad991d2b9152677edeecf014330817f2e66 100644 (file)
@@ -14,6 +14,7 @@
 char __bootdata(early_command_line)[COMMAND_LINE_SIZE];
 struct ipl_parameter_block __bootdata_preserved(ipl_block);
 int __bootdata_preserved(ipl_block_valid);
+unsigned int __bootdata_preserved(zlib_dfltcc_support) = ZLIB_DFLTCC_FULL;
 
 unsigned long __bootdata(vmalloc_size) = VMALLOC_DEFAULT_SIZE;
 unsigned long __bootdata(memory_end);
@@ -229,6 +230,19 @@ void parse_boot_command_line(void)
                if (!strcmp(param, "vmalloc") && val)
                        vmalloc_size = round_up(memparse(val, NULL), PAGE_SIZE);
 
+               if (!strcmp(param, "dfltcc")) {
+                       if (!strcmp(val, "off"))
+                               zlib_dfltcc_support = ZLIB_DFLTCC_DISABLED;
+                       else if (!strcmp(val, "on"))
+                               zlib_dfltcc_support = ZLIB_DFLTCC_FULL;
+                       else if (!strcmp(val, "def_only"))
+                               zlib_dfltcc_support = ZLIB_DFLTCC_DEFLATE_ONLY;
+                       else if (!strcmp(val, "inf_only"))
+                               zlib_dfltcc_support = ZLIB_DFLTCC_INFLATE_ONLY;
+                       else if (!strcmp(val, "always"))
+                               zlib_dfltcc_support = ZLIB_DFLTCC_FULL_DEBUG;
+               }
+
                if (!strcmp(param, "noexec")) {
                        rc = kstrtobool(val, &enabled);
                        if (!rc && !enabled)
index 69289e99cabdcee175a4a176881a128f49e3a574..b241ddb67cafd9798469885f2e7b8dff073e232a 100644 (file)
@@ -79,6 +79,13 @@ struct parmarea {
        char command_line[ARCH_COMMAND_LINE_SIZE];      /* 0x10480 */
 };
 
+extern unsigned int zlib_dfltcc_support;
+#define ZLIB_DFLTCC_DISABLED           0
+#define ZLIB_DFLTCC_FULL               1
+#define ZLIB_DFLTCC_DEFLATE_ONLY       2
+#define ZLIB_DFLTCC_INFLATE_ONLY       3
+#define ZLIB_DFLTCC_FULL_DEBUG         4
+
 extern int noexec_disabled;
 extern int memory_end_set;
 extern unsigned long memory_end;
index 7d113e208f653ee4020026aed76cce4bee57b0e5..b2c2f75860e8874623aeab013374cc198f71a57c 100644 (file)
@@ -111,6 +111,8 @@ unsigned long __bootdata_preserved(__etext_dma);
 unsigned long __bootdata_preserved(__sdma);
 unsigned long __bootdata_preserved(__edma);
 unsigned long __bootdata_preserved(__kaslr_offset);
+unsigned int __bootdata_preserved(zlib_dfltcc_support);
+EXPORT_SYMBOL(zlib_dfltcc_support);
 
 unsigned long VMALLOC_START;
 EXPORT_SYMBOL(VMALLOC_START);
index 7f77e5bb01c6573b4a38fd113946150f1977ac86..c30de430b30ca64ae30d3299949e59ddb9520604 100644 (file)
@@ -44,7 +44,10 @@ void dfltcc_reset(
     dfltcc_state->param.nt = 1;
 
     /* Initialize tuning parameters */
-    dfltcc_state->level_mask = DFLTCC_LEVEL_MASK;
+    if (zlib_dfltcc_support == ZLIB_DFLTCC_FULL_DEBUG)
+        dfltcc_state->level_mask = DFLTCC_LEVEL_MASK_DEBUG;
+    else
+        dfltcc_state->level_mask = DFLTCC_LEVEL_MASK;
     dfltcc_state->block_size = DFLTCC_BLOCK_SIZE;
     dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE;
     dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE;
index 4782c92bb2ffd4b312cf6f45332a9d2adeb9ef5c..be70c807b62f38041a983f82304fa8494e59d3bc 100644 (file)
@@ -8,6 +8,7 @@
  * Tuning parameters.
  */
 #define DFLTCC_LEVEL_MASK 0x2 /* DFLTCC compression for level 1 only */
+#define DFLTCC_LEVEL_MASK_DEBUG 0x3fe /* DFLTCC compression for all levels */
 #define DFLTCC_BLOCK_SIZE 1048576
 #define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096
 #define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096
index 9f0f1c90c4e08e0e695d8557985e7bc3eb0e5b42..00c185101c6d14a145d16b54b739f8b8caa2d830 100644 (file)
@@ -3,6 +3,7 @@
 #include "../zlib_deflate/defutil.h"
 #include "dfltcc_util.h"
 #include "dfltcc.h"
+#include <asm/setup.h>
 #include <linux/zutil.h>
 
 /*
@@ -15,6 +16,11 @@ int dfltcc_can_deflate(
     deflate_state *state = (deflate_state *)strm->state;
     struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
 
+    /* Check for kernel dfltcc command line parameter */
+    if (zlib_dfltcc_support == ZLIB_DFLTCC_DISABLED ||
+            zlib_dfltcc_support == ZLIB_DFLTCC_INFLATE_ONLY)
+        return 0;
+
     /* Unsupported compression settings */
     if (!dfltcc_are_params_ok(state->level, state->w_bits, state->strategy,
                               dfltcc_state->level_mask))
index 12a93a06bd61830eafcdc9d13eacba47e20bdfdb..aa9ef23474df0234557a9799354c3d1d50dfdcad 100644 (file)
@@ -3,6 +3,7 @@
 #include "../zlib_inflate/inflate.h"
 #include "dfltcc_util.h"
 #include "dfltcc.h"
+#include <asm/setup.h>
 #include <linux/zutil.h>
 
 /*
@@ -15,6 +16,11 @@ int dfltcc_can_inflate(
     struct inflate_state *state = (struct inflate_state *)strm->state;
     struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
 
+    /* Check for kernel dfltcc command line parameter */
+    if (zlib_dfltcc_support == ZLIB_DFLTCC_DISABLED ||
+            zlib_dfltcc_support == ZLIB_DFLTCC_DEFLATE_ONLY)
+        return 0;
+
     /* Unsupported compression settings */
     if (state->wbits != HB_BITS)
         return 0;
index 82cd1950c416a55727e3027d30ea7856a486a359..7c0d3bdc50a960003d4eb27e9491f0845fa921c2 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <linux/zutil.h>
 #include <asm/facility.h>
+#include <asm/setup.h>
 
 /*
  * C wrapper for the DEFLATE CONVERSION CALL instruction.
@@ -102,7 +103,8 @@ static inline int dfltcc_are_params_ok(
 
 static inline int is_dfltcc_enabled(void)
 {
-    return test_facility(DFLTCC_FACILITY);
+    return (zlib_dfltcc_support != ZLIB_DFLTCC_DISABLED &&
+            test_facility(DFLTCC_FACILITY));
 }
 
 char *oesc_msg(char *buf, int oesc);