All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philip Yang <yangp@amd.com>
To: James Zhu <James.Zhu@amd.com>, amd-gfx@lists.freedesktop.org
Cc: philip.yang@amd.com, Hawking.Zhang@amd.com, Bob.Zhou@amd.com,
	Harish.Kasiviswanathan@amd.com, jamesz@amd.com,
	Vladimir Indic <vladimir.indic@amd.com>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: move DGPU TBA/TMA from system to device memory
Date: Wed, 24 Jun 2026 11:00:46 -0400	[thread overview]
Message-ID: <d8ddd8b5-bddb-408b-89cd-e9409650eea5@amd.com> (raw)
In-Reply-To: <20260624142727.1946258-2-James.Zhu@amd.com>

[-- Attachment #1: Type: text/plain, Size: 2186 bytes --]



On 2026-06-24 10:27, James Zhu wrote:
> for GFX9.4.2 and above.
>
> -v2: keep APU with GTT allocation
>
> Signed-off-by: James Zhu<James.Zhu@amd.com>
> Reviewed-by: Vladimir Indic<vladimir.indic@amd.com>
> Reviewed-by: Harish Kasiviswanathan<Harish.Kasiviswanathan@amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_process.c | 17 ++++++++++++++---
>   1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 21a90fc3adff..a69e278f7aee 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -776,6 +776,12 @@ static int kfd_process_alloc_gpuvm(struct kfd_process_device *pdd,
>   	}
>   
>   	if (kptr) {
> +		uint32_t domain;
> +
> +		if (flags & KFD_IOC_ALLOC_MEM_FLAGS_GTT)
> +			domain = AMDGPU_GEM_DOMAIN_GTT;
> +		else
> +			domain = AMDGPU_GEM_DOMAIN_VRAM;
>   		err = amdgpu_amdkfd_gpuvm_map_bo_to_kernel(
>   				(struct kgd_mem *)*mem, kptr, NULL, domain);
>   		if (err) {
> @@ -1489,8 +1495,7 @@ static int kfd_process_device_init_cwsr_dgpu(struct kfd_process_device *pdd)
>   {
>   	struct kfd_node *dev = pdd->dev;
>   	struct qcm_process_device *qpd = &pdd->qpd;
> -	uint32_t flags = KFD_IOC_ALLOC_MEM_FLAGS_GTT
> -			| KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE
> +	uint32_t flags = KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE
>   			| KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE;
>   	struct kgd_mem *mem;
>   	void *kaddr;
> @@ -1499,7 +1504,13 @@ static int kfd_process_device_init_cwsr_dgpu(struct kfd_process_device *pdd)
>   	if (!dev->kfd->cwsr_enabled || qpd->cwsr_kaddr || !qpd->cwsr_base)
>   		return 0;
>   
> -	/* cwsr_base is only set for dGPU */
> +	if (KFD_GC_VERSION(dev) >= IP_VERSION(9, 4, 2) &&
> +	    !(dev->adev->flags & AMD_IS_APU))
use !adev->apu_prefer_gtt

With this fixed, this patch is Reviewed-by: Philip Yang 
<philip.yang@amd.com>
> +		flags |= KFD_IOC_ALLOC_MEM_FLAGS_VRAM;
> +	else
> +		flags |= KFD_IOC_ALLOC_MEM_FLAGS_GTT;
> +
> +	/* Allocate CWSR TBA/TMA buffers */
>   	ret = kfd_process_alloc_gpuvm(pdd, qpd->cwsr_base,
>   				      KFD_CWSR_TBA_TMA_SIZE, flags, &mem, &kaddr);
>   	if (ret)

[-- Attachment #2: Type: text/html, Size: 3007 bytes --]

  reply	other threads:[~2026-06-24 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 14:27 [PATCH v2 1/2] drm/amdkfd: support kfd map bo to kernel James Zhu
2026-06-24 14:27 ` [PATCH v2 2/2] drm/amdgpu: move DGPU TBA/TMA from system to device memory James Zhu
2026-06-24 15:00   ` Philip Yang [this message]
2026-06-24 15:14 ` [PATCH v2 1/2] drm/amdkfd: support kfd map bo to kernel Philip Yang

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=d8ddd8b5-bddb-408b-89cd-e9409650eea5@amd.com \
    --to=yangp@amd.com \
    --cc=Bob.Zhou@amd.com \
    --cc=Harish.Kasiviswanathan@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=James.Zhu@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=jamesz@amd.com \
    --cc=philip.yang@amd.com \
    --cc=vladimir.indic@amd.com \
    /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.