Re: [PATCH v2 3/4] powerpc/boot: Add bzip2 support for uImage

2019-04-25 Thread Adam Borowski
On Tue, Apr 23, 2019 at 02:20:43PM +, Christophe Leroy wrote:
> This patch allows to generate bzip2 compressed uImage

Please don't add bzip2 support, that's a waste of your time as we're trying
to remove it kernel-wide.  There's a patchset to retire compressors beaten
by alternatives on the whole speed-to-size curve; reposting it is overdue.

It does:
* add ZSTD (fast and strong)
* remove BZIP2 (obsolete, only user in kernel)
* remove LZMA (redundant with XZ, uses a private copy of its library)
* makes Kconfig prose talk badly about LZO (used elsewhere in the kernel)

I believe only three compressors are worth using here: XZ, ZSTD, LZ4.
GZIP must stay because of ubiquitous support, the rest should go.

> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -199,6 +199,7 @@ config PPC
> + select HAVE_KERNEL_BZIP2if DEFAULT_UIMAGE
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -23,6 +23,7 @@ all: $(obj)/zImage
> +compress-$(CONFIG_KERNEL_BZIP2)   := CONFIG_KERNEL_BZIP2
> @@ -259,6 +260,7 @@ endif
> +compressor-$(CONFIG_KERNEL_BZIP2) := bz2
> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -137,7 +137,7 @@ while [ "$#" -gt 0 ]; do
> -[ "$1" != "gz" -o "$1" != "xz" -o "$1" != "lzma" -o "$1" != "none" ] 
> || usage
> +[ "$1" != "gz" -o "$1" != "xz" -o "$1" != "lzma" -o "$1" != "bz2" -o 
> "$1" != "none" ] || usage
> @@ -149,6 +149,9 @@ while [ "$#" -gt 0 ]; do
> + if [ $uboot_comp = "bz2" ]; then
> + uboot_comp=bzip2
> + fi
> @@ -377,6 +380,9 @@ if [ -z "$cacheit" -o ! -f "$vmz$compression" -o 
> "$vmz$compression" -ot "$kernel
> +.bz2)
> +bzip2 -f "$vmz.$$"
> + ;;


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢰⠒⠀⣿⡁ 10 people enter a bar: 1 who understands binary,
⢿⡄⠘⠷⠚⠋⠀ 1 who doesn't, D who prefer to write it as hex,
⠈⠳⣄ and 1 who narrowly avoided an off-by-one error.


Re: [PATCH 05/17] mips: Remove support for BZIP2 and LZMA compressed kernel

2018-11-13 Thread Adam Borowski
On Tue, Nov 13, 2018 at 10:45:54PM +, Paul Burton wrote:
> On Fri, Nov 09, 2018 at 08:02:52PM +0100, Adam Borowski wrote:
> > @@ -122,7 +104,6 @@ $(obj)/vmlinux.its.S: $(addprefix 
> > $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS
> >  
> >  targets += vmlinux.its
> >  targets += vmlinux.gz.its
> > -targets += vmlinux.bz2.its
> >  targets += vmlinux.lzmo.its
> >  targets += vmlinux.lzo.its
> 
> It looks to me like this "vmlinux.lzmo.its" was a typo & ought to have
> been vmlinux.lzma.its, and thus ought to be removed.

Good catch!

The whole series was bz2 only at first, grepping for lzma missed this.

> Apart from that I'm fine with this in general:
> 
> Acked-by: Paul Burton 

Thanks.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢰⠒⠀⣿⡁ “This is gonna be as easy as cheating on an ethics exam!”
⢿⡄⠘⠷⠚⠋⠀ -Cerise Brightmoon
⠈⠳⣄


[PATCH 16/17] Kconfig: Update the prose for selection of compression algorithm

2018-11-09 Thread Adam Borowski
It was really obsolete, and some entries contradicted each other.

Let's not recommend ZSTD for kernel compression yet as it's available
only on x86, and some distros might not have the tool installed.
Proposing ZSTD for initrd is safer but let's test it first.

Signed-off-by: Adam Borowski 
---
 init/Kconfig | 25 +
 usr/Kconfig  | 24 +++-
 2 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 412ba93673fa..7c0180c41a3c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -153,26 +153,27 @@ choice
  version of this functionality (bzip2 only), for 2.4, was
  supplied by Christian Ludwig)
 
- High compression options are mostly useful for users, who
- are low on disk space (embedded systems), but for whom ram
- size matters less.
+ High compression options tend to be more useful in most cases,
+ as bootloaders are often egregiously slow to read the kernel
+ from the disk/SD card/network/etc, overcoming any boot time
+ savings you would get from faster decompression.
 
- If in doubt, select 'gzip'
+ If in doubt, select 'xz'
 
 config KERNEL_GZIP
bool "Gzip"
depends on HAVE_KERNEL_GZIP
help
- The old and tried gzip compression. It provides a good balance
- between compression ratio and decompression speed.
+ The old and tried gzip compression. You generally want it if
+ some tool you use doesn't support more modern compressors.
 
 config KERNEL_LZMA
bool "LZMA"
depends on HAVE_KERNEL_LZMA
help
- This compression algorithm's ratio is best.  Decompression speed
- is between gzip and bzip2.  Compression is slowest.
- The kernel size is about 33% smaller with LZMA in comparison to gzip.
+ An old version of xz, like it providing strong compression at slow
+ speed. It lacks a header and support for filters or uncompressed
+ blocks, thus it's usually better to pick xz.
 
 config KERNEL_XZ
bool "XZ"
@@ -193,9 +194,9 @@ config KERNEL_LZO
bool "LZO"
depends on HAVE_KERNEL_LZO
help
- Its compression ratio is the poorest among the choices. The kernel
- size is about 10% bigger than gzip; however its speed
- (both compression and decompression) is the fastest.
+ Its compression ratio is pretty poor (but still better than
+ LZ4). You want to pick ZSTD (similar speed but much better
+ compression) or LZ4 (much better speed) instead.
 
 config KERNEL_LZ4
bool "LZ4"
diff --git a/usr/Kconfig b/usr/Kconfig
index 8d99edacabc9..f6e871585f05 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -131,17 +131,15 @@ config INITRAMFS_COMPRESSION_NONE
  on those architectures that support this. However, not compressing the
  initramfs may lead to slightly higher memory consumption during a
  short time at boot, while both the cpio image and the unpacked
- filesystem image will be present in memory simultaneously
+ filesystem image will be present in memory simultaneously.
 
 config INITRAMFS_COMPRESSION_GZIP
bool "Gzip"
depends on RD_GZIP
help
- Use the old and well tested gzip compression algorithm. Gzip provides
- a good balance between compression ratio and decompression speed and
- has a reasonable compression speed. It is also more likely to be
- supported by your build system as the gzip tool is present by default
- on most distros.
+ Use the old and well tested gzip compression algorithm. Gzip doesn't
+ provide very good compression nor speed, but it's the safest choice,
+ with wide support.
 
 config INITRAMFS_COMPRESSION_XZ
bool "XZ"
@@ -150,20 +148,20 @@ config INITRAMFS_COMPRESSION_XZ
  XZ uses the LZMA2 algorithm and has a large dictionary which may cause
  problems on memory constrained systems. The initramfs size is about
  30% smaller with XZ in comparison to gzip. Decompression speed is
- better than that of bzip2 but worse than gzip and LZO. Compression is
- slow.
+ okayish but still slowest of all currently available algorithms.
+ Compression is slow.
 
- If you choose this, keep in mind that you may need to install the xz
- tool to be able to compress the initram.
+ Any modern distro provides xz in its default install, but on
+ minimal build systems you might need to install xz-utils to be
+ able to compress the initram.
 
 config INITRAMFS_COMPRESSION_LZO
bool "LZO"
depends on RD_LZO
help
  It's compression ratio is the second poorest amongst the choices. The
- kernel size is about 10% bigger t

[PATCH 17/17] [NOT FOR MERGING] lib: Be noisy about used decompression method.

2018-11-09 Thread Adam Borowski
It's too easy to build the initrd with wrong options during testing, after
which it may silently work anyway.

Signed-off-by: Adam Borowski 
---
 lib/decompress.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/decompress.c b/lib/decompress.c
index 95f39a14eb7b..345679312a45 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -69,7 +69,9 @@ decompress_fn __init decompress_method(const unsigned char 
*inbuf, long len,
break;
 
}
-   if (name)
+   if (name) {
*name = cf->name;
+   printk("Decompressing using %s.\n", *name);
+   }
return cf->decompressor;
 }
-- 
2.19.1



[PATCH 07/17] s390: Remove support for BZIP2 and LZMA compressed kernel

2018-11-09 Thread Adam Borowski
Made redundant by newer choices.

Signed-off-by: Adam Borowski 
---
 arch/s390/Kconfig| 2 --
 arch/s390/boot/compressed/Makefile   | 8 +---
 arch/s390/boot/compressed/decompressor.c | 8 
 3 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 5173366af8f3..96adb6127246 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -150,10 +150,8 @@ config S390
select HAVE_FUNCTION_TRACER
select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_GCC_PLUGINS
-   select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZ4
-   select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO
select HAVE_KERNEL_UNCOMPRESSED
select HAVE_KERNEL_XZ
diff --git a/arch/s390/boot/compressed/Makefile 
b/arch/s390/boot/compressed/Makefile
index 593039620487..ddd9d44fb7a8 100644
--- a/arch/s390/boot/compressed/Makefile
+++ b/arch/s390/boot/compressed/Makefile
@@ -11,7 +11,7 @@ UBSAN_SANITIZE := n
 KASAN_SANITIZE := n
 
 obj-y  := $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) piggy.o info.o
-targets:= vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz 
vmlinux.bin.bz2
+targets:= vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz
 targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
 targets += info.bin $(obj-y)
 
@@ -40,20 +40,14 @@ $(obj)/vmlinux.bin: vmlinux FORCE
 vmlinux.bin.all-y := $(obj)/vmlinux.bin
 
 suffix-$(CONFIG_KERNEL_GZIP)  := .gz
-suffix-$(CONFIG_KERNEL_BZIP2) := .bz2
 suffix-$(CONFIG_KERNEL_LZ4)  := .lz4
-suffix-$(CONFIG_KERNEL_LZMA)  := .lzma
 suffix-$(CONFIG_KERNEL_LZO)  := .lzo
 suffix-$(CONFIG_KERNEL_XZ)  := .xz
 
 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
