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

drm/amdgpu: Add a kernel parameter for specifying the asic type

As more and more new asics start to reuse the old device IDs before
launch, there is a need to quickly override the existing asic type
corresponding to the reused device ID through a kernel parameter. With
this, engineers no longer need to rely on local hack patches,
facilitating cooperation across teams.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Yong Zhao and committed by
Alex Deucher
4e66d7d2 bb42eda2

+45 -28
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 168 168 extern int amdgpu_discovery; 169 169 extern int amdgpu_mes; 170 170 extern int amdgpu_noretry; 171 + extern int amdgpu_force_asic_type; 171 172 172 173 #ifdef CONFIG_DRM_AMDGPU_SI 173 174 extern int amdgpu_si_support;
+6 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2585 2585 adev->ddev = ddev; 2586 2586 adev->pdev = pdev; 2587 2587 adev->flags = flags; 2588 - adev->asic_type = flags & AMD_ASIC_MASK; 2588 + 2589 + if (amdgpu_force_asic_type >= 0 && amdgpu_force_asic_type < CHIP_LAST) 2590 + adev->asic_type = amdgpu_force_asic_type; 2591 + else 2592 + adev->asic_type = flags & AMD_ASIC_MASK; 2593 + 2589 2594 adev->usec_timeout = AMDGPU_MAX_USEC_TIMEOUT; 2590 2595 if (amdgpu_emu_mode == 1) 2591 2596 adev->usec_timeout *= 2;
+11
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 146 146 int amdgpu_discovery = -1; 147 147 int amdgpu_mes = 0; 148 148 int amdgpu_noretry = 1; 149 + int amdgpu_force_asic_type = -1; 149 150 150 151 struct amdgpu_mgpu_info mgpu_info = { 151 152 .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), ··· 616 615 MODULE_PARM_DESC(noretry, 617 616 "Disable retry faults (0 = retry enabled, 1 = retry disabled (default))"); 618 617 module_param_named(noretry, amdgpu_noretry, int, 0644); 618 + 619 + /** 620 + * DOC: force_asic_type (int) 621 + * A non negative value used to specify the asic type for all supported GPUs. 622 + */ 623 + MODULE_PARM_DESC(force_asic_type, 624 + "A non negative value used to specify the asic type for all supported GPUs"); 625 + module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444); 626 + 627 + 619 628 620 629 #ifdef CONFIG_HSA_AMD 621 630 /**
+27 -27
include/drm/amd_asic_type.h
··· 27 27 */ 28 28 enum amd_asic_type { 29 29 CHIP_TAHITI = 0, 30 - CHIP_PITCAIRN, 31 - CHIP_VERDE, 32 - CHIP_OLAND, 33 - CHIP_HAINAN, 34 - CHIP_BONAIRE, 35 - CHIP_KAVERI, 36 - CHIP_KABINI, 37 - CHIP_HAWAII, 38 - CHIP_MULLINS, 39 - CHIP_TOPAZ, 40 - CHIP_TONGA, 41 - CHIP_FIJI, 42 - CHIP_CARRIZO, 43 - CHIP_STONEY, 44 - CHIP_POLARIS10, 45 - CHIP_POLARIS11, 46 - CHIP_POLARIS12, 47 - CHIP_VEGAM, 48 - CHIP_VEGA10, 49 - CHIP_VEGA12, 50 - CHIP_VEGA20, 51 - CHIP_RAVEN, 52 - CHIP_ARCTURUS, 53 - CHIP_RENOIR, 54 - CHIP_NAVI10, 55 - CHIP_NAVI14, 56 - CHIP_NAVI12, 30 + CHIP_PITCAIRN, /* 1 */ 31 + CHIP_VERDE, /* 2 */ 32 + CHIP_OLAND, /* 3 */ 33 + CHIP_HAINAN, /* 4 */ 34 + CHIP_BONAIRE, /* 5 */ 35 + CHIP_KAVERI, /* 6 */ 36 + CHIP_KABINI, /* 7 */ 37 + CHIP_HAWAII, /* 8 */ 38 + CHIP_MULLINS, /* 9 */ 39 + CHIP_TOPAZ, /* 10 */ 40 + CHIP_TONGA, /* 11 */ 41 + CHIP_FIJI, /* 12 */ 42 + CHIP_CARRIZO, /* 13 */ 43 + CHIP_STONEY, /* 14 */ 44 + CHIP_POLARIS10, /* 15 */ 45 + CHIP_POLARIS11, /* 16 */ 46 + CHIP_POLARIS12, /* 17 */ 47 + CHIP_VEGAM, /* 18 */ 48 + CHIP_VEGA10, /* 19 */ 49 + CHIP_VEGA12, /* 20 */ 50 + CHIP_VEGA20, /* 21 */ 51 + CHIP_RAVEN, /* 22 */ 52 + CHIP_ARCTURUS, /* 23 */ 53 + CHIP_RENOIR, /* 24 */ 54 + CHIP_NAVI10, /* 25 */ 55 + CHIP_NAVI14, /* 26 */ 56 + CHIP_NAVI12, /* 27 */ 57 57 CHIP_LAST, 58 58 }; 59 59