Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2be0527 authored by Ben Hutchings's avatar Ben Hutchings Committed by David Woodhouse
Browse files

panic: Allow warnings to set different taint flags



WARN() is used in some places to report firmware or hardware bugs that
are then worked-around.  These bugs do not affect the stability of the
kernel and should not set the flag for TAINT_WARN.  To allow for this,
add WARN_TAINT() and WARN_TAINT_ONCE() macros that take a taint number
as argument.

Architectures that implement warnings using trap instructions instead
of calls to warn_slowpath_*() now implement __WARN_TAINT(taint)
instead of __WARN().

Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Acked-by: default avatarHelge Deller <deller@gmx.de>
Tested-by: default avatarPaul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 8954da1f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -256,6 +256,7 @@ characters, each representing a particular tainted value.
  9: 'A' if the ACPI table has been overridden.

 10: 'W' if a warning has previously been issued by the kernel.
     (Though some warnings may set more specific taint flags.)

 11: 'C' if a staging driver has been loaded.

+4 −4
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@
#endif

#ifdef CONFIG_DEBUG_BUGVERBOSE
#define __WARN()							\
#define __WARN_TAINT(taint)						\
	do {								\
		asm volatile("\n"					\
			     "1:\t" PARISC_BUG_BREAK_ASM "\n"		\
@@ -54,11 +54,11 @@
			     "\t.org 2b+%c3\n"				\
			     "\t.popsection"				\
			     : : "i" (__FILE__), "i" (__LINE__),	\
			     "i" (BUGFLAG_WARNING),			\
			     "i" (BUGFLAG_TAINT(taint)), 		\
			     "i" (sizeof(struct bug_entry)) );		\
	} while(0)
#else
#define __WARN()							\
#define __WARN_TAINT(taint)						\
	do {								\
		asm volatile("\n"					\
			     "1:\t" PARISC_BUG_BREAK_ASM "\n"		\
@@ -67,7 +67,7 @@
			     "\t.short %c0\n"				\
			     "\t.org 2b+%c1\n"				\
			     "\t.popsection"				\
			     : : "i" (BUGFLAG_WARNING),			\
			     : : "i" (BUGFLAG_TAINT(taint)),		\
			     "i" (sizeof(struct bug_entry)) );		\
	} while(0)
#endif
+3 −3
Original line number Diff line number Diff line
@@ -85,12 +85,12 @@
	}							\
} while (0)

#define __WARN() do {						\
#define __WARN_TAINT(taint) do {				\
	__asm__ __volatile__(					\
		"1:	twi 31,0,0\n"				\
		_EMIT_BUG_ENTRY					\
		: : "i" (__FILE__), "i" (__LINE__),		\
		  "i" (BUGFLAG_WARNING),			\
		  "i" (BUGFLAG_TAINT(taint)),			\
		  "i" (sizeof(struct bug_entry)));		\
} while (0)

@@ -104,7 +104,7 @@
		"1:	"PPC_TLNEI"	%4,0\n"			\
		_EMIT_BUG_ENTRY					\
		: : "i" (__FILE__), "i" (__LINE__),		\
		  "i" (BUGFLAG_WARNING),			\
		  "i" (BUGFLAG_TAINT(TAINT_WARN)),		\
		  "i" (sizeof(struct bug_entry)),		\
		  "r" (__ret_warn_on));				\
	}							\
+4 −4
Original line number Diff line number Diff line
@@ -46,18 +46,18 @@
	unreachable();					\
} while (0)

#define __WARN() do {					\
	__EMIT_BUG(BUGFLAG_WARNING);			\
#define __WARN_TAINT(taint) do {			\
	__EMIT_BUG(BUGFLAG_TAINT(taint));		\
} while (0)

#define WARN_ON(x) ({					\
	int __ret_warn_on = !!(x);			\
	if (__builtin_constant_p(__ret_warn_on)) {	\
		if (__ret_warn_on)			\
			__EMIT_BUG(BUGFLAG_WARNING);	\
			__WARN();			\
	} else {					\
		if (unlikely(__ret_warn_on))		\
			__EMIT_BUG(BUGFLAG_WARNING);	\
			__WARN();			\
	}						\
	unlikely(__ret_warn_on);			\
})
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ do { \
		   "i" (sizeof(struct bug_entry)));	\
} while (0)

#define __WARN()					\
#define __WARN_TAINT(taint)				\
do {							\
	__asm__ __volatile__ (				\
		"1:\t.short %O0\n"			\
@@ -57,7 +57,7 @@ do { \
		 : "n" (TRAPA_BUG_OPCODE),		\
		   "i" (__FILE__),			\
		   "i" (__LINE__),			\
		   "i" (BUGFLAG_WARNING),		\
		   "i" (BUGFLAG_TAINT(taint)),		\
		   "i" (sizeof(struct bug_entry)));	\
} while (0)

Loading