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

Commit c52f4fa6 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/core: make all info-level messages silent for runtime pm



Removes the need for special handling of messages in init paths.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 16c4f227
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -105,7 +105,7 @@ nouveau_dbgopt(const char *optstr, const char *sub)
				else if (!strncasecmpz(optstr, "warn", len))
				else if (!strncasecmpz(optstr, "warn", len))
					level = NV_DBG_WARN;
					level = NV_DBG_WARN;
				else if (!strncasecmpz(optstr, "info", len))
				else if (!strncasecmpz(optstr, "info", len))
					level = NV_DBG_INFO;
					level = NV_DBG_INFO_NORMAL;
				else if (!strncasecmpz(optstr, "debug", len))
				else if (!strncasecmpz(optstr, "debug", len))
					level = NV_DBG_DEBUG;
					level = NV_DBG_DEBUG;
				else if (!strncasecmpz(optstr, "trace", len))
				else if (!strncasecmpz(optstr, "trace", len))
+25 −20
Original line number Original line Diff line number Diff line
@@ -27,16 +27,38 @@
#include <core/subdev.h>
#include <core/subdev.h>
#include <core/printk.h>
#include <core/printk.h>


int nv_printk_suspend_level = NV_DBG_DEBUG;
int nv_info_debug_level = NV_DBG_INFO_NORMAL;


void
void
nv_printk_(struct nouveau_object *object, const char *pfx, int level,
nv_printk_(struct nouveau_object *object, int level, const char *fmt, ...)
	   const char *fmt, ...)
{
{
	static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' };
	static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' };
	const char *pfx;
	char mfmt[256];
	char mfmt[256];
	va_list args;
	va_list args;


	switch (level) {
	case NV_DBG_FATAL:
		pfx = KERN_CRIT;
		break;
	case NV_DBG_ERROR:
		pfx = KERN_ERR;
		break;
	case NV_DBG_WARN:
		pfx = KERN_WARNING;
		break;
	case NV_DBG_INFO_NORMAL:
		pfx = KERN_INFO;
		break;
	case NV_DBG_DEBUG:
	case NV_DBG_PARANOIA:
	case NV_DBG_TRACE:
	case NV_DBG_SPAM:
	default:
		pfx = KERN_DEBUG;
		break;
	}

	if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
	if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
		struct nouveau_object *device = object;
		struct nouveau_object *device = object;
		struct nouveau_object *subdev = object;
		struct nouveau_object *subdev = object;
@@ -74,20 +96,3 @@ nv_printk_(struct nouveau_object *object, const char *pfx, int level,
	vprintk(mfmt, args);
	vprintk(mfmt, args);
	va_end(args);
	va_end(args);
}
}

#define CONV_LEVEL(x) case NV_DBG_##x: return NV_PRINTK_##x

const char *nv_printk_level_to_pfx(int level)
{
	switch (level) {
	CONV_LEVEL(FATAL);
	CONV_LEVEL(ERROR);
	CONV_LEVEL(WARN);
	CONV_LEVEL(INFO);
	CONV_LEVEL(DEBUG);
	CONV_LEVEL(PARANOIA);
	CONV_LEVEL(TRACE);
	CONV_LEVEL(SPAM);
	}
	return NV_PRINTK_DEBUG;
}
+8 −1
Original line number Original line Diff line number Diff line
#ifndef __NOUVEAU_DEBUG_H__
#ifndef __NOUVEAU_DEBUG_H__
#define __NOUVEAU_DEBUG_H__
#define __NOUVEAU_DEBUG_H__


extern int nv_info_debug_level;

#define NV_DBG_FATAL    0
#define NV_DBG_FATAL    0
#define NV_DBG_ERROR    1
#define NV_DBG_ERROR    1
#define NV_DBG_WARN     2
#define NV_DBG_WARN     2
#define NV_DBG_INFO     3
#define NV_DBG_INFO     nv_info_debug_level
#define NV_DBG_DEBUG    4
#define NV_DBG_DEBUG    4
#define NV_DBG_TRACE    5
#define NV_DBG_TRACE    5
#define NV_DBG_PARANOIA 6
#define NV_DBG_PARANOIA 6
#define NV_DBG_SPAM     7
#define NV_DBG_SPAM     7


#define NV_DBG_INFO_NORMAL 3
#define NV_DBG_INFO_SILENT NV_DBG_DEBUG

#define nv_debug_level(a) nv_info_debug_level = NV_DBG_INFO_##a

#endif
#endif
+4 −26
Original line number Original line Diff line number Diff line
@@ -6,27 +6,12 @@


struct nouveau_object;
struct nouveau_object;


#define NV_PRINTK_FATAL    KERN_CRIT
void __printf(3, 4)
#define NV_PRINTK_ERROR    KERN_ERR
nv_printk_(struct nouveau_object *, int, const char *, ...);
#define NV_PRINTK_WARN     KERN_WARNING
#define NV_PRINTK_INFO     KERN_INFO
#define NV_PRINTK_DEBUG    KERN_DEBUG
#define NV_PRINTK_PARANOIA KERN_DEBUG
#define NV_PRINTK_TRACE    KERN_DEBUG
#define NV_PRINTK_SPAM     KERN_DEBUG

extern int nv_printk_suspend_level;

#define NV_DBG_SUSPEND (nv_printk_suspend_level)
#define NV_PRINTK_SUSPEND  (nv_printk_level_to_pfx(nv_printk_suspend_level))

const char *nv_printk_level_to_pfx(int level);
void __printf(4, 5)
nv_printk_(struct nouveau_object *, const char *, int, const char *, ...);


#define nv_printk(o,l,f,a...) do {                                             \
#define nv_printk(o,l,f,a...) do {                                             \
	if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG)                                \
	if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG)                                \
		nv_printk_(nv_object(o), NV_PRINTK_##l, NV_DBG_##l, f, ##a);   \
		nv_printk_(nv_object(o), NV_DBG_##l, f, ##a);                  \
} while(0)
} while(0)