$(call if_changed,gzip)
-$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
-   $(call if_changed,bzip2)
 $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
$(call if_changed,lz4)
-$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
-   $(call if_changed,lzma)
 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
$(call if_changed,lzo)
 $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
diff --git a/arch/s390/boot/compressed/decompressor.c 
b/arch/s390/boot/compressed/decompressor.c
index 45046630c56a..3995a6fe60f5 100644
--- a/arch/s390/boot/compressed/decompressor.c
+++ b/arch/s390/boot/compressed/decompressor.c
@@ -42,18 +42,10 @@ static unsigned long free_mem_end_ptr = (unsigned long) 
_end + HEAP_SIZE;
 #include "../../../../lib/decompress_inflate.c"
 #endif
 
-#ifdef CONFIG_KERNEL_BZIP2
-#include "../../../../lib/decompress_bunzip2.c"
-#endif
-
 #ifdef CONFIG_KERNEL_LZ4
 #include "../../../../lib/decompress_unlz4.c"
 #endif
 
-#ifdef CONFIG_KERNEL_LZMA
-#include "../../../../lib/decompress_unlzma.c"
-#endif
-
 #ifdef CONFIG_KERNEL_LZO
 #include "../../../../lib/decompress_unlzo.c"
 #endif
-- 
2.19.1



[PATCH 04/17] x86: Remove support for BZIP2 and LZMA compressed kernel

2018-11-09 Thread Adam Borowski
While bzip2 used to be good in its heyday, it's been drastically eclipsed
by newer algorithms.  In no case it's a rational choice anymore -- at any
point of the size-to-compression curve, there's something much better.
As we control the build process, any .configs that still select it will
harmlessly be adjusted, thus there's no risk of breakage.

Bare lzma is redundant with xz, lacks some improvements, and uses its own
copy of code instead using the common library.

Signed-off-by: Adam Borowski 
---
 Documentation/x86/boot.txt| 11 +--
 arch/x86/Kconfig  |  2 --
 arch/x86/boot/compressed/Makefile | 12 +++-
 arch/x86/boot/compressed/misc.c   |  8 
 arch/x86/include/asm/boot.h   |  4 +---
 5 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
index a47b6bae3356..fbd9720989e5 100644
--- a/Documentation/x86/boot.txt
+++ b/Documentation/x86/boot.txt
@@ -682,12 +682,11 @@ Protocol: 2.08+
   of the protected-mode code to the payload.
 
   The payload may be compressed. The format of both the compressed and
-  uncompressed data should be determined using the standard magic
-  numbers.  The currently supported compression formats are gzip
-  (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA
-  (magic number 5D 00), XZ (magic number FD 37), LZ4 (magic number
-  02 21) and ZSTD (magic number 28 B5). The uncompressed payload is
-  currently always ELF (magic number 7F 45 4C 46).
+  uncompressed data should be determined using the standard magic numbers.
+  The currently supported compression formats are gzip (magic numbers 1F 8B
+  or 1F 9E), XZ (magic number FD 37), LZ4 (magic number 02 21) and ZSTD
+  (magic number 28 B5). The uncompressed payload is currently always ELF
+  (magic number 7F 45 4C 46).
 
 Field name:payload_length
 Type:  read
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 203f7467f5c4..a47af31bbc62 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -158,10 +158,8 @@ config X86
select HAVE_IOREMAP_PROT
select HAVE_IRQ_EXIT_ON_IRQ_STACK   if X86_64
select HAVE_IRQ_TIME_ACCOUNTING
-   select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZ4
-   select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO
select HAVE_KERNEL_XZ
select HAVE_KERNEL_ZSTD
diff --git a/arch/x86/boot/compressed/Makefile 
b/arch/x86/boot/compressed/Makefile
index 6d2a8d2d378d..763aeb850658 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -7,13 +7,13 @@
 # vmlinuz is:
 #  decompression code (*.o)
 #  asm globals (piggy.S), including:
-#  vmlinux.bin.(gz|bz2|lzma|...)
+#  vmlinux.bin.(gz|zst|xz|...)
 #
 # vmlinux.bin is:
 #  vmlinux stripped of debugging and comments
 # vmlinux.bin.all is:
 #  vmlinux.bin + vmlinux.relocs
-# vmlinux.bin.(gz|bz2|lzma|...) is:
+# vmlinux.bin.(gz|zst|xz|...) is:
 #  (see scripts/Makefile.lib size_append)
 #  compressed vmlinux.bin.all + u32 size of vmlinux.bin.all
 
@@ -23,7 +23,7 @@ OBJECT_FILES_NON_STANDARD := y
 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
 KCOV_INSTRUMENT:= n
 
-targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma 
\
+targets := vmlinux vmlinux.bin vmlinux.bin.gz \
vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 vmlinux.bin.zst
 
 KBUILD_CFLAGS := -m$(BITS) -O2
@@ -132,10 +132,6 @@ vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += 
$(obj)/vmlinux.relocs
 
 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,gzip)
-$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
-   $(call if_changed,bzip2)
-$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
-   $(call if_changed,lzma)
 $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,xzkern)
 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
