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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Merge debug module parameters

Merge all developer debug options available as separated module
parameters in one, making it obvious that are for developers.

Drop the obsolete module options in favor of the new ones.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

André Almeida and committed by
Alex Deucher
887db1e4 a10ea0ff

+45 -25
+4
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1098 1098 bool dc_enabled; 1099 1099 /* Mask of active clusters */ 1100 1100 uint32_t aid_mask; 1101 + 1102 + /* Debug */ 1103 + bool debug_vm; 1104 + bool debug_largebar; 1101 1105 }; 1102 1106 1103 1107 static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
··· 1151 1151 job->vm_pd_addr = amdgpu_gmc_pd_addr(vm->root.bo); 1152 1152 } 1153 1153 1154 - if (amdgpu_vm_debug) { 1154 + if (adev->debug_vm) { 1155 1155 /* Invalidate all BOs to test for userspace bugs */ 1156 1156 amdgpu_bo_list_for_each_entry(e, p->bo_list) { 1157 1157 struct amdgpu_bo *bo = e->bo;
+36 -20
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 118 118 #define KMS_DRIVER_MINOR 54 119 119 #define KMS_DRIVER_PATCHLEVEL 0 120 120 121 + /* 122 + * amdgpu.debug module options. Are all disabled by default 123 + */ 124 + enum AMDGPU_DEBUG_MASK { 125 + AMDGPU_DEBUG_VM = BIT(0), 126 + AMDGPU_DEBUG_LARGEBAR = BIT(1), 127 + }; 128 + 121 129 unsigned int amdgpu_vram_limit = UINT_MAX; 122 130 int amdgpu_vis_vram_limit; 123 131 int amdgpu_gart_size = -1; /* auto */ ··· 148 140 int amdgpu_vm_fragment_size = -1; 149 141 int amdgpu_vm_block_size = -1; 150 142 int amdgpu_vm_fault_stop; 151 - int amdgpu_vm_debug; 152 143 int amdgpu_vm_update_mode = -1; 153 144 int amdgpu_exp_hw_support; 154 145 int amdgpu_dc = -1; ··· 202 195 int amdgpu_sg_display = -1; /* auto */ 203 196 int amdgpu_user_partt_mode = AMDGPU_AUTO_COMPUTE_PARTITION_MODE; 204 197 int amdgpu_umsch_mm; 198 + uint amdgpu_debug_mask; 205 199 206 200 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); 207 201 ··· 413 405 */ 414 406 MODULE_PARM_DESC(vm_fault_stop, "Stop on VM fault (0 = never (default), 1 = print first, 2 = always)"); 415 407 module_param_named(vm_fault_stop, amdgpu_vm_fault_stop, int, 0444); 416 - 417 - /** 418 - * DOC: vm_debug (int) 419 - * Debug VM handling (0 = disabled, 1 = enabled). The default is 0 (Disabled). 420 - */ 421 - MODULE_PARM_DESC(vm_debug, "Debug VM handling (0 = disabled (default), 1 = enabled)"); 422 - module_param_named(vm_debug, amdgpu_vm_debug, int, 0644); 423 408 424 409 /** 425 410 * DOC: vm_update_mode (int) ··· 746 745 "Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)"); 747 746 748 747 /** 749 - * DOC: debug_largebar (int) 750 - * Set debug_largebar as 1 to enable simulating large-bar capability on non-large bar 751 - * system. This limits the VRAM size reported to ROCm applications to the visible 752 - * size, usually 256MB. 753 - * Default value is 0, diabled. 754 - */ 755 - int debug_largebar; 756 - module_param(debug_largebar, int, 0444); 757 - MODULE_PARM_DESC(debug_largebar, 758 - "Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)"); 759 - 760 - /** 761 748 * DOC: halt_if_hws_hang (int) 762 749 * Halt if HWS hang is detected. Default value, 0, disables the halt on hang. 763 750 * Setting 1 enables halt on hang. ··· 936 947 */ 937 948 module_param(enforce_isolation, bool, 0444); 938 949 MODULE_PARM_DESC(enforce_isolation, "enforce process isolation between graphics and compute . enforce_isolation = on"); 950 + 951 + /** 952 + * DOC: debug_mask (uint) 953 + * Debug options for amdgpu, work as a binary mask with the following options: 954 + * 955 + * - 0x1: Debug VM handling 956 + * - 0x2: Enable simulating large-bar capability on non-large bar system. This 957 + * limits the VRAM size reported to ROCm applications to the visible 958 + * size, usually 256MB. 959 + */ 960 + MODULE_PARM_DESC(debug_mask, "debug options for amdgpu, disabled by default"); 961 + module_param_named(debug_mask, amdgpu_debug_mask, uint, 0444); 939 962 940 963 /* These devices are not supported by amdgpu. 941 964 * They are supported by the mach64, r128, radeon drivers ··· 2053 2052 } 2054 2053 } 2055 2054 2055 + static void amdgpu_init_debug_options(struct amdgpu_device *adev) 2056 + { 2057 + if (amdgpu_debug_mask & AMDGPU_DEBUG_VM) { 2058 + pr_info("debug: VM handling debug enabled\n"); 2059 + adev->debug_vm = true; 2060 + } 2061 + 2062 + if (amdgpu_debug_mask & AMDGPU_DEBUG_LARGEBAR) { 2063 + pr_info("debug: enabled simulating large-bar capability on non-large bar system\n"); 2064 + adev->debug_largebar = true; 2065 + } 2066 + } 2067 + 2056 2068 static int amdgpu_pci_probe(struct pci_dev *pdev, 2057 2069 const struct pci_device_id *ent) 2058 2070 { ··· 2243 2229 (adev->asic_type >= CHIP_NAVI10)) 2244 2230 amdgpu_get_secondary_funcs(adev); 2245 2231 } 2232 + 2233 + amdgpu_init_debug_options(adev); 2246 2234 2247 2235 return 0; 2248 2236
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
··· 791 791 default: 792 792 break; 793 793 } 794 - if (!r && !(args->flags & AMDGPU_VM_DELAY_UPDATE) && !amdgpu_vm_debug) 794 + if (!r && !(args->flags & AMDGPU_VM_DELAY_UPDATE) && !adev->debug_vm) 795 795 amdgpu_gem_va_update_vm(adev, &fpriv->vm, bo_va, 796 796 args->operation); 797 797
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 1403 1403 spin_unlock(&vm->status_lock); 1404 1404 1405 1405 /* Try to reserve the BO to avoid clearing its ptes */ 1406 - if (!amdgpu_vm_debug && dma_resv_trylock(resv)) 1406 + if (!adev->debug_vm && dma_resv_trylock(resv)) 1407 1407 clear = false; 1408 1408 /* Somebody else is using the BO right now */ 1409 1409 else
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
··· 1021 1021 1022 1022 bool kfd_dev_is_large_bar(struct kfd_node *dev) 1023 1023 { 1024 - if (debug_largebar) { 1024 + if (dev->kfd->adev->debug_largebar) { 1025 1025 pr_debug("Simulate large-bar allocation on non large-bar machine\n"); 1026 1026 return true; 1027 1027 }
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_crat.c
··· 2116 2116 sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr + 2117 2117 sub_type_hdr->length); 2118 2118 2119 - if (debug_largebar) 2119 + if (kdev->adev->debug_largebar) 2120 2120 local_mem_info.local_mem_size_private = 0; 2121 2121 2122 2122 if (local_mem_info.local_mem_size_private == 0)