All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Set correct DMA mask for aldebaran
@ 2022-02-28 18:25 Harish Kasiviswanathan
  2022-03-02 22:41 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Harish Kasiviswanathan @ 2022-02-28 18:25 UTC (permalink / raw)
  To: amd-gfx; +Cc: Harish Kasiviswanathan

Aldebaran has 48-bit physical address support

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 412e44af1608..0765c163b355 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1675,12 +1675,17 @@ static int gmc_v9_0_sw_init(void *handle)
 	 */
 	adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
 
-	r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
+	if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) {
+		r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(48));
+		adev->need_swiotlb = drm_need_swiotlb(48);
+	} else {
+		r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
+		adev->need_swiotlb = drm_need_swiotlb(44);
+	}
 	if (r) {
 		printk(KERN_WARNING "amdgpu: No suitable DMA available.\n");
 		return r;
 	}
-	adev->need_swiotlb = drm_need_swiotlb(44);
 
 	r = gmc_v9_0_mc_init(adev);
 	if (r)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: Set correct DMA mask for aldebaran
  2022-02-28 18:25 [PATCH] drm/amdgpu: Set correct DMA mask for aldebaran Harish Kasiviswanathan
@ 2022-03-02 22:41 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2022-03-02 22:41 UTC (permalink / raw)
  To: Harish Kasiviswanathan, amd-gfx

On 2022-02-28 13:25, Harish Kasiviswanathan wrote:
> Aldebaran has 48-bit physical address support
>
> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 412e44af1608..0765c163b355 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -1675,12 +1675,17 @@ static int gmc_v9_0_sw_init(void *handle)
>   	 */
>   	adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
>   
> -	r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
> +	if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) {
> +		r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(48));
> +		adev->need_swiotlb = drm_need_swiotlb(48);
> +	} else {
> +		r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
> +		adev->need_swiotlb = drm_need_swiotlb(44);
> +	}

Instead of duplicating the code, I'd prefer a variable to hold the 
number of address bits. E.g.

    int dma_addr_bits =
    	(adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) ? 48 : 44;
    ...
    r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(dma_addr_bits));
    ...
    adev->need_swiotlb = drm_need_swiotlb(dma_addr_bits);

With that fixed, the patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


>   	if (r) {
>   		printk(KERN_WARNING "amdgpu: No suitable DMA available.\n");
>   		return r;
>   	}
> -	adev->need_swiotlb = drm_need_swiotlb(44);
>   
>   	r = gmc_v9_0_mc_init(adev);
>   	if (r)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-02 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 18:25 [PATCH] drm/amdgpu: Set correct DMA mask for aldebaran Harish Kasiviswanathan
2022-03-02 22:41 ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.