@@ -146,8 +142,6 @@ $(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
$(call if_changed,zstd)
 
 suffix-$(CONFIG_KERNEL_GZIP)   := gz
-suffix-$(CONFIG_KERNEL_BZIP2)  := bz2
-suffix-$(CONFIG_KERNEL_LZMA)   := lzma
 suffix-$(CONFIG_KERNEL_XZ) := xz
 suffix-$(CONFIG_KERNEL_LZO):= lzo
 suffix-$(CONFIG_KERNEL_LZ4):= lz4
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index b6c8921100fb..c0d75b74f199 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -57,14 +57,6 @@ static int lines, cols;
 #include "../../../../lib/decompress_inflate.c"
 #endif
 
-#ifdef CONFIG_KERNEL_BZIP2
-#include "../../../../lib/decompress_bunzip2.c"
-#endif
-
-#ifdef CONFIG_KERNEL_LZMA
-#include "../../../../lib/decompress_unlzma.c"
-#endif
-
 #ifdef CONFIG_KERNEL_XZ
 #include "../../../../lib/decompress_unxz.c"
 #endif
diff --git a/arch/x86/include/asm/bo

[PATCH 15/17] lib: Completely purge now-unused lzma code from the kernel

2018-11-09 Thread Adam Borowski
The XZ library already can decompress lzma, this other copy was redundant.
We just removed rather than converted all old users.

Signed-off-by: Adam Borowski 
---
 include/linux/decompress/unlzma.h |  13 -
 lib/Makefile  |   1 -
 lib/decompress.c  |   5 -
 lib/decompress_unlzma.c   | 679 --
 4 files changed, 698 deletions(-)
 delete mode 100644 include/linux/decompress/unlzma.h
 delete mode 100644 lib/decompress_unlzma.c

diff --git a/include/linux/decompress/unlzma.h 
b/include/linux/decompress/unlzma.h
deleted file mode 100644
index 1c930f125182..
--- a/include/linux/decompress/unlzma.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef DECOMPRESS_UNLZMA_H
-#define DECOMPRESS_UNLZMA_H
-
-int unlzma(unsigned char *, long,
-  long (*fill)(void*, unsigned long),
-  long (*flush)(void*, unsigned long),
-  unsigned char *output,
-  long *posp,
-  void(*error)(char *x)
-   );
-
-#endif
diff --git a/lib/Makefile b/lib/Makefile
index 4c1905e6d3a7..0036af71f4a8 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -134,7 +134,6 @@ obj-$(CONFIG_XZ_DEC) += xz/
 obj-$(CONFIG_RAID6_PQ) += raid6/
 
 lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
-lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
 lib-$(CONFIG_DECOMPRESS_XZ) += decompress_unxz.o
 lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
 lib-$(CONFIG_DECOMPRESS_LZ4) += decompress_unlz4.o
diff --git a/lib/decompress.c b/lib/decompress.c
index 60f05122b9da..95f39a14eb7b 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -8,7 +8,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -23,9 +22,6 @@
 #ifndef CONFIG_DECOMPRESS_GZIP
 # define gunzip NULL
 #endif
-#ifndef CONFIG_DECOMPRESS_LZMA
-# define unlzma NULL
-#endif
 #ifndef CONFIG_DECOMPRESS_XZ
 # define unxz NULL
 #endif
@@ -48,7 +44,6 @@ struct compress_format {
 static const struct compress_format compressed_formats[] __initconst = {
{ {0x1f, 0x8b}, "gzip", gunzip },
{ {0x1f, 0x9e}, "gzip", gunzip },
-   { {0x5d, 0x00}, "lzma", unlzma },
{ {0xfd, 0x37}, "xz", unxz },
{ {0x89, 0x4c}, "lzo", unlzo },
{ {0x02, 0x21}, "lz4", unlz4 },
diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c
deleted file mode 100644
index ed7a1fd819f2..
--- a/lib/decompress_unlzma.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/* Lzma decompressor for Linux kernel. Shamelessly snarfed
- *from busybox 1.1.1
- *
- *Linux kernel adaptation
- *Copyright (C) 2006  Alain < al...@knaff.lu >
- *
- *Based on small lzma deflate implementation/Small range coder
- *implementation for lzma.
- *Copyright (C) 2006  Aurelien Jacobs < au...@gnuage.org >
- *
- *Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/)
- *Copyright (C) 1999-2005  Igor Pavlov
- *
- *Copyrights of the parts, see headers below.
- *
- *
- *This program is free software; you can redistribute it and/or
- *modify it under the terms of the GNU Lesser General Public
- *License as published by the Free Software Foundation; either
- *version 2.1 of the License, or (at your option) any later version.
- *
- *This program is distributed in the hope that it will be useful,
- *but WITHOUT ANY WARRANTY; without even the implied warranty of
- *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *Lesser General Public License for more details.
- *
- *You should have received a copy of the GNU Lesser General Public
- *License along with this library; if not, write to the Free Software
- *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifdef STATIC
-#define PREBOOT
-#else
-#include 
-#endif /* STATIC */
-
-#include 
-
-#defineMIN(a, b) (((a) < (b)) ? (a) : (b))
-
-static long long INIT read_int(unsigned char *ptr, int size)
-{
-   int i;
-   long long ret = 0;
-
-   for (i = 0; i < size; i++)
-   ret = (ret << 8) | ptr[size-i-1];
-   return ret;
-}
-
-#define ENDIAN_CONVERT(x) \
-  x = (typeof(x))read_int((unsigned char *), sizeof(x))
-
-
-/* Small range coder implementation for lzma.
- *Copyright (C) 2006  Aurelien Jacobs < au...@gnuage.org >
- *
- *Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/)
- *Copyright (c) 1999-2005  Igor Pavlov
- */
-
-#include 
-
-#define LZMA_IOBUF_SIZE0x1
-
-struct rc {
-   long (*fill)(void*, unsigned long);
-   uint8_t *ptr;
-   uint8_t *buffer;
-   uint8_t *buffer_end;
-   long buffer_size;
-   uint32_t code;
-   uint32_t range;
-   uint32_t bound;
-   void (*error)(char *);
-};
-
-
-#define RC_TOP_BITS 24
-#define RC_MOVE_BITS 5
-#define RC_MODEL_TOTAL_BITS 11
-
-
-static long INIT nofill(void *buffer, unsigned long len)
-{
-   return -1;
-}
-
-/* Called tw

[PATCH 10/17] arm: Remove support for LZMA compressed kernel

2018-11-09 Thread Adam Borowski
You want XZ instead: newer version of same algorithm, has an optimized
filter for arm32 executables, uses a library shared with other uses of XZ
in the kernel.

Signed-off-by: Adam Borowski 
---
 arch/arm/Kconfig  | 1 -
 arch/arm/boot/compressed/Makefile | 1 -
 arch/arm/boot/compressed/decompress.c | 4 
 3 files changed, 6 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 91be74d8df65..637e100de6e3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -77,7 +77,6 @@ config ARM
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZ4
-   select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO
select HAVE_KERNEL_XZ
select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M
diff --git a/arch/arm/boot/compressed/Makefile 
b/arch/arm/boot/compressed/Makefile
index 1f5a5ffe7fcf..37e6097b7506 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -72,7 +72,6 @@ CPPFLAGS_vmlinux.lds := -DTEXT_START="$(ZTEXTADDR)" 
-DBSS_START="$(ZBSSADDR)"
 
 compress-$(CONFIG_KERNEL_GZIP) = gzip
 compress-$(CONFIG_KERNEL_LZO)  = lzo
-compress-$(CONFIG_KERNEL_LZMA) = lzma
 compress-$(CONFIG_KERNEL_XZ)   = xzkern
 compress-$(CONFIG_KERNEL_LZ4)  = lz4
 
diff --git a/arch/arm/boot/compressed/decompress.c 
b/arch/arm/boot/compressed/decompress.c
index c16c1829a5e4..350e7a96f6af 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -41,10 +41,6 @@ extern int memcmp(const void *cs, const void *ct, size_t 
count);
 #include "../../../../lib/decompress_unlzo.c"
 #endif
 
-#ifdef CONFIG_KERNEL_LZMA
-#include "../../../../lib/decompress_unlzma.c"
-#endif
-
 #ifdef CONFIG_KERNEL_XZ
 #define memmove memmove
 #define memcpy memcpy
-- 
2.19.1



[PATCH 06/17] parisc: Remove support for BZIP2 and LZMA compressed kernel

2018-11-09 Thread Adam Borowski
Made redundant by newer choices.

Signed-off-by: Adam Borowski 
---
 arch/parisc/Kconfig  |  2 --
 arch/parisc/boot/compressed/Makefile | 10 ++
 arch/parisc/boot/compressed/misc.c   |  8 
 3 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 92a339ee28b3..a9cca7d1a8d8 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -18,10 +18,8 @@ config PARISC
select BUG
select BUILDTIME_EXTABLE_SORT
select HAVE_PERF_EVENTS
-   select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZ4
-   select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO
select HAVE_KERNEL_XZ
select GENERIC_ATOMIC64 if !64BIT
diff --git a/arch/parisc/boot/compressed/Makefile 
b/arch/parisc/boot/compressed/Makefile
index 777533cdea31..a05f36f9279b 100644
--- a/arch/parisc/boot/compressed/Makefile
+++ b/arch/parisc/boot/compressed/Makefile
@@ -8,8 +8,8 @@ KCOV_INSTRUMENT := n
 GCOV_PROFILE := n
 UBSAN_SANITIZE := n
 
-targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
-targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
+targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz
+targets += vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
 targets += misc.o piggy.o sizes.h head.o real2.o firmware.o
 
 KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
@@ -60,20 +60,14 @@ $(obj)/vmlinux.bin: vmlinux
 vmlinux.bin.all-y := $(obj)/vmlinux.bin
 
 suffix-$(CONFIG_KERNEL_GZIP)  := gz
-suffix-$(CONFIG_KERNEL_BZIP2) := bz2
 suffix-$(CONFIG_KERNEL_LZ4)  := lz4
-suffix-$(CONFIG_KERNEL_LZMA)  := lzma
 suffix-$(CONFIG_KERNEL_LZO)  := lzo
 suffix-$(CONFIG_KERNEL_XZ)  := xz
 
 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
$(call if_changed,gzip)
-$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
-   $(call if_changed,bzip2)
 $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
$(call if_changed,lz4)
-$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
-   $(call if_changed,lzma)
 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
$(call if_changed,lzo)
 $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
diff --git a/arch/parisc/boot/compressed/misc.c 
b/arch/parisc/boot/compressed/misc.c
index 2556bb181813..1ca59916071e 100644
--- a/arch/parisc/boot/compressed/misc.c
+++ b/arch/parisc/boot/compressed/misc.c
@@ -42,18 +42,10 @@ static unsigned long free_mem_end_ptr;
 #include "../../../../lib/decompress_inflate.c"
 #endif
 
-#ifdef CONFIG_KERNEL_BZIP2
-#include "../../../../lib/decompress_bunzip2.c"
-#endif
-
 #ifdef CONFIG_KERNEL_LZ4
 #include "../../../../lib/decompress_unlz4.c"
 #endif
 
-#ifdef CONFIG_KERNEL_LZMA
-#include "../../../../lib/decompress_unlzma.c"
-#endif
-
 #ifdef CONFIG_KERNEL_LZO
 #include "../../../../lib/decompress_unlzo.c"
 #endif
-- 
2.19.1



[PATCH 01/17] lib: Add support for ZSTD-compressed kernel

2018-11-09 Thread Adam Borowski
From: Nick Terrell 

Add support for extracting ZSTD-compressed kernel images, as well as
ZSTD-compressed ramdisk images in the kernel boot process.

When neither `fill' nor `flush' are used, the decompression function
requires a constant amount of memory (192 KB is sufficient). When either
is used the decompression function requires memory proportional to the
window size used during compression, which is limited to 8 MB. The maximum
memory usage is just over 8 MB.

Fix up lib/zstd and lib/xxhash.c for the preboot environment. They avoid
declaring themselves as modules. A memcpy() call needs to be a
__builtin_memcpy() for performance. The gcc-7.1 bug in ZSTD_wildcopy() was
fixed in gcc-7.2, so it can be gated, since it hurts performance.

Signed-off-by: Nick Terrell 
---
 include/linux/decompress/unzstd.h |  26 +++
 init/Kconfig  |  14 +-
 lib/Kconfig   |   4 +
 lib/Makefile  |   1 +
 lib/decompress.c  |   5 +
 lib/decompress_unzstd.c   | 341 ++
 lib/xxhash.c  |  21 +-
 lib/zstd/decompress.c |   2 +
 lib/zstd/fse_decompress.c |   9 +-
 lib/zstd/zstd_internal.h  |  10 +-
 scripts/Makefile.lib  |  15 ++
 usr/Kconfig   |  22 ++
 12 files changed, 451 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/decompress/unzstd.h
 create mode 100644 lib/decompress_unzstd.c

diff --git a/include/linux/decompress/unzstd.h 
b/include/linux/decompress/unzstd.h
new file mode 100644
index ..6f3022cd0955
--- /dev/null
+++ b/include/linux/decompress/unzstd.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017 Facebook
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#ifndef LINUX_DECOMPRESS_UNZSTD_H
+#define LINUX_DECOMPRESS_UNZSTD_H
+
+int unzstd(unsigned char *inbuf, long len,
+  long (*fill)(void*, unsigned long),
+  long (*flush)(void*, unsigned long),
+  unsigned char *output,
+  long *pos,
+  void (*error_fn)(char *x));
+#endif
diff --git a/init/Kconfig b/init/Kconfig
index a4112e95724a..ffa5ae4abc88 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -134,13 +134,16 @@ config HAVE_KERNEL_LZO
 config HAVE_KERNEL_LZ4
bool
 
+config HAVE_KERNEL_ZSTD
+   bool
+
 config HAVE_KERNEL_UNCOMPRESSED
bool
 
 choice
prompt "Kernel compression mode"
default KERNEL_GZIP
-   depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || 
HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 || HAVE_KERNEL_UNCOMPRESSED
+   depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || 
HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 || HAVE_KERNEL_ZSTD || 
HAVE_KERNEL_UNCOMPRESSED
help
  The linux kernel is a kind of self-extracting executable.
  Several compression algorithms are available, which differ
@@ -219,6 +222,15 @@ config KERNEL_LZ4
  is about 8% bigger than LZO. But the decompression speed is
  faster than LZO.
 
+config KERNEL_ZSTD
+   bool "ZSTD"
+   depends on HAVE_KERNEL_ZSTD
+   help
+ ZSTD is a compression algorithm targeting intermediate compression
+ with fast decompression speed. It will compress better than GZIP and
+ decompress around the same speed as LZO, but slower than LZ4. You
+ will need at least 192 KB RAM or more for booting.
+
 config KERNEL_UNCOMPRESSED
bool "None"
depends on HAVE_KERNEL_UNCOMPRESSED
diff --git a/lib/Kconfig b/lib/Kconfig
index a9965f4af4dd..e7ab43fd5461 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -304,6 +304,10 @@ config DECOMPRESS_LZ4
select LZ4_DECOMPRESS
tristate
 
+config DECOMPRESS_ZSTD
+   select ZSTD_DECOMPRESS
+   tristate
+
 #
 # Generic allocator support is selected if needed
 #
diff --git a/lib/Makefile b/lib/Makefile
index db06d1237898..58b48993f48a 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -139,6 +139,7 @@ lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
 lib-$(CONFIG_DECOMPRESS_XZ) += decompress_unxz.o
 lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
 lib-$(CONFIG_DECOMPRESS_LZ4) += decompress_unlz4.o
+lib-$(CONFIG_DECOMPRESS_ZSTD) += decompress_unzstd.o
 
 obj-$(CONFIG_TEXTSEARCH) += textsearch.o
 obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o
diff --git a/lib/decompress.c b/lib/decompress.c

[PATCH 05/17] mips: Remove support for BZIP2 and LZMA compressed kernel

2018-11-09 Thread Adam Borowski
Made redundant by newer choices.

Signed-off-by: Adam Borowski 
---
 arch/mips/Kconfig  |  2 --
 arch/mips/boot/Makefile| 27 --
 arch/mips/boot/compressed/Makefile |  2 --
 arch/mips/boot/compressed/decompress.c |  8 
 4 files changed, 39 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 8272ea4c7264..8f774bb9d22f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1834,9 +1834,7 @@ endif # CPU_LOONGSON2F
 config SYS_SUPPORTS_ZBOOT
bool
select HAVE_KERNEL_GZIP
-   select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_LZ4
-   select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO
select HAVE_KERNEL_XZ
 
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index 35704c28a28b..9c5f380a6c20 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -24,9 +24,7 @@ strip-flags   := $(addprefix 
--remove-section=,$(drop-sections))
 hostprogs-y := elf2ecoff
 
 suffix-y   := bin
-suffix-$(CONFIG_KERNEL_BZIP2)  := bz2
 suffix-$(CONFIG_KERNEL_GZIP)   := gz
-suffix-$(CONFIG_KERNEL_LZMA)   := lzma
 suffix-$(CONFIG_KERNEL_LZO):= lzo
 
 targets := vmlinux.ecoff
@@ -54,20 +52,12 @@ UIMAGE_ENTRYADDR = $(VMLINUX_ENTRY_ADDRESS)
 # Compressed vmlinux images
 #
 
-extra-y += vmlinux.bin.bz2
 extra-y += vmlinux.bin.gz
-extra-y += vmlinux.bin.lzma
 extra-y += vmlinux.bin.lzo
 
-$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
-   $(call if_changed,bzip2)
-
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,gzip)
 
-$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
-   $(call if_changed,lzma)
-
 $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzo)
 
@@ -77,23 +67,15 @@ $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
 
 targets += uImage
 targets += uImage.bin
-targets += uImage.bz2
 targets += uImage.gz
-targets += uImage.lzma
 targets += uImage.lzo
 
 $(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
$(call if_changed,uimage,none)
 
-$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE
-   $(call if_changed,uimage,bzip2)
-
 $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
$(call if_changed,uimage,gzip)
 
-$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
-   $(call if_changed,uimage,lzma)
-
 $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
$(call if_changed,uimage,lzo)
 
@@ -122,7 +104,6 @@ $(obj)/vmlinux.its.S: $(addprefix 
$(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS
 
 targets += vmlinux.its
 targets += vmlinux.gz.its
-targets += vmlinux.bz2.its
 targets += vmlinux.lzmo.its
 targets += vmlinux.lzo.its
 
@@ -142,19 +123,11 @@ $(obj)/vmlinux.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
 $(obj)/vmlinux.gz.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
$(call if_changed,cpp_its_S,gzip,vmlinux.bin.gz)
 
-$(obj)/vmlinux.bz2.its: $(obj)/vmlinux.its.S $(VMLINUX)  FORCE
-   $(call if_changed,cpp_its_S,bzip2,vmlinux.bin.bz2)
-
-$(obj)/vmlinux.lzma.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
-   $(call if_changed,cpp_its_S,lzma,vmlinux.bin.lzma)
-
 $(obj)/vmlinux.lzo.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
$(call if_changed,cpp_its_S,lzo,vmlinux.bin.lzo)
 
 targets += vmlinux.itb
 targets += vmlinux.gz.itb
-targets += vmlinux.bz2.itb
-targets += vmlinux.lzma.itb
 targets += vmlinux.lzo.itb
 
 quiet_cmd_itb-image = ITB $@
diff --git a/arch/mips/boot/compressed/Makefile 
b/arch/mips/boot/compressed/Makefile
index 3c453a1f1ff1..a7448d74fe7b 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -62,9 +62,7 @@ $(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
$(call if_changed,objcopy)
 
 tool_$(CONFIG_KERNEL_GZIP)= gzip
-tool_$(CONFIG_KERNEL_BZIP2)   = bzip2
 tool_$(CONFIG_KERNEL_LZ4) = lz4
-tool_$(CONFIG_KERNEL_LZMA)= lzma
 tool_$(CONFIG_KERNEL_LZO) = lzo
 tool_$(CONFIG_KERNEL_XZ)  = xzkern
 
diff --git a/arch/mips/boot/compressed/decompress.c 
b/arch/mips/boot/compressed/decompress.c
index 81df9047e110..ac6978d210e6 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -56,18 +56,10 @@ void error(char *x)
 #include "../../../../lib/decompress_inflate.c"
 #endif
 
-#ifdef CONFIG_KERNEL_BZIP2
-#include "../../../../lib/decompress_bunzip2.c"
-#endif
-
 #ifdef CONFIG_KERNEL_LZ4
 #include "../../../../lib/decompress_unlz4.c"
 #endif
 
-#ifdef CONFIG_KERNEL_LZMA
-#include "../../../../lib/decompress_unlzma.c"
-#endif
-
 #ifdef CONFIG_KERNEL_LZO
 #include "../../../../lib/decompress_unlzo.c"
 #endif
-- 
2.19.1



[PATCH 03/17] .gitignore: add ZSTD-compressed files

2018-11-09 Thread Adam Borowski
For now, that's arch/x86/boot/compressed/vmlinux.bin.zst but probably more
will come, thus let's be consistent with all other compressors.

Signed-off-by: Adam Borowski 
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 97ba6b79834c..0d09cf1c053c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,6 +42,7 @@
 *.tab.[ch]
 *.tar
 *.xz
+*.zst
 Module.symvers
 modules.builtin
 
-- 
2.19.1



[PATCH 0/17] Kernel compression: add ZSTD, remove LZMA1 and BZIP2

2018-11-09 Thread Adam Borowski
Hi!
As new compressors get invented, they tend to find their way into the
kernel, yet we never prune superseded ones.  It's time to do so.

In particular, BZIP2 is drastically slower than other compressors we
have, even when they achieve smaller sizes.  It takes more memory, too.
And, BZIP2 is not used anywhere else in the kernel -- just for booting
the kernel itself and the initrd.  Thus, we can drop it from the tree
completely, making Linus happier by around 900 lines.

LZMA1 is redundant with XZ (LZMA2), and unlike the latter, it uses its own
copy of code that's not shared with anything else (some drivers use XZ).
Let's drop it as well.  Some bootloaders can use it thus let's keep the
Kconfig option, but I left no piece of code inside the kernel itself.

On the other hand, Nick Terrell has a couple of patches adding ZSTD support
(using code already in use in multiple pieces around the kernel).  ZSTD is
strong and fast, obsoleting all mid-range compressors.  As the removal of
BZIP2 and LZMA1 would be hopelessly entangled with this addition, I'm
resending Nick's patches here.  I've been booting using them since Oct'17
on amd64 (kernel+initrd), armhf and arm64 (initrd) without issues, other
folks tested various other architectures as well.

Thus, I'd recommend people to use:
* XZ for most machines
* ZSTD where speed is important
* mybe LZ4 is some special cases
(grub and u-boot are ridiculously slow at reading, making fast but weak
decompressors a net loss.  On the other hand, XZ decompresses pretty fast
but is very slow at compress time, making ZSTD preferred for rapid devel
cycles.)

* we can't get rid of GZIP in foreseable future
* LZO is obsolete but is used elsewhere in the kernel

Total:
 69 files changed, 518 insertions(+), 1785 deletions(-)

Not sure whose tree this patchset should go through.  I'm also not sure
how finely split into commits you want the arch bits be; I included
defconfig bits all together, yet separated code changes per-arch.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ A dumb species has no way to open a tuna can.
⢿⡄⠘⠷⠚⠋⠀ A smart species invents a can opener.
⠈⠳⣄ A master species delegates.


[PATCH 02/17] x86: Add support for ZSTD-compressed kernel

2018-11-09 Thread Adam Borowski
From: Nick Terrell 

Integrates the ZSTD decompression code to the x86 pre-boot code.

Zstandard requires slightly more memory during the kernel decompression
on x86 (192 KB vs 64 KB), and the memory usage is independent of the
window size.

Zstandard requires memory proportional to the window size used during
compression for decompressing the ramdisk image, since streaming mode is
used. Newer versions of zstd (1.3.2+) list the window size of a file
with `zstd -lv '. The absolute maximum amount of memory required
is just over 8 MB.

Signed-off-by: Nick Terrell 
---
 Documentation/x86/boot.txt| 6 +++---
 arch/x86/Kconfig  | 1 +
 arch/x86/boot/compressed/Makefile | 5 -
 arch/x86/boot/compressed/misc.c   | 4 
 arch/x86/boot/header.S| 8 +++-
 arch/x86/include/asm/boot.h   | 6 --
 6 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
index 7727db8f94bc..a47b6bae3356 100644
--- a/Documentation/x86/boot.txt
+++ b/Documentation/x86/boot.txt
@@ -685,9 +685,9 @@ Protocol:   2.08+
   uncompressed data should be determined using the standard magic
   numbers.  The currently supported compression formats are gzip
   (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA
-  (magic number 5D 00), XZ (magic number FD 37), and LZ4 (magic number
-  02 21).  The uncompressed payload is currently always ELF (magic
-  number 7F 45 4C 46).
+  (magic number 5D 00), XZ (magic number FD 37), LZ4 (magic number
+  02 21) and ZSTD (magic number 28 B5). The uncompressed payload is
+  currently always ELF (magic number 7F 45 4C 46).
 
 Field name:payload_length
 Type:  read
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ba7e3464ee92..203f7467f5c4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -164,6 +164,7 @@ config X86
select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO
select HAVE_KERNEL_XZ
+   select HAVE_KERNEL_ZSTD
select HAVE_KPROBES
select HAVE_KPROBES_ON_FTRACE
select HAVE_FUNCTION_ERROR_INJECTION
diff --git a/arch/x86/boot/compressed/Makefile 
b/arch/x86/boot/compressed/Makefile
index 466f66c8a7f8..6d2a8d2d378d 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -24,7 +24,7 @@ OBJECT_FILES_NON_STANDARD := y
 KCOV_INSTRUMENT:= n
 
 targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma 
\
-   vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
+   vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 vmlinux.bin.zst
 
 KBUILD_CFLAGS := -m$(BITS) -O2
 KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC)
@@ -142,6 +142,8 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lzo)
 $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lz4)
+$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
+   $(call if_changed,zstd)
 
 suffix-$(CONFIG_KERNEL_GZIP)   := gz
 suffix-$(CONFIG_KERNEL_BZIP2)  := bz2
@@ -149,6 +151,7 @@ suffix-$(CONFIG_KERNEL_LZMA):= lzma
 suffix-$(CONFIG_KERNEL_XZ) := xz
 suffix-$(CONFIG_KERNEL_LZO):= lzo
 suffix-$(CONFIG_KERNEL_LZ4):= lz4
+suffix-$(CONFIG_KERNEL_ZSTD)   := zst
 
 quiet_cmd_mkpiggy = MKPIGGY $@
   cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 8dd1d5ccae58..b6c8921100fb 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -76,6 +76,10 @@ static int lines, cols;
 #ifdef CONFIG_KERNEL_LZ4
 #include "../../../../lib/decompress_unlz4.c"
 #endif
+
+#ifdef CONFIG_KERNEL_ZSTD
+#include "../../../../lib/decompress_unzstd.c"
+#endif
 /*
  * NOTE: When adding a new decompressor, please update the analysis in
  * ../header.S.
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 4c881c850125..af2efb256527 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -526,8 +526,14 @@ pref_address:  .quad LOAD_PHYSICAL_ADDR
# preferred load addr
 # the size-dependent part now grows so fast.
 #
 # extra_bytes = (uncompressed_size >> 8) + 65536
+#
+# ZSTD compressed data grows by at most 3 bytes per 128K, and only has a 22
+# byte fixed overhead but has a maximum block size of 128K, so it needs a
+# larger margin.
+#
+# extra_bytes = (uncompressed_size >> 8) + 131072
 
-#define ZO_z_extra_bytes   ((ZO_z_output_len >> 8) + 65536)
+#define ZO_z_extra_bytes   ((ZO_z_output_len >> 8) + 131072)
 #if ZO_z_output_len > ZO_z_input_len
 # define ZO_z_extract_offset   (ZO_z_output_len + ZO_z_extra_bytes - \
 ZO_z_input_len)
diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
index 680c320363db..d6dd43d25d9f 100644
--- a/arch/x86/include/asm/boot.h
+++ b/arch/x86/include/asm/boot.h
@@ -24,9 +24,11 @@
 # error "Invalid value for 

[PATCH 08/17] sh: Remove support for BZIP2 and LZMA compressed kernel

2018-11-09 Thread Adam Borowski
Made redundant by newer choices.

Signed-off-by: Adam Borowski 
---
 arch/sh/Kconfig  |  2 --
 arch/sh/Makefile |  4 +---
 arch/sh/boot/Makefile| 19 ++-
 arch/sh/boot/compressed/Makefile |  5 -
 arch/sh/boot/compressed/misc.c   | 12 
 5 files changed, 3 insertions(+), 39 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index f82a4da7adf3..fbb2e17275d1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -23,8 +23,6 @@ config SUPERH
select HAVE_DEBUG_KMEMLEAK
select HAVE_KERNEL_GZIP
select CPU_NO_EFFICIENT_FFS
-   select HAVE_KERNEL_BZIP2
-   select HAVE_KERNEL_LZMA
select HAVE_KERNEL_XZ
select HAVE_KERNEL_LZO
select HAVE_UID16
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index c521ade2557c..70925d0cd2a8 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -209,7 +209,7 @@ endif
 libs-$(CONFIG_SUPERH32):= arch/sh/lib/ $(libs-y)
 libs-$(CONFIG_SUPERH64):= arch/sh/lib64/ $(libs-y)
 
-BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.xz uImage.lzo \
+BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.xz uImage.lzo \
   uImage.srec uImage.bin zImage vmlinux.bin vmlinux.srec \
   romImage
 PHONY += $(BOOT_TARGETS)
@@ -237,8 +237,6 @@ define archhelp
@echo '  uImage.srec   - Create an S-record for U-Boot'
@echo '  uImage.bin- Kernel-only image for U-Boot (bin)'
@echo '* uImage.gz - Kernel-only image for U-Boot 
(gzip)'
-   @echo '  uImage.bz2- Kernel-only image for U-Boot 
(bzip2)'
-   @echo '  uImage.lzma   - Kernel-only image for U-Boot 
(lzma)'
@echo '  uImage.xz - Kernel-only image for U-Boot (xz)'
@echo '  uImage.lzo- Kernel-only image for U-Boot (lzo)'
 endef
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index 58592dfa5cb6..bf8cf598a5ab 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -21,15 +21,12 @@ CONFIG_PHYSICAL_START   ?= $(CONFIG_MEMORY_START)
 
 suffix-y := bin
 suffix-$(CONFIG_KERNEL_GZIP)   := gz
-suffix-$(CONFIG_KERNEL_BZIP2)  := bz2
-suffix-$(CONFIG_KERNEL_LZMA)   := lzma
 suffix-$(CONFIG_KERNEL_XZ) := xz
 suffix-$(CONFIG_KERNEL_LZO):= lzo
 
 targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz \
-  uImage.bz2 uImage.lzma uImage.xz uImage.lzo uImage.bin
-extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
-  vmlinux.bin.xz vmlinux.bin.lzo
+  uImage.xz uImage.lzo uImage.bin
+extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.xz vmlinux.bin.lzo
 subdir- := compressed romimage
 
 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
@@ -68,27 +65,15 @@ $(obj)/vmlinux.bin: vmlinux FORCE
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,gzip)
 
-$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
-   $(call if_changed,bzip2)
-
-$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
-   $(call if_changed,lzma)
-
 $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
$(call if_changed,xzkern)
 
 $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzo)
 
-$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2
-   $(call if_changed,uimage,bzip2)
-
 $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
$(call if_changed,uimage,gzip)
 
-$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
-   $(call if_changed,uimage,lzma)
-
 $(obj)/uImage.xz: $(obj)/vmlinux.bin.xz
$(call if_changed,uimage,xz)
 
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
index f5e1bd779789..abd33fd0d525 100644
--- a/arch/sh/boot/compressed/Makefile
+++ b/arch/sh/boot/compressed/Makefile
@@ -6,7 +6,6 @@
 #
 
 targets:= vmlinux vmlinux.bin vmlinux.bin.gz \
-  vmlinux.bin.bz2 vmlinux.bin.lzma \
   vmlinux.bin.xz vmlinux.bin.lzo \
   head_$(BITS).o misc.o piggy.o
 
@@ -64,10 +63,6 @@ vmlinux.bin.all-y := $(obj)/vmlinux.bin
 
 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,gzip)
-$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
-   $(call if_changed,bzip2)
-$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
-   $(call if_changed,lzma)
 $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,xzkern)
 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
index c15cac9251b9..c82402add51e 100644
--- a/arch/sh/boot/compressed/misc.c
+++ b/arch/sh/boot/compressed/misc.c
@@ -44,24 +44,12 @@ extern int _end;
 static unsigned long free_mem_ptr;
 static unsigned long free_mem_end_ptr;
 
-#ifdef CONFIG_HAVE_KERNEL_BZIP2
-#define HEAP_SIZE  0x40
-#else
 #define HEAP_SIZE  0x1
-#endif
 
 #ifdef CONFIG_KERNEL_GZIP

[PATCH 11/17] Kconfig: Remove support for BZIP2-compressed initrd and kernel

2018-11-09 Thread Adam Borowski
In no case it's a rational choice anymore: it's much slower than newer
algorithms at similar compression strength, and takes lots of memory
as well.

Removal of compression algorithms for vmlinuz is completely safe (the
kernel gets compressed by this very Makefile), less so for initrd as
someone might have requested it in initramfs.conf -- but it's not an
option users tend to alter, and they'd use a better algorithm anyway.
Thus, user damage is possible but on par with removal of an ancient
filesystem.

Signed-off-by: Adam Borowski 
---
 Makefile   |  1 -
 init/Kconfig   | 17 ++---
 init/do_mounts_rd.c|  1 -
 kernel/configs/tiny.config |  1 -
 usr/Kconfig| 24 
 5 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/Makefile b/Makefile
index 9fce8b91c15f..c812467bfe11 100644
--- a/Makefile
+++ b/Makefile
@@ -938,7 +938,6 @@ export mod_compress_cmd
 # This shall be used by the dracut(8) tool while creating an initramfs image.
 #
 INITRD_COMPRESS-y  := gzip
-INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
 INITRD_COMPRESS-$(CONFIG_RD_LZMA)  := lzma
 INITRD_COMPRESS-$(CONFIG_RD_XZ):= xz
 INITRD_COMPRESS-$(CONFIG_RD_LZO)   := lzo
diff --git a/init/Kconfig b/init/Kconfig
index ffa5ae4abc88..412ba93673fa 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -119,9 +119,6 @@ config BUILD_SALT
 config HAVE_KERNEL_GZIP
bool
 
-config HAVE_KERNEL_BZIP2
-   bool
-
 config HAVE_KERNEL_LZMA
bool
 
@@ -143,7 +140,7 @@ config HAVE_KERNEL_UNCOMPRESSED
 choice
prompt "Kernel compression mode"
default KERNEL_GZIP
-   depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || 
HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 || HAVE_KERNEL_ZSTD || 
HAVE_KERNEL_UNCOMPRESSED
+   depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || 
HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 || HAVE_KERNEL_ZSTD || 
HAVE_KERNEL_UNCOMPRESSED
help
  The linux kernel is a kind of self-extracting executable.
  Several compression algorithms are available, which differ
@@ -151,7 +148,7 @@ choice
  Compression speed is only relevant when building a kernel.
  Decompression speed is relevant at each boot.
 
- If you have any problems with bzip2 or lzma compressed
+ If you have any problems with lzma compressed
  kernels, mail me (Alain Knaff) . (An older
  version of this functionality (bzip2 only), for 2.4, was
  supplied by Christian Ludwig)
@@ -169,16 +166,6 @@ config KERNEL_GZIP
  The old and tried gzip compression. It provides a good balance
  between compression ratio and decompression speed.
 
-config KERNEL_BZIP2
-   bool "Bzip2"
-   depends on HAVE_KERNEL_BZIP2
-   help
- Its compression ratio and speed is intermediate.
- Decompression speed is slowest among the choices.  The kernel
- size is about 10% smaller with bzip2, in comparison to gzip.
- Bzip2 uses a large amount of memory. For modern kernels you
- will need at least 8MB RAM or more for booting.
-
 config KERNEL_LZMA
bool "LZMA"
depends on HAVE_KERNEL_LZMA
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 32fb049d18f9..5f26365ea8b1 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -48,7 +48,6 @@ static int __init crd_load(int in_fd, int out_fd, 
decompress_fn deco);
  * cramfs
  * squashfs
  * gzip
- * bzip2
  * lzma
  * xz
  * lzo
diff --git a/kernel/configs/tiny.config b/kernel/configs/tiny.config
index 7fa0c4ae6394..c5480f87fae3 100644
--- a/kernel/configs/tiny.config
+++ b/kernel/configs/tiny.config
@@ -1,7 +1,6 @@
 # CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 # CONFIG_KERNEL_GZIP is not set
-# CONFIG_KERNEL_BZIP2 is not set
 # CONFIG_KERNEL_LZMA is not set
 CONFIG_KERNEL_XZ=y
 # CONFIG_KERNEL_LZO is not set
diff --git a/usr/Kconfig b/usr/Kconfig
index 5ff529b75ee1..05b6be569041 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -61,15 +61,6 @@ config RD_GZIP
  Support loading of a gzip encoded initial ramdisk or cpio buffer.
  If unsure, say Y.
 
-config RD_BZIP2
-   bool "Support initial ramdisk/ramfs compressed using bzip2"
-   default y
-   depends on BLK_DEV_INITRD
-   select DECOMPRESS_BZIP2
-   help
- Support loading of a bzip2 encoded initial ramdisk or cpio buffer
- If unsure, say N.
-
 config RD_LZMA
bool "Support initial ramdisk/ramfs compressed using LZMA"
default y
@@ -161,19 +152,6 @@ config INITRAMFS_COMPRESSION_GZIP
  supported by your build system as the gzip tool is present by default
  on most distros.
 
-config INITRAMFS_COMPRESSION_BZIP2
-   bool "Bzip2"
-   depends on RD_BZIP2
-   hel

[PATCH 12/17] Kconfig: Remove support for LZMA-compressed initrd

2018-11-09 Thread Adam Borowski
Obsoleted by XZ.

The config option for compressing the kernel stays, as some archs have a
bootloader outside the kernel that wants LZMA.

Signed-off-by: Adam Borowski 
---
 Makefile|  1 -
 usr/Kconfig | 28 ++--
 2 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index c812467bfe11..97e4bf26a6d3 100644
--- a/Makefile
+++ b/Makefile
@@ -938,7 +938,6 @@ export mod_compress_cmd
 # This shall be used by the dracut(8) tool while creating an initramfs image.
 #
 INITRD_COMPRESS-y  := gzip
-INITRD_COMPRESS-$(CONFIG_RD_LZMA)  := lzma
 INITRD_COMPRESS-$(CONFIG_RD_XZ):= xz
 INITRD_COMPRESS-$(CONFIG_RD_LZO)   := lzo
 INITRD_COMPRESS-$(CONFIG_RD_LZ4)   := lz4
diff --git a/usr/Kconfig b/usr/Kconfig
index 05b6be569041..8d99edacabc9 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -61,15 +61,6 @@ config RD_GZIP
  Support loading of a gzip encoded initial ramdisk or cpio buffer.
  If unsure, say Y.
 
-config RD_LZMA
-   bool "Support initial ramdisk/ramfs compressed using LZMA"
-   default y
-   depends on BLK_DEV_INITRD
-   select DECOMPRESS_LZMA
-   help
- Support loading of a LZMA encoded initial ramdisk or cpio buffer
- If unsure, say N.
-
 config RD_XZ
bool "Support initial ramdisk/ramfs compressed using XZ"
depends on BLK_DEV_INITRD
@@ -118,8 +109,8 @@ choice
  when building a kernel.  Decompression speed is relevant at
  each boot. Also the memory usage during decompression may become
  relevant on memory constrained systems. This is usually based on the
- dictionary size of the algorithm with algorithms like XZ and LZMA
- featuring large dictionary sizes.
+ dictionary size of the algorithm with algorithms like XZ featuring
+ large dictionary sizes.
 
  High compression options are mostly useful for users who are
  low on RAM, since it reduces the memory consumption during
@@ -152,19 +143,6 @@ config INITRAMFS_COMPRESSION_GZIP
  supported by your build system as the gzip tool is present by default
  on most distros.
 
-config INITRAMFS_COMPRESSION_LZMA
-   bool "LZMA"
-   depends on RD_LZMA
-   help
- This algorithm's compression ratio is best but has a large dictionary
- size which might cause issues in memory constrained systems.
- Decompression speed is between the other choices. Compression is
- slowest. The initramfs size is about 33% smaller with LZMA in
- comparison to gzip.
-
- If you choose this, keep in mind that you may need to install the xz
- or lzma tools to be able to compress the initram.
-
 config INITRAMFS_COMPRESSION_XZ
bool "XZ"
depends on RD_XZ
@@ -219,7 +197,6 @@ config INITRAMFS_COMPRESSION
string
default ""  if INITRAMFS_COMPRESSION_NONE
default ".gz"   if INITRAMFS_COMPRESSION_GZIP
-   default ".lzma" if INITRAMFS_COMPRESSION_LZMA
default ".xz"   if INITRAMFS_COMPRESSION_XZ
default ".lzo"  if INITRAMFS_COMPRESSION_LZO
default ".lz4"  if INITRAMFS_COMPRESSION_LZ4
@@ -228,6 +205,5 @@ config INITRAMFS_COMPRESSION
default ".lz4"  if RD_LZ4
default ".lzo"  if RD_LZO
default ".xz"   if RD_XZ
-   default ".lzma" if RD_LZMA
default ".zst"  if RD_ZSTD
default ""
-- 
2.19.1



[PATCH 09/17] unicore32: Remove support for BZIP2 and LZMA compressed kernel

2018-11-09 Thread Adam Borowski
Made redundant by newer choices -- sort of, as no one enabled support
for XZ nor ZSTD for unicore yet...

Signed-off-by: Adam Borowski 
---
 arch/unicore32/Kconfig  | 2 --
 arch/unicore32/boot/compressed/Makefile | 4 +---
 arch/unicore32/boot/compressed/misc.c   | 8 
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index a4c05159dca5..b7eb7e9fb0d2 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -7,10 +7,8 @@ config UNICORE32
select DMA_DIRECT_OPS
select HAVE_GENERIC_DMA_COHERENT
select HAVE_KERNEL_GZIP
-   select HAVE_KERNEL_BZIP2
select GENERIC_ATOMIC64
select HAVE_KERNEL_LZO
-   select HAVE_KERNEL_LZMA
select VIRT_TO_BUS
select ARCH_HAVE_CUSTOM_GPIO_H
select GENERIC_FIND_FIRST_BIT
diff --git a/arch/unicore32/boot/compressed/Makefile 
b/arch/unicore32/boot/compressed/Makefile
index 9aecdd3ddc48..79ff908ad78c 100644
--- a/arch/unicore32/boot/compressed/Makefile
+++ b/arch/unicore32/boot/compressed/Makefile
@@ -22,9 +22,7 @@ $(obj)/font.c: $(srctree)/lib/fonts/font_8x8.c
 
 # piggy.S and piggy.o
 suffix_$(CONFIG_KERNEL_GZIP)   := gzip
-suffix_$(CONFIG_KERNEL_BZIP2)  := bz2
 suffix_$(CONFIG_KERNEL_LZO):= lzo
-suffix_$(CONFIG_KERNEL_LZMA)   := lzma
 
 $(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
$(call if_changed,$(suffix_y))
@@ -39,7 +37,7 @@ targets   := vmlinux vmlinux.lds font.o font.c 
head.o misc.o \
piggy.$(suffix_y) piggy.o piggy.S \
 
 # Make sure files are removed during clean
-extra-y+= piggy.gzip piggy.bz2 piggy.lzo piggy.lzma
+extra-y+= piggy.gzip piggy.lzo
 
 # ?
 LDFLAGS_vmlinux += -p
diff --git a/arch/unicore32/boot/compressed/misc.c 
b/arch/unicore32/boot/compressed/misc.c
index 5c65dfee278c..ab9b56cf6907 100644
--- a/arch/unicore32/boot/compressed/misc.c
+++ b/arch/unicore32/boot/compressed/misc.c
@@ -91,18 +91,10 @@ void error(char *x)
 #include "../../../../lib/decompress_inflate.c"
 #endif
 
-#ifdef CONFIG_KERNEL_BZIP2
-#include "../../../../lib/decompress_bunzip2.c"
-#endif
-
 #ifdef CONFIG_KERNEL_LZO
 #include "../../../../lib/decompress_unlzo.c"
 #endif
 
-#ifdef CONFIG_KERNEL_LZMA
-#include "../../../../lib/decompress_unlzma.c"
-#endif
-
 unsigned long decompress_kernel(unsigned long output_start,
unsigned long free_mem_ptr_p,
unsigned long free_mem_ptr_end_p)
-- 
2.19.1



[PATCH 13/17] arch/*: Purge references to CONFIG_RD_BZIP2/LZMA from various defconfigs

2018-11-09 Thread Adam Borowski
They don't exist anymore.

Signed-off-by: Adam Borowski 
---
 arch/arm/configs/aspeed_g4_defconfig   | 1 -
 arch/arm/configs/aspeed_g5_defconfig   | 1 -
 arch/arm/configs/clps711x_defconfig| 1 -
 arch/arm/configs/ezx_defconfig | 2 --
 arch/arm/configs/hisi_defconfig| 1 -
 arch/arm/configs/imote2_defconfig  | 2 --
 arch/arm/configs/lpc18xx_defconfig | 2 --
 arch/arm/configs/vf610m4_defconfig | 2 --
 arch/m68k/configs/stmark2_defconfig| 2 --
 arch/mips/configs/ar7_defconfig| 1 -
 arch/mips/configs/ath25_defconfig  | 1 -
 arch/mips/configs/ath79_defconfig  | 1 -
 arch/mips/configs/lemote2f_defconfig   | 2 --
 arch/mips/configs/loongson3_defconfig  | 2 --
 arch/mips/configs/nlm_xlp_defconfig| 2 --
 arch/mips/configs/nlm_xlr_defconfig| 2 --
 arch/mips/configs/pistachio_defconfig  | 2 --
 arch/openrisc/configs/simple_smp_defconfig | 2 --
 arch/powerpc/configs/44x/fsp2_defconfig| 1 -
 arch/powerpc/configs/skiroot_defconfig | 2 --
 arch/sh/configs/sdk7786_defconfig  | 2 --
 arch/xtensa/configs/cadence_csp_defconfig  | 2 --
 arch/xtensa/configs/nommu_kc705_defconfig  | 2 --
 23 files changed, 38 deletions(-)

diff --git a/arch/arm/configs/aspeed_g4_defconfig 
b/arch/arm/configs/aspeed_g4_defconfig
index 1446262921b4..2e978ba5fab3 100644
--- a/arch/arm/configs/aspeed_g4_defconfig
+++ b/arch/arm/configs/aspeed_g4_defconfig
@@ -8,7 +8,6 @@ CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=16
 CONFIG_CGROUPS=y
 CONFIG_BLK_DEV_INITRD=y
-# CONFIG_RD_BZIP2 is not set
 # CONFIG_RD_LZO is not set
 # CONFIG_RD_LZ4 is not set
 # CONFIG_UID16 is not set
diff --git a/arch/arm/configs/aspeed_g5_defconfig 
b/arch/arm/configs/aspeed_g5_defconfig
index 02fa3a41add5..4fef8a5d208a 100644
--- a/arch/arm/configs/aspeed_g5_defconfig
+++ b/arch/arm/configs/aspeed_g5_defconfig
@@ -8,7 +8,6 @@ CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=16
 CONFIG_CGROUPS=y
 CONFIG_BLK_DEV_INITRD=y
-# CONFIG_RD_BZIP2 is not set
 # CONFIG_RD_LZO is not set
 # CONFIG_RD_LZ4 is not set
 # CONFIG_UID16 is not set
diff --git a/arch/arm/configs/clps711x_defconfig 
b/arch/arm/configs/clps711x_defconfig
index fc105c9178cc..63e029d9c5a6 100644
--- a/arch/arm/configs/clps711x_defconfig
+++ b/arch/arm/configs/clps711x_defconfig
@@ -2,7 +2,6 @@ CONFIG_KERNEL_LZMA=y
 CONFIG_SYSVIPC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_RD_LZMA=y
 CONFIG_EMBEDDED=y
 CONFIG_SLOB=y
 CONFIG_JUMP_LABEL=y
diff --git a/arch/arm/configs/ezx_defconfig b/arch/arm/configs/ezx_defconfig
index 484e51fbd4a6..47bbd7b20f07 100644
--- a/arch/arm/configs/ezx_defconfig
+++ b/arch/arm/configs/ezx_defconfig
@@ -4,8 +4,6 @@ CONFIG_SYSVIPC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_SYSFS_DEPRECATED_V2=y
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_RD_BZIP2=y
-CONFIG_RD_LZMA=y
 CONFIG_EXPERT=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
diff --git a/arch/arm/configs/hisi_defconfig b/arch/arm/configs/hisi_defconfig
index 74d611e41e02..c8660e175f15 100644
--- a/arch/arm/configs/hisi_defconfig
+++ b/arch/arm/configs/hisi_defconfig
@@ -1,7 +1,6 @@
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_RD_LZMA=y
 CONFIG_ARCH_HISI=y
 CONFIG_ARCH_HI3xxx=y
 CONFIG_PARTITION_ADVANCED=y
diff --git a/arch/arm/configs/imote2_defconfig 
b/arch/arm/configs/imote2_defconfig
index f204017c26b9..5cd017270f1e 100644
--- a/arch/arm/configs/imote2_defconfig
+++ b/arch/arm/configs/imote2_defconfig
@@ -3,8 +3,6 @@ CONFIG_SYSVIPC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_SYSFS_DEPRECATED_V2=y
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_RD_BZIP2=y
-CONFIG_RD_LZMA=y
 CONFIG_EXPERT=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_SLAB=y
diff --git a/arch/arm/configs/lpc18xx_defconfig 
b/arch/arm/configs/lpc18xx_defconfig
index 23df2518203d..f0d36814111a 100644
--- a/arch/arm/configs/lpc18xx_defconfig
+++ b/arch/arm/configs/lpc18xx_defconfig
@@ -1,8 +1,6 @@
 CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_BLK_DEV_INITRD=y
-# CONFIG_RD_BZIP2 is not set
-# CONFIG_RD_LZMA is not set
 # CONFIG_RD_XZ is not set
 # CONFIG_RD_LZO is not set
 # CONFIG_RD_LZ4 is not set
diff --git a/arch/arm/configs/vf610m4_defconfig 
b/arch/arm/configs/vf610m4_defconfig
index a89f035c3b01..6b34e135035b 100644
--- a/arch/arm/configs/vf610m4_defconfig
+++ b/arch/arm/configs/vf610m4_defconfig
@@ -1,7 +1,5 @@
 CONFIG_NAMESPACES=y
 CONFIG_BLK_DEV_INITRD=y
-# CONFIG_RD_BZIP2 is not set
-# CONFIG_RD_LZMA is not set
 # CONFIG_RD_XZ is not set
 # CONFIG_RD_LZ4 is not set
 CONFIG_KALLSYMS_ALL=y
diff --git a/arch/m68k/configs/stmark2_defconfig 
b/arch/m68k/configs/stmark2_defconfig
index 3d07b1de7eb0..fe82d37ba81d 100644
--- a/arch/m68k/configs/stmark2_defconfig
+++ b/arch/m68k/configs/stmark2_defconfig
@@ -5,8 +5,6 @@ CONFIG_SYSVIPC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_NAMESPACES=y
 CONFIG_BLK_DEV_INITRD=y
-# CONFIG_RD_BZIP2 is not set
-# CONFIG_RD_LZMA is not set
 # CONFIG_RD_XZ 

[PATCH 14/17] lib: Completely purge now-unused bzip2 code from the kernel

2018-11-09 Thread Adam Borowski
All remaining references are userspace code to build tarballs, packages
or such.

Signed-off-by: Adam Borowski 
---
 lib/Kconfig  |   3 -
 lib/Makefile |   1 -
 lib/decompress.c |   4 -
 lib/decompress_bunzip2.c | 756 ---
 scripts/Makefile.lib |  12 +-
 5 files changed, 2 insertions(+), 774 deletions(-)
 delete mode 100644 lib/decompress_bunzip2.c

diff --git a/lib/Kconfig b/lib/Kconfig
index e7ab43fd5461..83a548b8c504 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -286,9 +286,6 @@ config DECOMPRESS_GZIP
select ZLIB_INFLATE
tristate
 
-config DECOMPRESS_BZIP2
-   tristate
-
 config DECOMPRESS_LZMA
tristate
 
diff --git a/lib/Makefile b/lib/Makefile
index 58b48993f48a..4c1905e6d3a7 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -134,7 +134,6 @@ obj-$(CONFIG_XZ_DEC) += xz/
 obj-$(CONFIG_RAID6_PQ) += raid6/
 
 lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
-lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
 lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
 lib-$(CONFIG_DECOMPRESS_XZ) += decompress_unxz.o
 lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
diff --git a/lib/decompress.c b/lib/decompress.c
index ab3fc90ffc64..60f05122b9da 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -23,9 +23,6 @@
 #ifndef CONFIG_DECOMPRESS_GZIP
 # define gunzip NULL
 #endif
-#ifndef CONFIG_DECOMPRESS_BZIP2
-# define bunzip2 NULL
-#endif
 #ifndef CONFIG_DECOMPRESS_LZMA
 # define unlzma NULL
 #endif
@@ -51,7 +48,6 @@ struct compress_format {
 static const struct compress_format compressed_formats[] __initconst = {
{ {0x1f, 0x8b}, "gzip", gunzip },
{ {0x1f, 0x9e}, "gzip", gunzip },
-   { {0x42, 0x5a}, "bzip2", bunzip2 },
{ {0x5d, 0x00}, "lzma", unlzma },
{ {0xfd, 0x37}, "xz", unxz },
{ {0x89, 0x4c}, "lzo", unlzo },
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
deleted file mode 100644
index 7c4932eed748..
--- a/lib/decompress_bunzip2.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/* Small bzip2 deflate implementation, by Rob Landley (r...@landley.net).
-
-   Based on bzip2 decompression code by Julian R Seward (jsew...@acm.org),
-   which also acknowledges contributions by Mike Burrows, David Wheeler,
-   Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
-   Robert Sedgewick, and Jon L. Bentley.
-
-   This code is licensed under the LGPLv2:
-   LGPL (http://www.gnu.org/copyleft/lgpl.html
-*/
-
-/*
-   Size and speed optimizations by Manuel Novoa III  (m...@codepoet.org).
-
-   More efficient reading of Huffman codes, a streamlined read_bunzip()
-   function, and various other tweaks.  In (limited) tests, approximately
-   20% faster than bzcat on x86 and about 10% faster on arm.
-
-   Note that about 2/3 of the time is spent in read_unzip() reversing
-   the Burrows-Wheeler transformation.  Much of that time is delay
-   resulting from cache misses.
-
-   I would ask that anyone benefiting from this work, especially those
-   using it in commercial products, consider making a donation to my local
-   non-profit hospice organization in the name of the woman I loved, who
-   passed away Feb. 12, 2003.
-
-   In memory of Toni W. Hagan
-
-   Hospice of Acadiana, Inc.
-   2600 Johnston St., Suite 200
-   Lafayette, LA 70503-3240
-
-   Phone (337) 232-1234 or 1-800-738-2226
-   Fax   (337) 232-1297
-
-   http://www.hospiceacadiana.com/
-
-   Manuel
- */
-
-/*
-   Made it fit for running in Linux Kernel by Alain Knaff (al...@knaff.lu)
-*/
-
-
-#ifdef STATIC
-#define PREBOOT
-#else
-#include 
-#endif /* STATIC */
-
-#include 
-#include 
-
-#ifndef INT_MAX
-#define INT_MAX 0x7fff
-#endif
-
-/* Constants for Huffman coding */
-#define MAX_GROUPS 6
-#define GROUP_SIZE 50  /* 64 would have been more efficient */
-#define MAX_HUFCODE_BITS   20  /* Longest Huffman code allowed */
-#define MAX_SYMBOLS258 /* 256 literals + RUNA + RUNB */
-#define SYMBOL_RUNA0
-#define SYMBOL_RUNB1
-
-/* Status return values */
-#define RETVAL_OK  0
-#define RETVAL_LAST_BLOCK  (-1)
-#define RETVAL_NOT_BZIP_DATA   (-2)
-#define RETVAL_UNEXPECTED_INPUT_EOF(-3)
-#define RETVAL_UNEXPECTED_OUTPUT_EOF   (-4)
-#define RETVAL_DATA_ERROR  (-5)
-#define RETVAL_OUT_OF_MEMORY   (-6)
-#define RETVAL_OBSOLETE_INPUT  (-7)
-
-/* Other housekeeping constants */
-#define BZIP2_IOBUF_SIZE   4096
-
-/* This is what we know about each Huffman coding group */
-struct group_data {
-   /* We have an extra slot at the end of limit[] for a sentinal value. */
-   int limit[MAX_HUFCODE_BITS

Re: [RFC] new SYSCALL_DEFINE/COMPAT_SYSCALL_DEFINE wrappers

2018-03-30 Thread Adam Borowski
On Fri, Mar 30, 2018 at 12:58:02PM +0200, Ingo Molnar wrote:
> * John Paul Adrian Glaubitz  wrote:
> 
> > On 03/27/2018 12:40 PM, Linus Torvalds wrote:
> > > On Mon, Mar 26, 2018 at 4:37 PM, John Paul Adrian Glaubitz
> > >  wrote:
> > >>
> > >> What about a tarball with a minimal Debian x32 chroot? Then you can
> > >> install interesting packages you would like to test yourself.

> Here's the direct download link:
>   $ wget 
> https://people.debian.org/~glaubitz/chroots/debian-x32-unstable.tar.gz

> Seems to work fine here (on a distro kernel) even if I extract all the files 
> as a 
> non-root user and do:
> 
>   ~/s/debian-x32-unstable> fakechroot /usr/sbin/chroot . /usr/bin/dpkg -l  | 
> tail -2
> 
>   ERROR: ld.so: object 'libfakechroot.so' from LD_PRELOAD cannot be preloaded 
> (cannot open shared object file): ignored.
>   ii  util-linux:x32 2.31.1-0.5   x32  miscellaneous 
> system utilities
>   ii  zlib1g:x32 1:1.2.8.dfsg-5   x32  compression 
> library - runtime

> So that 'dpkg' instance appears to be running inside the chroot environment 
> and is 
> listing x32 installed packages.

> Although I did get this warning:
>   ERROR: ld.so: object 'libfakechroot.so' from LD_PRELOAD cannot be preloaded 
> (cannot open shared object file): ignored.
> Even with that warning, is still still a sufficiently complex test of x32 
> syscall 
> code paths?

Instead of mucking with fakechroot which would require installing its :x32
part inside the guest, or running the test as root, what about using any
random static binary?  For example, a shell like sash or bash-static would
have a decentish syscall coverage even by itself.

I've extracted sash from
http://ftp.ports.debian.org/debian-ports//pool-x32/main/s/sash/sash_3.8-4_x32.deb
and placed at https://angband.pl/tmp/sash.x32

$ sha256sum sash.x32 
de24097c859b313fa422af742b648c9d731de6b33b98cb995658d1da16398456  sash.x32

Obviously, you can compile a static binary that uses whatever syscalls you
want.  Without a native chroot, you can "gcc -mx32" although you'd need some
kind of libc unless your program is stand-alone.


It might be worth mentioning my "arch-test:
https://github.com/kilobyte/arch-test
Because of many toolchain pieces it needs, you want a prebuilt copy:
https://github.com/kilobyte/arch-test/releases/download/v0.10/arch-test_prebuilt_0.10.tar.xz
https://github.com/kilobyte/arch-test/releases/download/v0.10/arch-test_prebuilt_0.10.tar.xz.asc
-- while it has _extremely_ small coverage of syscalls (just write() and
_exit(), enough to check endianness and pointer width), concentrating on
instruction set inadequacies (broken SWP on arm, POWER7 vs POWER8, powerpc
vs powerpcspe, etc), it provides minimal test binaries for a wide range of
architectures.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢰⠒⠀⣿⡁ I was born a dumb, ugly and work-loving kid, then I got swapped on
⢿⡄⠘⠷⠚⠋⠀ the maternity ward.
⠈⠳⣄


signature.asc
Description: PGP signature


Re: [PATCH 00/13] mmu_notifier kill invalidate_page callback

2017-08-30 Thread Adam Borowski
On Tue, Aug 29, 2017 at 08:56:15PM -0400, Jerome Glisse wrote:
> I will wait for people to test and for result of my own test before
> reposting if need be, otherwise i will post as separate patch.
>
> > But from a _very_ quick read-through this looks fine. But it obviously
> > needs testing.
> > 
> > People - *especially* the people who saw issues under KVM - can you
> > try out Jérôme's patch-series? I aded some people to the cc, the full
> > series is on lkml. Jérôme - do you have a git branch for people to
> > test that they could easily pull and try out?
> 
> https://cgit.freedesktop.org/~glisse/linux mmu-notifier branch
> git://people.freedesktop.org/~glisse/linux

Tested your branch as of 10f07641, on a long list of guest VMs.
No earth-shattering kaboom.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢰⠒⠀⣿⡁ Vat kind uf sufficiently advanced technology iz dis!?
⢿⡄⠘⠷⠚⠋⠀ -- Genghis Ht'rok'din
⠈⠳⣄ 


[PATCH] powerpc/85xx: typo in dts: interupt (four devices)

2013-11-12 Thread Adam Borowski
These lines were inoperative for four years, which puts some doubt into
their importance, and it's possible the fixed version will regress, but
at the very least they should be removed instead.

Signed-off-by: Adam Borowski kilob...@angband.pl
---
 arch/powerpc/boot/dts/xcalibur1501.dts | 4 ++--
 arch/powerpc/boot/dts/xpedite5301.dts  | 4 ++--
 arch/powerpc/boot/dts/xpedite5330.dts  | 4 ++--
 arch/powerpc/boot/dts/xpedite5370.dts  | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/boot/dts/xcalibur1501.dts 
b/arch/powerpc/boot/dts/xcalibur1501.dts
index cc00f4d..c409cba 100644
--- a/arch/powerpc/boot/dts/xcalibur1501.dts
+++ b/arch/powerpc/boot/dts/xcalibur1501.dts
@@ -637,14 +637,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
diff --git a/arch/powerpc/boot/dts/xpedite5301.dts 
b/arch/powerpc/boot/dts/xpedite5301.dts
index 53c1c6a..04cb410 100644
--- a/arch/powerpc/boot/dts/xpedite5301.dts
+++ b/arch/powerpc/boot/dts/xpedite5301.dts
@@ -547,14 +547,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
diff --git a/arch/powerpc/boot/dts/xpedite5330.dts 
b/arch/powerpc/boot/dts/xpedite5330.dts
index 2152259..73f8620 100644
--- a/arch/powerpc/boot/dts/xpedite5330.dts
+++ b/arch/powerpc/boot/dts/xpedite5330.dts
@@ -583,14 +583,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
diff --git a/arch/powerpc/boot/dts/xpedite5370.dts 
b/arch/powerpc/boot/dts/xpedite5370.dts
index 11dbda1..cd0ea2b 100644
--- a/arch/powerpc/boot/dts/xpedite5370.dts
+++ b/arch/powerpc/boot/dts/xpedite5370.dts
@@ -545,14 +545,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
-- 
1.8.5.rc0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/85xx: typo in dts: interupt (four devices)

2013-11-11 Thread Adam Borowski
These lines were inoperative for four years, which puts some doubt into
their importance, and it's possible the fixed version will regress, but
at the very least they should be removed instead.

Signed-off-by: Adam Borowski kilob...@angband.pl
---
 arch/powerpc/boot/dts/xcalibur1501.dts | 4 ++--
 arch/powerpc/boot/dts/xpedite5301.dts  | 4 ++--
 arch/powerpc/boot/dts/xpedite5330.dts  | 4 ++--
 arch/powerpc/boot/dts/xpedite5370.dts  | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/boot/dts/xcalibur1501.dts 
b/arch/powerpc/boot/dts/xcalibur1501.dts
index cc00f4d..f151426 100644
--- a/arch/powerpc/boot/dts/xcalibur1501.dts
+++ b/arch/powerpc/boot/dts/xcalibur1501.dts
@@ -637,14 +637,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2 ;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
diff --git a/arch/powerpc/boot/dts/xpedite5301.dts 
b/arch/powerpc/boot/dts/xpedite5301.dts
index 53c1c6a..d00fe16 100644
--- a/arch/powerpc/boot/dts/xpedite5301.dts
+++ b/arch/powerpc/boot/dts/xpedite5301.dts
@@ -547,14 +547,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2 ;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
diff --git a/arch/powerpc/boot/dts/xpedite5330.dts 
b/arch/powerpc/boot/dts/xpedite5330.dts
index 2152259..e506554 100644
--- a/arch/powerpc/boot/dts/xpedite5330.dts
+++ b/arch/powerpc/boot/dts/xpedite5330.dts
@@ -583,14 +583,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2 ;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
diff --git a/arch/powerpc/boot/dts/xpedite5370.dts 
b/arch/powerpc/boot/dts/xpedite5370.dts
index 11dbda1..9f1c608 100644
--- a/arch/powerpc/boot/dts/xpedite5370.dts
+++ b/arch/powerpc/boot/dts/xpedite5370.dts
@@ -545,14 +545,14 @@
tlu@2f000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x2f000 0x1000;
-   interupts = 61 2 ;
+   interrupts = 61 2 ;
interrupt-parent = mpic;
};
 
tlu@15000 {
compatible = fsl,mpc8572-tlu, fsl_tlu;
reg = 0x15000 0x1000;
-   interupts = 75 2;
+   interrupts = 75 2;
interrupt-parent = mpic;
};
};
-- 
1.8.5.rc0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev