From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
Andrew Morton <akpm@linux-foundation.org>,
Gao Xiang <xiang@kernel.org>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Linus Walleij <linus.walleij@linaro.org>,
kernel@pengutronix.de,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
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 [thread overview]
Message-ID: <20191017114906.30302-4-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20191017114906.30302-1-linux@rasmusvillemoes.dk>
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 <linux@rasmusvillemoes.dk>
---
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)"
--
2.20.1
next prev parent reply other threads:[~2019-10-17 11:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 11:49 [RFC PATCH 0/3] watchdog servicing during decompression Rasmus Villemoes
2019-10-17 11:49 ` [RFC PATCH 1/3] decompress/keepalive.h: prepare for watchdog keepalive during kernel decompression Rasmus Villemoes
2019-10-17 11:49 ` [RFC PATCH 2/3] lib: lz4: wire up watchdog keepalive during decompression Rasmus Villemoes
2019-10-17 11:49 ` Rasmus Villemoes [this message]
2019-10-24 12:17 ` [RFC PATCH 3/3] decompress/keepalive.h: add config option for toggling a set of bits Linus Walleij
2019-10-24 13:45 ` Rasmus Villemoes
2019-10-17 12:03 ` [RFC PATCH 0/3] watchdog servicing during decompression Russell King - ARM Linux admin
2019-10-17 12:34 ` Rasmus Villemoes
2019-10-17 12:48 ` Russell King - ARM Linux admin
2019-10-24 12:38 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191017114906.30302-4-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=akpm@linux-foundation.org \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).