1# SPDX-License-Identifier: GPL-2.0-only
2config PSTORE
3	tristate "Persistent store support"
4	select CRYPTO if PSTORE_COMPRESS
5	default n
6	help
7	   This option enables generic access to platform level
8	   persistent storage via "pstore" filesystem that can
9	   be mounted as /dev/pstore.  Only useful if you have
10	   a platform level driver that registers with pstore to
11	   provide the data, so you probably should just go say "Y"
12	   (or "M") to a platform specific persistent store driver
13	   (e.g. ACPI_APEI on X86) which will select this for you.
14	   If you don't have a platform persistent store driver,
15	   say N.
16
17config PSTORE_DEFAULT_KMSG_BYTES
18	int "Default kernel log storage space" if EXPERT
19	depends on PSTORE
20	default "10240"
21	help
22	  Defines default size of pstore kernel log storage.
23	  Can be enlarged if needed, not recommended to shrink it.
24
25config PSTORE_DEFLATE_COMPRESS
26	tristate "DEFLATE (ZLIB) compression"
27	default y
28	depends on PSTORE
29	select CRYPTO_DEFLATE
30	help
31	  This option enables DEFLATE (also known as ZLIB) compression
32	  algorithm support.
33
34config PSTORE_LZO_COMPRESS
35	tristate "LZO compression"
36	depends on PSTORE
37	select CRYPTO_LZO
38	help
39	  This option enables LZO compression algorithm support.
40
41config PSTORE_LZ4_COMPRESS
42	tristate "LZ4 compression"
43	depends on PSTORE
44	select CRYPTO_LZ4
45	help
46	  This option enables LZ4 compression algorithm support.
47
48config PSTORE_LZ4HC_COMPRESS
49	tristate "LZ4HC compression"
50	depends on PSTORE
51	select CRYPTO_LZ4HC
52	help
53	  This option enables LZ4HC (high compression) mode algorithm.
54
55config PSTORE_842_COMPRESS
56	bool "842 compression"
57	depends on PSTORE
58	select CRYPTO_842
59	help
60	  This option enables 842 compression algorithm support.
61
62config PSTORE_ZSTD_COMPRESS
63	bool "zstd compression"
64	depends on PSTORE
65	select CRYPTO_ZSTD
66	help
67	  This option enables zstd compression algorithm support.
68
69config PSTORE_COMPRESS
70	def_bool y
71	depends on PSTORE
72	depends on PSTORE_DEFLATE_COMPRESS || PSTORE_LZO_COMPRESS ||	\
73		   PSTORE_LZ4_COMPRESS || PSTORE_LZ4HC_COMPRESS ||	\
74		   PSTORE_842_COMPRESS || PSTORE_ZSTD_COMPRESS
75
76choice
77	prompt "Default pstore compression algorithm"
78	depends on PSTORE_COMPRESS
79	help
80	  This option chooses the default active compression algorithm.
81	  This change be changed at boot with "pstore.compress=..." on
82	  the kernel command line.
83
84	  Currently, pstore has support for 6 compression algorithms:
85	  deflate, lzo, lz4, lz4hc, 842 and zstd.
86
87	  The default compression algorithm is deflate.
88
89	config PSTORE_DEFLATE_COMPRESS_DEFAULT
90		bool "deflate" if PSTORE_DEFLATE_COMPRESS
91
92	config PSTORE_LZO_COMPRESS_DEFAULT
93		bool "lzo" if PSTORE_LZO_COMPRESS
94
95	config PSTORE_LZ4_COMPRESS_DEFAULT
96		bool "lz4" if PSTORE_LZ4_COMPRESS
97
98	config PSTORE_LZ4HC_COMPRESS_DEFAULT
99		bool "lz4hc" if PSTORE_LZ4HC_COMPRESS
100
101	config PSTORE_842_COMPRESS_DEFAULT
102		bool "842" if PSTORE_842_COMPRESS
103
104	config PSTORE_ZSTD_COMPRESS_DEFAULT
105		bool "zstd" if PSTORE_ZSTD_COMPRESS
106
107endchoice
108
109config PSTORE_COMPRESS_DEFAULT
110	string
111	depends on PSTORE_COMPRESS
112	default "deflate" if PSTORE_DEFLATE_COMPRESS_DEFAULT
113	default "lzo" if PSTORE_LZO_COMPRESS_DEFAULT
114	default "lz4" if PSTORE_LZ4_COMPRESS_DEFAULT
115	default "lz4hc" if PSTORE_LZ4HC_COMPRESS_DEFAULT
116	default "842" if PSTORE_842_COMPRESS_DEFAULT
117	default "zstd" if PSTORE_ZSTD_COMPRESS_DEFAULT
118
119config PSTORE_CONSOLE
120	bool "Log kernel console messages"
121	depends on PSTORE
122	help
123	  When the option is enabled, pstore will log all kernel
124	  messages, even if no oops or panic happened.
125
126config PSTORE_PMSG
127	bool "Log user space messages"
128	depends on PSTORE
129	help
130	  When the option is enabled, pstore will export a character
131	  interface /dev/pmsg0 to log user space messages. On reboot
132	  data can be retrieved from /sys/fs/pstore/pmsg-ramoops-[ID].
133
134	  If unsure, say N.
135
136config PSTORE_FTRACE
137	bool "Persistent function tracer"
138	depends on PSTORE
139	depends on FUNCTION_TRACER
140	depends on DEBUG_FS
141	help
142	  With this option kernel traces function calls into a persistent
143	  ram buffer that can be decoded and dumped after reboot through
144	  pstore filesystem. It can be used to determine what function
145	  was last called before a reset or panic.
146
147	  If unsure, say N.
148
149config PSTORE_RAM
150	tristate "Log panic/oops to a RAM buffer"
151	depends on PSTORE
152	depends on HAS_IOMEM
153	select REED_SOLOMON
154	select REED_SOLOMON_ENC8
155	select REED_SOLOMON_DEC8
156	help
157	  This enables panic and oops messages to be logged to a circular
158	  buffer in RAM where it can be read back at some later point.
159
160	  Note that for historical reasons, the module will be named
161	  "ramoops.ko".
162
163	  For more information, see Documentation/admin-guide/ramoops.rst.
164
165config PSTORE_ZONE
166	tristate
167	depends on PSTORE
168	help
169	  The common layer for pstore/blk (and pstore/ram in the future)
170	  to manage storage in zones.
171
172config PSTORE_BLK
173	tristate "Log panic/oops to a block device"
174	depends on PSTORE
175	depends on BLOCK
176	select PSTORE_ZONE
177	default n
178	help
179	  This enables panic and oops message to be logged to a block dev
180	  where it can be read back at some later point.
181
182	  For more information, see Documentation/admin-guide/pstore-blk.rst
183
184	  If unsure, say N.
185
186config PSTORE_BLK_BLKDEV
187	string "block device identifier"
188	depends on PSTORE_BLK
189	default ""
190	help
191	  Which block device should be used for pstore/blk.
192
193	  It accepts the following variants:
194	  1) <hex_major><hex_minor> device number in hexadecimal representation,
195	     with no leading 0x, for example b302.
196	  2) /dev/<disk_name> represents the device name of disk
197	  3) /dev/<disk_name><decimal> represents the device name and number
198	     of partition - device number of disk plus the partition number
199	  4) /dev/<disk_name>p<decimal> - same as the above, this form is
200	     used when disk name of partitioned disk ends with a digit.
201	  5) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
202	     unique id of a partition if the partition table provides it.
203	     The UUID may be either an EFI/GPT UUID, or refer to an MSDOS
204	     partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero-
205	     filled hex representation of the 32-bit "NT disk signature", and PP
206	     is a zero-filled hex representation of the 1-based partition number.
207	  6) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation
208	     to a partition with a known unique id.
209	  7) <major>:<minor> major and minor number of the device separated by
210	     a colon.
211
212	  NOTE that, both Kconfig and module parameters can configure
213	  pstore/blk, but module parameters have priority over Kconfig.
214
215config PSTORE_BLK_KMSG_SIZE
216	int "Size in Kbytes of kmsg dump log to store"
217	depends on PSTORE_BLK
218	default 64
219	help
220	  This just sets size of kmsg dump (oops, panic, etc) log for
221	  pstore/blk. The size is in KB and must be a multiple of 4.
222
223	  NOTE that, both Kconfig and module parameters can configure
224	  pstore/blk, but module parameters have priority over Kconfig.
225
226config PSTORE_BLK_MAX_REASON
227	int "Maximum kmsg dump reason to store"
228	depends on PSTORE_BLK
229	default 2
230	help
231	  The maximum reason for kmsg dumps to store. The default is
232	  2 (KMSG_DUMP_OOPS), see include/linux/kmsg_dump.h's
233	  enum kmsg_dump_reason for more details.
234
235	  NOTE that, both Kconfig and module parameters can configure
236	  pstore/blk, but module parameters have priority over Kconfig.
237
238config PSTORE_BLK_PMSG_SIZE
239	int "Size in Kbytes of pmsg to store"
240	depends on PSTORE_BLK
241	depends on PSTORE_PMSG
242	default 64
243	help
244	  This just sets size of pmsg (pmsg_size) for pstore/blk. The size is
245	  in KB and must be a multiple of 4.
246
247	  NOTE that, both Kconfig and module parameters can configure
248	  pstore/blk, but module parameters have priority over Kconfig.
249
250config PSTORE_BLK_CONSOLE_SIZE
251	int "Size in Kbytes of console log to store"
252	depends on PSTORE_BLK
253	depends on PSTORE_CONSOLE
254	default 64
255	help
256	  This just sets size of console log (console_size) to store via
257	  pstore/blk. The size is in KB and must be a multiple of 4.
258
259	  NOTE that, both Kconfig and module parameters can configure
260	  pstore/blk, but module parameters have priority over Kconfig.
261
262config PSTORE_BLK_FTRACE_SIZE
263	int "Size in Kbytes of ftrace log to store"
264	depends on PSTORE_BLK
265	depends on PSTORE_FTRACE
266	default 64
267	help
268	  This just sets size of ftrace log (ftrace_size) for pstore/blk. The
269	  size is in KB and must be a multiple of 4.
270
271	  NOTE that, both Kconfig and module parameters can configure
272	  pstore/blk, but module parameters have priority over Kconfig.
273