• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: GPL-2.0
2menu "Kernel hacking"
3
4source "lib/Kconfig.debug"
5
6config DEBUG_VERBOSE
7	bool "Verbose fault messages"
8	default y
9	select PRINTK
10	help
11	  When a program crashes due to an exception, or the kernel detects
12	  an internal error, the kernel can print a not so brief message
13	  explaining what the problem was. This debugging information is
14	  useful to developers and kernel hackers when tracking down problems,
15	  but mostly meaningless to other people. This is always helpful for
16	  debugging but serves no purpose on a production system.
17	  Most people should say N here.
18
19config DEBUG_MMRS
20	tristate "Generate Blackfin MMR tree"
21	depends on !PINCTRL
22	select DEBUG_FS
23	help
24	  Create a tree of Blackfin MMRs via the debugfs tree.  If
25	  you enable this, you will find all MMRs laid out in the
26	  /sys/kernel/debug/blackfin/ directory where you can read/write
27	  MMRs directly from userspace.  This is obviously just a debug
28	  feature.
29
30config DEBUG_HWERR
31	bool "Hardware error interrupt debugging"
32	depends on DEBUG_KERNEL
33	help
34	  When enabled, the hardware error interrupt is never disabled, and
35	  will happen immediately when an error condition occurs.  This comes
36	  at a slight cost in code size, but is necessary if you are getting
37	  hardware error interrupts and need to know where they are coming
38	  from.
39
40config EXACT_HWERR
41	bool "Try to make Hardware errors exact"
42	depends on DEBUG_HWERR
43	help
44	  By default, the Blackfin hardware errors are not exact - the error
45          be reported multiple cycles after the error happens. This delay
46	  can cause the wrong application, or even the kernel to receive a
47	  signal to be killed. If you are getting HW errors in your system,
48	  try turning this on to ensure they are at least coming from the
49	  proper thread.
50
51	  On production systems, it is safe (and a small optimization) to say N.
52
53config DEBUG_DOUBLEFAULT
54	bool "Debug Double Faults"
55	default n
56	help
57	  If an exception is caused while executing code within the exception
58	  handler, the NMI handler, the reset vector, or in emulator mode,
59	  a double fault occurs. On the Blackfin, this is a unrecoverable
60	  event. You have two options:
61	  - RESET exactly when double fault occurs. The excepting
62	    instruction address is stored in RETX, where the next kernel
63	    boot will print it out.
64	  - Print debug message. This is much more error prone, although
65	    easier to handle. It is error prone since:
66	    - The excepting instruction is not committed.
67	    - All writebacks from the instruction are prevented.
68	    - The generated exception is not taken.
69	    - The EXCAUSE field is updated with an unrecoverable event
70	    The only way to check this is to see if EXCAUSE contains the
71	    unrecoverable event value at every exception return. By selecting
72	    this option, you are skipping over the faulting instruction, and
73	    hoping things stay together enough to print out a debug message.
74
75	  This does add a little kernel code, but is the only method to debug
76	  double faults - if unsure say "Y"
77
78choice
79	prompt "Double Fault Failure Method"
80	default DEBUG_DOUBLEFAULT_PRINT
81	depends on DEBUG_DOUBLEFAULT
82
83config DEBUG_DOUBLEFAULT_PRINT
84	bool "Print"
85
86config DEBUG_DOUBLEFAULT_RESET
87	bool "Reset"
88
89endchoice
90
91config DEBUG_HUNT_FOR_ZERO
92	bool "Catch NULL pointer reads/writes"
93	default y
94	help
95	  Say Y here to catch reads/writes to anywhere in the memory range
96	  from 0x0000 - 0x0FFF (the first 4k) of memory.  This is useful in
97	  catching common programming errors such as NULL pointer dereferences.
98
99	  Misbehaving applications will be killed (generate a SEGV) while the
100	  kernel will trigger a panic.
101
102	  Enabling this option will take up an extra entry in CPLB table.
103	  Otherwise, there is no extra overhead.
104
105config DEBUG_BFIN_HWTRACE_ON
106	bool "Turn on Blackfin's Hardware Trace"
107	default y
108	help
109	  All Blackfins include a Trace Unit which stores a history of the last
110	  16 changes in program flow taken by the program sequencer. The history
111	  allows the user to recreate the program sequencer’s recent path. This
112	  can be handy when an application dies - we print out the execution
113	  path of how it got to the offending instruction.
114
115	  By turning this off, you may save a tiny amount of power.
116
117choice
118	prompt "Omit loop Tracing"
119	default DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
120	depends on DEBUG_BFIN_HWTRACE_ON
121	help
122	  The trace buffer can be configured to omit recording of changes in
123	  program flow that match either the last entry or one of the last
124	  two entries. Omitting one of these entries from the record prevents
125	  the trace buffer from overflowing because of any sort of loop (for, do
126	  while, etc) in the program.
127
128	  Because zero-overhead Hardware loops are not recorded in the trace buffer,
129	  this feature can be used to prevent trace overflow from loops that
130	  are nested four deep.
131
132config DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
133	bool "Trace all Loops"
134	help
135	  The trace buffer records all changes of flow
136
137config DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
138	bool "Compress single-level loops"
139	help
140	  The trace buffer does not record single loops - helpful if trace
141	  is spinning on a while or do loop.
142
143config DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
144	bool "Compress two-level loops"
145	help
146	  The trace buffer does not record loops two levels deep. Helpful if
147	  the trace is spinning in a nested loop
148
149endchoice
150
151config DEBUG_BFIN_HWTRACE_COMPRESSION
152	int
153	depends on DEBUG_BFIN_HWTRACE_ON
154	default 0 if DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
155	default 1 if DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
156	default 2 if DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
157
158
159config DEBUG_BFIN_HWTRACE_EXPAND
160	bool "Expand Trace Buffer greater than 16 entries"
161	depends on DEBUG_BFIN_HWTRACE_ON
162	default n
163	help
164	  By selecting this option, every time the 16 hardware entries in
165	  the Blackfin's HW Trace buffer are full, the kernel will move them
166	  into a software buffer, for dumping when there is an issue. This
167	  has a great impact on performance, (an interrupt every 16 change of
168	  flows) and should normally be turned off, except in those nasty
169	  debugging sessions
170
171config DEBUG_BFIN_HWTRACE_EXPAND_LEN
172	int "Size of Trace buffer (in power of 2k)"
173	range 0 4
174	depends on DEBUG_BFIN_HWTRACE_EXPAND
175	default 1
176	help
177	  This sets the size of the software buffer that the trace information
178	  is kept in.
179	  0 for (2^0)  1k, or 256 entries,
180	  1 for (2^1)  2k, or 512 entries,
181	  2 for (2^2)  4k, or 1024 entries,
182	  3 for (2^3)  8k, or 2048 entries,
183	  4 for (2^4) 16k, or 4096 entries
184
185config DEBUG_BFIN_NO_KERN_HWTRACE
186	bool "Turn off hwtrace in CPLB handlers"
187	depends on DEBUG_BFIN_HWTRACE_ON
188	default y
189	help
190	  The CPLB error handler contains a lot of flow changes which can
191	  quickly fill up the hardware trace buffer.  When debugging crashes,
192	  the hardware trace may indicate that the problem lies in kernel
193	  space when in reality an application is buggy.
194
195	  Say Y here to disable hardware tracing in some known "jumpy" pieces
196	  of code so that the trace buffer will extend further back.
197
198config EARLY_PRINTK
199	bool "Early printk"
200	default n
201	select SERIAL_CORE_CONSOLE
202	help
203	  This option enables special console drivers which allow the kernel
204	  to print messages very early in the bootup process.
205
206	  This is useful for kernel debugging when your machine crashes very
207	  early before the console code is initialized. After enabling this
208	  feature, you must add "earlyprintk=serial,uart0,57600" to the
209	  command line (bootargs). It is safe to say Y here in all cases, as
210	  all of this lives in the init section and is thrown away after the
211	  kernel boots completely.
212
213config NMI_WATCHDOG
214	bool "Enable NMI watchdog to help debugging lockup on SMP"
215	default n
216	depends on SMP
217	help
218	  If any CPU in the system does not execute the period local timer
219	  interrupt for more than 5 seconds, then the NMI handler dumps debug
220	  information. This information can be used to debug the lockup.
221
222config CPLB_INFO
223	bool "Display the CPLB information"
224	help
225	  Display the CPLB information via /proc/cplbinfo.
226
227config ACCESS_CHECK
228	bool "Check the user pointer address"
229	default y
230	help
231	  Usually the pointer transfer from user space is checked to see if its
232	  address is in the kernel space.
233
234	  Say N here to disable that check to improve the performance.
235
236config BFIN_ISRAM_SELF_TEST
237	bool "isram boot self tests"
238	default n
239	help
240	  Run some self tests of the isram driver code at boot.
241
242config BFIN_PSEUDODBG_INSNS
243	bool "Support pseudo debug instructions"
244	default n
245	help
246	  This option allows the kernel to emulate some pseudo instructions which
247	  allow simulator test cases to be run under Linux with no changes.
248
249	  Most people should say N here.
250
251config BFIN_PM_WAKEUP_TIME_BENCH
252	bool "Display the total time for kernel to resume from power saving mode"
253	default n
254	help
255	  Display the total time when kernel resumes normal from standby or
256	  suspend to mem mode.
257
258endmenu
259