#define nv_fatal(o,f,a...) nv_printk((o), FATAL, f, ##a)
#define nv_fatal(o,f,a...) nv_printk((o), FATAL, f, ##a)
@@ -37,16 +22,9 @@ nv_printk_(struct nouveau_object *, const char *, int, const char *, ...);
#define nv_trace(o,f,a...) nv_printk((o), TRACE, f, ##a)
#define nv_trace(o,f,a...) nv_printk((o), TRACE, f, ##a)
#define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a)
#define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a)


#define nv_suspend(o,f,a...) nv_printk((o), SUSPEND, f, ##a)

static inline void nv_suspend_set_printk_level(int level)
{
	nv_printk_suspend_level = level;
}

#define nv_assert(f,a...) do {                                                 \
#define nv_assert(f,a...) do {                                                 \
	if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG)                              \
	if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG)                              \
		nv_printk_(NULL, NV_PRINTK_FATAL, NV_DBG_FATAL, f "\n", ##a);  \
		nv_printk_(NULL, NV_DBG_FATAL, f "\n", ##a);                   \
	BUG_ON(1);                                                             \
	BUG_ON(1);                                                             \
} while(0)
} while(0)


+1 −1
Original line number Original line Diff line number Diff line
@@ -2180,7 +2180,7 @@ nvbios_init(struct nouveau_subdev *subdev, bool execute)
	u16 data;
	u16 data;


	if (execute)
	if (execute)
		nv_suspend(bios, "running init tables\n");
		nv_info(bios, "running init tables\n");
	while (!ret && (data = (init_script(bios, ++i)))) {
	while (!ret && (data = (init_script(bios, ++i)))) {
		struct nvbios_init init = {
		struct nvbios_init init = {
			.subdev = subdev,
			.subdev = subdev,
Loading