From patchwork Thu Jun 24 20:53:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 1496829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G9snK0hHkz9sWc; Fri, 25 Jun 2021 06:54:13 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lwWMU-0003bb-0w; Thu, 24 Jun 2021 20:54:10 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lwWMS-0003aw-0s for kernel-team@lists.ubuntu.com; Thu, 24 Jun 2021 20:54:08 +0000 Received: from mail-wr1-f69.google.com ([209.85.221.69]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lwWMR-0007di-PO for kernel-team@lists.ubuntu.com; Thu, 24 Jun 2021 20:54:07 +0000 Received: by mail-wr1-f69.google.com with SMTP id l2-20020adfe5820000b029011a64161d6aso2632888wrm.6 for ; Thu, 24 Jun 2021 13:54:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LWuoLpfWkxzuyJywTrmST7BScSKqeftBebcwgLS9Agk=; b=O++jgOG27KdSVk2GGSFrN0gs8SmHeTc8fWFUhhktgiOZdqxdg66WUScQCYH2Uc6cKz oaLl3P9TRzaT/OdXRAcMxwwBT0rRXz1yhcpX9MGV+Knbh3adsH2+spbSDWoT+Y/miq1J KERKpsPrF2FsFt6hpD+VlOi9dHJx3ipNorfOSgCiQb1e21T5vh/wouFMkqZ5birNbFSs l9iJ3E6yILr7/vB6odzgPm9wKqP1ftGdVUUI7HgSStpwIoER9ivss2VJ8k7ILA0QqQMI oJZ7MZuIQLyvDnPnZJETa+6NArkOFcFmMDJzFp6N8xeR/MvrhZZ7Flvg5PDXLXhX2vh0 k9VQ== X-Gm-Message-State: AOAM531mxxRjCQHS0bxr1+McpSVi7AP/4nTRe9nX77jFkVDQj8GRfqZ6 r0Rf6oVNaMGRSx936Ai3PUpOHnYz3BSWVSr/BkDkXRWtDKlTZuIvUH7sdfMiPWiYNb6Ow5NIHt3 8NaokCYcAAKALlhqAjh6Ub/j+RTGqDyxzRmdTrbmeLQ== X-Received: by 2002:adf:a284:: with SMTP id s4mr6709920wra.397.1624568047224; Thu, 24 Jun 2021 13:54:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdniJR5o0zmymVvgsI8wNpDsIoLglGj8ayzM6yCW9DFBnhwYHU9Tci4i3T7i8J4ZDTz05Mfg== X-Received: by 2002:adf:a284:: with SMTP id s4mr6709902wra.397.1624568047009; Thu, 24 Jun 2021 13:54:07 -0700 (PDT) Received: from localhost ([2a01:4b00:85fd:d700:e864:ba34:2726:5604]) by smtp.gmail.com with ESMTPSA id y66sm3938224wmy.39.2021.06.24.13.54.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 13:54:06 -0700 (PDT) From: Dimitri John Ledkov To: kernel-team@lists.ubuntu.com Subject: [UNSTABLE][PATCH 2/3] s390/boot: add zstd support Date: Thu, 24 Jun 2021 21:53:46 +0100 Message-Id: <20210624205347.28144-3-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210624205347.28144-1-dimitri.ledkov@canonical.com> References: <20210624205347.28144-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Enable ztsd support in s390/boot, to enable booting with zstd compressed kernel when configured with CONFIG_KERNEL_ZSTD=y. BOOT_HEAP_SIZE is defined to 0x30000 in this case. Actual decompressor memory usage with allyesconfig is currently 0x26150. BugLink: https://bugs.launchpad.net/bugs/1931725 Signed-off-by: Dimitri John Ledkov cc: Heiko Carstens cc: Vasily Gorbik cc: Christian Borntraeger cc: linux-s390@vger.kernel.org Link: https://lore.kernel.org/r/20210615114150.325080-1-dimitri.ledkov@canonical.com [gor: added BOOT_HEAP_SIZE for zstd] Signed-off-by: Vasily Gorbik (cherry picked from commit 7b034d9c1b08b3d06ad712283c1115a7fe39e354 linux-next) BugLink: https://bugs.launchpad.net/bugs/1931725 Signed-off-by: Dimitri John Ledkov --- arch/s390/Kconfig | 1 + arch/s390/boot/compressed/Makefile | 4 ++++ arch/s390/boot/compressed/decompressor.c | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index b4c7c34069f8..fdbf584e13eb 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -172,6 +172,7 @@ config S390 select HAVE_KERNEL_LZO select HAVE_KERNEL_UNCOMPRESSED select HAVE_KERNEL_XZ + select HAVE_KERNEL_ZSTD select HAVE_KPROBES select HAVE_KPROBES_ON_FTRACE select HAVE_KRETPROBES diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile index de18dab518bb..75660aaaa7a3 100644 --- a/arch/s390/boot/compressed/Makefile +++ b/arch/s390/boot/compressed/Makefile @@ -14,6 +14,7 @@ obj-y := $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o obj-all := $(obj-y) piggy.o syms.o 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.bin.zst targets += info.bin syms.bin vmlinux.syms $(obj-all) KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) @@ -63,6 +64,7 @@ suffix-$(CONFIG_KERNEL_LZ4) := .lz4 suffix-$(CONFIG_KERNEL_LZMA) := .lzma suffix-$(CONFIG_KERNEL_LZO) := .lzo suffix-$(CONFIG_KERNEL_XZ) := .xz +suffix-$(CONFIG_KERNEL_ZSTD) := .zst $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE $(call if_changed,gzip) @@ -76,6 +78,8 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE $(call if_changed,lzo) $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE $(call if_changed,xzkern) +$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE + $(call if_changed,zstd22) OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE diff --git a/arch/s390/boot/compressed/decompressor.c b/arch/s390/boot/compressed/decompressor.c index cf2571050c68..37a4a8d33c6c 100644 --- a/arch/s390/boot/compressed/decompressor.c +++ b/arch/s390/boot/compressed/decompressor.c @@ -30,6 +30,8 @@ extern unsigned char _compressed_end[]; #ifdef CONFIG_KERNEL_BZIP2 #define BOOT_HEAP_SIZE 0x400000 +#elif CONFIG_KERNEL_ZSTD +#define BOOT_HEAP_SIZE 0x30000 #else #define BOOT_HEAP_SIZE 0x10000 #endif @@ -61,6 +63,10 @@ static unsigned long free_mem_end_ptr = (unsigned long) _end + BOOT_HEAP_SIZE; #include "../../../../lib/decompress_unxz.c" #endif +#ifdef CONFIG_KERNEL_ZSTD +#include "../../../../lib/decompress_unzstd.c" +#endif + #define decompress_offset ALIGN((unsigned long)_end + BOOT_HEAP_SIZE, PAGE_SIZE) unsigned long mem_safe_offset(void)