[PATCH] Revert "drm/amdgpu: make function pointers mandatory"

Christian K├Ânig ckoenig.leichtzumerken at gmail.com
Thu Aug 22 14:54:28 UTC 2019


Am 22.08.19 um 16:49 schrieb Gang Ba:
> This reverts commit f54b30d70bc606f7a154edba5883c7fa23838e9f.

??? Why we want to revert that one?

Christian.

>
> Change-Id: I22327aac390297bdf6a19b3ac33fadb47be1e96d
> ---
>   drivers/gpu/drm/amd/amdgpu/cik_ih.c      |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/cik_sdma.c    | 20 ++++++++++++--------
>   drivers/gpu/drm/amd/amdgpu/cz_ih.c       |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/dce_v6_0.c    |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c    |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c    |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c    |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c    |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/iceland_ih.c  |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   | 20 ++++++++++++--------
>   drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   | 20 ++++++++++++--------
>   drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 25 ++++++-------------------
>   drivers/gpu/drm/amd/amdgpu/si_dma.c      | 20 ++++++++++++--------
>   drivers/gpu/drm/amd/amdgpu/si_ih.c       |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/tonga_ih.c    |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/vega10_ih.c   |  3 ++-
>   20 files changed, 84 insertions(+), 66 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/cik_ih.c b/drivers/gpu/drm/amd/amdgpu/cik_ih.c
> index 721c757..3b5b2ab 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cik_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cik_ih.c
> @@ -441,7 +441,8 @@ static const struct amdgpu_ih_funcs cik_ih_funcs = {
>   
>   static void cik_ih_set_interrupt_funcs(struct amdgpu_device *adev)
>   {
> -	adev->irq.ih_funcs = &cik_ih_funcs;
> +	if (adev->irq.ih_funcs == NULL)
> +		adev->irq.ih_funcs = &cik_ih_funcs;
>   }
>   
>   const struct amdgpu_ip_block_version cik_ih_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> index d42808b..f30a961 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> @@ -1356,8 +1356,10 @@ static const struct amdgpu_buffer_funcs cik_sdma_buffer_funcs = {
>   
>   static void cik_sdma_set_buffer_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mman.buffer_funcs = &cik_sdma_buffer_funcs;
> -	adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	if (adev->mman.buffer_funcs == NULL) {
> +		adev->mman.buffer_funcs = &cik_sdma_buffer_funcs;
> +		adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	}
>   }
>   
>   static const struct amdgpu_vm_pte_funcs cik_sdma_vm_pte_funcs = {
> @@ -1373,13 +1375,15 @@ static void cik_sdma_set_vm_pte_funcs(struct amdgpu_device *adev)
>   	struct drm_gpu_scheduler *sched;
>   	unsigned i;
>   
> -	adev->vm_manager.vm_pte_funcs = &cik_sdma_vm_pte_funcs;
> -	for (i = 0; i < adev->sdma.num_instances; i++) {
> -		sched = &adev->sdma.instance[i].ring.sched;
> -		adev->vm_manager.vm_pte_rqs[i] =
> -			&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +	if (adev->vm_manager.vm_pte_funcs == NULL) {
> +		adev->vm_manager.vm_pte_funcs = &cik_sdma_vm_pte_funcs;
> +		for (i = 0; i < adev->sdma.num_instances; i++) {
> +			sched = &adev->sdma.instance[i].ring.sched;
> +			adev->vm_manager.vm_pte_rqs[i] =
> +				&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +		}
> +		adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   	}
> -	adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   }
>   
>   const struct amdgpu_ip_block_version cik_sdma_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/cz_ih.c b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
> index 61024b9..76af75e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cz_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
> @@ -422,7 +422,8 @@ static const struct amdgpu_ih_funcs cz_ih_funcs = {
>   
>   static void cz_ih_set_interrupt_funcs(struct amdgpu_device *adev)
>   {
> -	adev->irq.ih_funcs = &cz_ih_funcs;
> +	if (adev->irq.ih_funcs == NULL)
> +		adev->irq.ih_funcs = &cz_ih_funcs;
>   }
>   
>   const struct amdgpu_ip_block_version cz_ih_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index c609b7a..c337d71 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -3574,7 +3574,8 @@ static const struct amdgpu_display_funcs dce_v10_0_display_funcs = {
>   
>   static void dce_v10_0_set_display_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mode_info.funcs = &dce_v10_0_display_funcs;
> +	if (adev->mode_info.funcs == NULL)
> +		adev->mode_info.funcs = &dce_v10_0_display_funcs;
>   }
>   
>   static const struct amdgpu_irq_src_funcs dce_v10_0_crtc_irq_funcs = {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 719db05..e0c6b36 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -3706,7 +3706,8 @@ static const struct amdgpu_display_funcs dce_v11_0_display_funcs = {
>   
>   static void dce_v11_0_set_display_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mode_info.funcs = &dce_v11_0_display_funcs;
> +	if (adev->mode_info.funcs == NULL)
> +		adev->mode_info.funcs = &dce_v11_0_display_funcs;
>   }
>   
>   static const struct amdgpu_irq_src_funcs dce_v11_0_crtc_irq_funcs = {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 8ee9965..d115672 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -3381,7 +3381,8 @@ static const struct amdgpu_display_funcs dce_v6_0_display_funcs = {
>   
>   static void dce_v6_0_set_display_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mode_info.funcs = &dce_v6_0_display_funcs;
> +	if (adev->mode_info.funcs == NULL)
> +		adev->mode_info.funcs = &dce_v6_0_display_funcs;
>   }
>   
>   static const struct amdgpu_irq_src_funcs dce_v6_0_crtc_irq_funcs = {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 7037e01..6a48e81 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -3462,7 +3462,8 @@ static const struct amdgpu_display_funcs dce_v8_0_display_funcs = {
>   
>   static void dce_v8_0_set_display_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mode_info.funcs = &dce_v8_0_display_funcs;
> +	if (adev->mode_info.funcs == NULL)
> +		adev->mode_info.funcs = &dce_v8_0_display_funcs;
>   }
>   
>   static const struct amdgpu_irq_src_funcs dce_v8_0_crtc_irq_funcs = {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 6dadbed..a2ac277 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -641,7 +641,8 @@ static const struct amdgpu_display_funcs dce_virtual_display_funcs = {
>   
>   static void dce_virtual_set_display_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mode_info.funcs = &dce_virtual_display_funcs;
> +	if (adev->mode_info.funcs == NULL)
> +		adev->mode_info.funcs = &dce_virtual_display_funcs;
>   }
>   
>   static int dce_virtual_pageflip(struct amdgpu_device *adev,
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> index 564fb1c..31aa9cc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> @@ -1167,7 +1167,8 @@ static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = {
>   
>   static void gmc_v6_0_set_gmc_funcs(struct amdgpu_device *adev)
>   {
> -	adev->gmc.gmc_funcs = &gmc_v6_0_gmc_funcs;
> +	if (adev->gmc.gmc_funcs == NULL)
> +		adev->gmc.gmc_funcs = &gmc_v6_0_gmc_funcs;
>   }
>   
>   static void gmc_v6_0_set_irq_funcs(struct amdgpu_device *adev)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> index 9e6a233..a2c0311 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> @@ -1363,7 +1363,8 @@ static const struct amdgpu_irq_src_funcs gmc_v7_0_irq_funcs = {
>   
>   static void gmc_v7_0_set_gmc_funcs(struct amdgpu_device *adev)
>   {
> -	adev->gmc.gmc_funcs = &gmc_v7_0_gmc_funcs;
> +	if (adev->gmc.gmc_funcs == NULL)
> +		adev->gmc.gmc_funcs = &gmc_v7_0_gmc_funcs;
>   }
>   
>   static void gmc_v7_0_set_irq_funcs(struct amdgpu_device *adev)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> index f7d6a07..548b4cc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> @@ -1731,7 +1731,8 @@ static const struct amdgpu_irq_src_funcs gmc_v8_0_irq_funcs = {
>   
>   static void gmc_v8_0_set_gmc_funcs(struct amdgpu_device *adev)
>   {
> -	adev->gmc.gmc_funcs = &gmc_v8_0_gmc_funcs;
> +	if (adev->gmc.gmc_funcs == NULL)
> +		adev->gmc.gmc_funcs = &gmc_v8_0_gmc_funcs;
>   }
>   
>   static void gmc_v8_0_set_irq_funcs(struct amdgpu_device *adev)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 6ce2977..8f64b23 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -638,7 +638,8 @@ static const struct amdgpu_gmc_funcs gmc_v9_0_gmc_funcs = {
>   
>   static void gmc_v9_0_set_gmc_funcs(struct amdgpu_device *adev)
>   {
> -	adev->gmc.gmc_funcs = &gmc_v9_0_gmc_funcs;
> +	if (adev->gmc.gmc_funcs == NULL)
> +		adev->gmc.gmc_funcs = &gmc_v9_0_gmc_funcs;
>   }
>   
>   static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
> diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
> index b1626e1..a7750d6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c
> @@ -420,7 +420,8 @@ static const struct amdgpu_ih_funcs iceland_ih_funcs = {
>   
>   static void iceland_ih_set_interrupt_funcs(struct amdgpu_device *adev)
>   {
> -	adev->irq.ih_funcs = &iceland_ih_funcs;
> +	if (adev->irq.ih_funcs == NULL)
> +		adev->irq.ih_funcs = &iceland_ih_funcs;
>   }
>   
>   const struct amdgpu_ip_block_version iceland_ih_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> index 3619637..0b33b86 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> @@ -1243,8 +1243,10 @@ static const struct amdgpu_buffer_funcs sdma_v2_4_buffer_funcs = {
>   
>   static void sdma_v2_4_set_buffer_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mman.buffer_funcs = &sdma_v2_4_buffer_funcs;
> -	adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	if (adev->mman.buffer_funcs == NULL) {
> +		adev->mman.buffer_funcs = &sdma_v2_4_buffer_funcs;
> +		adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	}
>   }
>   
>   static const struct amdgpu_vm_pte_funcs sdma_v2_4_vm_pte_funcs = {
> @@ -1260,13 +1262,15 @@ static void sdma_v2_4_set_vm_pte_funcs(struct amdgpu_device *adev)
>   	struct drm_gpu_scheduler *sched;
>   	unsigned i;
>   
> -	adev->vm_manager.vm_pte_funcs = &sdma_v2_4_vm_pte_funcs;
> -	for (i = 0; i < adev->sdma.num_instances; i++) {
> -		sched = &adev->sdma.instance[i].ring.sched;
> -		adev->vm_manager.vm_pte_rqs[i] =
> -			&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +	if (adev->vm_manager.vm_pte_funcs == NULL) {
> +		adev->vm_manager.vm_pte_funcs = &sdma_v2_4_vm_pte_funcs;
> +		for (i = 0; i < adev->sdma.num_instances; i++) {
> +			sched = &adev->sdma.instance[i].ring.sched;
> +			adev->vm_manager.vm_pte_rqs[i] =
> +				&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +		}
> +		adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   	}
> -	adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   }
>   
>   const struct amdgpu_ip_block_version sdma_v2_4_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> index 6d39544..2501bf6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> @@ -1681,8 +1681,10 @@ static const struct amdgpu_buffer_funcs sdma_v3_0_buffer_funcs = {
>   
>   static void sdma_v3_0_set_buffer_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mman.buffer_funcs = &sdma_v3_0_buffer_funcs;
> -	adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	if (adev->mman.buffer_funcs == NULL) {
> +		adev->mman.buffer_funcs = &sdma_v3_0_buffer_funcs;
> +		adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	}
>   }
>   
>   static const struct amdgpu_vm_pte_funcs sdma_v3_0_vm_pte_funcs = {
> @@ -1698,13 +1700,15 @@ static void sdma_v3_0_set_vm_pte_funcs(struct amdgpu_device *adev)
>   	struct drm_gpu_scheduler *sched;
>   	unsigned i;
>   
> -	adev->vm_manager.vm_pte_funcs = &sdma_v3_0_vm_pte_funcs;
> -	for (i = 0; i < adev->sdma.num_instances; i++) {
> -		sched = &adev->sdma.instance[i].ring.sched;
> -		adev->vm_manager.vm_pte_rqs[i] =
> -			&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +	if (adev->vm_manager.vm_pte_funcs == NULL) {
> +		adev->vm_manager.vm_pte_funcs = &sdma_v3_0_vm_pte_funcs;
> +		for (i = 0; i < adev->sdma.num_instances; i++) {
> +			sched = &adev->sdma.instance[i].ring.sched;
> +			adev->vm_manager.vm_pte_rqs[i] =
> +				&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +		}
> +		adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   	}
> -	adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   }
>   
>   const struct amdgpu_ip_block_version sdma_v3_0_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index 071d6c9..25c61c6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -2499,10 +2499,7 @@ static const struct amdgpu_buffer_funcs sdma_v4_0_buffer_funcs = {
>   static void sdma_v4_0_set_buffer_funcs(struct amdgpu_device *adev)
>   {
>   	adev->mman.buffer_funcs = &sdma_v4_0_buffer_funcs;
> -	if (adev->sdma.has_page_queue && adev->sdma.num_instances > 1)
> -		adev->mman.buffer_funcs_ring = &adev->sdma.instance[1].page;
> -	else
> -		adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
>   }
>   
>   static const struct amdgpu_vm_pte_funcs sdma_v4_0_vm_pte_funcs = {
> @@ -2519,22 +2516,12 @@ static void sdma_v4_0_set_vm_pte_funcs(struct amdgpu_device *adev)
>   	unsigned i;
>   
>   	adev->vm_manager.vm_pte_funcs = &sdma_v4_0_vm_pte_funcs;
> -	if (adev->sdma.has_page_queue && adev->sdma.num_instances > 1) {
> -		for (i = 1; i < adev->sdma.num_instances; i++) {
> -			sched = &adev->sdma.instance[i].page.sched;
> -			adev->vm_manager.vm_pte_rqs[i - 1] =
> -				&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> -		}
> -		adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances - 1;
> -		adev->vm_manager.page_fault = &adev->sdma.instance[0].page;
> -	} else {
> -		for (i = 0; i < adev->sdma.num_instances; i++) {
> -			sched = &adev->sdma.instance[i].ring.sched;
> -			adev->vm_manager.vm_pte_rqs[i] =
> -				&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> -		}
> -		adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
> +	for (i = 0; i < adev->sdma.num_instances; i++) {
> +		sched = &adev->sdma.instance[i].ring.sched;
> +		adev->vm_manager.vm_pte_rqs[i] =
> +			&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
>   	}
> +	adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   }
>   
>   const struct amdgpu_ip_block_version sdma_v4_0_ip_block = {
> diff --git a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c
> index 3eeefd4..b9b5081 100644
> --- a/drivers/gpu/drm/amd/amdgpu/si_dma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c
> @@ -820,8 +820,10 @@ static const struct amdgpu_buffer_funcs si_dma_buffer_funcs = {
>   
>   static void si_dma_set_buffer_funcs(struct amdgpu_device *adev)
>   {
> -	adev->mman.buffer_funcs = &si_dma_buffer_funcs;
> -	adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	if (adev->mman.buffer_funcs == NULL) {
> +		adev->mman.buffer_funcs = &si_dma_buffer_funcs;
> +		adev->mman.buffer_funcs_ring = &adev->sdma.instance[0].ring;
> +	}
>   }
>   
>   static const struct amdgpu_vm_pte_funcs si_dma_vm_pte_funcs = {
> @@ -837,13 +839,15 @@ static void si_dma_set_vm_pte_funcs(struct amdgpu_device *adev)
>   	struct drm_gpu_scheduler *sched;
>   	unsigned i;
>   
> -	adev->vm_manager.vm_pte_funcs = &si_dma_vm_pte_funcs;
> -	for (i = 0; i < adev->sdma.num_instances; i++) {
> -		sched = &adev->sdma.instance[i].ring.sched;
> -		adev->vm_manager.vm_pte_rqs[i] =
> -			&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +	if (adev->vm_manager.vm_pte_funcs == NULL) {
> +		adev->vm_manager.vm_pte_funcs = &si_dma_vm_pte_funcs;
> +		for (i = 0; i < adev->sdma.num_instances; i++) {
> +			sched = &adev->sdma.instance[i].ring.sched;
> +			adev->vm_manager.vm_pte_rqs[i] =
> +				&sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL];
> +		}
> +		adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   	}
> -	adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances;
>   }
>   
>   const struct amdgpu_ip_block_version si_dma_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/si_ih.c b/drivers/gpu/drm/amd/amdgpu/si_ih.c
> index 8c50c9c..582c54f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/si_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/si_ih.c
> @@ -296,7 +296,8 @@ static const struct amdgpu_ih_funcs si_ih_funcs = {
>   
>   static void si_ih_set_interrupt_funcs(struct amdgpu_device *adev)
>   {
> -	adev->irq.ih_funcs = &si_ih_funcs;
> +	if (adev->irq.ih_funcs == NULL)
> +		adev->irq.ih_funcs = &si_ih_funcs;
>   }
>   
>   const struct amdgpu_ip_block_version si_ih_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
> index a20b711..9e4eae4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c
> @@ -474,7 +474,8 @@ static const struct amdgpu_ih_funcs tonga_ih_funcs = {
>   
>   static void tonga_ih_set_interrupt_funcs(struct amdgpu_device *adev)
>   {
> -	adev->irq.ih_funcs = &tonga_ih_funcs;
> +	if (adev->irq.ih_funcs == NULL)
> +		adev->irq.ih_funcs = &tonga_ih_funcs;
>   }
>   
>   const struct amdgpu_ip_block_version tonga_ih_ip_block =
> diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
> index f19268a..0be5b28 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
> @@ -708,7 +708,8 @@ static const struct amdgpu_ih_funcs vega10_ih_funcs = {
>   
>   static void vega10_ih_set_interrupt_funcs(struct amdgpu_device *adev)
>   {
> -	adev->irq.ih_funcs = &vega10_ih_funcs;
> +	if (adev->irq.ih_funcs == NULL)
> +		adev->irq.ih_funcs = &vega10_ih_funcs;
>   }
>   
>   const struct amdgpu_ip_block_version vega10_ih_ip_block =



More information about the amd-gfx mailing list