[PATCH] drm: Harmonize CIK ASIC support in radeon and amdgpu (v2)

Michel Dänzer michel at daenzer.net
Tue Apr 11 01:38:31 UTC 2017


On 11/04/17 08:21 AM, Felix Kuehling wrote:
> Provide convenient compile time and boot time options for selecting
> CIK ASIC support in either or both drivers.
> 
> v2: git add missing files

[...]

> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 483059a..f85f81c 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -148,6 +148,57 @@ config DRM_AMDGPU
>  
>  source "drivers/gpu/drm/amd/amdgpu/Kconfig"
>  
> +choice DRM_CIK_SUPPORT
> +	prompt "Support for AMD CIK ASICs"
> +	default DRM_CIK_RADEON
> +	depends on DRM_AMDGPU || DRM_RADEON
> +	help
> +	  Choose the driver used to support AMD CIK ASICs.
> +
> +config DRM_CIK_RADEON
> +	bool "Radeon"
> +	depends on DRM_RADEON
> +	select DRM_RADEON_CIK
> +	select DRM_RADEON_CIK_ENABLED
> +	help
> +	  The Radeon driver was traditionally used to support CIK ASICs.
> +
> +config DRM_CIK_AMDGPU
> +	bool "AMD GPU"
> +	depends on DRM_AMDGPU
> +	select DRM_AMDGPU_CIK
> +	select DRM_AMDGPU_CIK_ENABLED
> +	help
> +	  The AMD GPU driver has more active development for features and
> +	  performance. If you choose this driver, you also need the amdgpu
> +	  DDX driver for X.org.
> +
> +config DRM_CIK_BOTH_DEFAULT_RADEON
> +	bool "Both, use Radeon by default"
> +	depends on DRM_AMDGPU && DRM_RADEON
> +	select DRM_RADEON_CIK
> +	select DRM_RADEON_CIK_ENABLED
> +	select DRM_AMDGPU_CIK
> +	help
> +	  This option is useful for driver developers who want to test
> +	  both drivers while running the same kernel. The active driver
> +	  can be selected using the module parameters radeon.enable_cik
> +	  and amdgpu.enable_cik.
> +
> +config DRM_CIK_BOTH_DEFAULT_AMDGPU
> +	bool "Both, use AMD GPU by default"
> +	depends on DRM_AMDGPU && DRM_RADEON
> +	select DRM_RADEON_CIK
> +	select DRM_AMDGPU_CIK
> +	select DRM_AMDGPU_CIK_ENABLED
> +	help
> +	  This option is useful for driver developers who want to test
> +	  both drivers while running the same kernel. The active driver
> +	  can be selected using the module parameters radeon.enable_cik
> +	  and amdgpu.enable_cik.
> +
> +endchoice

I wonder if we really need all these Kconfig options. I was thinking we
could simply always compile CIK support in amdgpu, and make
DRM_AMDGPU_CIK choose between using amdgpu or radeon by default for CIK.


> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 1006d7c..b30f2b0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -88,6 +88,32 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
>  	struct amdgpu_device *adev;
>  	int r, acpi_status;
>  
> +	if (!amdgpu_enable_cik) {
> +		switch (flags & AMD_ASIC_MASK) {
> +		case CHIP_KAVERI:
> +		case CHIP_BONAIRE:
> +		case CHIP_HAWAII:
> +		case CHIP_KABINI:
> +		case CHIP_MULLINS:
> +			dev_warn(dev->dev,
> +				 "CIK support disabled by module param\n");
> +			return -ENODEV;
> +		}
> +	}
> +
> +	if (!amdgpu_enable_cik) {
> +		switch (flags & AMD_ASIC_MASK) {
> +		case CHIP_KAVERI:
> +		case CHIP_BONAIRE:
> +		case CHIP_HAWAII:
> +		case CHIP_KABINI:
> +		case CHIP_MULLINS:
> +			dev_warn(dev->dev,
> +                                 "CIK support disabled by module param\n");
> +			return -ENODEV;
> +		}
> +	}
> +

Duplicate code.


Other than that, this looks good to me.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list