All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Set correct DMA mask for aldebaran
Date: Wed, 2 Mar 2022 17:41:22 -0500	[thread overview]
Message-ID: <bfdcdf2a-07a7-edc9-6cac-806ce6a4ca4c@amd.com> (raw)
In-Reply-To: <20220228182508.464871-1-Harish.Kasiviswanathan@amd.com>

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)

      reply	other threads:[~2022-03-02 22:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 18:25 [PATCH] drm/amdgpu: Set correct DMA mask for aldebaran Harish Kasiviswanathan
2022-03-02 22:41 ` Felix Kuehling [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfdcdf2a-07a7-edc9-6cac-806ce6a4ca4c@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Harish.Kasiviswanathan@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.