aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c169
1 files changed, 120 insertions, 49 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0f41d8647376..28781414d71c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -36,6 +36,7 @@
36 36
37#include "amdgpu.h" 37#include "amdgpu.h"
38#include "amdgpu_irq.h" 38#include "amdgpu_irq.h"
39#include "amdgpu_gem.h"
39 40
40#include "amdgpu_amdkfd.h" 41#include "amdgpu_amdkfd.h"
41 42
@@ -113,8 +114,8 @@ uint amdgpu_pg_mask = 0xffffffff;
113uint amdgpu_sdma_phase_quantum = 32; 114uint amdgpu_sdma_phase_quantum = 32;
114char *amdgpu_disable_cu = NULL; 115char *amdgpu_disable_cu = NULL;
115char *amdgpu_virtual_display = NULL; 116char *amdgpu_virtual_display = NULL;
116/* OverDrive(bit 14),gfxoff(bit 15),stutter mode(bit 17) disabled by default*/ 117/* OverDrive(bit 14) disabled by default*/
117uint amdgpu_pp_feature_mask = 0xfffd3fff; 118uint amdgpu_pp_feature_mask = 0xffffbfff;
118int amdgpu_ngg = 0; 119int amdgpu_ngg = 0;
119int amdgpu_prim_buf_per_se = 0; 120int amdgpu_prim_buf_per_se = 0;
120int amdgpu_pos_buf_per_se = 0; 121int amdgpu_pos_buf_per_se = 0;
@@ -126,6 +127,9 @@ int amdgpu_compute_multipipe = -1;
126int amdgpu_gpu_recovery = -1; /* auto */ 127int amdgpu_gpu_recovery = -1; /* auto */
127int amdgpu_emu_mode = 0; 128int amdgpu_emu_mode = 0;
128uint amdgpu_smu_memory_pool_size = 0; 129uint amdgpu_smu_memory_pool_size = 0;
130struct amdgpu_mgpu_info mgpu_info = {
131 .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex),
132};
129 133
130/** 134/**
131 * DOC: vramlimit (int) 135 * DOC: vramlimit (int)
@@ -531,6 +535,102 @@ MODULE_PARM_DESC(smu_memory_pool_size,
531 "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte"); 535 "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
532module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444); 536module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
533 537
538#ifdef CONFIG_HSA_AMD
539/**
540 * DOC: sched_policy (int)
541 * Set scheduling policy. Default is HWS(hardware scheduling) with over-subscription.
542 * Setting 1 disables over-subscription. Setting 2 disables HWS and statically
543 * assigns queues to HQDs.
544 */
545int sched_policy = KFD_SCHED_POLICY_HWS;
546module_param(sched_policy, int, 0444);
547MODULE_PARM_DESC(sched_policy,
548 "Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)");
549
550/**
551 * DOC: hws_max_conc_proc (int)
552 * Maximum number of processes that HWS can schedule concurrently. The maximum is the
553 * number of VMIDs assigned to the HWS, which is also the default.
554 */
555int hws_max_conc_proc = 8;
556module_param(hws_max_conc_proc, int, 0444);
557MODULE_PARM_DESC(hws_max_conc_proc,
558 "Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))");
559
560/**
561 * DOC: cwsr_enable (int)
562 * CWSR(compute wave store and resume) allows the GPU to preempt shader execution in
563 * the middle of a compute wave. Default is 1 to enable this feature. Setting 0
564 * disables it.
565 */
566int cwsr_enable = 1;
567module_param(cwsr_enable, int, 0444);
568MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))");
569
570/**
571 * DOC: max_num_of_queues_per_device (int)
572 * Maximum number of queues per device. Valid setting is between 1 and 4096. Default
573 * is 4096.
574 */
575int max_num_of_queues_per_device = KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT;
576module_param(max_num_of_queues_per_device, int, 0444);
577MODULE_PARM_DESC(max_num_of_queues_per_device,
578 "Maximum number of supported queues per device (1 = Minimum, 4096 = default)");
579
580/**
581 * DOC: send_sigterm (int)
582 * Send sigterm to HSA process on unhandled exceptions. Default is not to send sigterm
583 * but just print errors on dmesg. Setting 1 enables sending sigterm.
584 */
585int send_sigterm;
586module_param(send_sigterm, int, 0444);
587MODULE_PARM_DESC(send_sigterm,
588 "Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)");
589
590/**
591 * DOC: debug_largebar (int)
592 * Set debug_largebar as 1 to enable simulating large-bar capability on non-large bar
593 * system. This limits the VRAM size reported to ROCm applications to the visible
594 * size, usually 256MB.
595 * Default value is 0, diabled.
596 */
597int debug_largebar;
598module_param(debug_largebar, int, 0444);
599MODULE_PARM_DESC(debug_largebar,
600 "Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)");
601
602/**
603 * DOC: ignore_crat (int)
604 * Ignore CRAT table during KFD initialization. By default, KFD uses the ACPI CRAT
605 * table to get information about AMD APUs. This option can serve as a workaround on
606 * systems with a broken CRAT table.
607 */
608int ignore_crat;
609module_param(ignore_crat, int, 0444);
610MODULE_PARM_DESC(ignore_crat,
611 "Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)");
612
613/**
614 * DOC: noretry (int)
615 * This parameter sets sh_mem_config.retry_disable. Default value, 0, enables retry.
616 * Setting 1 disables retry.
617 * Retry is needed for recoverable page faults.
618 */
619int noretry;
620module_param(noretry, int, 0644);
621MODULE_PARM_DESC(noretry,
622 "Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)");
623
624/**
625 * DOC: halt_if_hws_hang (int)
626 * Halt if HWS hang is detected. Default value, 0, disables the halt on hang.
627 * Setting 1 enables halt on hang.
628 */
629int halt_if_hws_hang;
630module_param(halt_if_hws_hang, int, 0644);
631MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)");
632#endif
633
534static const struct pci_device_id pciidlist[] = { 634static const struct pci_device_id pciidlist[] = {
535#ifdef CONFIG_DRM_AMDGPU_SI 635#ifdef CONFIG_DRM_AMDGPU_SI
536 {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI}, 636 {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
@@ -770,14 +870,15 @@ static const struct pci_device_id pciidlist[] = {
770 {0x1002, 0x69A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12}, 870 {0x1002, 0x69A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
771 {0x1002, 0x69AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12}, 871 {0x1002, 0x69AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
772 /* Vega 20 */ 872 /* Vega 20 */
773 {0x1002, 0x66A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20|AMD_EXP_HW_SUPPORT}, 873 {0x1002, 0x66A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
774 {0x1002, 0x66A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20|AMD_EXP_HW_SUPPORT}, 874 {0x1002, 0x66A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
775 {0x1002, 0x66A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20|AMD_EXP_HW_SUPPORT}, 875 {0x1002, 0x66A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
776 {0x1002, 0x66A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20|AMD_EXP_HW_SUPPORT}, 876 {0x1002, 0x66A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
777 {0x1002, 0x66A7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20|AMD_EXP_HW_SUPPORT}, 877 {0x1002, 0x66A7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
778 {0x1002, 0x66AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20|AMD_EXP_HW_SUPPORT}, 878 {0x1002, 0x66AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA20},
779 /* Raven */ 879 /* Raven */
780 {0x1002, 0x15dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU}, 880 {0x1002, 0x15dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU},
881 {0x1002, 0x15d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU},
781 882
782 {0, 0, 0} 883 {0, 0, 0}
783}; 884};
@@ -786,28 +887,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
786 887
787static struct drm_driver kms_driver; 888static struct drm_driver kms_driver;
788 889
789static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev)
790{
791 struct apertures_struct *ap;
792 bool primary = false;
793
794 ap = alloc_apertures(1);
795 if (!ap)
796 return -ENOMEM;
797
798 ap->ranges[0].base = pci_resource_start(pdev, 0);
799 ap->ranges[0].size = pci_resource_len(pdev, 0);
800
801#ifdef CONFIG_X86
802 primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
803#endif
804 drm_fb_helper_remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary);
805 kfree(ap);
806
807 return 0;
808}
809
810
811static int amdgpu_pci_probe(struct pci_dev *pdev, 890static int amdgpu_pci_probe(struct pci_dev *pdev,
812 const struct pci_device_id *ent) 891 const struct pci_device_id *ent)
813{ 892{
@@ -826,30 +905,18 @@ static int amdgpu_pci_probe(struct pci_dev