aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-11-07 23:38:40 -0500
committerBen Skeggs <bskeggs@redhat.com>2013-11-08 00:39:59 -0500
commitc52f4fa61d7504bacd94fd54f43fd0b5bdf74bbc (patch)
tree82c87ed81bfdac79b6d50e5c12e8c3865f1dbe9e
parent16c4f227ffc556a4851518092e2b5979da1280c1 (diff)
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: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/core/core/option.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/core/printk.c45
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/debug.h9
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/printk.h30
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c39
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.h1
8 files changed, 54 insertions, 76 deletions
diff --git a/drivers/gpu/drm/nouveau/core/core/option.c b/drivers/gpu/drm/nouveau/core/core/option.c
index 62a432ea39e5..d42e72a87651 100644
--- a/drivers/gpu/drm/nouveau/core/core/option.c
+++ b/drivers/gpu/drm/nouveau/core/core/option.c
@@ -105,7 +105,7 @@ nouveau_dbgopt(const char *optstr, const char *sub)
105 else if (!strncasecmpz(optstr, "warn", len)) 105 else if (!strncasecmpz(optstr, "warn", len))
106 level = NV_DBG_WARN; 106 level = NV_DBG_WARN;
107 else if (!strncasecmpz(optstr, "info", len)) 107 else if (!strncasecmpz(optstr, "info", len))
108 level = NV_DBG_INFO; 108 level = NV_DBG_INFO_NORMAL;
109 else if (!strncasecmpz(optstr, "debug", len)) 109 else if (!strncasecmpz(optstr, "debug", len))
110 level = NV_DBG_DEBUG; 110 level = NV_DBG_DEBUG;
111 else if (!strncasecmpz(optstr, "trace", len)) 111 else if (!strncasecmpz(optstr, "trace", len))
diff --git a/drivers/gpu/drm/nouveau/core/core/printk.c b/drivers/gpu/drm/nouveau/core/core/printk.c
index 52fb2aa129e8..03e0060b13da 100644
--- a/drivers/gpu/drm/nouveau/core/core/printk.c
+++ b/drivers/gpu/drm/nouveau/core/core/printk.c
@@ -27,16 +27,38 @@
27#include <core/subdev.h> 27#include <core/subdev.h>
28#include <core/printk.h> 28#include <core/printk.h>
29 29
30int nv_printk_suspend_level = NV_DBG_DEBUG; 30int nv_info_debug_level = NV_DBG_INFO_NORMAL;
31 31
32void 32void
33nv_printk_(struct nouveau_object *object, const char *pfx, int level, 33nv_printk_(struct nouveau_object *object, int level, const char *fmt, ...)
34 const char *fmt, ...)
35{ 34{
36 static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' }; 35 static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' };
36 const char *pfx;
37 char mfmt[256]; 37 char mfmt[256];
38 va_list args; 38 va_list args;
39 39
40 switch (level) {
41 case NV_DBG_FATAL:
42 pfx = KERN_CRIT;
43 break;
44 case NV_DBG_ERROR:
45 pfx = KERN_ERR;
46 break;
47 case NV_DBG_WARN:
48 pfx = KERN_WARNING;
49 break;
50 case NV_DBG_INFO_NORMAL:
51 pfx = KERN_INFO;
52 break;
53 case NV_DBG_DEBUG:
54 case NV_DBG_PARANOIA:
55 case NV_DBG_TRACE:
56 case NV_DBG_SPAM:
57 default:
58 pfx = KERN_DEBUG;
59 break;
60 }
61
40 if (object && !nv_iclass(object, NV_CLIENT_CLASS)) { 62 if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
41 struct nouveau_object *device = object; 63 struct nouveau_object *device = object;
42 struct nouveau_object *subdev = object; 64 struct nouveau_object *subdev = object;
@@ -74,20 +96,3 @@ nv_printk_(struct nouveau_object *object, const char *pfx, int level,
74 vprintk(mfmt, args); 96 vprintk(mfmt, args);
75 va_end(args); 97 va_end(args);
76} 98}
77
78#define CONV_LEVEL(x) case NV_DBG_##x: return NV_PRINTK_##x
79
80const char *nv_printk_level_to_pfx(int level)
81{
82 switch (level) {
83 CONV_LEVEL(FATAL);
84 CONV_LEVEL(ERROR);
85 CONV_LEVEL(WARN);
86 CONV_LEVEL(INFO);
87 CONV_LEVEL(DEBUG);
88 CONV_LEVEL(PARANOIA);
89 CONV_LEVEL(TRACE);
90 CONV_LEVEL(SPAM);
91 }
92 return NV_PRINTK_DEBUG;
93}
diff --git a/drivers/gpu/drm/nouveau/core/include/core/debug.h b/drivers/gpu/drm/nouveau/core/include/core/debug.h
index 9ea18dfcb4d0..8092e2e90323 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/debug.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/debug.h
@@ -1,13 +1,20 @@
1#ifndef __NOUVEAU_DEBUG_H__ 1#ifndef __NOUVEAU_DEBUG_H__
2#define __NOUVEAU_DEBUG_H__ 2#define __NOUVEAU_DEBUG_H__
3 3
4extern int nv_info_debug_level;
5
4#define NV_DBG_FATAL 0 6#define NV_DBG_FATAL 0
5#define NV_DBG_ERROR 1 7#define NV_DBG_ERROR 1
6#define NV_DBG_WARN 2 8#define NV_DBG_WARN 2
7#define NV_DBG_INFO 3 9#define NV_DBG_INFO nv_info_debug_level
8#define NV_DBG_DEBUG 4 10#define NV_DBG_DEBUG 4
9#define NV_DBG_TRACE 5 11#define NV_DBG_TRACE 5
10#define NV_DBG_PARANOIA 6 12#define NV_DBG_PARANOIA 6
11#define NV_DBG_SPAM 7 13#define NV_DBG_SPAM 7
12 14
15#define NV_DBG_INFO_NORMAL 3
16#define NV_DBG_INFO_SILENT NV_DBG_DEBUG
17
18#define nv_debug_level(a) nv_info_debug_level = NV_DBG_INFO_##a
19
13#endif 20#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/core/printk.h b/drivers/gpu/drm/nouveau/core/include/core/printk.h
index d87836e3a704..0f9a37bd32b0 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/printk.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/printk.h
@@ -6,27 +6,12 @@
6 6
7struct nouveau_object; 7struct nouveau_object;
8 8
9#define NV_PRINTK_FATAL KERN_CRIT 9void __printf(3, 4)
10#define NV_PRINTK_ERROR KERN_ERR 10nv_printk_(struct nouveau_object *, int, const char *, ...);
11#define NV_PRINTK_WARN KERN_WARNING
12#define NV_PRINTK_INFO KERN_INFO
13#define NV_PRINTK_DEBUG KERN_DEBUG
14#define NV_PRINTK_PARANOIA KERN_DEBUG
15#define NV_PRINTK_TRACE KERN_DEBUG
16#define NV_PRINTK_SPAM KERN_DEBUG
17
18extern int nv_printk_suspend_level;
19
20#define NV_DBG_SUSPEND (nv_printk_suspend_level)
21#define NV_PRINTK_SUSPEND (nv_printk_level_to_pfx(nv_printk_suspend_level))
22
23const char *nv_printk_level_to_pfx(int level);
24void __printf(4, 5)
25nv_printk_(struct nouveau_object *, const char *, int, const char *, ...);
26 11
27#define nv_printk(o,l,f,a...) do { \ 12#define nv_printk(o,l,f,a...) do { \
28 if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG) \ 13 if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG) \
29 nv_printk_(nv_object(o), NV_PRINTK_##l, NV_DBG_##l, f, ##a); \ 14 nv_printk_(nv_object(o), NV_DBG_##l, f, ##a); \
30} while(0) 15} while(0)
31 16
32#define nv_fatal(o,f,a...) nv_printk((o), FATAL, f, ##a) 17#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 *, ...);
37#define nv_trace(o,f,a...) nv_printk((o), TRACE, f, ##a) 22#define nv_trace(o,f,a...) nv_printk((o), TRACE, f, ##a)
38#define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a) 23#define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a)
39 24
40#define nv_suspend(o,f,a...) nv_printk((o), SUSPEND, f, ##a)
41
42static inline void nv_suspend_set_printk_level(int level)
43{
44 nv_printk_suspend_level = level;
45}
46
47#define nv_assert(f,a...) do { \ 25#define nv_assert(f,a...) do { \
48 if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG) \ 26 if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG) \
49 nv_printk_(NULL, NV_PRINTK_FATAL, NV_DBG_FATAL, f "\n", ##a); \ 27 nv_printk_(NULL, NV_DBG_FATAL, f "\n", ##a); \
50 BUG_ON(1); \ 28 BUG_ON(1); \
51} while(0) 29} while(0)
52 30
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index 92f1411e4f52..420908cb82b6 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -2180,7 +2180,7 @@ nvbios_init(struct nouveau_subdev *subdev, bool execute)
2180 u16 data; 2180 u16 data;
2181 2181
2182 if (execute) 2182 if (execute)
2183 nv_suspend(bios, "running init tables\n"); 2183 nv_info(bios, "running init tables\n");
2184 while (!ret && (data = (init_script(bios, ++i)))) { 2184 while (!ret && (data = (init_script(bios, ++i)))) {
2185 struct nvbios_init init = { 2185 struct nvbios_init init = {
2186 .subdev = subdev, 2186 .subdev = subdev,
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 510d13ee1a04..44642d9094e6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -457,7 +457,7 @@ nouveau_display_suspend(struct drm_device *dev)
457 457
458 nouveau_display_fini(dev); 458 nouveau_display_fini(dev);
459 459
460 NV_SUSPEND(drm, "unpinning framebuffer(s)...\n"); 460 NV_INFO(drm, "unpinning framebuffer(s)...\n");
461 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 461 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
462 struct nouveau_framebuffer *nouveau_fb; 462 struct nouveau_framebuffer *nouveau_fb;
463 463
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index c0a79c715827..265e77ccab1c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -462,16 +462,16 @@ nouveau_do_suspend(struct drm_device *dev)
462 int ret; 462 int ret;
463 463
464 if (dev->mode_config.num_crtc) { 464 if (dev->mode_config.num_crtc) {
465 NV_SUSPEND(drm, "suspending display...\n"); 465 NV_INFO(drm, "suspending display...\n");
466 ret = nouveau_display_suspend(dev); 466 ret = nouveau_display_suspend(dev);
467 if (ret) 467 if (ret)
468 return ret; 468 return ret;
469 } 469 }
470 470
471 NV_SUSPEND(drm, "evicting buffers...\n"); 471 NV_INFO(drm, "evicting buffers...\n");
472 ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); 472 ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM);
473 473
474 NV_SUSPEND(drm, "waiting for kernel channels to go idle...\n"); 474 NV_INFO(drm, "waiting for kernel channels to go idle...\n");
475 if (drm->cechan) { 475 if (drm->cechan) {
476 ret = nouveau_channel_idle(drm->cechan); 476 ret = nouveau_channel_idle(drm->cechan);
477 if (ret) 477 if (ret)
@@ -484,7 +484,7 @@ nouveau_do_suspend(struct drm_device *dev)
484 return ret; 484 return ret;
485 } 485 }
486 486
487 NV_SUSPEND(drm, "suspending client object trees...\n"); 487 NV_INFO(drm, "suspending client object trees...\n");
488 if (drm->fence && nouveau_fence(drm)->suspend) { 488 if (drm->fence && nouveau_fence(drm)->suspend) {
489 if (!nouveau_fence(drm)->suspend(drm)) 489 if (!nouveau_fence(drm)->suspend(drm))
490 return -ENOMEM; 490 return -ENOMEM;
@@ -496,7 +496,7 @@ nouveau_do_suspend(struct drm_device *dev)
496 goto fail_client; 496 goto fail_client;
497 } 497 }
498 498
499 NV_SUSPEND(drm, "suspending kernel object tree...\n"); 499 NV_INFO(drm, "suspending kernel object tree...\n");
500 ret = nouveau_client_fini(&drm->client.base, true); 500 ret = nouveau_client_fini(&drm->client.base, true);
501 if (ret) 501 if (ret)
502 goto fail_client; 502 goto fail_client;
@@ -510,7 +510,7 @@ fail_client:
510 } 510 }
511 511
512 if (dev->mode_config.num_crtc) { 512 if (dev->mode_config.num_crtc) {
513 NV_SUSPEND(drm, "resuming display...\n"); 513 NV_INFO(drm, "resuming display...\n");
514 nouveau_display_resume(dev); 514 nouveau_display_resume(dev);
515 } 515 }
516 return ret; 516 return ret;
@@ -529,7 +529,6 @@ int nouveau_pmops_suspend(struct device *dev)
529 if (drm_dev->mode_config.num_crtc) 529 if (drm_dev->mode_config.num_crtc)
530 nouveau_fbcon_set_suspend(drm_dev, 1); 530 nouveau_fbcon_set_suspend(drm_dev, 1);
531 531
532 nv_suspend_set_printk_level(NV_DBG_INFO);
533 ret = nouveau_do_suspend(drm_dev); 532 ret = nouveau_do_suspend(drm_dev);
534 if (ret) 533 if (ret)
535 return ret; 534 return ret;
@@ -537,8 +536,6 @@ int nouveau_pmops_suspend(struct device *dev)
537 pci_save_state(pdev); 536 pci_save_state(pdev);
538 pci_disable_device(pdev); 537 pci_disable_device(pdev);
539 pci_set_power_state(pdev, PCI_D3hot); 538 pci_set_power_state(pdev, PCI_D3hot);
540 nv_suspend_set_printk_level(NV_DBG_DEBUG);
541
542 return 0; 539 return 0;
543} 540}
544 541
@@ -548,15 +545,15 @@ nouveau_do_resume(struct drm_device *dev)
548 struct nouveau_drm *drm = nouveau_drm(dev); 545 struct nouveau_drm *drm = nouveau_drm(dev);
549 struct nouveau_cli *cli; 546 struct nouveau_cli *cli;
550 547
551 NV_SUSPEND(drm, "re-enabling device...\n"); 548 NV_INFO(drm, "re-enabling device...\n");
552 549
553 nouveau_agp_reset(drm); 550 nouveau_agp_reset(drm);
554 551
555 NV_SUSPEND(drm, "resuming kernel object tree...\n"); 552 NV_INFO(drm, "resuming kernel object tree...\n");
556 nouveau_client_init(&drm->client.base); 553 nouveau_client_init(&drm->client.base);
557 nouveau_agp_init(drm); 554 nouveau_agp_init(drm);
558 555
559 NV_SUSPEND(drm, "resuming client object trees...\n"); 556 NV_INFO(drm, "resuming client object trees...\n");
560 if (drm->fence && nouveau_fence(drm)->resume) 557 if (drm->fence && nouveau_fence(drm)->resume)
561 nouveau_fence(drm)->resume(drm); 558 nouveau_fence(drm)->resume(drm);
562 559
@@ -568,7 +565,7 @@ nouveau_do_resume(struct drm_device *dev)
568 nouveau_pm_resume(dev); 565 nouveau_pm_resume(dev);
569 566
570 if (dev->mode_config.num_crtc) { 567 if (dev->mode_config.num_crtc) {
571 NV_SUSPEND(drm, "resuming display...\n"); 568 NV_INFO(drm, "resuming display...\n");
572 nouveau_display_repin(dev); 569 nouveau_display_repin(dev);
573 } 570 }
574 571
@@ -592,19 +589,15 @@ int nouveau_pmops_resume(struct device *dev)
592 return ret; 589 return ret;
593 pci_set_master(pdev); 590 pci_set_master(pdev);
594 591
595 nv_suspend_set_printk_level(NV_DBG_INFO);
596 ret = nouveau_do_resume(drm_dev); 592 ret = nouveau_do_resume(drm_dev);
597 if (ret) { 593 if (ret)
598 nv_suspend_set_printk_level(NV_DBG_DEBUG);
599 return ret; 594 return ret;
600 }
601 if (drm_dev->mode_config.num_crtc) 595 if (drm_dev->mode_config.num_crtc)
602 nouveau_fbcon_set_suspend(drm_dev, 0); 596 nouveau_fbcon_set_suspend(drm_dev, 0);
603 597
604 nouveau_fbcon_zfill_all(drm_dev); 598 nouveau_fbcon_zfill_all(drm_dev);
605 if (drm_dev->mode_config.num_crtc) 599 if (drm_dev->mode_config.num_crtc)
606 nouveau_display_resume(drm_dev); 600 nouveau_display_resume(drm_dev);
607 nv_suspend_set_printk_level(NV_DBG_DEBUG);
608 return 0; 601 return 0;
609} 602}
610 603
@@ -614,12 +607,10 @@ static int nouveau_pmops_freeze(struct device *dev)
614 struct drm_device *drm_dev = pci_get_drvdata(pdev); 607 struct drm_device *drm_dev = pci_get_drvdata(pdev);
615 int ret; 608 int ret;
616 609
617 nv_suspend_set_printk_level(NV_DBG_INFO);
618 if (drm_dev->mode_config.num_crtc) 610 if (drm_dev->mode_config.num_crtc)
619 nouveau_fbcon_set_suspend(drm_dev, 1); 611 nouveau_fbcon_set_suspend(drm_dev, 1);
620 612
621 ret = nouveau_do_suspend(drm_dev); 613 ret = nouveau_do_suspend(drm_dev);
622 nv_suspend_set_printk_level(NV_DBG_DEBUG);
623 return ret; 614 return ret;
624} 615}
625 616
@@ -629,18 +620,14 @@ static int nouveau_pmops_thaw(struct device *dev)
629 struct drm_device *drm_dev = pci_get_drvdata(pdev); 620 struct drm_device *drm_dev = pci_get_drvdata(pdev);
630 int ret; 621 int ret;
631 622
632 nv_suspend_set_printk_level(NV_DBG_INFO);
633 ret = nouveau_do_resume(drm_dev); 623 ret = nouveau_do_resume(drm_dev);
634 if (ret) { 624 if (ret)
635 nv_suspend_set_printk_level(NV_DBG_DEBUG);
636 return ret; 625 return ret;
637 }
638 if (drm_dev->mode_config.num_crtc) 626 if (drm_dev->mode_config.num_crtc)
639 nouveau_fbcon_set_suspend(drm_dev, 0); 627 nouveau_fbcon_set_suspend(drm_dev, 0);
640 nouveau_fbcon_zfill_all(drm_dev); 628 nouveau_fbcon_zfill_all(drm_dev);
641 if (drm_dev->mode_config.num_crtc) 629 if (drm_dev->mode_config.num_crtc)
642 nouveau_display_resume(drm_dev); 630 nouveau_display_resume(drm_dev);
643 nv_suspend_set_printk_level(NV_DBG_DEBUG);
644 return 0; 631 return 0;
645} 632}
646 633
@@ -844,6 +831,7 @@ static int nouveau_pmops_runtime_suspend(struct device *dev)
844 if (nouveau_runtime_pm == 0) 831 if (nouveau_runtime_pm == 0)
845 return -EINVAL; 832 return -EINVAL;
846 833
834 nv_debug_level(SILENT);
847 drm_kms_helper_poll_disable(drm_dev); 835 drm_kms_helper_poll_disable(drm_dev);
848 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF); 836 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
849 nouveau_switcheroo_optimus_dsm(); 837 nouveau_switcheroo_optimus_dsm();
@@ -880,6 +868,7 @@ static int nouveau_pmops_runtime_resume(struct device *dev)
880 nv_mask(device, 0x88488, (1 << 25), (1 << 25)); 868 nv_mask(device, 0x88488, (1 << 25), (1 << 25));
881 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON); 869 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON);
882 drm_dev->switch_power_state = DRM_SWITCH_POWER_ON; 870 drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
871 nv_debug_level(NORMAL);
883 return ret; 872 return ret;
884} 873}
885 874
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h
index 910448f2b851..f148fc617a9c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.h
@@ -153,7 +153,6 @@ nouveau_dev(struct drm_device *dev)
153int nouveau_pmops_suspend(struct device *); 153int nouveau_pmops_suspend(struct device *);
154int nouveau_pmops_resume(struct device *); 154int nouveau_pmops_resume(struct device *);
155 155
156#define NV_SUSPEND(cli, fmt, args...) nv_suspend((cli), fmt, ##args)
157#define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args) 156#define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args)
158#define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args) 157#define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args)
159#define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args) 158#define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args)