@@ -618,39 +618,37 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644);
618618
619619/**
620620 * DOC: si_support (int)
621- * Set SI support driver. This parameter works after set config CONFIG_DRM_AMDGPU_SI. For SI asic, when radeon driver is enabled,
622- * set value 0 to use radeon driver, while set value 1 to use amdgpu driver. The default is using radeon driver when it available,
623- * otherwise using amdgpu driver.
624- */
621+ * 1 = enabled, 0 = disabled, -1 = default
622+ *
623+ * SI (Southern Islands) are first generation GCN GPUs, supported by both
624+ * drivers: radeon (old) and amdgpu (new). This parameter controls whether
625+ * amdgpu should support SI.
626+ * By default, SI chips are supported by radeon (except when radeon is not built).
627+ * Only relevant when CONFIG_DRM_AMDGPU_SI is enabled to build SI support in amdgpu.
628+ * See also radeon.si_support which should be disabled when amdgpu.si_support is
629+ * enabled, and vice versa.
630+ */
631+ int amdgpu_si_support = -1 ;
625632#ifdef CONFIG_DRM_AMDGPU_SI
626-
627- #if IS_ENABLED (CONFIG_DRM_RADEON ) || IS_ENABLED (CONFIG_DRM_RADEON_MODULE )
628- int amdgpu_si_support ;
629- MODULE_PARM_DESC (si_support , "SI support (1 = enabled, 0 = disabled (default))" );
630- #else
631- int amdgpu_si_support = 1 ;
632- MODULE_PARM_DESC (si_support , "SI support (1 = enabled (default), 0 = disabled)" );
633- #endif
634-
633+ MODULE_PARM_DESC (si_support , "SI support (1 = enabled, 0 = disabled, -1 = default)" );
635634module_param_named (si_support , amdgpu_si_support , int , 0444 );
636635#endif
637636
638637/**
639638 * DOC: cik_support (int)
640- * Set CIK support driver. This parameter works after set config CONFIG_DRM_AMDGPU_CIK. For CIK asic, when radeon driver is enabled,
641- * set value 0 to use radeon driver, while set value 1 to use amdgpu driver. The default is using radeon driver when it available,
642- * otherwise using amdgpu driver.
643- */
639+ * 1 = enabled, 0 = disabled, -1 = default
640+ *
641+ * CIK (Sea Islands) are second generation GCN GPUs, supported by both
642+ * drivers: radeon (old) and amdgpu (new). This parameter controls whether
643+ * amdgpu should support CIK.
644+ * By default, CIK chips are supported by radeon (except when radeon is not built).
645+ * Only relevant when CONFIG_DRM_AMDGPU_CIK is enabled to build CIK support in amdgpu.
646+ * See also radeon.cik_support which should be disabled when amdgpu.cik_support is
647+ * enabled, and vice versa.
648+ */
649+ int amdgpu_cik_support = -1 ;
644650#ifdef CONFIG_DRM_AMDGPU_CIK
645-
646- #if IS_ENABLED (CONFIG_DRM_RADEON ) || IS_ENABLED (CONFIG_DRM_RADEON_MODULE )
647- int amdgpu_cik_support ;
648- MODULE_PARM_DESC (cik_support , "CIK support (1 = enabled, 0 = disabled (default))" );
649- #else
650- int amdgpu_cik_support = 1 ;
651- MODULE_PARM_DESC (cik_support , "CIK support (1 = enabled (default), 0 = disabled)" );
652- #endif
653-
651+ MODULE_PARM_DESC (cik_support , "CIK support (1 = enabled, 0 = disabled, -1 = default)" );
654652module_param_named (cik_support , amdgpu_cik_support , int , 0444 );
655653#endif
656654
@@ -2306,6 +2304,69 @@ static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned long fl
23062304 return flags ;
23072305}
23082306
2307+ static bool amdgpu_support_enabled (struct device * dev ,
2308+ const enum amd_asic_type family )
2309+ {
2310+ const char * gen ;
2311+ const char * param ;
2312+ int module_param = -1 ;
2313+ bool radeon_support_built = IS_ENABLED (CONFIG_DRM_RADEON );
2314+ bool amdgpu_support_built = false;
2315+ bool support_by_default = false;
2316+
2317+ switch (family ) {
2318+ case CHIP_TAHITI :
2319+ case CHIP_PITCAIRN :
2320+ case CHIP_VERDE :
2321+ case CHIP_OLAND :
2322+ case CHIP_HAINAN :
2323+ gen = "SI" ;
2324+ param = "si_support" ;
2325+ module_param = amdgpu_si_support ;
2326+ amdgpu_support_built = IS_ENABLED (CONFIG_DRM_AMDGPU_SI );
2327+ break ;
2328+
2329+ case CHIP_BONAIRE :
2330+ case CHIP_HAWAII :
2331+ case CHIP_KAVERI :
2332+ case CHIP_KABINI :
2333+ case CHIP_MULLINS :
2334+ gen = "CIK" ;
2335+ param = "cik_support" ;
2336+ module_param = amdgpu_cik_support ;
2337+ amdgpu_support_built = IS_ENABLED (CONFIG_DRM_AMDGPU_CIK );
2338+ break ;
2339+
2340+ default :
2341+ /* All other chips are supported by amdgpu only */
2342+ return true;
2343+ }
2344+
2345+ if (!amdgpu_support_built ) {
2346+ dev_info (dev , "amdgpu built without %s support\n" , gen );
2347+ return false;
2348+ }
2349+
2350+ if ((module_param == -1 && (support_by_default || !radeon_support_built )) ||
2351+ module_param == 1 ) {
2352+ if (radeon_support_built )
2353+ dev_info (dev , "%s support provided by amdgpu.\n"
2354+ "Use radeon.%s=1 amdgpu.%s=0 to override.\n" ,
2355+ gen , param , param );
2356+
2357+ return true;
2358+ }
2359+
2360+ if (radeon_support_built )
2361+ dev_info (dev , "%s support provided by radeon.\n"
2362+ "Use radeon.%s=0 amdgpu.%s=1 to override.\n" ,
2363+ gen , param , param );
2364+ else if (module_param == 0 )
2365+ dev_info (dev , "%s support disabled by module param\n" , gen );
2366+
2367+ return false;
2368+ }
2369+
23092370static int amdgpu_pci_probe (struct pci_dev * pdev ,
23102371 const struct pci_device_id * ent )
23112372{
@@ -2353,48 +2414,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
23532414 return - ENOTSUPP ;
23542415 }
23552416
2356- switch (flags & AMD_ASIC_MASK ) {
2357- case CHIP_TAHITI :
2358- case CHIP_PITCAIRN :
2359- case CHIP_VERDE :
2360- case CHIP_OLAND :
2361- case CHIP_HAINAN :
2362- #ifdef CONFIG_DRM_AMDGPU_SI
2363- if (!amdgpu_si_support ) {
2364- dev_info (& pdev -> dev ,
2365- "SI support provided by radeon.\n" );
2366- dev_info (& pdev -> dev ,
2367- "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n"
2368- );
2369- return - ENODEV ;
2370- }
2371- break ;
2372- #else
2373- dev_info (& pdev -> dev , "amdgpu is built without SI support.\n" );
2417+ if (!amdgpu_support_enabled (& pdev -> dev , flags & AMD_ASIC_MASK ))
23742418 return - ENODEV ;
2375- #endif
2376- case CHIP_KAVERI :
2377- case CHIP_BONAIRE :
2378- case CHIP_HAWAII :
2379- case CHIP_KABINI :
2380- case CHIP_MULLINS :
2381- #ifdef CONFIG_DRM_AMDGPU_CIK
2382- if (!amdgpu_cik_support ) {
2383- dev_info (& pdev -> dev ,
2384- "CIK support provided by radeon.\n" );
2385- dev_info (& pdev -> dev ,
2386- "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n"
2387- );
2388- return - ENODEV ;
2389- }
2390- break ;
2391- #else
2392- dev_info (& pdev -> dev , "amdgpu is built without CIK support.\n" );
2393- return - ENODEV ;
2394- #endif
2395- default :
2396- break ;
2397- }
23982419
23992420 adev = devm_drm_dev_alloc (& pdev -> dev , & amdgpu_kms_driver , typeof (* adev ), ddev );
24002421 if (IS_ERR (adev ))
0 commit comments