From patchwork Thu Oct 17 11:49:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 11195493 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BA881575 for ; Thu, 17 Oct 2019 11:49:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36B412082C for ; Thu, 17 Oct 2019 11:49:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NNIESAhC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="Y94hZcrB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36B412082C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aPmEPOOW37U0Xi1hx7tsa3escLqVCwTukipZPa5M/Ac=; b=NNIESAhCgkD6Wb LxKXmaMXiLyUugKZKDTQ650u/1M9K1SzRsu9gtJCv24yp4KUqVy/ezrFnH2jf3Clp2Hgv44D58Adn +kUh+k3G/caT8O78STjyD82ppxU46QvX2kM7WGoUoTlwG71KQHL0wilFCIMzy/r/shvjBu/fsE3eb QFR8brJ8iveiGk5JbQ1yUlSd5UPUI6UPn1T3OGLEbpvTuid46Lo8/YQSJDwx516zCbdmqcuttaMkg 7CFFKb+R8GHFUJJNPkVA0OISY5Bbc66S4uyEKWWJ5GoVM2P8IPM8jZqKiP3W05uIaxeOIgo0ZBSo8 5q3DK8t6Tq/xhuFiM+Tw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iL4Hb-0001tF-H8; Thu, 17 Oct 2019 11:49:31 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iL4HL-0001hm-A8 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2019 11:49:16 +0000 Received: by mail-lj1-x241.google.com with SMTP id j19so2229930lja.1 for ; Thu, 17 Oct 2019 04:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v8LKBRBxcaymYywQC1yoyW7qk1pLqld/GOLoE3N0/Gk=; b=Y94hZcrB1Y777DAYUOPKEcDZveCY0YSN4thc+ix3qgL9cYKMOVj69ctzDms1zp9Pck jt8E4tROWs+rMeMU4TR/buZTRzbxGNP4SpmvAyNhcttPsW8OXf3f21N6EyvoC2dhf+8l MMmTyDhdL9xm3opCRJRWwlpcbPUmnPAaUZ+As= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v8LKBRBxcaymYywQC1yoyW7qk1pLqld/GOLoE3N0/Gk=; b=dHGcCmEIEDBE4vyrFpB9Ta20NINcSWgGUMljKDQIwTdOlyyg0Z5O3zdeok2XyTcHBp /NPxHBb9ibM5PYrc7DHXUwubwW3Qd00Lv9gY4CyI/BPz9evxsAnk3sRMn+Q2rN9qfzT3 iJvAK1CVrD4IfqK3lrjVptiHjJ0xDq/BnuT+Wp2rEAD2m2MLOW5qp9hAVZ+R+GR0lkzA Iil8wxylV1MWGpjRhfOjN6AirR/09/I1vE13WL2PTvIRb7+QZd+epJhy4eEKBKFYRPhL 5mvoYJSYye2VZAo5IHTHuaCEZQ7T3lnKmvQGK4v5P+ccDjR5SaVtddTWRtyuq0L9714M xmhg== X-Gm-Message-State: APjAAAX6jkGFVdlEm+z7mrtE77RJpFv4Nl+psqZQvXiCowQGFxjY5e78 /8GLeBg7uZMIqIFDiQawozJ7iA== X-Google-Smtp-Source: APXvYqwMm83t6Ayeaku/Uq23tNm6C0IkV0iS3pOoZUwg5XfkH0rI651FLIb5bwUm/9F+fKO8u6JQ3A== X-Received: by 2002:a2e:8417:: with SMTP id z23mr2192660ljg.28.1571312953668; Thu, 17 Oct 2019 04:49:13 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id x30sm920772ljd.39.2019.10.17.04.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 04:49:13 -0700 (PDT) From: Rasmus Villemoes To: Masahiro Yamada , Andrew Morton , Gao Xiang Subject: [RFC PATCH 1/3] decompress/keepalive.h: prepare for watchdog keepalive during kernel decompression Date: Thu, 17 Oct 2019 13:49:04 +0200 Message-Id: <20191017114906.30302-2-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017114906.30302-1-linux@rasmusvillemoes.dk> References: <20191017114906.30302-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191017_044915_347106_D13C17C0 X-CRM114-Status: GOOD ( 11.09 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:241 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@pengutronix.de, Linus Walleij , Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some boards have a hardware watchdog that (a) cannot be disabled and (b) has a timeout short enough that there's no chance for the kernel to get through decompression, let alone reach the initialization of the appropriate watchdog device driver. In order to allow booting such boards, the decompression routine needs to service the watchdog in its main loop. This adds a header making it easy to wire up each decompressor - just include this header and add a decompress_keepalive() in the main loop. Outside of the pre-boot stage, this is always a no-op. Signed-off-by: Rasmus Villemoes --- include/linux/decompress/keepalive.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 include/linux/decompress/keepalive.h diff --git a/include/linux/decompress/keepalive.h b/include/linux/decompress/keepalive.h new file mode 100644 index 000000000000..39caa7693624 --- /dev/null +++ b/include/linux/decompress/keepalive.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef DECOMPRESS_KEEPALIVE_H +#define DECOMPRESS_KEEPALIVE_H + +#ifdef PREBOOT + +#endif + +#ifndef decompress_keepalive +#define decompress_keepalive() do { } while (0) +#endif + +#endif /* DECOMPRESS_KEEPALIVE_H */ From patchwork Thu Oct 17 11:49:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 11195495 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 185E81575 for ; Thu, 17 Oct 2019 11:49:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E02E821848 for ; Thu, 17 Oct 2019 11:49:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="A1mw9oHt"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="a81Dft1d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E02E821848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8HvJiboo82Vx4Af2YZpKYDaxsEDDvHkZnP/u92bRO/g=; b=A1mw9oHtNpnRDv mKhhQjZeqGlzVcO5GtYQ/tcWKEXP7abrAW4B9V/D5fr7jSO6A79JN4LOqDPgf+PtU6hTUCAgfhB7I piPVQrlRpcN4/AAemuyOcG0EQimhUSakkjrXeYC7zZrXm6HUtTI/UjLjVvIxUNhpyJZWWDAp8EsLL 38lRB2uw3+fHa/q+cmhFGKILEx2eJIZjZICXcPCeaKk6+uDTgbkNm+lxmS6NzZJ3B9mSq5eLoKDWN qnZYgpORAf8gvR+HOEX9LaoYRrUxKQ/Ll81L3G3nvtdRd0ua9GDB0WYzeVTty+7jdufKJtG2Ht1pz 8Plz2O9ePkvYpV5Xpp1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iL4Hs-00029L-4W; Thu, 17 Oct 2019 11:49:48 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iL4HM-0001i1-Ff for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2019 11:49:17 +0000 Received: by mail-lf1-x142.google.com with SMTP id u28so1634879lfc.5 for ; Thu, 17 Oct 2019 04:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aRODApNsJVV2rJDwziBmWs3j8yPs9YphekPtecPLAiU=; b=a81Dft1duwadDoXnkkFElfwe10DpV2vpElINNcypWE7FBfOQcdZm18KcVc+ATFFWfY kljiMjoHa3+55HWqHvmqVQgGWo9RXUzhVHZjrE0zd8OkR6gSrKFL7ZiKkq1dZa9xeKmK ffSTvwj0Yuxj0ci/iv67cg1+6pSoOtiHZBRI0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aRODApNsJVV2rJDwziBmWs3j8yPs9YphekPtecPLAiU=; b=QlA1EfoQwzKDMT0HeKLqFSqaaoKyoNELQTCTnKxzFrMG/8RZovbr0iQqDQD4ZWHQNv MxQu2dT1J6eTl4NT9ghnb9qRTcRX6UYIurG88HxUgt+oc+9Y2WQ7RxyqP/rSXTH5b5ff wangNb2RslTqJeYNNgq6ZaSno4jSV5cehFU22csClpARYrnnVZb8TVwWD8G4ZqiTXnPG Pj9kOfIytNhkR/EkYEiJFgu9H4pxsV7Ce0Q/ickudSAj/j7io+ifmuAELkuSggIeYX8x 2sBWDg7aNU8Vic9xcNe92yu7yNnF+z7PHFAwc4bgs9zfX+vpjyTawLXoXiVlslxnJOPA 1TPw== X-Gm-Message-State: APjAAAX5ANocpZxOd85sP1Pm0xHe8tzux4E4YmB7TZS+8T4XVsFMgUIQ VcSSaxDwwa4GNhkSk8L69hhzIg== X-Google-Smtp-Source: APXvYqyli5l3scW9RbTMDV7OJSAaURiEht8wF2Q1Cz/jerpQFJ/kBqqYjXUNWLCSY1A1nEqVUxLm7w== X-Received: by 2002:a19:f707:: with SMTP id z7mr2017958lfe.162.1571312954818; Thu, 17 Oct 2019 04:49:14 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id x30sm920772ljd.39.2019.10.17.04.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 04:49:14 -0700 (PDT) From: Rasmus Villemoes To: Masahiro Yamada , Andrew Morton , Gao Xiang Subject: [RFC PATCH 2/3] lib: lz4: wire up watchdog keepalive during decompression Date: Thu, 17 Oct 2019 13:49:05 +0200 Message-Id: <20191017114906.30302-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017114906.30302-1-linux@rasmusvillemoes.dk> References: <20191017114906.30302-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191017_044916_525769_6C519572 X-CRM114-Status: GOOD ( 11.01 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:142 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@pengutronix.de, Linus Walleij , Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some boards have a hardware watchdog that (a) cannot be disabled and (b) has a timeout short enough that there's no chance for the kernel to get through decompression, let alone reach the initialization of the appropriate watchdog device driver. In order to allow booting such boards, the decompression routine needs to service the watchdog in its main loop. This wires up lz4 to do that via the decompress_keepalive() macro defined in the new linux/decompress/keepalive.h. Signed-off-by: Rasmus Villemoes --- lib/lz4/lz4_decompress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index 0c9d3ad17e0f..54ba41d073a6 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c @@ -39,6 +39,7 @@ #include #include #include +#include /*-***************************** * Decompression functions @@ -129,6 +130,7 @@ static FORCE_INLINE int LZ4_decompress_generic( /* ip < iend before the increment */ assert(!endOnInput || ip <= iend); + decompress_keepalive(); /* * A two-stage shortcut for the most common case: From patchwork Thu Oct 17 11:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 11195497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DFFF1575 for ; Thu, 17 Oct 2019 11:50:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 262E32089C for ; Thu, 17 Oct 2019 11:50:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lO72zNat"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="SBcX2tI4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 262E32089C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+gcb46LZgQ3nH1hbRvD+UVhMgWjvidqNt/Ae7MoQa7I=; b=lO72zNat9eJKjr tyHHrzDkIxBymrNiWDho/bz5CvQ/eECbkCg9chmp7D9awvgb5f//RoAoG0xxqfKBfDbqymSwzezI2 BOzP9zpNkMa4WPdeL8KeW/9R0FGsYyEP3l0g85FQ1AMiKftHHt4wsi9FWqy6JMmg9DdfMIvm+9xBN FC+vR6DTqDpGVMaRTBm/Q9SeBFbgIyW5DBlzBDt2IKdCA0MbN0rniFeFqy/ZQhJ9mgVR2akN7ktcD oxkOYgJS70Qrephn+VB3Z/KpQPOSTv65ngyUNdvS3NNCeZLOiP2PkzXRd8JSeCgttc1Uql9LY+4D9 rgz3G07/6bXLIIQ5o4ww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iL4I5-0002N0-QX; Thu, 17 Oct 2019 11:50:01 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iL4HN-0001iZ-R6 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2019 11:49:19 +0000 Received: by mail-lj1-x242.google.com with SMTP id d1so2164080ljl.13 for ; Thu, 17 Oct 2019 04:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a+GxmprIIlivls+xiiE2BlDUBLKsv4nmlWzvKE4aR9Y=; b=SBcX2tI4x4/1Q7OpymRwhlxB/kdYjwCirEuibHX7DawgeJTuPaHyxNMLNh4W9MVyBF letoHX64UHC4ruCNszUwvKalaZpVG78M22y3d3Vq8FVk+S+V7nQJVOE9LlNTM/rcST4N OLyB3dRj3YA71fYRagSSWlZZTUNlAHC7+YCZs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a+GxmprIIlivls+xiiE2BlDUBLKsv4nmlWzvKE4aR9Y=; b=cFZlqqL9f4Bh46AU0AC3LcVvq61Baca+rhHOfkIjNnlbW/cT4HL/Az3npdYp9Yxnx8 Ilzz/Oi4ElvEqtcJjBOcmYuUQ8MKUcZWXLFLk12FroXIIjuo+kB/AbRliQvxpr3Q8sev QHjM73GoGom11OUUzbJ+mqB5uctrLBJQq+3i9FKuRjiUjT+HqZHYFEMgbpt51Y0nOGas BnAiRmeqDzD2q3AmipzeQN0IFprJ0qnnLeubjGIDDXQdyeZ5ApW68SN9S1pYGQCy82Gq w4tMAzqBo7bJYcsze7zzk0KZ+/KebbNzoNh8mVQGlYotCkeJXtmbfmoS1DkvuJXwTZmN +0RQ== X-Gm-Message-State: APjAAAX1IPor5XS5VoaQTrlkPMVy/zsNBIFUPU6j4q8sULpawXkzdRD1 fxZ4VC/2Dtw4vVDmOI8SmLdQCJMuP12Jffd3 X-Google-Smtp-Source: APXvYqxGLJtJkNX4m2MxleJ2gGPlrbCblZIvrattCDK3O6KMUbntqKBn9afoSuGTNTeqmCY1Gi1qOw== X-Received: by 2002:a05:651c:8b:: with SMTP id 11mr2229402ljq.98.1571312956132; Thu, 17 Oct 2019 04:49:16 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id x30sm920772ljd.39.2019.10.17.04.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 04:49:15 -0700 (PDT) From: Rasmus Villemoes To: Masahiro Yamada , Andrew Morton , Gao Xiang Subject: [RFC PATCH 3/3] decompress/keepalive.h: add config option for toggling a set of bits Date: Thu, 17 Oct 2019 13:49:06 +0200 Message-Id: <20191017114906.30302-4-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017114906.30302-1-linux@rasmusvillemoes.dk> References: <20191017114906.30302-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191017_044917_893349_B480770B X-CRM114-Status: GOOD ( 13.55 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:242 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@pengutronix.de, Linus Walleij , Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org It's quite common to have an external watchdog which is serviced via flipping a GPIO, with the value of that GPIO being settable directly in a memory-mapped register. So add kconfig options defining the physical address of such a register as well as a mask to have the decompressor periodically xor into that register. If and when other decompress_keepalive methods are added, this can be made into a "choice DECOMPRESS_KEEPALIVE". Since only LZ4 is wired up currently, this is "depends on KERNEL_LZ4" for now. Also, prevent this option from being shown to the average user. Signed-off-by: Rasmus Villemoes --- include/linux/decompress/keepalive.h | 8 +++++++ init/Kconfig | 33 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/linux/decompress/keepalive.h b/include/linux/decompress/keepalive.h index 39caa7693624..c62e49bee7cf 100644 --- a/include/linux/decompress/keepalive.h +++ b/include/linux/decompress/keepalive.h @@ -5,6 +5,14 @@ #ifdef PREBOOT +#ifdef CONFIG_DECOMPRESS_KEEPALIVE_TOGGLE +#define decompress_keepalive() do { \ + long addr = CONFIG_DECOMPRESS_KEEPALIVE_TOGGLE_REG; \ + volatile unsigned *reg = (volatile unsigned *)addr; \ + *reg ^= CONFIG_DECOMPRESS_KEEPALIVE_TOGGLE_MASK; \ +} while (0) +#endif + #endif #ifndef decompress_keepalive diff --git a/init/Kconfig b/init/Kconfig index b4daad2bac23..8a894d9fdd77 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -289,6 +289,39 @@ config KERNEL_UNCOMPRESSED endchoice +config DECOMPRESS_KEEPALIVE_TOGGLE + depends on KERNEL_LZ4 + depends on EXPERT + bool "Toggle some bits while decompressing" + help + Some embedded boards have an always-running hardware + watchdog with a timeout short enough that the board is reset + during decompression, thus preventing the board from ever + booting. + + Enable this to toggle certain bits in a memory register + while decompressing the kernel. This can for example be used + in the common case of an external watchdog serviced via a + memory-mapped GPIO. + + Say N unless you know you need this. + +if DECOMPRESS_KEEPALIVE_TOGGLE + +config DECOMPRESS_KEEPALIVE_TOGGLE_REG + hex "Address of register to modify while decompressing" + help + Set this to a physical address of a 32-bit memory word to + modify while decompressing. + +config DECOMPRESS_KEEPALIVE_TOGGLE_MASK + hex "Bit mask to toggle while decompressing" + help + The register selected above will periodically be xor'ed with + this value during decompression. + +endif + config DEFAULT_HOSTNAME string "Default hostname" default "(none)"