Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+54 -76
+1 -1
drivers/gpu/drm/nouveau/core/core/option.c
··· 105 105 else if (!strncasecmpz(optstr, "warn", len)) 106 106 level = NV_DBG_WARN; 107 107 else if (!strncasecmpz(optstr, "info", len)) 108 - level = NV_DBG_INFO; 108 + level = NV_DBG_INFO_NORMAL; 109 109 else if (!strncasecmpz(optstr, "debug", len)) 110 110 level = NV_DBG_DEBUG; 111 111 else if (!strncasecmpz(optstr, "trace", len))
+25 -20
drivers/gpu/drm/nouveau/core/core/printk.c
··· 27 27 #include <core/subdev.h> 28 28 #include <core/printk.h> 29 29 30 - int nv_printk_suspend_level = NV_DBG_DEBUG; 30 + int nv_info_debug_level = NV_DBG_INFO_NORMAL; 31 31 32 32 void 33 - nv_printk_(struct nouveau_object *object, const char *pfx, int level, 34 - const char *fmt, ...) 33 + nv_printk_(struct nouveau_object *object, int level, const char *fmt, ...) 35 34 { 36 35 static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' }; 36 + const char *pfx; 37 37 char mfmt[256]; 38 38 va_list args; 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 + } 39 61 40 62 if (object && !nv_iclass(object, NV_CLIENT_CLASS)) { 41 63 struct nouveau_object *device = object; ··· 95 73 va_start(args, fmt); 96 74 vprintk(mfmt, args); 97 75 va_end(args); 98 - } 99 - 100 - #define CONV_LEVEL(x) case NV_DBG_##x: return NV_PRINTK_##x 101 - 102 - const char *nv_printk_level_to_pfx(int level) 103 - { 104 - switch (level) { 105 - CONV_LEVEL(FATAL); 106 - CONV_LEVEL(ERROR); 107 - CONV_LEVEL(WARN); 108 - CONV_LEVEL(INFO); 109 - CONV_LEVEL(DEBUG); 110 - CONV_LEVEL(PARANOIA); 111 - CONV_LEVEL(TRACE); 112 - CONV_LEVEL(SPAM); 113 - } 114 - return NV_PRINTK_DEBUG; 115 76 }
+8 -1
drivers/gpu/drm/nouveau/core/include/core/debug.h
··· 1 1 #ifndef __NOUVEAU_DEBUG_H__ 2 2 #define __NOUVEAU_DEBUG_H__ 3 3 4 + extern int nv_info_debug_level; 5 + 4 6 #define NV_DBG_FATAL 0 5 7 #define NV_DBG_ERROR 1 6 8 #define NV_DBG_WARN 2 7 - #define NV_DBG_INFO 3 9 + #define NV_DBG_INFO nv_info_debug_level 8 10 #define NV_DBG_DEBUG 4 9 11 #define NV_DBG_TRACE 5 10 12 #define NV_DBG_PARANOIA 6 11 13 #define NV_DBG_SPAM 7 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 12 19 13 20 #endif
+4 -26
drivers/gpu/drm/nouveau/core/include/core/printk.h
··· 6 6 7 7 struct nouveau_object; 8 8 9 - #define NV_PRINTK_FATAL KERN_CRIT 10 - #define NV_PRINTK_ERROR KERN_ERR 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 - 18 - extern 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 - 23 - const char *nv_printk_level_to_pfx(int level); 24 - void __printf(4, 5) 25 - nv_printk_(struct nouveau_object *, const char *, int, const char *, ...); 9 + void __printf(3, 4) 10 + nv_printk_(struct nouveau_object *, int, const char *, ...); 26 11 27 12 #define nv_printk(o,l,f,a...) do { \ 28 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 15 } while(0) 31 16 32 17 #define nv_fatal(o,f,a...) nv_printk((o), FATAL, f, ##a) ··· 22 37 #define nv_trace(o,f,a...) nv_printk((o), TRACE, f, ##a) 23 38 #define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a) 24 39 25 - #define nv_suspend(o,f,a...) nv_printk((o), SUSPEND, f, ##a) 26 - 27 - static inline void nv_suspend_set_printk_level(int level) 28 - { 29 - nv_printk_suspend_level = level; 30 - } 31 - 32 40 #define nv_assert(f,a...) do { \ 33 41 if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG) \ 34 - nv_printk_(NULL, NV_PRINTK_FATAL, NV_DBG_FATAL, f "\n", ##a); \ 42 + nv_printk_(NULL, NV_DBG_FATAL, f "\n", ##a); \ 35 43 BUG_ON(1); \ 36 44 } while(0) 37 45
+1 -1
drivers/gpu/drm/nouveau/core/subdev/bios/init.c
··· 2180 2180 u16 data; 2181 2181 2182 2182 if (execute) 2183 - nv_suspend(bios, "running init tables\n"); 2183 + nv_info(bios, "running init tables\n"); 2184 2184 while (!ret && (data = (init_script(bios, ++i)))) { 2185 2185 struct nvbios_init init = { 2186 2186 .subdev = subdev,
+1 -1
drivers/gpu/drm/nouveau/nouveau_display.c
··· 457 457 458 458 nouveau_display_fini(dev); 459 459 460 - NV_SUSPEND(drm, "unpinning framebuffer(s)...\n"); 460 + NV_INFO(drm, "unpinning framebuffer(s)...\n"); 461 461 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 462 462 struct nouveau_framebuffer *nouveau_fb; 463 463
+14 -25
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 462 462 int ret; 463 463 464 464 if (dev->mode_config.num_crtc) { 465 - NV_SUSPEND(drm, "suspending display...\n"); 465 + NV_INFO(drm, "suspending display...\n"); 466 466 ret = nouveau_display_suspend(dev); 467 467 if (ret) 468 468 return ret; 469 469 } 470 470 471 - NV_SUSPEND(drm, "evicting buffers...\n"); 471 + NV_INFO(drm, "evicting buffers...\n"); 472 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 475 if (drm->cechan) { 476 476 ret = nouveau_channel_idle(drm->cechan); 477 477 if (ret) ··· 484 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 488 if (drm->fence && nouveau_fence(drm)->suspend) { 489 489 if (!nouveau_fence(drm)->suspend(drm)) 490 490 return -ENOMEM; ··· 496 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 500 ret = nouveau_client_fini(&drm->client.base, true); 501 501 if (ret) 502 502 goto fail_client; ··· 510 510 } 511 511 512 512 if (dev->mode_config.num_crtc) { 513 - NV_SUSPEND(drm, "resuming display...\n"); 513 + NV_INFO(drm, "resuming display...\n"); 514 514 nouveau_display_resume(dev); 515 515 } 516 516 return ret; ··· 529 529 if (drm_dev->mode_config.num_crtc) 530 530 nouveau_fbcon_set_suspend(drm_dev, 1); 531 531 532 - nv_suspend_set_printk_level(NV_DBG_INFO); 533 532 ret = nouveau_do_suspend(drm_dev); 534 533 if (ret) 535 534 return ret; ··· 536 537 pci_save_state(pdev); 537 538 pci_disable_device(pdev); 538 539 pci_set_power_state(pdev, PCI_D3hot); 539 - nv_suspend_set_printk_level(NV_DBG_DEBUG); 540 - 541 540 return 0; 542 541 } 543 542 ··· 545 548 struct nouveau_drm *drm = nouveau_drm(dev); 546 549 struct nouveau_cli *cli; 547 550 548 - NV_SUSPEND(drm, "re-enabling device...\n"); 551 + NV_INFO(drm, "re-enabling device...\n"); 549 552 550 553 nouveau_agp_reset(drm); 551 554 552 - NV_SUSPEND(drm, "resuming kernel object tree...\n"); 555 + NV_INFO(drm, "resuming kernel object tree...\n"); 553 556 nouveau_client_init(&drm->client.base); 554 557 nouveau_agp_init(drm); 555 558 556 - NV_SUSPEND(drm, "resuming client object trees...\n"); 559 + NV_INFO(drm, "resuming client object trees...\n"); 557 560 if (drm->fence && nouveau_fence(drm)->resume) 558 561 nouveau_fence(drm)->resume(drm); 559 562 ··· 565 568 nouveau_pm_resume(dev); 566 569 567 570 if (dev->mode_config.num_crtc) { 568 - NV_SUSPEND(drm, "resuming display...\n"); 571 + NV_INFO(drm, "resuming display...\n"); 569 572 nouveau_display_repin(dev); 570 573 } 571 574 ··· 589 592 return ret; 590 593 pci_set_master(pdev); 591 594 592 - nv_suspend_set_printk_level(NV_DBG_INFO); 593 595 ret = nouveau_do_resume(drm_dev); 594 - if (ret) { 595 - nv_suspend_set_printk_level(NV_DBG_DEBUG); 596 + if (ret) 596 597 return ret; 597 - } 598 598 if (drm_dev->mode_config.num_crtc) 599 599 nouveau_fbcon_set_suspend(drm_dev, 0); 600 600 601 601 nouveau_fbcon_zfill_all(drm_dev); 602 602 if (drm_dev->mode_config.num_crtc) 603 603 nouveau_display_resume(drm_dev); 604 - nv_suspend_set_printk_level(NV_DBG_DEBUG); 605 604 return 0; 606 605 } 607 606 ··· 607 614 struct drm_device *drm_dev = pci_get_drvdata(pdev); 608 615 int ret; 609 616 610 - nv_suspend_set_printk_level(NV_DBG_INFO); 611 617 if (drm_dev->mode_config.num_crtc) 612 618 nouveau_fbcon_set_suspend(drm_dev, 1); 613 619 614 620 ret = nouveau_do_suspend(drm_dev); 615 - nv_suspend_set_printk_level(NV_DBG_DEBUG); 616 621 return ret; 617 622 } 618 623 ··· 620 629 struct drm_device *drm_dev = pci_get_drvdata(pdev); 621 630 int ret; 622 631 623 - nv_suspend_set_printk_level(NV_DBG_INFO); 624 632 ret = nouveau_do_resume(drm_dev); 625 - if (ret) { 626 - nv_suspend_set_printk_level(NV_DBG_DEBUG); 633 + if (ret) 627 634 return ret; 628 - } 629 635 if (drm_dev->mode_config.num_crtc) 630 636 nouveau_fbcon_set_suspend(drm_dev, 0); 631 637 nouveau_fbcon_zfill_all(drm_dev); 632 638 if (drm_dev->mode_config.num_crtc) 633 639 nouveau_display_resume(drm_dev); 634 - nv_suspend_set_printk_level(NV_DBG_DEBUG); 635 640 return 0; 636 641 } 637 642 ··· 831 844 if (nouveau_runtime_pm == 0) 832 845 return -EINVAL; 833 846 847 + nv_debug_level(SILENT); 834 848 drm_kms_helper_poll_disable(drm_dev); 835 849 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF); 836 850 nouveau_switcheroo_optimus_dsm(); ··· 868 880 nv_mask(device, 0x88488, (1 << 25), (1 << 25)); 869 881 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON); 870 882 drm_dev->switch_power_state = DRM_SWITCH_POWER_ON; 883 + nv_debug_level(NORMAL); 871 884 return ret; 872 885 } 873 886
-1
drivers/gpu/drm/nouveau/nouveau_drm.h
··· 153 153 int nouveau_pmops_suspend(struct device *); 154 154 int nouveau_pmops_resume(struct device *); 155 155 156 - #define NV_SUSPEND(cli, fmt, args...) nv_suspend((cli), fmt, ##args) 157 156 #define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args) 158 157 #define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args) 159 158 #define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args)